Open sasumner opened 3 years ago
@sasumner What about using tk? (see https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/Sorter.py or https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/Formatter.py) Or maybe something like in https://github.com/bruderstein/PythonScript/blob/master/scripts/Samples/ReplaceDefaultReplaceDialog.py.
Is EasyDialogs compatible with python 3? Maybe not: https://stackoverflow.com/questions/4159194/cant-import-easydialogs-importerror-no-module-named-dlg
What about using tk?
Well, I guess it is possible. tk might be a bit heavy for only this type of need, though. I stay away from tk in things like Pythonscripts, because Pythonscripts are supposed to be relatively simple things, and have an obvious dependence upon Notepad++. If I'm going to do a "larger" thing, i.e., get "involved" with Tk or other GUI toolkit for Python, I'm going to take it outside of Notepad++ for sure.
Is EasyDialogs compatible with python 3?
I pointed to "EasyDialogs" of an example of something that might be possible to replicate inside of PS to insulate users from the gory details, and yet still have a way to use windows standard dialogs. I was not suggesting it as an "import EasyDialogs" type of thing, certainly.
It seems to me that a nice and simple notepad.askFIleForOpen()
/ notepad.askFileForSave()
/ notepad.askFolder()
(to borrow EasyDialogs's function names) would be a good addition to the Pythonscript functionality, without the "overhead" of pulling in tk or some other import.
So it is just a suggestion, kicked off to see what others think. Do with it what you will or won't. :-)
Sometimes in my scripts I want to pop up a file open/saveas box, or a folder-choosing box.
As an example, I wanted to write a script to solve this Notepad++ user request: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8844 "...Save-All-as-Copy-(To-Folder)" But I found it "unreasonable" to do without an easy way to pop up a box allowing the user of the script to choose the destination directory for the output.
In my own scripts I have used a variant of the "EasyDialogs", presented HERE. That is problematic when publishing scripts for others, because it is a lot of extra code to add to a script file. It is also a bit "dated" as it uses "old style" dialogs.
So my request is for something like this to be added into Pythonscript as member functions of the
Notepad
object. It should be configurable like EasyDialogs, and should either return None if the user cancels the dialog, or a string with the path the user has specified via the dialog. Also, it should use the "new style" of dialogs.