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

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


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]