root/trunk/RBSkinning/RBSkinning/wxTools/wxPositionKeeper.py

Revision 253, 1.5 kB (checked in by sholloway, 6 years ago)

Changed to BSD License

Line 
1 #!/usr/bin/env python
2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 ##~ License
4 ##~
5 ##- The RuneBlade Foundation library is intended to ease some
6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.)
7 ##- applications, while providing the flexibility to modularly change the
8 ##- architecture. Enjoy.
9 ##~
10 ##~ Copyright (C) 2002  TechGame Networks, LLC.
11 ##~
12 ##~ This library is free software; you can redistribute it and/or
13 ##~ modify it under the terms of the BSD style License as found in the
14 ##~ LICENSE file included with this distribution.
15 ##~
16 ##~ TechGame Networks, LLC can be reached at:
17 ##~ 3578 E. Hartsel Drive #211
18 ##~ Colorado Springs, Colorado, USA, 80920
19 ##~
20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 #~ Imports
24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 #~ Definitions
28 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
30 class wxPositionKeeper(object):
31     def __init__(self, frame=None):
32         if frame:
33             self.Save(frame)
34
35     def Save(self, frame):
36         self.Dimensions = frame.GetRect().asTuple()
37         self.Shown = frame.IsShown() and 1 or 0
38         self.Iconized = frame.IsIconized() and 1 or 0
39         self.Maximized = frame.IsMaximized() and 1 or 0
40
41     def Restore(self, frame):
42         frame.SetDimensions(*self.Dimensions)
43         frame.Iconize(self.Iconized)
44         if not self.Iconized: frame.Maximize(self.Maximized)
45         frame.Show(self.Shown)
46
Note: See TracBrowser for help on using the browser.