Mon 23 May 2016 12:35:29 PM UTC, comment #4:
A script is executed in a single stream and can be paused properly by
- a modal dialog
- a pause() command.
You could find other tricks to pause, but they will likely end up in using 100% CPU time and/or GUI events not being processed properly.
A modal dialog does not let you use other GUI components while it is open: you have to acknowledge it first.
If you want to pause with a non-modal dialog (modal=False), you have to add the pause command explicitely to stop the script processing. The following would work:
However, you are required now to press twice to close the dialog AND continue the script: the 'Close' dialog button to close the dialog and the PLAY toolbar button to continue the script.
Can you do both with a single click? Currently not with showInfo, because the actions list does not allow to specify a function (the associated function is always just closing the dialog).
But you can use the showText function instead: this accepts a list of actions bound to user functions.
In this case the play function is bound to the dialog's 'Continue' button. Thus the script will continue when clicked. The dialog has still to be closed then. And you could of course create a function that executes play and closes the dialog.
A backdraw of this second method is that the showText was intended for large texts, and may not display a short message as nice as showInfo. But you could add a s resize to fix that.
Conclusion: there is enough available to do what you want, but maybe we should enhance the showInfo and related function to allow an action list that binds to specified functions. That would also simplify thinks in that the actions parameter would have same meaning and value in all functions.
Therefore, I removed the 'wont fix' status.
|