dabo Commit
Revision 2957
Date: 2007-03-23 10:32:56 -0700 (Fri, 23 Mar 2007)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/2957
Changed:
U trunk/dabo/ui/uiwx/dDialog.py
U trunk/dabo/ui/uiwx/dForm.py
U trunk/dabo/ui/uiwx/dFormMain.py
U trunk/dabo/ui/uiwx/dFormMixin.py
Log:
Worked around the bug on gtk where the form position would reset after a
hide() and show() cycle.
Diff:
Modified: trunk/dabo/ui/uiwx/dDialog.py
===================================================================
--- trunk/dabo/ui/uiwx/dDialog.py 2007-03-23 00:13:36 UTC (rev 2956)
+++ trunk/dabo/ui/uiwx/dDialog.py 2007-03-23 17:32:56 UTC (rev 2957)
@@ -49,6 +49,15 @@
self.bindKey("esc", self._onEscape)
+ def Show(self, show, *args, **kwargs):
+ self._gtk_show_fix(show)
+ wx.Dialog.Show(self, show, *args, **kwargs)
+
+ def ShowModal(self, *args, **kwargs):
+ self._gtk_show_fix(True)
+ wx.Dialog.ShowModal(self, *args, **kwargs)
+
+
def showModal(self):
"""Show the dialog modally."""
## pkm: We had to override this, because the default in
dPemMixin doesn't
Modified: trunk/dabo/ui/uiwx/dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dForm.py 2007-03-23 00:13:36 UTC (rev 2956)
+++ trunk/dabo/ui/uiwx/dForm.py 2007-03-23 17:32:56 UTC (rev 2957)
@@ -789,6 +789,9 @@
## we are modifying the dForm class definition globally.)
BaseForm.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
+ def Show(self, show, *args, **kwargs):
+ self._gtk_show_fix(show)
+ dForm.__bases__[-1].Show(self, show, *args, **kwargs)
def Layout(self):
super(dForm, self).Layout()
@@ -808,7 +811,12 @@
kwargs["ShowToolBar"] = False
BaseForm.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
+ def Show(self, show, *args, **kwargs):
+ self._gtk_show_fix(show)
+ wx.MiniFrame.Show(self, show, *args, **kwargs)
+
+
class dBorderlessForm(BaseForm, wx.Frame):
def __init__(self, parent=None, properties=None, attProperties=None,
*args, **kwargs):
self._baseClass = dBorderlessForm
@@ -820,7 +828,11 @@
preClass = wx.PreFrame
BaseForm.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
+ def Show(self, show, *args, **kwargs):
+ self._gtk_show_fix(show)
+ wx.Frame.Show(self, show, *args, **kwargs)
+
class _dForm_test(dForm):
def afterInit(self):
self.Caption = _("Regular Form")
Modified: trunk/dabo/ui/uiwx/dFormMain.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMain.py 2007-03-23 00:13:36 UTC (rev 2956)
+++ trunk/dabo/ui/uiwx/dFormMain.py 2007-03-23 17:32:56 UTC (rev 2957)
@@ -56,6 +56,9 @@
dFormMainBase.__init__(self, preClass, parent, properties,
*args, **kwargs)
+ def Show(self, show, *args, **kwargs):
+ self._gtk_show_fix(show)
+ dFormMain.__bases__[-1].Show(self, show, *args, **kwargs)
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2007-03-23 00:13:36 UTC (rev 2956)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2007-03-23 17:32:56 UTC (rev 2957)
@@ -261,7 +261,21 @@
"""
pass
-
+
+ def _gtk_show_fix(self, show=True):
+ # On Gtk, in wxPython 2.8.1.1 at least, the form will get
re-shown at its
+ # initial position, instead of the position the user last put
it at.
+ if not show and "linux" in sys.platform:
+ self._gtk_bug_position = self.Position
+ else:
+ pos = getattr(self, "_gtk_bug_position", None)
+ if pos is not None:
+ # position needs to be jiggled, not merely set:
+ x,y = pos
+ self.Position = (x, y+1)
+ self.Position = (x, y)
+
+
def showModal(self):
"""Shows the form in a modal fashion. Other forms can still be
activated, but all controls are disabled.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev