dabo Commit
Revision 5908
Date: 2010-07-05 11:46:18 -0700 (Mon, 05 Jul 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5908
Changed:
U trunk/ide/ClassDesignerComponents.py
U trunk/ide/ClassDesignerFormMixin.py
Log:
Updated the mixin classes to inherit from dObject so that these controls can
use the same afterInit() hooks as other classes.
Added a Selected property to sizers in the Designer so that they now appear
highlighted on the design surface when the are selected. Previously sizers had
no visible components.
Diff:
Modified: trunk/ide/ClassDesignerComponents.py
===================================================================
--- trunk/ide/ClassDesignerComponents.py 2010-07-05 18:42:05 UTC (rev
5907)
+++ trunk/ide/ClassDesignerComponents.py 2010-07-05 18:46:18 UTC (rev
5908)
@@ -3,6 +3,7 @@
import dabo
dabo.ui.loadUI("wx")
from dabo.dLocalize import _
+from dabo.dObject import dObject
import dabo.dEvents as dEvents
import dabo.ui.dialogs as dlgs
from ClassDesignerExceptions import PropertyUpdateException
@@ -22,10 +23,14 @@
-class LayoutSaverMixin(object):
+class LayoutSaverMixin(dObject):
"""Contains the basic code for generating the dict required
to save the ClassDesigner item's contents.
"""
+ def __init__(self, *args, **kwargs):
+ super(LayoutSaverMixin, self).__init__(*args, **kwargs)
+
+
def getDesignerDict(self, itemNum=0, allProps=False,
classID=None, classDict=None, propsToExclude=None):
app = self.Controller
@@ -992,9 +997,19 @@
class LayoutSizerMixin(LayoutSaverMixin):
def __init__(self, *args, **kwargs):
self.isDesignerSizer = True
+ self._selected = False
super(LayoutSizerMixin, self).__init__(*args, **kwargs)
+ def _afterInit(self):
+ super(LayoutSizerMixin, self)._afterInit()
+ # No special reason for these choices, except that they make the
+ # sizer clearly visible.
+ self.outlineColor = "ORCHID"
+ self.outlineStyle = "solid"
+ self.outlineWidth = 2
+
+
def getItemProps(self, itm):
"""Return a dict containing the sizer item properties as keys,
with
their associated values. Must override in each subclass.
@@ -1317,6 +1332,28 @@
return ret
+ def _getSel(self):
+ return self._selected
+
+ def _setSel(self, val):
+ if self._selected != val:
+ frm = None
+ obj = self
+ while obj.Parent:
+ try:
+ frm = obj.Parent.Form
+ break
+ except AttributeError:
+ pass
+ obj = obj.Parent
+ if frm:
+ if val:
+ frm.addToOutlinedSizers(self)
+ else:
+ frm.removeFromOutlinedSizers(self)
+ self._selected = val
+
+
def _getSzItmProps(self):
return {"Border": {"type" : int, "readonly" : False},
"BorderSides": {"type" : list, "readonly" :
False,
@@ -1479,6 +1516,9 @@
subclass the sizer item, custom stuff like this will
always have to
be done through the sizer class. (dict)""") )
+ Selected = property(_getSel, _setSel, None,
+ _("Denotes if this sizer is selected for user
interaction. (bool)") )
+
Sizer_Border = property(_getSzBorder, _setSzBorder, None,
_("Border setting of controlling sizer item (int)"))
@@ -1514,6 +1554,10 @@
class LayoutSizer(LayoutSizerMixin, dabo.ui.dSizer):
+ def __init__(self, *args, **kwargs):
+ super(LayoutSizer, self).__init__(*args, **kwargs)
+
+
def getBorderedClass(self):
"""Return the class that is the border sizer version of this
class."""
return LayoutBorderSizer
@@ -1558,7 +1602,7 @@
-class LayoutGridSizer(LayoutSaverMixin, dabo.ui.dGridSizer):
+class LayoutGridSizer(LayoutSizerMixin, dabo.ui.dGridSizer):
def __init__(self, *args, **kwargs):
super(LayoutGridSizer, self).__init__(*args, **kwargs)
self._rows = self._cols = 0
@@ -1638,6 +1682,8 @@
if insideClass:
clsDict = self.getChildClassDict(clsChildren,
kid)
+ # Make sure that the clsDict is not None.
+ clsDict = clsDict or {}
for prop in self.ItemDesignerProps.keys():
itmDict[prop] = self.getItemProp(kid, prop)
itmDiffDict = self._diffSizerItemProps(itmDict, self)
Modified: trunk/ide/ClassDesignerFormMixin.py
===================================================================
--- trunk/ide/ClassDesignerFormMixin.py 2010-07-05 18:42:05 UTC (rev 5907)
+++ trunk/ide/ClassDesignerFormMixin.py 2010-07-05 18:46:18 UTC (rev 5908)
@@ -39,7 +39,6 @@
self._namedConnection = ""
self._selection = [self]
self._classFile = ""
- self.redrawOutlines = False
self._canContain = self._isMain
self._currContainer = None
self._dragObject = None
@@ -85,6 +84,10 @@
self._defaultTop = 50
self._defaultWidth = 570
self._defaultHeight = 550
+ self._alwaysDrawSizerOutlines = True
+ self._drawSizerChildren = True
+ self._recurseOutlinedSizers = False
+ self._sizersToOutline = []
def afterInitAll(self):
@@ -895,7 +898,6 @@
# Nothing changed; we're switching active forms
return
self.lockDisplay()
- self.setAll("Selected", False)
if not isinstance(ctls, (list, tuple)):
ctls = [ctls]
for ct in ctls:
_______________________________________________
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]