jeanphilippegoldman / plugin_filetools

filetools for Praat
GNU General Public License v3.0
0 stars 0 forks source link

Dialogue box: using Pause wIndow instead of form #3

Closed rolandomunoz closed 6 years ago

rolandomunoz commented 6 years ago

Using form/endform environment to create dialogue boxes is great for plug-ins, specially because of the Ok, Apply and Cancel buttons; also you can open many windows at the same time. However, it seems to me that the resulting dialogue box is a little messy. This is so, because the first field shows the path of the script. Another disadvantage is that it is difficult to make the forms remember the arguments we provided. (Your setbasename.praat does a nice job!).

image

To deal with the problem of the undesired script path field, we could use the pause window approach. (Use pauseWindow instead of form/endform).

Here are the advantages:

image

And here the disadvantages:

If you want, take a look to one of my projects, the Finder. Here the field contents are save in a preference txt where they are get from when you open a dialogue box.

jeanphilippegoldman commented 6 years ago

one more disadvantage of pauseWindow is that you can not use the script from commandline or from other scripts. plus i like being able to play with multiple opened script windows (for such util plugins). maybe lets stick to the form/endform schema for a start.

one thing to do , maybe , would be to add this CGI utility so the user can browse his/her folders

rolandomunoz commented 6 years ago

Ohh... that's a big problem!

By the way, CGI means a Common Gateway Interface?

Do you mean that procedures are stored in a form/endform script. Then, we can mask this script by using a pauseScript/endPause script which only contains the dialogue box for the user? Am I in the right way?

jeanphilippegoldman commented 6 years ago

no i was talking about the chooseReadFile and chooseDirectory functions. can they be integrated in form/endform block ? or only in the pausewindow ? if so (pausewindow) , then ok to switch all the interfaces to beginPause/endPause blocks.

rolandomunoz commented 6 years ago

This is the only thing that pass by my mind:

folder_directory$ = ""
beginPause: "Choose you folder"
sentence: "Folder directory", folder_directory$
clicked = endPause: "Cancel", "Choose folder", "Ok", 3

if clicked = 1
  exitScript()
elsif clicked = 2
  folder_directory$ = chooseDirectory$: "Open a file"  
endif

beginPause: "Do something"
sentence: "Folder directory", folder_directory$
clicked = endPause: "Cancel", "Continue", "Ok", 3

if clicked = 1
  exitScript()
endif

writeInfoLine: folder_directory$

Here you can use the chooseDirectory or simply enter a path manually.

In addition to my another post, you could have two scripts:

So you can use the do_something_pause_window to call the do_something.praat. Since the do_something.praat use the form/endform block, you can call it from the command line. The other thing is that, the arguments you insert can be stored in a preference.txt and can be loaded to the dialogue box (beginPause/endPause) without rewriting any script each time you insert a new argument value (as it happens because of the setbasename.praat procedure). The sad part is that you cannot use multiple windows :/

At this moment, I like form/endform block. Let me know if you change your mind :)