dabo Commit
Revision 7189
Date: 2012-05-17 13:22:06 -0700 (Thu, 17 May 2012)
Author: Paul
Trac: http://trac.dabodev.com/changeset/7189
Changed:
U trunk/dabo/ui/uiwx/dDialog.py
U trunk/dabo/ui/uiwx/dFormMixin.py
Log:
Per the recent email discussion regarding r7155, this appears to work
well (restoring window position, size, and state upon Show(), instead
of upon instantiation), but definitely needs more testing especially
on Windows and Mac.
I did notice that although it restores in maximized state if that's how
it was saved, it doesn't appear to normalize back to the original
size and position.
I also note that this fixes some flickering common in showing dabo
forms that I believe has been there for years.
Diff:
Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py 2012-05-17 19:01:07 UTC (rev 7188)
+++ trunk/dabo/ui/uiwx/dDialog.py 2012-05-17 20:22:06 UTC (rev 7189)
@@ -78,6 +78,7 @@
def ShowModal(self):
self._gtk_show_fix(True)
+ self.restoreSizeAndPositionIfNeeded()
# updates were potentially suppressed while the dialog
# wasn't visible, so update now.
self.update()
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2012-05-17 19:01:07 UTC (rev 7188)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2012-05-17 20:22:06 UTC (rev 7189)
@@ -27,7 +27,6 @@
self._idleRefreshInterval = 1000
self._drawSizerChildren = False
self._statusBarClass = dabo.ui.dStatusBar
- self._windowStateSet = False
# Extract the menu definition file, if any
self._menuBarFile = self._extractKey((properties,
attProperties, kwargs),
@@ -78,8 +77,6 @@
dabo.ui.callAfter(self._createStatusBar)
self._createToolBar()
- if not self._designerMode:
- self.restoreSizeAndPosition()
def _getInitPropertiesList(self):
@@ -399,6 +396,17 @@
self.Position = (x, y)
+ def restoreSizeAndPositionIfNeeded(self):
+ if not getattr(self, "_firstShown", False):
+ self.restoreSizeAndPosition()
+ self._firstShown = True
+
+
+ def Show(self, *args, **kwargs):
+ self.restoreSizeAndPositionIfNeeded()
+ super(dFormMixin, self).Show(*args, **kwargs)
+
+
def showModal(self):
"""
Shows the form in a modal fashion. Other forms can still be
@@ -567,8 +575,7 @@
self.Left = max(0, self.Left)
self.Top = max(minTop, self.Top)
- if not self._windowStateSet:
- self.WindowState = state
+ self.WindowState = state
def saveSizeAndPosition(self):
@@ -1122,8 +1129,6 @@
if self._constructed():
lowvalue = ustr(value).lower().strip()
vis = self.Visible
- self.lockDisplay()
- self.Visible = True
if lowvalue == "normal":
if self.IsFullScreen():
self.ShowFullScreen(False)
@@ -1144,9 +1149,6 @@
self.unlockDisplay()
raise ValueError("The only possible values are "
"'Normal',
'Minimized', 'Maximized', and 'FullScreen'")
- self._windowStateSet = True
- self.Visible = vis
- self.unlockDisplay()
else:
self._properties["WindowState"] = value
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]