dabo Commit
Revision 4064
Date: 2008-05-04 13:04:33 -0700 (Sun, 04 May 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4064
Changed:
U trunk/dabo/ui/uiwx/dSplitForm.py
Log:
Added an explicit 'Splitter' property, as I found some edge cases where there
was not yet a splitter created when attempting to set props after
self.constructed() returned True. Now the Splitter prop will create the
splitter the first time it is referenced.
Diff:
Modified: trunk/dabo/ui/uiwx/dSplitForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dSplitForm.py 2008-05-04 18:37:34 UTC (rev 4063)
+++ trunk/dabo/ui/uiwx/dSplitForm.py 2008-05-04 20:04:33 UTC (rev 4064)
@@ -9,80 +9,89 @@
class dSplitForm(dabo.ui.dForm):
- def _afterInit(self):
- win = self.splitter = dSplitter(self, createPanes=True,
RegID="MainSplitter")
- super(dSplitForm, self)._afterInit()
- self.Sizer.append1x(win)
- win.Visible = True
- self.layout()
+ def __init__(self, *args, **kwargs):
+ self._splitter = None
+ super(dSplitForm, self).__init__(*args, **kwargs)
def unsplit(self):
- self.splitter.unsplit()
+ self.Splitter.unsplit()
def split(self, dir=None):
- self.splitter.split(dir)
+ self.Splitter.split(dir)
def _getMinPanelSize(self):
- return self.splitter.MinPanelSize
+ return self.Splitter.MinPanelSize
def _setMinPanelSize(self, val):
if self._constructed():
- self.splitter.MinPanelSize = val
+ self.Splitter.MinPanelSize = val
else:
self._properties["MinPanelSize"] = val
def _getOrientation(self):
- return self.splitter.Orientation
+ return self.Splitter.Orientation
def _setOrientation(self, val):
if self._constructed():
- self.splitter.Orientation = val
+ self.Splitter.Orientation = val
else:
self._properties["MinPanelSize"] = val
def _getPanel1(self):
- return self.splitter.Panel1
+ return self.Splitter.Panel1
def _setPanel1(self, pnl):
if self._constructed():
- self.splitter.Panel1 = pnl
+ self.Splitter.Panel1 = pnl
else:
self._properties["Panel1"] = pnl
def _getPanel2(self):
- return self.splitter.Panel2
+ return self.Splitter.Panel2
def _setPanel2(self, pnl):
if self._constructed():
- self.splitter.Panel2 = pnl
+ self.Splitter.Panel2 = pnl
else:
self._properties["Panel2"] = pnl
def _getSashPosition(self):
- return self.splitter.SashPosition
+ return self.Splitter.SashPosition
def _setSashPosition(self, val):
if self._constructed():
- self.splitter.SashPosition = val
+ self.Splitter.SashPosition = val
else:
self._properties["SashPosition"] = val
-
+ def _getSplitter(self):
+ if self._splitter is None:
+ win = self._splitter = dSplitter(self,
createPanes=True, RegID="MainSplitter")
+ def addToSizer(frm, itm):
+ if not frm.Sizer:
+ dabo.ui.callAfter(addToSizer, frm, itm)
+ else:
+ frm.Sizer.append1x(itm)
+ frm.layout()
+ win.Visible = True
+ dabo.ui.callAfter(addToSizer, self, win)
+ return self._splitter
+
+
+
MinPanelSize = property(_getMinPanelSize, _setMinPanelSize, None,
_("Controls the minimum width/height of the panels.
(int)"))
- DynamicMinPanelSize = makeDynamicProperty(MinPanelSize)
Orientation = property(_getOrientation, _setOrientation, None,
_("Determines if the window splits Horizontally or
Vertically. (str)"))
- DynamicOrientation = makeDynamicProperty(Orientation)
Panel1 = property(_getPanel1, _setPanel1, None,
_("Returns the Top/Left panel. (SplitterPanel)"))
@@ -92,17 +101,24 @@
SashPosition = property(_getSashPosition, _setSashPosition, None,
_("Position of the sash when the window is split.
(int)"))
+
+ Splitter = property(_getSplitter, None, None,
+ _("Reference to the main splitter in the form
(dSplitter"))
+
+
+
+ DynamicMinPanelSize = makeDynamicProperty(MinPanelSize)
+ DynamicOrientation = makeDynamicProperty(Orientation)
DynamicSashPosition = makeDynamicProperty(SashPosition)
-
class _dSplitForm_test(dSplitForm):
def initProperties(self):
self.Caption = "Splitter Demo"
def afterInit(self):
- self.splitter.Panel1.BackColor = dabo.dColors.randomColor()
- self.splitter.Panel2.BackColor = dabo.dColors.randomColor()
+ self.Splitter.Panel1.BackColor = dabo.dColors.randomColor()
+ self.Splitter.Panel2.BackColor = dabo.dColors.randomColor()
if __name__ == "__main__":
_______________________________________________
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]