daboide Commit Revision 489 Date: 2006-02-28 15:17:58 -0800 (Tue, 28 Feb 2006) Author: ed
Changed: U trunk/ClassDesigner.py
Log: Fixed a bug that prevented paged controls from being added. Also cleaned up the page information dialog.
Diff: Modified: trunk/ClassDesigner.py =================================================================== --- trunk/ClassDesigner.py 2006-02-28 22:06:11 UTC (rev 488) +++ trunk/ClassDesigner.py 2006-02-28 23:17:58 UTC (rev 489) @@ -848,7 +848,10 @@ self._classDefaultVals[cls] = ret if cleanup: exec cleanup in locals() - obj.release() + + if not issubclass(cls, dui.dPage): + # Pages will be released by their parent. + obj.release() if frm: frm.release() return ret @@ -1382,21 +1385,10 @@ oldrow, oldcol = sz.getGridPos(pnl) else: pos = pnl.getPositionInSizer() - parent = pnl.Parent - - # Need to notify the tree that an update to a node will be - # happening. Get the affected node - nd = self.Tree.getNodeFor(pnl) - sz.remove(pnl) - dui.callAfter(pnl.release) - - isSavedClass = (self._extractKey(attProperties, "savedClass") == "True") - classID = self._extractKey(attProperties, "classID") - + isPageControl = issubclass(cls, (dui.dPageFrame, dui.dPageList, dui.dPageSelect, dui.dPageFrameNoTabs)) - if isPageControl: noTabs = issubclass(cls, dui.dPageFrameNoTabs) props["PageClass"] = self.getControlClass(dui.dPage) @@ -1410,10 +1402,11 @@ super(PageInfoDialog, self).__init__(*args, **kwargs) def addControls(self): - gsz = self.Sizer = dui.dGridSizer(maxCols=2, hgap=5, vgap=5) + self.Caption = "Paged Control Settings" + gsz = dui.dGridSizer(maxCols=2, hgap=5, vgap=12) lbl = dui.dLabel(self, Caption=_("Number of pages:")) spn = dui.dSpinner(self, DataSource="form", - DataField="pageCount", Min=0, Max=20) + DataField="pageCount", Min=1, Max=20, Value=3) gsz.append(lbl, halign="right") gsz.append(spn) @@ -1421,10 +1414,12 @@ lbl = dui.dLabel(self, Caption=_("Tab Position:")) dd = dui.dDropdownList(self, Choices=(_("Top"), _("Bottom"), _("Left"), _("Right")), ValueMode="Position", - DataSource="form", DataField="tabPosSelection") + Value=0, DataSource="form", DataField="tabPosSelection") gsz.append(lbl, halign="right") gsz.append(dd) - gsz.setFullExpand() + gsz.setColExpand("all", True) + + self.Sizer.append1x(gsz, border=30, halign="Center", valign="Middle") self.refresh() self.layout() @@ -1433,7 +1428,7 @@ dlg.AutoSize = False dlg.Centered = True dlg.show() - if dlg.Accepted: + if not dlg.Accepted: # User canceled return try: @@ -1449,7 +1444,7 @@ else: if not props.get("TabPosition"): props["TabPosition"] = "Left" - + if issubclass(cls, dui.dGrid): # Make sure it adds customized columns. props["ColumnClass"] = self.getControlClass(dui.dColumn) @@ -1461,6 +1456,15 @@ except: newCols = 3 + # Need to notify the tree that an update to a node will be + # happening. Get the affected node + nd = self.Tree.getNodeFor(pnl) + sz.remove(pnl) + dui.callAfter(pnl.release) + + isSavedClass = (self._extractKey(attProperties, "savedClass") == "True") + classID = self._extractKey(attProperties, "classID") + mixedClass = self.getControlClass(cls) obj = mixedClass(parent, properties=props, attProperties=attProperties) if grdsz: @@ -1473,14 +1477,10 @@ for pg in obj.Pages[::-1]: pg.Sizer = LayoutSizer("v") pg0panel = LayoutPanel(pg) - pg0panel.BackColor = pg.BackColor +# pg0panel.BackColor = pg.BackColor newitem = obj.ControllingSizerItem sz.setItemProps(newitem, itmProps) - -#- newitem.SetProportion(itProportion) -#- newitem.SetBorder(itBorder) -#- newitem.SetFlag(itFlag) try: dui.callAfterInterval(500, obj.Form.layout) except: @@ -1496,7 +1496,9 @@ obj.fillGrid() if isPageControl: - self.select(pg0panel) + dui.callAfter(self.select, pg0panel) + else: + dui.callAfter(self.select, obj) if not skipUpdate: dui.callAfterInterval(self.updateLayout, 500) return obj
©2006 Ed Leafe |
|