Skip to content
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

Merged
merged 5 commits into from
Apr 1, 2013

Conversation

johnhaddon
Copy link
Member

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.

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.
@johnhaddon
Copy link
Member Author

It'll be True still I'm afraid. Same as in this situation :

s.save()
doSomething
s.undo()

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?

@johnhaddon
Copy link
Member Author

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.

@andrewkaufman
Copy link
Contributor

That's ok about the undo/redo. Was just hoping (nedit does it), but understandable if more complex apps can't handle it.

andrewkaufman added a commit that referenced this pull request Apr 1, 2013
Prompt user when exiting would lose unsaved changes.
@andrewkaufman andrewkaufman merged commit 005e26e into GafferHQ:master Apr 1, 2013
@johnhaddon johnhaddon deleted the unsavedChanges branch April 1, 2013 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants