Changeset 4388

Show
Ignore:
Timestamp:
08/09/08 19:30:24 (3 months ago)
Author:
ed
Message:

Updated for the name change from dFoldPanelBar to dSlidePanelControl.

Began implementing suppport for dSlidePanelControl in the Class Designer.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ide/ClassDesigner.py

    r4360 r4388  
    139139                {"name" : "DropdownList", "class" : dui.dDropdownList, "order" : 70}, 
    140140                {"name" : "EditBox", "class" : dui.dEditBox, "order" : 80}, 
     141                {"name" : "SlidePanelControl", "class" : dui.dSlidePanelControl, "order" : 82}, 
    141142                {"name" : "HtmlBox", "class" : dui.dHtmlBox, "order" : 85}, 
    142143                {"name" : "Gauge", "class" : dui.dGauge, "order" : 90}, 
     
    267268        dct = defVals.copy() 
    268269        self._sizerDefaults[dui.dEditor] = dct 
     270        dct = defVals.copy() 
     271        self._sizerDefaults[dui.dSlidePanelControl] = dct 
    269272        dct = defVals.copy() 
    270273        dct.update({"Proportion" : 0}) 
     
    345348                "ListEvent", "MenuEvent", "MouseEvent", "SashEvent", 
    346349                "CalendarEvent", "TreeEvent") 
    347         classes = (dui.dBox, dui.dBitmap, dui.dBitmapButton, dui.dButton, dui.dCheckBox,  
    348                 dui.dComboBox, dui.dDateTextBox, dui.dDialog, dui.dDropdownList, dui.dEditBox,  
    349                 dui.dEditor, dui.dForm, dui.dDockForm, dui.dGauge, dui.dGrid, dui.dHtmlBox, dui.dImage,  
    350                 dui.dLabel, dui.dLine, dui.dListBox, dui.dListControl, dui.dOkCancelDialog, dui.dPanel,  
    351                 dui.dPage, dui.dScrollPanel, dui.dPage, dui.dPageFrame, dui.dPageList, dui.dPageSelect
    352                 dui.dPageFrameNoTabs, dui.dRadioList, dui.dSlider, dui.dSpinner, dui.dSplitter, dui.dTextBox,  
    353                 dui.dToggleButton, 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) 
    354357 
    355358        def evtsForClass(cls): 
     
    635638            # Standard directory structure; process the parent directory 
    636639            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") 
    637642        if self._reuseMainForm(useSizers=atts.get("UseSizers", False)): 
    638643            # Original form hasn't changed, so just use it. 
     
    708713        frm.Centered = True 
    709714        frm.Visible = True 
     715        if mbf: 
     716            frm.MenuBarFile = mbf 
    710717        # Save the initial state 
    711718        dabo.ui.callAfter(frm.saveState) 
     
    914921                isTree = issubclass(newClass, dui.dTreeView) 
    915922                isSplitter = issubclass(newClass, dui.dSplitter) 
     923                isSlidePanelControl = issubclass(newClass, dui.dSlidePanelControl) 
    916924                isPageControl = issubclass(newClass, self.pagedControls) 
    917925                noTabs = issubclass(newClass, dui.dPageFrameNoTabs) 
     
    935943                    if noTabs: 
    936944                        del props["TabPosition"] 
     945                elif isSlidePanelControl: 
     946                    props["PanelCount"] = int(atts.get("PanelCount", "0")) 
     947                    try: 
     948                        del atts["PanelCount"] 
     949                    except: pass 
    937950                elif isSplitter: 
    938951                    ornt = self._extractKey(atts, "Orientation", "Vertical") 
     
    940953                    props["createPanes"] = False 
    941954                    atts["Split"] = False 
     955 
    942956                # If we are pasting, we can get two objects with the same 
    943957                # Name value, so change it to NameBase. 
     
    10021016                                self._srcObj = pg 
    10031017                                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) 
    10051033                    elif isSplitter: 
    10061034                        for pos, kid in enumerate(kids): 
     
    17331761                # Create a dropdown list containing all the choices. 
    17341762                # 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] 
    17511775                if not _USE_DOCKFORM: 
    17521776                    # The dock form reference is position 1 
     
    25192543                            self.update() 
    25202544 
    2521  
    25222545                dlg = PageInfoDialog(self.CurrentForm, NoTabs=noTabs, 
    25232546                        BasePrefKey=self.BasePrefKey+".PageInfoDialog") 
     
    25702593                    newCols = 3 
    25712594 
     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 
    25722610        if useSizers: 
    25732611            # Need to notify the tree that an update to a node will be 
     
    25952633            pcount = props["PageCount"] 
    25962634            props["PageCount"] = 0 
     2635 
     2636        # Delay the creation of pages 
     2637        if isSlidePanelControl: 
     2638            pcount = props["PanelCount"] 
     2639            props["PanelCount"] = 0 
    25972640 
    25982641        # Make sure that the RadioList's components are Designer-aware 
     
    26742717                            pg0panel = LayoutPanel(pg) 
    26752718 
     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 
    26762742        if isinstance(obj, dui.dPage) and not isinstance(obj.Parent, self.pagedControls): 
    26772743            # This is a free standing page being designed. Add the sizer, if required. 
     
    27232789            if useSizers and isPageControl: 
    27242790                dui.callAfter(self.select, pg0panel) 
     2791            elif useSizers and isSlidePanelControl: 
     2792                dui.callAfter(self.select, pnl0) 
    27252793            else: 
    27262794                dui.callAfter(self.select, obj) 
     
    29202988            pop.append(_("Add Panel"), OnHit=self.onNewPanel) 
    29212989            pop.append(_("Add ScrollPanel"), OnHit=self.onNewScrollPanel) 
     2990            pop.append(_("Add SlidePanelControl"), OnHit=self.onNewSlidePanelControl) 
    29222991            pop.append(_("Add Splitter"), OnHit=self.onNewSplitter) 
    29232992            mainpop.appendMenu(pop) 
     
    31143183    def onNewEditor(self, evt): 
    31153184        dui.callAfter(self.addNewControl, None, dui.dEditor) 
     3185    def onNewSlidePanelControl(self, evt): 
     3186        dui.callAfter(self.addNewControl, None, dui.dSlidePanelControl) 
    31163187    def onNewGauge(self, evt): 
    31173188        dui.callAfter(self.addNewControl, None, dui.dGauge) 
     
    35003571                    _("PageSelect") : self.onNewPageSelect, 
    35013572                    _("PageNoTabs") : self.onNewPageNoTabs, 
     3573                    _("SlidePanelControl") : self.onNewSlidePanelControl, 
    35023574                    _("Slider") : self.onNewSlider, 
    35033575                    _("Spinner") : self.onNewSpinner, 
     
    39003972                    (_("DropdownList"), dui.dDropdownList), 
    39013973                    (_("EditBox"), dui.dEditBox), 
     3974                    (_("SlidePanelControl"), dui.dSlidePanelControl), 
    39023975                    (_("Gauge"), dui.dGauge), 
    39033976                    (_("Grid"), dui.dGrid), 
  • trunk/ide/ClassDesignerComponents.py

    r4364 r4388  
    156156                        isDefaultSize = (abs(self.Height - defHt) <= 1) 
    157157                    if isDefaultSize: 
    158                         # ignore it. 
     158                        # ignore it 
    159159                        continue 
    160160            if prop == "BackColor" and isinstance(self, (LayoutPanel, LayoutSpacerPanel)): 
  • trunk/ide/ClassDesignerControlMixin.py

    r4325 r4388  
    783783                "Min": {"type" : int, "readonly" : False}, 
    784784                "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}} 
    785801        splitterProps = {"MinimumPanelSize": {"type" : int, "readonly" : False}, 
    786802                "Orientation": {"type" : list, "readonly" : False, 
     
    957973            ret.update(panelProps) 
    958974            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) 
    959980        elif isinstance(self, dabo.ui.dSlider): 
    960981            ret.update(sliderProps) 
  • trunk/ide/ClassDesignerEditor.py

    r4296 r4388  
    218218        for number in [2,4,6,8,16]: 
    219219            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") 
    221221        self._tabMenu.Children[1].Checked = True 
    222222 
  • trunk/ide/ClassDesignerFormMixin.py

    r4176 r4388  
    6666        # for adding controls. 
    6767        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""" 
    6875        # Convenient flag for controls determining if  
    6976        # they are being modified on a design surface 
    7077        # or run interactively. 
    7178        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 
    7681     
    7782    def afterInit(self): 
  • trunk/ide/ClassDesignerPemForm.py

    r3668 r4388  
    6767        tsz = tp.Sizer = dabo.ui.dSizer("v") 
    6868 
    69         dabo.ui.dFoldPanelBar(pp, SingleClick=True, Singleton=True, 
    70                 CollapseToBottom=True, RegID="mainBar") 
    71         psz.append1x(self.mainBar) 
     69        dabo.ui.dSlidePanelControl(pp, SingleClick=True, Singleton=True, 
     70                CollapseToBottom=True, RegID="mainContainer") 
     71        psz.append1x(self.mainContainer) 
    7272        # This helps restore the sash position on the prop grid page 
    7373        self._propSashPct = 80 
    7474        # Bind to panel changes 
    75         self.mainBar.bindEvent(dEvents.FoldPanelChange, self.onPanelChange) 
    76         dabo.ui.dFoldPanel(self.mainBar, Caption=_("Properties"), RegID="propPage", 
     75        self.mainContainer.bindEvent(dEvents.SlidePanelChange, self.onPanelChange) 
     76        dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Properties"), RegID="propPage", 
    7777                CaptionForeColor="blue") 
    78         dabo.ui.dFoldPanel(self.mainBar, Caption=_("Methods"), RegID="methodPage", 
     78        dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Methods"), RegID="methodPage", 
    7979                CaptionForeColor="blue") 
    80         dabo.ui.dFoldPanel(self.mainBar, Caption=_("Custom Properties"), RegID="objPropPage", 
     80        dabo.ui.dSlidePanel(self.mainContainer, Caption=_("Custom Properties"), RegID="objPropPage", 
    8181                CaptionForeColor="blue") 
    8282 
     
    108108        ps.Controller = ms.Controller = self._tree.Controller = ops.Controller = self.Controller 
    109109        self.layout() 
    110         dabo.ui.callAfter(self.mainBar.expand, self.propPage) 
     110        dabo.ui.callAfter(self.mainContainer.expand, self.propPage) 
    111111 
    112112     
     
    135135    def onResize(self, evt): 
    136136        try: 
    137             dabo.ui.callAfter(self.mainBar.refresh) 
     137            dabo.ui.callAfter(self.mainContainer.refresh) 
    138138        except: 
    139             # 'mainBar' might not be defined yet, so ignore 
     139            # 'mainContainer' might not be defined yet, so ignore 
    140140            pass 
    141141