-
Notifications
You must be signed in to change notification settings - Fork 206
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
Prompt user when exiting would lose unsaved changes. #69
Conversation
ScriptNode now has an "unsavedChanges" BoolPlug which is kept up to date when Actions are performed and when the script is save()d or load()ed. This will form the basis for UI elements preventing the user from accidentally losing work when closing windows or quitting. Additionally ScriptNode plug accessors now use the much faster index based accessors rather than name based lookup and unecessary member data.
… the user before discarding unsaved work.
It'll be True still I'm afraid. Same as in this situation : s.save() I could reimplement by having a pointer to the point in the undo stack where the file was last saved, and setting unsavedChanges to false if the current undo position moves back to that point. But that won't deal properly with changes that have been made without undo enabled - I don't see an obvious way of supporting both. What do you think to having non-undoable changes not reflected in the unsavedChanges status? Currently the only intentional non-undoable changes are for moving nodes to a new position - perhaps they should be undoable anyway? |
There's a "Cancel" and a "Discard and Quit". I was trying to avoid presenting the user with a series of identical dialogues when quitting with multiple files open. Ben and I discussed adding "Save and Quit" and agreed to deal with it in a separate request - this one should be enough to prevent anyone losing work, and the other can be a lower priority enhancement we add later. |
That's ok about the undo/redo. Was just hoping (nedit does it), but understandable if more complex apps can't handle it. |
Prompt user when exiting would lose unsaved changes.
This adds an "unsavedChanges" BoolPlug to the ScriptNode which tracks whether or not there are unsaved changes in the script. The UI uses this to prompt the user for confirmation if they close a window with unsaved changes, or if they quit while there are unsaved changes.
This fixes issue #9.