[Idle-dev] Slow close?

Guido van Rossum guido@python.org
Mon, 25 Feb 2002 09:17:07 -0500


> Actually I think I just found the problem. When I moved the above 'quit
> now' lines two lines down in close(), so that the lines
> 
> self.top.wm_deiconify()
> self.top.tkraise()
> 
> are allowed to execute, the pause returns!

Good sleuthing!

> So just commenting those two lines like so:
> 
> def close(self):
>     #self.top.wm_deiconify()
>     #self.top.tkraise()
>     reply = self.maybesave()
>     if reply != "cancel":
>         self._close()
>     return reply
> 
> causes the EditorWindow instances to begin closing at normal speed (no
> pause).
> 
> Can anyone with knowledge of the code base remember why these two
> seemingly redundant lines are there in the first place, and what the
> implications would be for just removing them?

I think this is an attempt to make sure that when the dialog "do you
want to save ... before closing" is displayed, the right window is on
top.  That dialog is presented (if necessary) by maybesave().  I'm
sure you can figure out a better way to ensure this.  To test this
behavior, you should create a whole bunch of unsaved windows (but
saved to files so you can tell them apart), reorder them randomly,
iconify a few, and then hit control-Q.  This should pop up the windows
to match the "do you want to save" dialogs.

For extra credit, make sure it works on Windows, too.

--Guido van Rossum (home page: http://www.python.org/~guido/)