dabo Commit Revision 2245 Date: 2006-06-30 14:25:46 -0700 (Fri, 30 Jun 2006) Author: ed
Changed: U trunk/dabo/ui/uiwx/dGrid.py U trunk/dabo/ui/uiwx/dSplitter.py
Log: Updated the grid to use the dDataSet class.
Began working on dSplitter in order to get it working in the Class Designer.
Diff: Modified: trunk/dabo/ui/uiwx/dGrid.py =================================================================== --- trunk/dabo/ui/uiwx/dGrid.py 2006-06-30 19:12:18 UTC (rev 2244) +++ trunk/dabo/ui/uiwx/dGrid.py 2006-06-30 21:25:46 UTC (rev 2245) @@ -3298,6 +3298,8 @@ raise ValueError, "Cannot set DataSet: DataSource defined." # We must make sure the grid's table is initialized first: self._Table + if not isinstance(val, dabo.db.dDataSet): + val = dabo.db.dDataSet(val) self._dataSet = val self.fillGrid(True) biz = self.getBizobj() @@ -4003,9 +4005,9 @@ class _dGrid_test(dGrid): def initProperties(self): - self.DataSet = [{"name" : "Ed Leafe", "age" : 47, "coder" : True, "color": "brown"}, - {"name" : "Mike Leafe", "age" : 18, "coder" : False, "color": "purple"}, - {"name" : "Dan Leafe", "age" : 13, "coder" : False, "color": "green"}] + self.DataSet = [{"name" : "Ed Leafe", "age" : 48, "coder" : True, "color": "brown"}, + {"name" : "Mike Leafe", "age" : 19, "coder" : False, "color": "purple"}, + {"name" : "Dan Leafe", "age" : 14, "coder" : False, "color": "green"}] self.Width = 360 self.Height = 150 self.Editable = True @@ -4068,15 +4070,6 @@ self.Sizer.append(chk, halign="Center") chk.refresh() - self.grid.bindEvent(dEvents.GridBeforeSort, self.beforeSort) - self.grid.bindEvent(dEvents.GridAfterSort, self.afterSort) - - def beforeSort(self, evt): - print "Before Sort Event", evt.EventData - - def afterSort(self, evt): - print "After Sort Event", evt.EventData - app = dabo.dApp() app.MainFormClass = TestForm app.setup()
Modified: trunk/dabo/ui/uiwx/dSplitter.py =================================================================== --- trunk/dabo/ui/uiwx/dSplitter.py 2006-06-30 19:12:18 UTC (rev 2244) +++ trunk/dabo/ui/uiwx/dSplitter.py 2006-06-30 21:25:46 UTC (rev 2245) @@ -130,13 +130,20 @@ self.__p2 = None # Create the panes if self._createPanes: - self.__p1 = SplitterPanel(self) - self.__p2 = SplitterPanel(self) - + self.createPanes() if self._splitOnInit: self.split() + super(dSplitter, self)._afterInit() - super(dSplitter, self)._afterInit() + + def createPanes(self): + self.__p1 = self.PanelClass(self) + self.__p2 = self.PanelClass(self) + if self.IsSplit(): + self.unsplit() + self.split() + else: + self.initialize(self.Panel1) def initialize(self, p1): @@ -291,6 +298,17 @@ self._properties["Panel2"] = pnl + def _getPanelClass(self): + try: + ret = self._panelClass + except: + ret = self._panelClass = SplitterPanel + return ret + + def _setPanelClass(self, val): + self._panelClass = val + + def _getSashPosition(self): if self.IsSplit(): self._sashPos = self.GetSashPosition() @@ -334,11 +352,16 @@ _("Determines if the window splits Horizontally or Vertically. (string)")) Panel1 = property(_getPanel1, _setPanel1, None, - _("Returns the Top/Left panel. (SplitterPanel)")) + _("Returns the Top/Left panel. (dPanel)")) Panel2 = property(_getPanel2, _setPanel2, None, - _("Returns the Bottom/Right panel. (SplitterPanel)")) + _("Returns the Bottom/Right panel. (dPanel)")) + PanelClass = property(_getPanelClass, _setPanelClass, None, + _("""Class used for creating panels. This must be set before the panels are + created; setting it afterward has no effect unless you destroy the panels + and re-create them. Default=SplitterPanel (dPanel)""")) + SashPosition = property(_getSashPosition, _setSashPosition, None, _("Position of the sash when the window is split. (int)"))
©2006 Ed Leafe |
|