Changeset 4388
- Timestamp:
- 08/09/08 19:30:24 (3 months ago)
- Files:
-
- trunk/ide/ClassDesigner.py (modified) (19 diffs)
- trunk/ide/ClassDesignerComponents.py (modified) (1 diff)
- trunk/ide/ClassDesignerControlMixin.py (modified) (2 diffs)
- trunk/ide/ClassDesignerEditor.py (modified) (1 diff)
- trunk/ide/ClassDesignerFormMixin.py (modified) (1 diff)
- trunk/ide/ClassDesignerPemForm.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ide/ClassDesigner.py
r4360 r4388 139 139 {"name" : "DropdownList", "class" : dui.dDropdownList, "order" : 70}, 140 140 {"name" : "EditBox", "class" : dui.dEditBox, "order" : 80}, 141 {"name" : "SlidePanelControl", "class" : dui.dSlidePanelControl, "order" : 82}, 141 142 {"name" : "HtmlBox", "class" : dui.dHtmlBox, "order" : 85}, 142 143 {"name" : "Gauge", "class" : dui.dGauge, "order" : 90}, … … 267 268 dct = defVals.copy() 268 269 self._sizerDefaults[dui.dEditor] = dct 270 dct = defVals.copy() 271 self._sizerDefaults[dui.dSlidePanelControl] = dct 269 272 dct = defVals.copy() 270 273 dct.update({"Proportion" : 0}) … … 345 348 "ListEvent", "MenuEvent", "MouseEvent", "SashEvent", 346 349 "CalendarEvent", "TreeEvent") 347 classes = (dui.dBox, dui.dBitmap, dui.dBitmapButton, dui.dButton, dui.dCheckBox, 348 dui.d ComboBox, dui.dDateTextBox, dui.dDialog, dui.dDropdownList, dui.dEditBox,349 dui.d Editor, dui.dForm, dui.dDockForm, dui.dGauge, dui.dGrid, dui.dHtmlBox, dui.dImage,350 dui.dL abel, dui.dLine, dui.dListBox, dui.dListControl, dui.dOkCancelDialog, dui.dPanel,351 dui.dPage, dui.d ScrollPanel, dui.dPage, dui.dPageFrame, dui.dPageList, dui.dPageSelect,352 dui.d PageFrameNoTabs, dui.dRadioList, dui.dSlider, dui.dSpinner, dui.dSplitter, dui.dTextBox,353 dui.dT oggleButton, dui.dTreeView, dlgs.Wizard, dlgs.WizardPage)350 classes = (dui.dBox, dui.dBitmap, dui.dBitmapButton, dui.dButton, dui.dCheckBox, dui.dComboBox, 351 dui.dDateTextBox, dui.dDialog, dui.dDropdownList, dui.dEditBox, dui.dEditor, dui.dSlidePanelControl, 352 dui.dForm, dui.dDockForm, dui.dGauge, dui.dGrid, dui.dHtmlBox, dui.dImage, dui.dLabel, dui.dLine, 353 dui.dListBox, dui.dListControl, dui.dOkCancelDialog, dui.dPanel, dui.dPage, dui.dScrollPanel, 354 dui.dPage, dui.dPageFrame, dui.dPageList, dui.dPageSelect, dui.dPageFrameNoTabs, 355 dui.dRadioList, dui.dSlider, dui.dSpinner, dui.dSplitter, dui.dTextBox, dui.dToggleButton, 356 dui.dTreeView, dlgs.Wizard, dlgs.WizardPage) 354 357 355 358 def evtsForClass(cls): … … 635 638 # Standard directory structure; process the parent directory 636 639 self._initDB(os.path.dirname(currdir)) 640 # We need to remove the menu bar class for now, since it isn't used at design time. 641 mbf = self._extractKey(atts, "MenuBarFile") 637 642 if self._reuseMainForm(useSizers=atts.get("UseSizers", False)): 638 643 # Original form hasn't changed, so just use it. … … 708 713 frm.Centered = True 709 714 frm.Visible = True 715 if mbf: 716 frm.MenuBarFile = mbf 710 717 # Save the initial state 711 718 dabo.ui.callAfter(frm.saveState) … … 914 921 isTree = issubclass(newClass, dui.dTreeView) 915 922 isSplitter = issubclass(newClass, dui.dSplitter) 923 isSlidePanelControl = issubclass(newClass, dui.dSlidePanelControl) 916 924 isPageControl = issubclass(newClass, self.pagedControls) 917 925 noTabs = issubclass(newClass, dui.dPageFrameNoTabs) … … 935 943 if noTabs: 936 944 del props["TabPosition"] 945 elif isSlidePanelControl: 946 props["PanelCount"] = int(atts.get("PanelCount", "0")) 947 try: 948 del atts["PanelCount"] 949 except: pass 937 950 elif isSplitter: 938 951 ornt = self._extractKey(atts, "Orientation", "Vertical") … … 940 953 props["createPanes"] = False 941 954 atts["Split"] = False 955 942 956 # If we are pasting, we can get two objects with the same 943 957 # Name value, so change it to NameBase. … … 1002 1016 self._srcObj = pg 1003 1017 self.recreateChildren(pg, grandkids, None, False) 1004 1018 elif isSlidePanelControl: 1019 for pos, kid in enumerate(kids): 1020 pnl = obj.Children[pos] 1021 kidatts = kid.get("attributes", {}) 1022 kidClassID = self._extractKey(kidatts, "classID", "") 1023 if kidClassID: 1024 pnl.classID = kidClassID 1025 pnl.setPropertiesFromAtts(kidatts) 1026 kidcode = kid.get("code", {}) 1027 if kidcode: 1028 self._codeDict[pnl] = kidcode 1029 grandkids = kid.get("children", []) 1030 if grandkids: 1031 self._srcObj = pnl 1032 self.recreateChildren(pg, grandkids, None, False) 1005 1033 elif isSplitter: 1006 1034 for pos, kid in enumerate(kids): … … 1733 1761 # Create a dropdown list containing all the choices. 1734 1762 # NOTE: This would be an excellent candidate for usage ordering. 1735 chc = ["Form", "DockForm", "Panel", "ScrollPanel", "Plain Dialog", "OK/Cancel Dialog", 1736 "Wizard", "WizardPage", "PageFrame", "PageList", "PageSelect", 1737 "PageNoTabs", "Box", "Bitmap", "BitmapButton", "Button", "CheckBox", 1738 "ComboBox", "DateTextBox", "DropdownList", "EditBox", "Editor", 1739 "Gauge", "Grid", "HtmlBox", "Image", "Label", "Line", "ListBox", "ListControl", "Page", 1740 "RadioList", "Slider", "Spinner", "Splitter", "TextBox", "ToggleButton", 1741 "TreeView"] 1742 keys = [dui.dForm, dui.dDockForm, dui.dPanel, dui.dScrollPanel, dui.dDialog, 1743 dui.dOkCancelDialog, dlgs.Wizard, dlgs.WizardPage, 1744 dui.dPageFrame, dui.dPageList, dui.dPageSelect, dui.dPageFrameNoTabs, 1745 dui.dBox, dui.dBitmap, dui.dBitmapButton, dui.dButton, dui.dCheckBox, 1746 dui.dComboBox, dui.dDateTextBox, dui.dDropdownList, dui.dEditBox, 1747 dui.dEditor, dui.dGauge, dui.dGrid, dui.dHtmlBox, dui.dImage, dui.dLabel, dui.dLine, 1748 dui.dListBox, dui.dListControl, dui.dPage, dui.dRadioList, dui.dSlider, 1749 dui.dSpinner, dui.dSplitter, dui.dTextBox, dui.dToggleButton, 1750 dui.dTreeView] 1763 chc = ["Form", "DockForm", "Panel", "ScrollPanel", "SlidePanel", "Plain Dialog", "OK/Cancel Dialog", 1764 "Wizard", "WizardPage", "PageFrame", "PageList", "PageSelect", "PageNoTabs", "Box", "Bitmap", 1765 "BitmapButton", "Button", "CheckBox", "ComboBox", "DateTextBox", "DropdownList", "EditBox", 1766 "Editor", "Gauge", "Grid", "HtmlBox", "Image", "Label", "Line", "ListBox", "ListControl", "Page", 1767 "RadioList", "Slider", "Spinner", "Splitter", "TextBox", "ToggleButton", "TreeView"] 1768 keys = [dui.dForm, dui.dDockForm, dui.dPanel, dui.dScrollPanel, dui.dSlidePanelControl, dui.dDialog, 1769 dui.dOkCancelDialog, dlgs.Wizard, dlgs.WizardPage, dui.dPageFrame, dui.dPageList, 1770 dui.dPageSelect, dui.dPageFrameNoTabs, dui.dBox, dui.dBitmap, dui.dBitmapButton, 1771 dui.dButton, dui.dCheckBox, dui.dComboBox, dui.dDateTextBox, dui.dDropdownList, 1772 dui.dEditBox, dui.dEditor, dui.dGauge, dui.dGrid, dui.dHtmlBox, dui.dImage, dui.dLabel, 1773 dui.dLine, dui.dListBox, dui.dListControl, dui.dPage, dui.dRadioList, dui.dSlider, dui.dSpinner, 1774 dui.dSplitter, dui.dTextBox, dui.dToggleButton, dui.dTreeView] 1751 1775 if not _USE_DOCKFORM: 1752 1776 # The dock form reference is position 1 … … 2519 2543 self.update() 2520 2544 2521 2522 2545 dlg = PageInfoDialog(self.CurrentForm, NoTabs=noTabs, 2523 2546 BasePrefKey=self.BasePrefKey+".PageInfoDialog") … … 2570 2593 newCols = 3 2571 2594 2595 isSlidePanelControl = issubclass(cls, dui.dSlidePanelControl) 2596 if isSlidePanelControl: 2597 dabo.ui.exclaim("NOT IMPLEMENTED YET") 2598 return 2599 # Make sure it has some panels. 2600 newPanels = None 2601 cnt = props.get("PanelCount", 0) 2602 if not cnt: 2603 try: 2604 newPanels = int(dui.getString(_("How many panels?"), 2605 _("New Slide Container"), "3")) 2606 except ValueError: 2607 newPanels = 3 2608 props["PanelCount"] = newPanels 2609 2572 2610 if useSizers: 2573 2611 # Need to notify the tree that an update to a node will be … … 2595 2633 pcount = props["PageCount"] 2596 2634 props["PageCount"] = 0 2635 2636 # Delay the creation of pages 2637 if isSlidePanelControl: 2638 pcount = props["PanelCount"] 2639 props["PanelCount"] = 0 2597 2640 2598 2641 # Make sure that the RadioList's components are Designer-aware … … 2674 2717 pg0panel = LayoutPanel(pg) 2675 2718 2719 if isSlidePanelControl: 2720 pnlCls = obj.PanelClass 2721 if isinstance(pnlCls, basestring): 2722 # Saved class; let the control handle it 2723 obj.PanelCount = pcount 2724 # This is the key that marks it as a class, and not a base object. 2725 prop = classFlagProp 2726 for pnl in obj.Panels: 2727 pnl.Expanded = False 2728 pnl.__setattr__(prop, pnlCls) 2729 pnl0panel = obj.Panels[0] 2730 else: 2731 pnlCtlCls = self.getControlClass(pnlCls) 2732 basePanelCls = self.getControlClass(dabo.ui.dPanel) 2733 obj.PanelClass = pnlCtlCls 2734 obj.PanelCount = pcount 2735 pnl0panel = None 2736 for pnl in obj.Panels[::-1]: 2737 pnl.Expanded = False 2738 if useSizers: 2739 sz = pnl.Sizer = LayoutSizer("v") 2740 pnl0 = LayoutPanel(pnl) 2741 2676 2742 if isinstance(obj, dui.dPage) and not isinstance(obj.Parent, self.pagedControls): 2677 2743 # This is a free standing page being designed. Add the sizer, if required. … … 2723 2789 if useSizers and isPageControl: 2724 2790 dui.callAfter(self.select, pg0panel) 2791 elif useSizers and isSlidePanelControl: 2792 dui.callAfter(self.select, pnl0) 2725 2793 else: 2726 2794 dui.callAfter(self.select, obj) … … 2920 2988 pop.append(_("Add Panel"), OnHit=self.onNewPanel) 2921 2989 pop.append(_("Add ScrollPanel"), OnHit=self.onNewScrollPanel) 2990 pop.append(_("Add SlidePanelControl"), OnHit=self.onNewSlidePanelControl) 2922 2991 pop.append(_("Add Splitter"), OnHit=self.onNewSplitter) 2923 2992 mainpop.appendMenu(pop) … … 3114 3183 def onNewEditor(self, evt): 3115 3184 dui.callAfter(self.addNewControl, None, dui.dEditor) 3185 def onNewSlidePanelControl(self, evt): 3186 dui.callAfter(self.addNewControl, None, dui.dSlidePanelControl) 3116 3187 def onNewGauge(self, evt): 3117 3188 dui.callAfter(self.addNewControl, None, dui.dGauge) … … 3500 3571 _("PageSelect") : self.onNewPageSelect, 3501 3572 _("PageNoTabs") : self.onNewPageNoTabs, 3573 _("SlidePanelControl") : self.onNewSlidePanelControl, 3502 3574 _("Slider") : self.onNewSlider, 3503 3575 _("Spinner") : self.onNewSpinner, … … 3900 3972 (_("DropdownList"), dui.dDropdownList), 3901 3973 (_("EditBox"), dui.dEditBox), 3974 (_("SlidePanelControl"), dui.dSlidePanelControl), 3902 3975 (_("Gauge"), dui.dGauge), 3903 3976 (_("Grid"), dui.dGrid), trunk/ide/ClassDesignerComponents.py
r4364 r4388 156 156 isDefaultSize = (abs(self.Height - defHt) <= 1) 157 157 if isDefaultSize: 158 # ignore it .158 # ignore it 159 159 continue 160 160 if prop == "BackColor" and isinstance(self, (LayoutPanel, LayoutSpacerPanel)): trunk/ide/ClassDesignerControlMixin.py
r4325 r4388 783 783 "Min": {"type" : int, "readonly" : False}, 784 784 "ShowLabels" : {"type" : bool, "readonly" : False}} 785 slidePanelControlProps = {"CollapseToBottom" : {"type" : bool, "readonly" : False}, 786 "ExpandContent": {"type" : bool, "readonly" : False}, 787 "PanelCount" : {"type" : int, "readonly" : True}, 788 "SingleClick" : {"type" : bool, "readonly" : False}, 789 "Singleton" : {"type" : bool, "readonly" : False}} 790 slidePanelProps = { 791 "BarColor1" : {"type" : "color", "readonly" : False, 792 "customEditor": "editColor"}, 793 "BarColor2" : {"type" : "color", "readonly" : False, 794 "customEditor": "editColor"}, 795 "BarStyle": {"type" : list, "readonly" : False, 796 "values" : ["Borderless", "BorderOnly", "FilledBorder", "HorizontalFill", "VerticalFill"]}, 797 "Border": {"type" : int, "readonly" : False}, 798 "CaptionForeColor" : {"type" : "color", "readonly" : False, 799 "customEditor": "editColor"}, 800 "PanelPosition": {"type" : int, "readonly" : False}} 785 801 splitterProps = {"MinimumPanelSize": {"type" : int, "readonly" : False}, 786 802 "Orientation": {"type" : list, "readonly" : False, … … 957 973 ret.update(panelProps) 958 974 ret.update(colorProps) 975 elif isinstance(self, dabo.ui.dSlidePanelControl): 976 ret.update(slidePanelControlProps) 977 elif isinstance(self, dabo.ui.dSlidePanel): 978 ret.update(slidePanelProps) 979 ret.update(captionProps) 959 980 elif isinstance(self, dabo.ui.dSlider): 960 981 ret.update(sliderProps) trunk/ide/ClassDesignerEditor.py
r4296 r4388 218 218 for number in [2,4,6,8,16]: 219 219 self._tabMenu.append(_("Tab Size %s" % number), OnHit=self.onTabSize, bmp="", 220 help=_("Set Tab Size To %s" % number), menutype="radio")220 help=_("Set Tab Size To %s" % number), menutype="radio") 221 221 self._tabMenu.Children[1].Checked = True 222 222 trunk/ide/ClassDesignerFormMixin.py
r4176 r4388 66 66 # for adding controls. 67 67 self._activeContainer = None 68 # The auto-binding happens too late in this case, so call 69 # this method here. 70 self.onActivate(None) 71 72 73 def _beforeInit(self, pre): 74 """Need to set this early in the process""" 68 75 # Convenient flag for controls determining if 69 76 # they are being modified on a design surface 70 77 # or run interactively. 71 78 self.isDesignerForm = True 72 # The auto-binding happens too late in this case, so call 73 # this method here. 74 self.onActivate(None) 75 79 return super(ClassDesignerFormMixin, self)._beforeInit(pre) 80 76 81 77 82 def afterInit(self): trunk/ide/ClassDesignerPemForm.py
r3668 r4388 67 67 tsz = tp.Sizer = dabo.ui.dSizer("v") 68 68 69 dabo.ui.d FoldPanelBar(pp, SingleClick=True, Singleton=True,70 CollapseToBottom=True, RegID="main Bar")71 psz.append1x(self.main Bar)69 dabo.ui.dSlidePanelControl(pp, SingleClick=True, Singleton=True, 70 CollapseToBottom=True, RegID="mainContainer") 71 psz.append1x(self.mainContainer) 72 72 # This helps restore the sash position on the prop grid page 73 73 self._propSashPct = 80 74 74 # Bind to panel changes 75 self.main Bar.bindEvent(dEvents.FoldPanelChange, self.onPanelChange)76 dabo.ui.d FoldPanel(self.mainBar, Caption=_("Properties"), RegID="propPage",75 self.mainContainer.bindEvent(dEvents.SlidePanelChange, self.onPanelChange) 76 dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Properties"), RegID="propPage", 77 77 CaptionForeColor="blue") 78 dabo.ui.d FoldPanel(self.mainBar, Caption=_("Methods"), RegID="methodPage",78 dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Methods"), RegID="methodPage", 79 79 CaptionForeColor="blue") 80 dabo.ui.d FoldPanel(self.mainBar, Caption=_("Custom Properties"), RegID="objPropPage",80 dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Custom Properties"), RegID="objPropPage", 81 81 CaptionForeColor="blue") 82 82 … … 108 108 ps.Controller = ms.Controller = self._tree.Controller = ops.Controller = self.Controller 109 109 self.layout() 110 dabo.ui.callAfter(self.main Bar.expand, self.propPage)110 dabo.ui.callAfter(self.mainContainer.expand, self.propPage) 111 111 112 112 … … 135 135 def onResize(self, evt): 136 136 try: 137 dabo.ui.callAfter(self.main Bar.refresh)137 dabo.ui.callAfter(self.mainContainer.refresh) 138 138 except: 139 # 'main Bar' might not be defined yet, so ignore139 # 'mainContainer' might not be defined yet, so ignore 140 140 pass 141 141
