Changeset 4425

Show
Ignore:
Timestamp:
08/21/08 05:29:47 (3 months ago)
Author:
ed
Message:

Fixed Trac Issue #1165: opening a saved form does not correctly restore the size of that form.

Fixed a bug in the ClassDesignerEditor? that made it hard to delete a method just by deleting the body of the method.

Fixed the cause of most of the sources that caused the message: "None PROP DICT:, ROW=..." to print out while starting the Class Designer. It was mostly the result of an overzealous wx.Grid trying to determine CanGetValueAs?() when the grid was empty. IOW, not an error condition, and thus doesn't merit the output. There are still some timing issues when creating sizers; I've suppressed that output under the verboseLogging setting because it is simpler than getting into the underpinnings of sizer creation.

Added some additional support for dSlidePanelControl. It still is not 100% solid, but at least it's somewhat workable for now.

Files:

Legend:

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

    r4388 r4425  
    671671        self.CurrentForm = frm 
    672672        frm._classFile = pth 
    673         frm._formMode = frm.SaveRestorePosition = isFormClass 
     673        frm._formMode = isFormClass 
    674674        if isFormClass: 
    675675            # See if there is any code associated with the form 
     
    836836                defAtts.update(dictStringify(atts)) 
    837837                atts = defAtts 
    838                 sz.setPropertiesFromAtts(atts) 
     838                if isinstance(sz.Parent, dabo.ui.dSlidePanel): 
     839                    # Main sizer for a slide panel; don't do anything 
     840                    pass 
     841                else: 
     842                    sz.setPropertiesFromAtts(atts) 
    839843                if classID: 
    840844                    sz.classID = classID 
     
    10301034                            if grandkids: 
    10311035                                self._srcObj = pnl 
    1032                                 self.recreateChildren(pg, grandkids, None, False) 
     1036                                self.recreateChildren(pnl, grandkids, None, False) 
    10331037                    elif isSplitter: 
    10341038                        for pos, kid in enumerate(kids): 
     
    15421546                    obj = pgf.Pages[-1] 
    15431547                    cleanup = "pgf.PageCount = %s" % pp 
     1548                if issubclass(cls, dui.dSlidePanel) and isinstance(srcObj.Parent, 
     1549                        dui.dSlidePanelControl): 
     1550                    spc = srcObj.Parent 
     1551                    pp = spc.PanelCount 
     1552                    spc.PanelCount += 1 
     1553                    obj = spc.Panels[-1] 
     1554                    cleanup = "spc.PanelCount = %s" % pp 
    15441555                elif issubclass(cls, dui.dColumn): 
    15451556                    grd = srcObj.Parent 
     
    15581569            if cleanup: 
    15591570                exec cleanup in locals() 
    1560  
    1561             if not issubclass(cls, dui.dPage): 
     1571            if not issubclass(cls, (dui.dPage, dui.dSlidePanel)): 
    15621572                # Pages will be released by their parent. 
    15631573                obj.release() 
     
    25952605        isSlidePanelControl = issubclass(cls, dui.dSlidePanelControl) 
    25962606        if isSlidePanelControl: 
    2597             dabo.ui.exclaim("NOT IMPLEMENTED YET") 
    2598             return 
    25992607            # Make sure it has some panels. 
    26002608            newPanels = None 
     
    27382746                    if useSizers: 
    27392747                        sz = pnl.Sizer = LayoutSizer("v") 
     2748                        sz.Parent = pnl 
    27402749                        pnl0 = LayoutPanel(pnl) 
    27412750 
     
    34063415            itm = None 
    34073416        if itm: 
     3417            if isinstance(newSizer.Parent, dabo.ui.dSlidePanel): 
     3418                #This is the main sizer 
     3419                itm = None 
     3420        if itm: 
    34083421            if sizerAtts: 
    34093422                if isSpacer: 
  • trunk/ide/ClassDesignerControlMixin.py

    r4388 r4425  
    8585        elif isinstance(self, dabo.ui.dImage): 
    8686            self.bindEvent(dEvents.Resize, self._onResize) 
     87        elif isinstance(self, (dabo.ui.dSlidePanelControl, dabo.ui.dSlidePanel)): 
     88            pass 
    8789        else: 
    8890            # This removes all previously-defined bindings 
     
    113115            # Bind the active page to the current selection 
    114116            self.bindEvent(dEvents.PageChanged, self.desSelectPage) 
     117        elif isinstance(self, dabo.ui.dSlidePanel):  
     118            self.bindEvent(dEvents.SlidePanelChange, self.desSlidePanelChg) 
    115119        elif isinstance(self, (dabo.ui.dPanel, dabo.ui.dImage, dabo.ui.dBitmap, 
    116120                dabo.ui.dBitmapButton, dabo.ui.dToggleButton)): 
     
    133137            self.Form.createControlHandles(self) 
    134138#       self.bindKey("left", self.Form.keyMoveLeft) 
    135      
    136          
     139 
     140 
    137141    def _insertPageOverride(self, pos, pgCls=None, caption="", imgKey=None, 
    138142            makeActive=False, ignoreOverride=False): 
     
    466470        """Called when a node in a tree is selected""" 
    467471        self.Form.selectControl(self.Selection, False) 
    468      
    469      
     472 
     473 
     474    def desSlidePanelChg(self, evt): 
     475        dabo.ui.callAfterInterval(100, self.Form.refresh) 
     476 
     477 
    470478    def moveControl(self, pos, shft=False): 
    471479        """ Wraps the Move command with the necessary 
  • trunk/ide/ClassDesignerEditor.py

    r4388 r4425  
    273273         
    274274    def _getMethodBase(self, mthd, isEvt): 
    275         cd = ("def %s(self):\n\t" % mthd, "def %s(self, evt):\n\t" % mthd) 
     275        cd = ("def %s(self):" % mthd, "def %s(self, evt):" % mthd) 
    276276        if isEvt is None: 
    277277            return cd 
     
    545545        mthd = ed.Method 
    546546        mb = self._getMethodBase(mthd, None) 
    547         isEmpty = (txt.strip() == "") or (txt in mb) 
     547        ts = txt.strip() 
     548        isEmpty = (ts == "") or (ts in mb) 
    548549        obj = ed.Object 
    549550        objCode = rep.get(obj) 
  • trunk/ide/ClassDesignerPropSheet.py

    r4122 r4425  
    709709            return None 
    710710        try: 
    711             return self.propDict[prop] 
     711            return self.propDict[prop] 
    712712        except KeyError, e: 
    713713            print "PROP DICT ERROR: >%s<, row=%s" % (prop, row) 
     
    717717        super(PropertyGrid, self).fillGrid(force) 
    718718        # Set the renderers and editors manually by cell 
     719        if not self.Application.Selection: 
     720            return 
    719721        valColumn = self.Columns[1] 
    720722        for row in range(self.RowCount): 
     
    752754            ret = typ in ("str", "string", "unicode", "u") 
    753755        else: 
     756            if not self.Application.Selection: 
     757                return type(None) 
    754758            pd = self.getPropDictForRow(row) 
    755759             
    756760            if not isinstance(pd, dict): 
    757761                if pd is None: 
    758                     print _("None PROP DICT:, ROW="), row 
     762                    if dabo.verboseLogging: 
     763                        # Not technically logging, but this is such a non-event... 
     764                        print _("None PROP DICT:, ROW="), row, col, typ 
    759765                else: 
    760766                    print _("BAD PROP DICT:"), pd, type(pd), _("ROW="), row 
     
    810816        if col is None: 
    811817            col = self.CurrentColumn 
     818        if not self.Application.Selection: 
     819            self.CurrentRow = self.CurrentColumn = 0 
     820            return 
    812821        pd = self.getPropDictForRow(row) 
    813822        if pd is None: