Hi all, I've recently checked out ways to have IDLE do something upon closing a window. Turns out the there is a beginning of such a mechanism in EditorWindow: the set_close_hook method. However, this method simply sets the instance's close_hook attribute, which means that setting it again will override the original hook. Specifically, EditorWindow sets the close_hook to FileList.close_edit(self), which removes the window from the FileList. This means that overriding the close_hook could (and would) cause bugs (in FileList)!
The simplest solution AFAIK is to have a list of hooks and allow adding and removing hooks. Upon closing, the hooks are called in the reverse order of which they were added (i.e. last added is called first). Another solution would be to allow setting a new hook, and have a flag stating whether the old hook should be called after the new one is done. Obviously more comprehensive solutions exist but I don't think we need something more complex. Thoughts? Ideas? - Tal
_______________________________________________ IDLE-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/idle-dev
