[Pythonmac-SIG] Closing windows on quit
Gordon Worley
redbird@rbisland.cx
Mon, 14 Aug 2000 22:40:08 -0400
I'm trying to impliment in my program a feature where, on quit,
rather than just forcing the windows closed and not checking to see
if they have unsaved data (which, I take it, means that my windows'
close functions are being overrided or not called in some way). My
original plan was to modify the _quit() function in my application
object, making it close the Win.FrontWindow() until it gets an error
(because there are no more windows), but this resulted in an
AttributeError (the offending line of code was, and I quote,
'Win.FrontWindow().close()'). There is, in fact, a close() function
in all of the windows opened, so either I am somehow not accessing a
window (or one not created by my code) or FrontWindow() doesn't do
what I think it does (return the front most window). Is it possible
that it wouldn't recoginize my windows as windows (they inherit from
W.Window, in case that might matter)?
Stepping back for a moment, is there a better way to do this? I
don't want to go through implimenting all of the code necessary for a
windows menu, since my program mostly creates small windows and does
not necessarily lead itself to having lots of windows open. I just
want to be able to give users a chance to save their data before
quiting without a time delay (the trick used when the Finder sends
the quit event to my program (thanks to the WWidgets examples :-))).
Now, for something not so Python related, has anyone used icns
resources with BNDL resources? I'm wondering because I designed
icons for my application that look best at 32-bit and just okay at
anything less. It's easy to get around this with the application
itself (since I can just past the icon on), but with documents the
answer isn't so clear (if I paste on icons when the documents are
created, the icons won't update if the icons are changed in future
versions of the program). If this is not possible after all and it
is something other people have been lusting after, I guess I'll just
have to wait for Mac OS X.
--
Gordon Worley
http://www.rbisland.cx/
mailto:redbird@rbisland.cx
PGP: C462 FA84 B811 3501 9010 20D2 6EF3 77F7 BBD3 B003