dabo Commit
Revision 5065
Date: 2009-02-19 21:48:52 -0800 (Thu, 19 Feb 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5065
Changed:
U trunk/dabo/ui/uiwx/dForm.py
Log:
dForm.Modal works by changing the base class to dialog. However, it
changes it for all live forms which isn't correct. Changed it to
hack to dialog only in __init__ and around ShowModal().
Fixes ticket #1069.
Diff:
Modified: trunk/dabo/ui/uiwx/dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dForm.py 2009-02-20 00:48:32 UTC (rev 5064)
+++ trunk/dabo/ui/uiwx/dForm.py 2009-02-20 05:48:52 UTC (rev 5065)
@@ -890,35 +890,48 @@
class dForm(BaseForm, wx.Frame):
def __init__(self, parent=None, properties=None, attProperties=None,
*args, **kwargs):
self._baseClass = dForm
+ self._mdi = False
if kwargs.pop("Modal", False):
# Hack this into a wx.Dialog, for true modality
- dForm.__bases__ = (BaseForm, wx.Dialog)
+ self._hackToDialog()
preClass = wx.PreDialog
self._modal = True
else:
# Normal dForm
if dabo.settings.MDI and isinstance(parent,
wx.MDIParentFrame):
# Hack this into an MDI Child:
- dForm.__bases__ = (BaseForm, wx.MDIChildFrame)
preClass = wx.PreMDIChildFrame
self._mdi = True
else:
# This is a normal SDI form:
- dForm.__bases__ = (BaseForm, wx.Frame)
preClass = wx.PreFrame
self._mdi = False
+ self._hackToFrame()
## (Note that it is necessary to run the above blocks each
time, because
## we are modifying the dForm class definition globally.)
BaseForm.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
+ self._hackToFrame()
+ def _hackToDialog(self):
+ dForm.__bases__ = (BaseForm, wx.Dialog)
+
+ def _hackToFrame(self):
+ if self._mdi:
+ dForm.__bases__ = (BaseForm, wx.MDIChildFrame)
+ else:
+ dForm.__bases__ = (BaseForm, wx.Frame)
+
+
def Show(self, show=True, *args, **kwargs):
self._gtk_show_fix(show)
+ if self.Modal:
+ self._hackToDialog()
dForm.__bases__[-1].Show(self, show, *args, **kwargs)
+ self._hackToFrame()
-
def _getModal(self):
return getattr(self, "_modal", False)
@@ -928,8 +941,10 @@
def _setVisible(self, val):
if self._constructed():
val = bool(val)
- if val and self.Modal and hasattr(self, "ShowModal"):
+ if val and self.Modal:
+ self._hackToDialog()
self.ShowModal()
+ self._hackToFrame()
else:
self.Show(val)
else:
_______________________________________________
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]