veto workbench editor being closed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

veto workbench editor being closed

Alexander Held
Hi,

I have some difficulties with the events concerned with the closing of a
pyface workbench editor. In the IEditor interface it says

# Fired when the editor is closing.
closing = VetoableEvent

(
https://github.com/enthought/pyface/blob/e5a2dcd1373f49d64691561e6cd821398dd2c3df/pyface/workbench/i_editor.py#L44 
)

however this event is never fired when the GUI user closes an editor in
a workbench (wx backend), but only if the editor's close method is
invoked programmatically (or do I have to hook this up somehow?). I
wanted to use this event to ask the user what to do if there are unsaved
changes to the model being edited, allowing the user to cancel closing
the editor by vetoing the event, saving changes or discarding changes.
There is another event 'editor_closing' in the interface for
WorkbenchWindowLayout which is not vetoable as far as I understand. I
was wondering, if there is another way of vetoing an editor being closed
by the user, since I guess asking for persisting changes made in a
workbench editor might not be so uncommon?

Any help would be appreciated

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev