This patch adds a confirm dialog when quitting a file with unsaved changes on platforms that don't supply a native dialog (currently Linux and BSD).
(the "Discard" text was changed to "Don't save" in the last revision)
Differential D566
Popup based confirm dialog on quit Authored by Diego Gangl (januz) on May 30 2014, 4:53 PM.
Details
This patch adds a confirm dialog when quitting a file with unsaved changes on platforms that don't supply a native dialog (currently Linux and BSD). (the "Discard" text was changed to "Don't save" in the last revision)
Diff Detail
Event TimelineThere are a very large number of changes, so older changes are hidden. Show Older Changes Comment Actions Reworked the popup dialog to work as a fallback for systems with no native dialogs.
Comment Actions @Diego Gangl (januz), could you update the patch? (Didn't test, but guess it won't apply to current master) Comment Actions @Julian Eisel (Severin) Rebased, looking forward to 2.8! Comment Actions Thinking about this... Maybe I'm missing something, but can't we just open a regular window and draw into it? Why does it need to be a dialog window from the OS? Things might get a bit more complicated then since we couldn't use our regular screen/area/region system as it is, but probably it's worth implementing a pretty basic system to draw our own dialog boxes (I'm actually tempted to try ;D). Comment Actions @Julian Eisel (Severin), the issue with using multiple windows is it will push us to have better multi-window handling. Eg, prevent the dialog from going behind the main window. X11 window types for dialog/transient windows... for other platforms too. Just seems like it will push us in the direction of having overlapping windows which then need to be managed - would rather avoid this if it's not essential. Of course there is an argument that we *should* have better multi-window handling. Just pointing out this adds work for us - for quite a small gain. Comment Actions I understand an actual window would be better than the internal popups for this, however the most important part of this patch is preventing Blender from closing with unsaved changes (exiting is aborted if the popup is closed). If putting this in a window is too much work (and complexity), I'd consider staying on the popup route.
Comment Actions Since this seems to be moving forward i'll pile on from a platform perspective, but the ui team should have the final say on this (so wait for them before changing anything) @Julian Eisel (Severin) *poke*? arc doesn't seem to want to apply this patch, so i'm working off the screenshot... i'm pretty sure on windows the 'native' dialog would be used so points 1+2 are not an issue, still it might be worth looking into what the ui guidelines for kde/gnome have to say about the subject.
Comment Actions Sorry, I haven't rebased this patch in 2.5 years :P I'll get to that soon. KDE's HIG doesn't say much about dialogs. Gnome's mentions that cancel should go first (from the left) and be an imperative verb. "Do you want to save changes" sounds way better, however I would keep the buttons' texts as verbs. I think it's an improvement over the old yes/no/cancel (and both KDE and Gnome use them). About order and alignment: Gnome, Kde and Elementary have three different opinions on this. I wouldn't mind aligning them to the right with the KDE order, but I'd rather wait to hear comments from the UI team. @Campbell Barton (campbellbarton) thanks for the inlines, I'll get to them soon.
Comment Actions
Comment Actions This patch isn't ready yet, but it compiles and sorta works now (feel free to test). To do:
Comment Actions I still haven't been able to make this work through a macro. It fails even when making a macro through Python in a 2.79 build, the exit op is never called after save. However if I change the first op to something non-modal (like opengl rendering), then quit actually gets called. Looking around other macros in code, it seems the modal op is always the last one and not the first. @Campbell Barton (campbellbarton) looks like this is a limitation of macros, or maybe a bug? Comment Actions Really great progress. How possible is it to override the "Do you want to override the so and so file" pop up when we save? Could we please also do something about the DELETE button dialogue? I´m pretty sure that UNDO is standard by now, and that Blender is more code-stable now Is it possible to send these as a checkbox somewhere to user preference windows to override and make those "SAVE" and "DELETE" commands execute at once, with no additional dialogues? Comment Actions @Campbell Barton (campbellbarton) thanks for the free rebase/cleanup :) Comment Actions Looked into making operator macros support this (see patch P607 which does work) however this is a bad hack, the macro system would need to be moved into the operator API for this to work properly - since currently a wrapper operator is used to execute macros - which causes problems with the file selector and is more of a problem to resolve then I'd expected. For now, suggest to add an exit option to the save operator (instead of having multiple operators). Comment Actions Removed the save and quit macro. Added an exit option to the save op. Comment Actions
Comment Actions Looks close to being complete, one issue remains. When the confirm quit preference *isnt* set, there is no longer a confirmation.
Comment Actions Forgot to submit the inline comment here, that invoke() change was from an earlier revision.
Comment Actions Think this is ready for user-interface review & signoff, @venomgfx could you check on this? Note that there is a remaining bug. If you have multiple windows and press Ctrl-Q. The popup always shows in the first window, no matter which one is currently active.
Comment Actions
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||