dabo Commit
Revision 4425
Date: 2008-08-21 05:29:47 -0700 (Thu, 21 Aug 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4425

Changed:
U   trunk/ide/ClassDesigner.py
U   trunk/ide/ClassDesignerControlMixin.py
U   trunk/ide/ClassDesignerEditor.py
U   trunk/ide/ClassDesignerPropSheet.py

Log:
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.


Diff:
Modified: trunk/ide/ClassDesigner.py
===================================================================
--- trunk/ide/ClassDesigner.py  2008-08-19 01:38:01 UTC (rev 4424)
+++ trunk/ide/ClassDesigner.py  2008-08-21 12:29:47 UTC (rev 4425)
@@ -670,7 +670,7 @@
                frm.Controller = self
                self.CurrentForm = frm
                frm._classFile = pth
-               frm._formMode = frm.SaveRestorePosition = isFormClass
+               frm._formMode = isFormClass
                if isFormClass:
                        # See if there is any code associated with the form
                        code = clsd.get("code", "")
@@ -835,7 +835,11 @@
                                        defAtts["Sizer_%s" % key] = val
                                defAtts.update(dictStringify(atts))
                                atts = defAtts
-                               sz.setPropertiesFromAtts(atts)
+                               if isinstance(sz.Parent, dabo.ui.dSlidePanel):
+                                       # Main sizer for a slide panel; don't 
do anything
+                                       pass
+                               else:
+                                       sz.setPropertiesFromAtts(atts)
                                if classID:
                                        sz.classID = classID
                                if not fromSzr:
@@ -1029,7 +1033,7 @@
                                                        grandkids = 
kid.get("children", [])
                                                        if grandkids:
                                                                self._srcObj = 
pnl
-                                                               
self.recreateChildren(pg, grandkids, None, False)
+                                                               
self.recreateChildren(pnl, grandkids, None, False)
                                        elif isSplitter:
                                                for pos, kid in enumerate(kids):
                                                        pnlClass = 
dui.__dict__[kid["name"]]
@@ -1541,6 +1545,13 @@
                                        pgf.PageCount += 1
                                        obj = pgf.Pages[-1]
                                        cleanup = "pgf.PageCount = %s" % pp
+                               if issubclass(cls, dui.dSlidePanel) and 
isinstance(srcObj.Parent,
+                                               dui.dSlidePanelControl):
+                                       spc = srcObj.Parent
+                                       pp = spc.PanelCount
+                                       spc.PanelCount += 1
+                                       obj = spc.Panels[-1]
+                                       cleanup = "spc.PanelCount = %s" % pp
                                elif issubclass(cls, dui.dColumn):
                                        grd = srcObj.Parent
                                        cc = grd.ColumnCount
@@ -1557,8 +1568,7 @@
                        self._classDefaultVals[cls] = ret
                        if cleanup:
                                exec cleanup in locals()
-
-                       if not issubclass(cls, dui.dPage):
+                       if not issubclass(cls, (dui.dPage, dui.dSlidePanel)):
                                # Pages will be released by their parent.
                                obj.release()
                        if frm:
@@ -2594,8 +2604,6 @@
 
                isSlidePanelControl = issubclass(cls, dui.dSlidePanelControl)
                if isSlidePanelControl:
-                       dabo.ui.exclaim("NOT IMPLEMENTED YET")
-                       return
                        # Make sure it has some panels.
                        newPanels = None
                        cnt = props.get("PanelCount", 0)
@@ -2737,6 +2745,7 @@
                                        pnl.Expanded = False
                                        if useSizers:
                                                sz = pnl.Sizer = 
LayoutSizer("v")
+                                               sz.Parent = pnl
                                                pnl0 = LayoutPanel(pnl)
 
                if isinstance(obj, dui.dPage) and not isinstance(obj.Parent, 
self.pagedControls):
@@ -3405,6 +3414,10 @@
                except:
                        itm = None
                if itm:
+                       if isinstance(newSizer.Parent, dabo.ui.dSlidePanel):
+                               #This is the main sizer
+                               itm = None
+               if itm:
                        if sizerAtts:
                                if isSpacer:
                                        sizerAtts["Proportion"] = 0

Modified: trunk/ide/ClassDesignerControlMixin.py
===================================================================
--- trunk/ide/ClassDesignerControlMixin.py      2008-08-19 01:38:01 UTC (rev 
4424)
+++ trunk/ide/ClassDesignerControlMixin.py      2008-08-21 12:29:47 UTC (rev 
4425)
@@ -84,6 +84,8 @@
                        pass
                elif isinstance(self, dabo.ui.dImage):
                        self.bindEvent(dEvents.Resize, self._onResize)
+               elif isinstance(self, (dabo.ui.dSlidePanelControl, 
dabo.ui.dSlidePanel)):
+                       pass
                else:
                        # This removes all previously-defined bindings
                        self.unbindEvent(None)
@@ -112,6 +114,8 @@
                        self.defaultHt = 300
                        # Bind the active page to the current selection
                        self.bindEvent(dEvents.PageChanged, self.desSelectPage)
+               elif isinstance(self, dabo.ui.dSlidePanel): 
+                       self.bindEvent(dEvents.SlidePanelChange, 
self.desSlidePanelChg)
                elif isinstance(self, (dabo.ui.dPanel, dabo.ui.dImage, 
dabo.ui.dBitmap,
                                dabo.ui.dBitmapButton, dabo.ui.dToggleButton)):
                        self.defaultWd = 60
@@ -132,8 +136,8 @@
                if not self.UsingSizers:
                        self.Form.createControlHandles(self)
 #              self.bindKey("left", self.Form.keyMoveLeft)
-       
-               
+
+
        def _insertPageOverride(self, pos, pgCls=None, caption="", imgKey=None,
                        makeActive=False, ignoreOverride=False):
                if not isinstance(self, self.Controller.pagedControls):
@@ -465,8 +469,12 @@
        def desSelectNode(self, evt):
                """Called when a node in a tree is selected"""
                self.Form.selectControl(self.Selection, False)
-       
-       
+
+
+       def desSlidePanelChg(self, evt):
+               dabo.ui.callAfterInterval(100, self.Form.refresh)
+
+
        def moveControl(self, pos, shft=False):
                """ Wraps the Move command with the necessary
                screen updating stuff.

Modified: trunk/ide/ClassDesignerEditor.py
===================================================================
--- trunk/ide/ClassDesignerEditor.py    2008-08-19 01:38:01 UTC (rev 4424)
+++ trunk/ide/ClassDesignerEditor.py    2008-08-21 12:29:47 UTC (rev 4425)
@@ -272,7 +272,7 @@
                
                
        def _getMethodBase(self, mthd, isEvt):
-               cd = ("def %s(self):\n\t" % mthd, "def %s(self, evt):\n\t" % 
mthd)
+               cd = ("def %s(self):" % mthd, "def %s(self, evt):" % mthd)
                if isEvt is None:
                        return cd
                else:
@@ -544,7 +544,8 @@
                txt = ed.Value
                mthd = ed.Method
                mb = self._getMethodBase(mthd, None)
-               isEmpty = (txt.strip() == "") or (txt in mb)
+               ts = txt.strip()
+               isEmpty = (ts == "") or (ts in mb)
                obj = ed.Object
                objCode = rep.get(obj)
                if isEmpty:

Modified: trunk/ide/ClassDesignerPropSheet.py
===================================================================
--- trunk/ide/ClassDesignerPropSheet.py 2008-08-19 01:38:01 UTC (rev 4424)
+++ trunk/ide/ClassDesignerPropSheet.py 2008-08-21 12:29:47 UTC (rev 4425)
@@ -708,7 +708,7 @@
                if not prop:
                        return None
                try:
-                       return  self.propDict[prop]
+                       return self.propDict[prop]
                except KeyError, e:
                        print "PROP DICT ERROR: >%s<, row=%s" % (prop, row)
                
@@ -716,6 +716,8 @@
        def fillGrid(self, force=False):
                super(PropertyGrid, self).fillGrid(force)
                # Set the renderers and editors manually by cell
+               if not self.Application.Selection:
+                       return
                valColumn = self.Columns[1]
                for row in range(self.RowCount):
                        pd = self.getPropDictForRow(row)
@@ -751,11 +753,15 @@
                if col == 0:
                        ret = typ in ("str", "string", "unicode", "u")
                else:
+                       if not self.Application.Selection:
+                               return type(None)
                        pd = self.getPropDictForRow(row)
                        
                        if not isinstance(pd, dict):
                                if pd is None:
-                                       print _("None PROP DICT:, ROW="), row
+                                       if dabo.verboseLogging:
+                                               # Not technically logging, but 
this is such a non-event...
+                                               print _("None PROP DICT:, 
ROW="), row, col, typ
                                else:
                                        print _("BAD PROP DICT:"), pd, 
type(pd), _("ROW="), row
                        else:
@@ -809,6 +815,9 @@
                        row = self.CurrentRow
                if col is None:
                        col = self.CurrentColumn
+               if not self.Application.Selection:
+                       self.CurrentRow = self.CurrentColumn = 0
+                       return
                pd = self.getPropDictForRow(row)
                if pd is None:
                        return




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to