dabo Commit Revision 1616 Date: 2005-11-30 16:04:07 -0800 (Wed, 30 Nov 2005) Author: paul
Changed: U trunk/dabo/lib/eventMixin.py U trunk/dabo/ui/uiwx/__init__.py U trunk/dabo/ui/uiwx/dForm.py U trunk/dabo/ui/uiwx/dGrid.py U trunk/dabo/ui/uiwx/dShell.py
Log: This is a test of the new MDI dynamic class binding. dForm's __init__ manually tweaks dForm.__bases__ depending on whether dabo.settings.MDI is currently set to True or not. I'm committing this now to see if it causes issues on Windows and Mac.
I had to tweak autoBindEvents to stop crawling up the parent hierarchy and go directly to self.Form because while in MDI mode, one of the parents is a raw ws.MDIParentWindow which doesn't have a Parent property.
Because of the above change, I had to give dColumn a Form property, and the easiest way to do that was to have it descend from dPemMixinBase instead of dObject.
Assuming this works on Mac and Windows, I'll finish the job by removing the commented code in dForm and doing similar changes to dFormMain.
Diff: Modified: trunk/dabo/lib/eventMixin.py =================================================================== --- trunk/dabo/lib/eventMixin.py 2005-11-30 22:32:40 UTC (rev 1615) +++ trunk/dabo/lib/eventMixin.py 2005-12-01 00:04:07 UTC (rev 1616) @@ -185,9 +185,17 @@ self._autoBindEvents(context=self, force=force) parent = self.Parent + stop = False while parent: + lastParent = parent self._autoBindEvents(context=parent, force=force) - parent = parent.Parent + if stop: + break + try: + parent = parent.Parent + except: + parent = self.Form + stop = True def _autoBindEvents(self, context, force=False):
Modified: trunk/dabo/ui/uiwx/__init__.py =================================================================== --- trunk/dabo/ui/uiwx/__init__.py 2005-11-30 22:32:40 UTC (rev 1615) +++ trunk/dabo/ui/uiwx/__init__.py 2005-12-01 00:04:07 UTC (rev 1616) @@ -64,9 +64,9 @@ from dFileDialog import dFolderDialog from dFileDialog import dSaveDialog from dFontDialog import dFontDialog -from dForm import dFormSDI -from dForm import dFormChildMDI -from dForm import dFormParentMDI +#from dForm import dFormSDI +#from dForm import dFormChildMDI +#from dForm import dFormParentMDI from dForm import dToolForm from dForm import dForm from dFormMain import dFormMain
Modified: trunk/dabo/ui/uiwx/dForm.py =================================================================== --- trunk/dabo/ui/uiwx/dForm.py 2005-11-30 22:32:40 UTC (rev 1615) +++ trunk/dabo/ui/uiwx/dForm.py 2005-12-01 00:04:07 UTC (rev 1616) @@ -732,14 +732,25 @@ _("Specifies whether dataset is row- or table-buffered. (bool)") ) -class dFormSDI(wx.Frame, dFormBase): +class dForm(wx.Frame, dFormBase): def __init__(self, parent=None, properties=None, *args, **kwargs): self._baseClass = dForm + + dForm.__bases__ = (wx.Frame, dFormBase) preClass = wx.PreFrame self._mdi = False + + if dabo.settings.MDI: + # Hack this into an MDI Child, but only if the parent is an MDI Parent: + if isinstance(parent, wx.MDIParentFrame): + dForm.__bases__ = (wx.MDIChildFrame, dFormBase) + preClass = wx.PreMDIChildFrame + self._mdi = True + dFormBase.__init__(self, preClass, parent, properties, *args, **kwargs) +""" class dFormParentMDI(wx.MDIParentFrame, dFormBase): def __init__(self, parent=None, properties=None, *args, **kwargs): self._baseClass = dForm @@ -754,15 +765,9 @@ preClass = wx.PreMDIChildFrame self._mdi = True dFormBase.__init__(self, preClass, parent, properties, *args, **kwargs) +""" -if dabo.settings.MDI: - dForm = dFormChildMDI -else: - dForm = dFormSDI - - -# class dToolForm(dFormSDI): class dToolForm(wx.MiniFrame, dFormBase): def __init__(self, parent=None, properties=None, *args, **kwargs): self._baseClass = dToolForm
Modified: trunk/dabo/ui/uiwx/dGrid.py =================================================================== --- trunk/dabo/ui/uiwx/dGrid.py 2005-11-30 22:32:40 UTC (rev 1615) +++ trunk/dabo/ui/uiwx/dGrid.py 2005-12-01 00:04:07 UTC (rev 1616) @@ -419,7 +419,7 @@ -class dColumn(dObject): +class dColumn(dabo.ui.dPemMixinBase.dPemMixinBase): """ These aren't the actual columns that appear in the grid; rather, they provide a way to interact with the underlying grid table in a more straightforward manner.
Modified: trunk/dabo/ui/uiwx/dShell.py =================================================================== --- trunk/dabo/ui/uiwx/dShell.py 2005-11-30 22:32:40 UTC (rev 1615) +++ trunk/dabo/ui/uiwx/dShell.py 2005-12-01 00:04:07 UTC (rev 1616) @@ -3,7 +3,7 @@ dabo.ui.loadUI("wx") -class dShell(dabo.ui.dFormSDI): +class dShell(dabo.ui.dForm): def afterInit(self): self.shell = wx.py.shell.Shell(self)
©2005 Paul McNett |
|