-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "prompt to close" method to script editor interface #1524
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well, many thanks!
Issue was raised by a user
Pinging @petebankhead about the change in the interface as it'll possibly break stuff, if not merge away |
Hmm yes, I thought it would not close on cancel, and obviously if it has been closed we shouldn't check any more as it should be self contained. Odd |
I can't fully reproduce this - if I do the following:
Then the cancel dialog disappears with nothing changed, ie the script editor remains open. However, I can close the script editor by using its window close button, then close QuPath, and at that point I get the same "Untitled 2" close prompt that you show in the second screenshot, which I agree is very confusing. I think that clarifying the text on the script editor save prompt is a good improvement either way. However, should we prompt users to save scripts when closing the editor, rather than when closing QuPath? Seems more friendly in a way, unless we also add some caching/autosave to scripts to ensure work isn't lost, because eg if a users closes the script editor, they may think it's saved, then QuPath crashes, and work is lost. |
I'm also not able to reproduce the script editor closing on cancel currently (on mac). |
I can still reproduce the issue on macOS following the steps Alan mentions (where 'edit 2 scripts' means new ones, not existing scripts).
Probably. I think I'll find this annoying sometimes, because I close the script editor as a way of hiding the window - because otherwise it isn't possible to hide a (child) window. So we might need a new hide option, although then we're almost back to the original problem. Another option would be to show the script editor when the user attempts to quit, and at that point clearly notify them that they have unsaved scripts (before moving in to whatever other unsaved stuff they might have). |
I also can't close QuPath without interacting with the script editor, because I get an exception
|
Yeah, I prefer the behavior when it's not a child except for the fact that it shows up as a different icon on win/Mac because it lets me put the editor behind the main qupath window. I think I looked for a middle ground but didn't find one. |
This should be fixed.
I did manage to reproduce it just now, it should be fixed as well. I've added an exit method to the editor's menu, with ctrl/cmd+q, and added handling to general close requests (these were previously commented out). |
This means that when a user attempts to close QuPath, we can check if there are any open scripts with unsaved changes and handle these as with other types of unsaved changes.
Unsure if changing the editor interface is a big deal, presumably there aren't too many implementations out there
Raised by @finglis