dabo Commit
Revision 6527
Date: 2011-04-03 10:42:21 -0700 (Sun, 03 Apr 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6527

Changed:
U   trunk/ide/ClassDesigner.py
U   trunk/ide/ClassDesignerComponents.py
U   trunk/ide/ClassDesignerControlMixin.py
U   trunk/ide/ClassDesignerTreeSheet.py

Log:
Replaced the LayoutPanel border box with a nested panel - it just made the code 
so much easier, and didn't require a separate class.

Fixed some issues with spacers and how they were displaying.


Diff:
Modified: trunk/ide/ClassDesigner.py
===================================================================
--- trunk/ide/ClassDesigner.py  2011-04-02 16:01:02 UTC (rev 6526)
+++ trunk/ide/ClassDesigner.py  2011-04-03 17:42:21 UTC (rev 6527)
@@ -349,10 +349,10 @@
                """If the selected class is a form/dialog, return a mixed-in
                subclass of it. Otherwise, return the base ClassDesignerForm.
                """
-               formIsMain = issubclass(self._selectedClass, (dui.dForm, 
dui.dFormMain, dui.dDialog))
                isDialog = issubclass(self._selectedClass, (dui.dDialog, ))
                isWizard = issubclass(self._selectedClass, (dlgs.Wizard, ))
                isDockForm = _USE_DOCKFORM and issubclass(self._selectedClass, 
(dui.dDockForm, ))
+               formIsMain = issubclass(self._selectedClass, (dui.dForm, 
dui.dFormMain, dui.dDialog))
                if formIsMain:
                        if isDockForm:
                                base = self._selectedClass              
##dui.dForm
@@ -1439,10 +1439,10 @@
                                sz = obj.ControllingSizer
                                # See if it's a spacer
                                if isinstance(obj, LayoutSpacerPanel):
-                                       if not 
sz.setItemProp(obj.ControllingSizerItem, prop, val):
-                                               self.setProp(obj, prop, val, 
typ)
                                        if prop.lower() == "spacing":
                                                obj.Spacing = val
+                                       elif not 
sz.setItemProp(obj.ControllingSizerItem, prop, val):
+                                               self.setProp(obj, prop, val, 
typ)
                                else:
                                        
sz.setItemProp(obj.ControllingSizerItem, prop, val)
 

Modified: trunk/ide/ClassDesignerComponents.py
===================================================================
--- trunk/ide/ClassDesignerComponents.py        2011-04-02 16:01:02 UTC (rev 
6526)
+++ trunk/ide/ClassDesignerComponents.py        2011-04-03 17:42:21 UTC (rev 
6527)
@@ -512,23 +512,24 @@
                self.depth = self.crawlUp(self)
                plat = self.Application.Platform
                if plat == "Win":
-                       self.BackColor = "cornsilk"
+                       self.normalColor = "cornsilk"
                else:
-                       self.BackColor = "azure"
+                       self.normalColor = "azure"
+               self.normalBorder = self.BorderColor = "darkgrey"
+               self.hiliteColor = "white"
+               self.hiliteBorder = "gold"
+               self.BackColor = self.normalBorder
                self._selected = False
                self.Selected = False
-#              self.BorderLineStyle = "Dot"
-#              self.BorderWidth = 1
-               self._borderBox = LayoutBorderBox(self)
+               self._innerPanel = dabo.ui.dPanel(self, 
BackColor=self.normalColor,
+                               _EventTarget=self)
+               self.Sizer = dabo.ui.dSizer("v")
+               self.Sizer.append1x(self._innerPanel, border=1)
                # Make sure the panel allows full resizing
                self.AlwaysResetSizer = True
                # Windows has a problem with auto-clearing
                ### NOTE: seems to not flicker as much with this commented out 
(at least on Mac).
                #self.autoClearDrawings = (plat != "Win")
-               self.normalColor = self.BackColor ##= self.colors[self.depth]
-               self.normalBorderColor = self.BorderColor = "black"
-               self.hiliteColor = "white"
-               self.hiliteBorder = "gold"
                if self._autoSizer:
                        if isinstance(self.Parent.Sizer, dabo.ui.dSizer):
                                self.Parent.Sizer.append1x(self)
@@ -544,6 +545,11 @@
                dabo.ui.callAfter(self._setDefaultSizerProps)
 
 
+       def getChildrenPropDict(self, clsChildren=None):
+               """LayoutPanels cannot have children."""
+               return []
+
+
        def _setDefaultSizerProps(self):
                if not self:
                        return
@@ -732,11 +738,11 @@
        def _setSel(self, val):
                if self._selected != val:
                        if val:
-                               self.BackColor = self.hiliteColor
-                               self.BorderColor = self.hiliteBorder
+                               self._innerPanel.BackColor = self.hiliteColor
+                               self.BackColor = self.hiliteBorder
                        else:
-                               self.BackColor = self.normalColor
-                               self.BorderColor = self.normalBorderColor
+                               self._innerPanel.BackColor = self.normalColor
+                               self.BackColor = self.normalBorder
                self._selected = val
 
 
@@ -888,31 +894,27 @@
        def __init__(self, parent, properties=None, orient=None, inGrid=False,
                        *args, **kwargs):
                kwargs["AutoSizer"] = False
-               self._spacing = None
+               self._spacing = 10
                self._orient = orient
                self._inGrid = inGrid
-
-               # TEMPORARY workaround until Paul fixes the bug in
-               # propertyHelperMixin
-               spc = self._extractKey((properties, kwargs), "Spacing", 20)
-
                super(LayoutSpacerPanel, self).__init__(parent,
                                properties=properties, *args, **kwargs)
 
-               self.Spacing = spc
 
-               # These need to be set after the super call, since the
-               # LayoutPanel will set them during it.
+       def afterInit(self):
+               super(LayoutSpacerPanel, self).afterInit()
+               self.AlwaysResetSizer = False
                self.Size = self.SpacingSize
-               self.BackColor = "antiquewhite"
-               self.normalColor = self.BackColor
-               self.normalBorderColor = self.BorderColor = "black"
+               # Change these to make them different than LayoutPanels
+               self.normalColor = "antiquewhite"
+               self._innerPanel.BackColor = self.normalColor
+               self.normalBorder = "black"
                self.hiliteColor = "white"
-               self.hiliteBorder = "blue"
-               self.BorderLineStyle = "dot"
+               self.BackColor = self.normalBorder
                # Set up sizer defaults
                addSizerDefaults({self.__class__: {
-                               "G": {"BorderSides": ["All"], "Proportion": 0, 
"HAlign": "Center", "VAlign": "Middle", "Border": 70, "Expand": False, 
"RowExpand": False, "ColExpand": False},
+                               "G": {"BorderSides": ["All"], "Proportion": 0, 
"HAlign": "Center", "VAlign": "Middle", "Border": 70,
+                                       "Expand": False, "RowExpand": False, 
"ColExpand": False},
                                "H": {"BorderSides": ["All"], "Proportion": 0, 
"HAlign": "Left", "VAlign": "Middle", "Border": 80, "Expand": False},
                                "V": {"BorderSides": ["All"], "Proportion": 0, 
"HAlign": "Center", "VAlign": "Top", "Border": 90, "Expand": False}
                                }})
@@ -970,16 +972,15 @@
 
        def _getSpacingSize(self):
                spc = self._spacing
-               if self._inGrid:
-                       self.Size = (spc, spc)
+               if self._inGrid or self._orient is None:
+                       ret = (spc, spc)
                else:
-                       fillerDim = min(5, spc)
-                       if self._orient is None:
-                               self.Size = (spc, spc)
-                       elif self._orient.lower()[0] == "v":
-                               self.Size = (fillerDim, spc)
+                       fillerDim = min(25, spc)
+                       if self._orient.lower()[0] == "v":
+                               ret = (fillerDim, spc)
                        else:
-                               self.Size = (spc, fillerDim)
+                               ret = (spc, fillerDim)
+               return ret
 
 
        DesignerProps = property(_getDesProps, None, None,
@@ -997,46 +998,6 @@
 
 
 
-class LayoutBorderBox(dabo.ui.dBox):
-       """Class used to visually separate LayoutPanels."""
-       def afterInit(self):
-               parent = self.Parent
-               self.buffer = 5
-               self.Left = parent.Left + self.buffer
-               self.Top = parent.Top + self.buffer
-               self.sizeToParent()
-               parent.bindEvent(dEvents.Resize, self.onParentResize)
-
-
-       def onParentResize(self, evt):
-               self.sizeToParent()
-
-
-       def sizeToParent(self):
-               parent = self.Parent
-               self.Width = parent.Width - (self.buffer * 2)
-               self.Height = parent.Height - (self.buffer * 2)
-
-
-       # The following methods pass through mouse interaction
-       # to the parent LayoutPanel.
-       def onMouseLeftUp(self, evt):
-               self.Parent.onMouseLeftUp(evt)
-
-
-       def onMouseLeftDown(self, evt):
-               self.Parent.onMouseLeftDown(evt)
-
-
-       def onSelect(self, evt):
-               self.Parent.onSelect(evt)
-
-
-       def onContextMenu(self, evt):
-               self.Parent.onContextMenu(evt)
-
-
-
 class LayoutSizerMixin(LayoutSaverMixin):
        def __init__(self, *args, **kwargs):
                self.isDesignerSizer = True

Modified: trunk/ide/ClassDesignerControlMixin.py
===================================================================
--- trunk/ide/ClassDesignerControlMixin.py      2011-04-02 16:01:02 UTC (rev 
6526)
+++ trunk/ide/ClassDesignerControlMixin.py      2011-04-03 17:42:21 UTC (rev 
6527)
@@ -137,6 +137,7 @@
                        self.defaultHt = 60
                else:
                        self.defaultWd = self.defaultHt = 100
+#              self.MinimumSize = (self.defaultWd, self.defaultHt)
 
                # This seems to happen after the main autobinding, so
                # it is necessary to call this manually.
@@ -1078,6 +1079,8 @@
                        elif isinstance(self, dui.dMaskedTextBox):
                                ret.update(maskedTextBoxProps)
                                del ret["ForceCase"]
+                       elif isinstance(self, dui.dEditBox):
+                               ret["WordWrap"] = {"type": bool, "readonly": 
False}
                elif isinstance(self, dui.dHtmlBox):
                        ret.update(htmlTextProps)
                        ret.update(scrollProps)

Modified: trunk/ide/ClassDesignerTreeSheet.py
===================================================================
--- trunk/ide/ClassDesignerTreeSheet.py 2011-04-02 16:01:02 UTC (rev 6526)
+++ trunk/ide/ClassDesignerTreeSheet.py 2011-04-03 17:42:21 UTC (rev 6527)
@@ -295,7 +295,7 @@
                                elif isinstance(win, LayoutPanel):
                                        cap = self._getDisplayName(win)
                                        sz = win.Sizer
-                                       if sz is None:
+                                       if sz is None or not isinstance(sz, 
LayoutSizer):
                                                # Empty slot; display it in the 
tree.
                                                childNode = 
node.appendChild(cap)
                                                childNode.Object = win
@@ -337,10 +337,6 @@
                                # A native wx control; skip it
                                return
                        elif isinstance(itm, LayoutPanel) and not 
isinstance(itm.Parent, dui.dialogs.WizardPage):
-                               if itm.Sizer:
-                                       if itm.Sizer.Children:
-                                               self.recurseLayout(itm.Sizer, 
node, noDisplay=noDisplay)
-                                               hasSizer = True
                                return
                        elif isinstance(itm, NoSizerBasePanel):
                                self._recurseChildren(itm.Children, node, 
noDisplay=False)



_______________________________________________
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