daboide Commit
Revision 861
Date: 2007-07-05 16:22:02 -0700 (Thu, 05 Jul 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/daboide/changeset/861
Changed:
U trunk/ClassDesignerComponents.py
Log:
Trailing whitespace removed.
Diff:
Modified: trunk/ClassDesignerComponents.py
===================================================================
--- trunk/ClassDesignerComponents.py 2007-07-05 23:21:25 UTC (rev 860)
+++ trunk/ClassDesignerComponents.py 2007-07-05 23:22:02 UTC (rev 861)
@@ -16,18 +16,18 @@
to save the ClassDesigner item's contents.
"""
# This odd property name is given to any object that is added
- # to a design as a class. We handle them differently; only the
+ # to a design as a class. We handle them differently; only the
# changes are saved in the design they are added to.
classFlagProp = "_CLASS_PATH_"
# Defaults for sizer items
- szItemDefaults1D = {"BorderSides": ["All"], "Proportion": 0, "HAlign":
"Left", "VAlign": "Top",
+ szItemDefaults1D = {"BorderSides": ["All"], "Proportion": 0, "HAlign":
"Left", "VAlign": "Top",
"Border": 0, "Expand": False}
- szItemDefaults2D = {"RowSpan": 1, "BorderSides": ["All"], "ColSpan": 1,
"Proportion": 1,
- "HAlign": "Left", "ColExpand": False, "VAlign": "Top",
"Border": 0, "Expand": False,
+ szItemDefaults2D = {"RowSpan": 1, "BorderSides": ["All"], "ColSpan": 1,
"Proportion": 1,
+ "HAlign": "Left", "ColExpand": False, "VAlign": "Top",
"Border": 0, "Expand": False,
"RowExpand": False}
-
- def getDesignerDict(self, itemNum=0, allProps=False,
+
+ def getDesignerDict(self, itemNum=0, allProps=False,
classID=None, classDict=None, propsToExclude=None):
app = self.Controller
ret = {}
@@ -39,7 +39,7 @@
# allProps = True
ret["attributes"] = ra = {}
isClass = hasattr(self, self.classFlagProp)
-
+
isWiz = isinstance(self, dlgs.Wizard)
insideClass = isClass or (len(app._classStack) > 0)
if isClass:
@@ -105,7 +105,7 @@
ra["savedClass"] = True
else:
ra["designerClass"] = self.getClassName()
-
+
# hasSizer = not isClass and (hasattr(self,
"ControllingSizerItem") and self.ControllingSizerItem)
hasSizer = (hasattr(self, "ControllingSizerItem") and
self.ControllingSizerItem)
# We want to include some props whether they are the
@@ -114,7 +114,7 @@
propsToInclude = ("classID", "SlotCount")
else:
propsToInclude = ("Caption", "Choices", "ColumnCount",
- "Orientation", "PageCount",
"SashPosition", "ScaleMode",
+ "Orientation", "PageCount",
"SashPosition", "ScaleMode",
"SlotCount", "Split")
# We want to exclude some props, since they are derived from
# other props or are settable via other props (fonts).
@@ -123,7 +123,7 @@
elif isinstance(propsToExclude, list):
propsToExclude = tuple(propsToExclude)
propsToExclude += ("Right", "Bottom", "Font", "HeaderFont")
- isSplitPanel = (isinstance(self, dabo.ui.dPanel)
+ isSplitPanel = (isinstance(self, dabo.ui.dPanel)
and isinstance(self.Parent, dabo.ui.dSplitter))
desProps = self.DesignerProps.keys()
if isinstance(self, dabo.ui.dForm) and hasattr(self,
"UseSizers"):
@@ -137,7 +137,7 @@
continue
if prop in propsToExclude:
continue
- if (hasSizer or isinstance(self, dabo.ui.dPage) or
isSplitPanel) and prop in ("Left",
+ if (hasSizer or isinstance(self, dabo.ui.dPage) or
isSplitPanel) and prop in ("Left",
"Right", "Top", "Bottom", "Width",
"Height"):
## Note: there may be additional cases
where we might have to fine-tune
## which if these parameters are
skipped/included.
@@ -145,7 +145,7 @@
continue
if prop == "BackColor" and isinstance(self,
(LayoutPanel, LayoutSpacerPanel)):
continue
-
+
if hasattr(self, prop):
val = eval("self.%s" % prop)
else:
@@ -153,11 +153,11 @@
continue
if prop == "RegID" and not val:
continue
-
+
# Convert any paths, but ignore the string properties
that may
# accidentally contain a legal path but which do not
represent paths.
- if not prop in ("Alignment", "Caption", "DataField",
"DataSource",
- "FontFace", "HAlign", "Name", "RegID",
"SelectionMode",
+ if not prop in ("Alignment", "Caption", "DataField",
"DataSource",
+ "FontFace", "HAlign", "Name", "RegID",
"SelectionMode",
"ToolTipText", "VAlign", "Value") and
(not prop.startswith("Border")
and not prop.startswith("Header") and
not prop.startswith("Sizer_")):
if isinstance(val, basestring) and
os.path.exists(val):
@@ -167,12 +167,12 @@
else:
ref = self.Form._classFile
ref = os.path.abspath(ref)
- if not os.path.isdir(ref):
+ if not os.path.isdir(ref):
# Can't test for 'isfile' since
the file may not have been saved yet.
ref = os.path.split(ref)[0]
val =
os.path.join(dabo.lib.utils.getPathAttributePrefix(),
dabo.lib.utils.relativePath(val, ref))
-
+
# If it hasn't changed from the default, skip it
if not allProps:
if defVals.has_key(prop):
@@ -193,8 +193,8 @@
elif dv == "None":
dv = None
if dv == val:
- continue
-
+ continue
+
if isinstance(val, basestring):
strval = val
else:
@@ -211,7 +211,7 @@
except AttributeError:
# Not controlled by a sizer.
pass
-
+
propDefs = self.getPropDefs()
if propDefs:
ret["properties"] = propDefs
@@ -223,8 +223,8 @@
# Remove this class from the processing stack
app._classStack.pop()
return ret
-
-
+
+
def _diffSizerItemProps(self, dct, szOrDict):
"""Remove all of the default values from the sizer item
props."""
if isinstance(szOrDict, dict):
@@ -261,10 +261,10 @@
if clsK not in currK:
ret[clsK] = ""
return ret
-
+
def getCode(self):
- """Return the code for the object in a method:code
+ """Return the code for the object in a method:code
dictionary.
"""
ret = {}
@@ -277,8 +277,8 @@
del objCode[emp]
ret.update(objCode)
return ret
-
-
+
+
def getPropDefs(self):
"""Get a dict containing any defined properties for this
object."""
ret = self.Controller.getPropDictForObject(self)
@@ -290,23 +290,23 @@
# if sqt in settings["comment"]:
# settings["comment"] =
settings["comment"].replace(sqt, sqtReplacement)
return ret
-
-
+
+
def serialName(self, nm, numItems=0):
"""Prepends a three-digit string to the beginning
- of the passed string. This string starts at '000', and
+ of the passed string. This string starts at '000', and
is incremented for each object listed in the 'keys'
- list. This enables us to maintain object order within
+ list. This enables us to maintain object order within
a dictionary, which is otherwise unordered.
"""
return "d%s%s" % (padl(numItems, 3, "0"), nm)
def getChildrenPropDict(self, clsChildren=None):
- """Iterate through the children. For controls, this will
- go through the containership hierarchy. Sizers will have
+ """Iterate through the children. For controls, this will
+ go through the containership hierarchy. Sizers will have
to override this method. If this is being called inside of a
- class definition, 'clsChildren' will be a dict containing the
+ class definition, 'clsChildren' will be a dict containing the
saved class definition for the child objects.
"""
ret = []
@@ -322,12 +322,12 @@
except AttributeError:
# Object does not have a Children prop
return ret
-
+
# Are we inside a class definition?
insideClass = clsChildren is not None
if insideClass:
childDict = clsChildren.get("children", [])
- if isinstance(self, (dabo.ui.dPageFrame, dabo.ui.dPageList,
+ if isinstance(self, (dabo.ui.dPageFrame, dabo.ui.dPageList,
dabo.ui.dPageSelect, dabo.ui.dPageFrameNoTabs)):
# The dPageFrameNoTabs is different, as it is not a
wx.Notebook
# based control
@@ -349,22 +349,22 @@
nonSizerKids = []
else:
nonSizerKids = [kk for kk in kids
- if not hasattr(kk,
"ControllingSizerItem")
+ if not hasattr(kk,
"ControllingSizerItem")
or kk.ControllingSizerItem is None]
for kid in nonSizerKids:
numItems = len(ret)
if isinstance(kid, dabo.ui.dForm):
- # This is a child window; most likely part of
the
- # ClassDesigner interface, but certainly not
part of
+ # This is a child window; most likely part of
the
+ # ClassDesigner interface, but certainly not
part of
# the class defintion. Sklp it!
continue
if not hasattr(kid, "getDesignerDict"):
- # This is some non-ClassDesigner control, such
as a
+ # This is some non-ClassDesigner control, such
as a
# Status Bar, that we don't need to save
continue
-
- # If we are inside of a class defintion, we need to
+
+ # If we are inside of a class defintion, we need to
# get the dict specific to this child. If it has a
classID,
# we can find the matching entry in our child dict.
# Otherwise, we have to assume that it is a new object
@@ -381,9 +381,9 @@
except:
pass
- ret.append(kid.getDesignerDict(itemNum=numItems,
+ ret.append(kid.getDesignerDict(itemNum=numItems,
classDict=kidDict))
-
+
if isinstance(self, dlgs.Wizard):
# All the children have been processed
return ret
@@ -423,15 +423,15 @@
pass
ret.append(sz.getDesignerDict(itemNum=len(ret),
classDict=szDict))
return ret
-
-
+
+
def getClass(self):
"""Return a string representing the item's class. Can
be overridden by subclasses.
"""
return str(self.BaseClass).split("'")[1].split(".")[-1]
-
+
def getClassName(self):
"""Return a string representing the item's class name. Can
be overridden by subclasses.
@@ -452,8 +452,8 @@
self._defaultSizerProps = {}
for prop in self.DesignerProps.keys():
self._propDefaults[prop] = eval("self.%s" % prop)
-
-
+
+
def afterInit(self):
self.depth = self.crawlUp(self)
plat = self.Application.Platform
@@ -495,8 +495,8 @@
except:
self._defaultSizerProps = {}
-
- def getDesignerDict(self, itemNum=0, allProps=False,
+
+ def getDesignerDict(self, itemNum=0, allProps=False,
classID=None, classDict=None, propsToExclude=None):
# Augment the default to add non-Property values
ret = super(LayoutPanel, self).getDesignerDict(itemNum,
allProps=allProps,
@@ -507,9 +507,9 @@
else:
itmDiffProps = {}
ret["attributes"]["sizerInfo"] = itmDiffProps
- return ret
-
-
+ return ret
+
+
def setMouseHandling(self, turnOn):
"""When turnOn is True, sets all the mouse event bindings. When
it is False, removes the bindings.
@@ -527,8 +527,8 @@
self.Form.onMouseDrag(evt)
else:
self.Form.DragObject = None
-
-
+
+
def onMouseLeftUp(self, evt):
self.Form.processLeftUp(self, evt)
evt.stop()
@@ -541,20 +541,20 @@
# def onMouseLeftClick(self, evt):
# shift = evt.EventData["shiftDown"]
# self.Form.objectClick(self, shift)
-
-
+
+
def onSelect(self, evt):
print "PANEL ON SELECT"
-
-
+
+
def onContextMenu(self, evt):
if isinstance(self.Parent, dabo.ui.dPage):
self.Parent.activePanel = self
pop = self.createContextMenu()
dabo.ui.callAfter(self.showContextMenu, pop)
evt.stop()
-
-
+
+
def createContextMenu(self):
pop = self.Controller.getControlMenu(self)
if isinstance(self.Parent, (dabo.ui.dPage, dabo.ui.dPanel)):
@@ -578,13 +578,13 @@
pop.prepend(_("Paste"), OnHit=self.onPaste)
if not isinstance(self.ControllingSizer, LayoutGridSizer):
pop.append(_("Delete this Slot"), OnHit=self.onDelete)
-
+
self.Controller.addSlotOptions(self, pop, sepBefore=True)
# Add the Sizer editing option
pop.appendSeparator()
pop.append(_("Edit Sizer Settings"), OnHit=self.onEditSizer)
pop.appendSeparator()
- pop.append(_("Add Controls from Data Environment"),
+ pop.append(_("Add Controls from Data Environment"),
OnHit=self.Form.onRunLayoutWiz)
return pop
@@ -594,25 +594,25 @@
to edit this slot's sizer information.
"""
self.Controller.editSizerSettings(self)
-
+
def onCut(self, evt):
"""Place a copy of this control on the Controller clipboard,
and then delete the control
"""
self.Controller.copyObject(self)
self.onDelete(evt)
-
+
def onCopy(self, evt):
"""Place a copy of this control on the Controller clipboard"""
self.Controller.copyObject(self)
-
+
def onPaste(self, evt):
self.Controller.pasteObject(self)
-
-
+
+
def onDeleteParent(self, evt):
"""Called when this panel is the only object on its parent."""
self.Parent.onDelete(evt)
@@ -627,14 +627,14 @@
def onDelete(self, evt):
"""This is called when the user wants to remove the slot
- represented by this panel. This is only allowed for
+ represented by this panel. This is only allowed for
box-type sizers, not grid sizers.
"""
csz = self.ControllingSizer
if csz and isinstance(csz, LayoutSizerMixin):
csz.delete(self, refill=False)
-
+
def crawlUp(self, obj, lev=0):
pp = obj.Parent
if pp is None or (pp is self.Form):
@@ -667,11 +667,11 @@
def _getDesProps(self):
return {"BackColor": {"type" : "color", "readonly" : False},
"Visible": {"type" : bool, "readonly" : False}}
-
-
+
+
def _getSel(self):
return self._selected
-
+
def _setSel(self, val):
if self._selected != val:
if val:
@@ -684,42 +684,42 @@
def _getSzBorder(self):
- return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
+ return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"Border")
-
+
def _setSzBorder(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Border", val)
-
-
+
+
def _getSzBorderSides(self):
- return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
+ return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"BorderSides")
def _setSzBorderSides(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"BorderSides", val)
-
-
+
+
def _getSzExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"Expand")
def _setSzExpand(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Expand", val)
-
+
def _getSzColExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColExpand")
-
+
def _setSzColExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"ColExpand", val)
-
-
+
+
def _getSzColSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColSpan")
-
+
def _setSzColSpan(self, val):
if val == self._getSzColSpan():
return
@@ -731,18 +731,18 @@
ok = False
if not ok:
raise PropertyUpdateException, e
-
-
+
+
def _getSzRowExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowExpand")
-
+
def _setSzRowExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"RowExpand", val)
def _getSzRowSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowSpan")
-
+
def _setSzRowSpan(self, val):
if val == self._getSzRowSpan():
return
@@ -759,27 +759,27 @@
def _getSzProp(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"Proportion")
-
+
def _setSzProp(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Proportion", val)
-
-
+
+
def _getSzHalign(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"Halign")
-
+
def _setSzHalign(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Halign", val)
-
-
+
+
def _getSzValign(self):
- return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
+ return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"Valign")
-
+
def _setSzValign(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Valign", val)
@@ -792,8 +792,8 @@
for the developer to attach code to. (list)""") )
DesignerProps = property(_getDesProps, None, None,
- _("""Returns a dict of editable properties for the
sizer, with the
- prop names as the keys, and the value for each another
dict,
+ _("""Returns a dict of editable properties for the
sizer, with the
+ prop names as the keys, and the value for each another
dict,
containing the following keys: 'type', which controls
how to display
and edit the property, and 'readonly', which will
prevent editing
when True. (dict)""") )
@@ -830,9 +830,9 @@
Sizer_VAlign = property(_getSzValign, _setSzValign, None,
_("Vert. Alignment setting of controlling sizer item
(choice)"))
-
-
+
+
class LayoutSpacerPanel(LayoutPanel):
def __init__(self, parent, properties=None, orient=None, inGrid=False,
*args, **kwargs):
@@ -840,17 +840,17 @@
self._spacing = None
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,
+
+ super(LayoutSpacerPanel, self).__init__(parent,
properties=properties, *args, **kwargs)
self.Spacing = spc
-
- # These need to be set after the super call, since the
+
+ # These need to be set after the super call, since the
# LayoutPanel will set them during it.
self.Size = self.SpacingSize
self.BackColor = "antiquewhite"
@@ -859,8 +859,8 @@
self.hiliteColor = "white"
self.hiliteBorder = "blue"
self.BorderLineStyle = "dot"
-
+
def onMouseRightClick(self, evt):
if isinstance(self.Parent, dabo.ui.dPage):
self.Parent.activePanel = self
@@ -926,25 +926,25 @@
DesignerProps = property(_getDesProps, None, None,
- _("""Returns a dict of editable properties for the
sizer, with the
- prop names as the keys, and the value for each another
dict,
+ _("""Returns a dict of editable properties for the
sizer, with the
+ prop names as the keys, and the value for each another
dict,
containing the following keys: 'type', which controls
how to display
and edit the property, and 'readonly', which will
prevent editing
when True. (dict)""") )
Spacing = property(_getSpacing, _setSpacing, None,
_("Allocated space for the spacer this represents
(tuple of int)"))
-
+
SpacingSize = property(_getSpacingSize, None, None,
_("Size of this spacer panel, based on the spacing
(tuple)"))
-
+
class LayoutSizerMixin(LayoutSaverMixin):
def __init__(self, *args, **kwargs):
super(LayoutSizerMixin, self).__init__(*args, **kwargs)
-
-
+
+
def getItemProps(self, itm):
"""Return a dict containing the sizer item properties as keys,
with
their associated values. Must override in each subclass.
@@ -956,7 +956,7 @@
ret["Proportion"] = self.getItemProp(itm, "Proportion")
return ret
-
+
def getChildrenPropDict(self, clsChildren=None):
ret = []
kids = self.Children
@@ -983,7 +983,7 @@
insideClass = clsChildren is not None
if insideClass:
childDict = clsChildren.get("children", [])
-
+
for kid in kids:
isSpacer = False
numItems = len(ret)
@@ -1004,9 +1004,9 @@
winDict = None
except:
pass
- kidDict =
kidItem.getDesignerDict(itemNum=numItems,
+ kidDict =
kidItem.getDesignerDict(itemNum=numItems,
classDict=winDict)
-
+
elif kidItem in self.ChildSizers:
szrDict = None
if insideClass:
@@ -1019,7 +1019,7 @@
szrDict = None
except:
pass
- kidDict =
kidItem.getDesignerDict(itemNum=numItems,
+ kidDict =
kidItem.getDesignerDict(itemNum=numItems,
classDict=szrDict)
else:
# Spacer
@@ -1029,7 +1029,7 @@
else:
pos = 0
spc = kidItem.Spacing
- kidDict = {"name" : "Spacer",
+ kidDict = {"name" : "Spacer",
"attributes" : {"size" : spc, "Name" :
"spacer"},
"cdata" : "",
"children" : [] }
@@ -1043,7 +1043,7 @@
def createContextMenu(self):
pop = dabo.ui.dMenu()
- isMain = (self.ControllingSizer is None
+ isMain = (self.ControllingSizer is None
and isinstance(self.Parent, dabo.ui.dForm))
if not isMain:
pop.append(_("Cut"), OnHit=self.Controller.onTreeCut)
@@ -1084,17 +1084,17 @@
else:
self.release(True)
dabo.ui.callAfter(self.Controller.updateLayout)
-
+
def onCopy(self, evt):
"""Place a copy of this control on the Controller clipboard"""
self.Controller.copyObject(self)
-
+
def onPaste(self, evt):
self.Controller.pasteObject(self)
-
-
+
+
def delete(self, obj, refill=True):
"""Delete the specified object. Add a replacement layout
panel unless refill is False.
@@ -1146,10 +1146,10 @@
def _getDesEvents(self):
return []
-
+
def _getDesProps(self):
- ret = {"Orientation": {"type" : list, "readonly" : False,
+ ret = {"Orientation": {"type" : list, "readonly" : False,
"values" : ["Horizontal", "Vertical"]},
"DefaultBorder": {"type" : int, "readonly" :
False},
"DefaultBorderLeft": {"type" : bool, "readonly"
: False},
@@ -1159,7 +1159,7 @@
"SlotCount" : {"type": int, "readonly" : False}}
# Add the controlling sizer props, if applicable
if self.ControllingSizer:
- ret.update({"Sizer_Border": {"type" : int, "readonly" :
False},
+ ret.update({"Sizer_Border": {"type" : int, "readonly" :
False},
"Sizer_BorderSides": {"type" : list,
"readonly" : False,
"values" : ["All", "Top",
"Bottom", "Left", "Right", "None"],
"customEditor":
"editBorderSides"},
@@ -1175,54 +1175,54 @@
"Sizer_RowSpan" : {"type" : int, "readonly" :
False},
"Sizer_ColSpan" : {"type" : int, "readonly" :
False}})
return ret
-
-
+
+
def _getSzItmProps(self):
return {"Border": {"type" : int, "readonly" : False},
- "BorderSides": {"type" : list, "readonly" :
False,
+ "BorderSides": {"type" : list, "readonly" :
False,
"values" : ["All", "Top", "Bottom",
"Left", "Right", "None"],
"customEditor": "editBorderSides"},
"Proportion": {"type" : int, "readonly" :
False},
- "HAlign": {"type" : list, "readonly" : False,
+ "HAlign": {"type" : list, "readonly" : False,
"values" : ["Left", "Right", "Center"]},
- "VAlign": {"type" : list, "readonly" : False,
+ "VAlign": {"type" : list, "readonly" : False,
"values" : ["Top", "Bottom", "Middle"]},
"Expand": {"type" : bool, "readonly" : False}}
-
-
+
+
def _getSzBorder(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Border")
def _setSzBorder(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Border", val)
-
-
+
+
def _getSzBorderSides(self):
- return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
+ return
self.ControllingSizer.getItemProp(self.ControllingSizerItem,
"BorderSides")
def _setSzBorderSides(self, val):
- self.ControllingSizer.setItemProp(self.ControllingSizerItem,
+ self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"BorderSides", val)
-
-
+
+
def _getSzExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Expand")
-
+
def _setSzExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Expand", val)
def _getSzColExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColExpand")
-
+
def _setSzColExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"ColExpand", val)
-
-
+
+
def _getSzColSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColSpan")
-
+
def _setSzColSpan(self, val):
if val == self._getSzColSpan():
return
@@ -1234,17 +1234,17 @@
if not ok:
raise PropertyUpdateException, e
-
+
def _getSzRowExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowExpand")
-
+
def _setSzRowExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"RowExpand", val)
def _getSzRowSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowSpan")
-
+
def _setSzRowSpan(self, val):
if val == self._getSzRowSpan():
return
@@ -1263,7 +1263,7 @@
def _setSzProp(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Proportion", val)
-
+
def _getSzHalign(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Halign")
@@ -1280,7 +1280,7 @@
def _getSlotCount(self):
return len(self.Children)
-
+
def _setSlotCount(self, val):
cnt = len(self.Children)
if val > cnt:
@@ -1298,33 +1298,33 @@
elif obj in self.ChildSizers:
self.remove(obj)
obj.release(True)
-
-
+
+
Controller = property(_getController, _setController, None,
_("Object to which this one reports events (object
(varies))"))
DefaultBorder = property(_getDefaultBorder, _setDefaultBorder, None,
- _("""Not only changes the current setting, but goes
back and applies
+ _("""Not only changes the current setting, but goes
back and applies
it to all existing children (int)"""))
-
+
DesignerEvents = property(_getDesEvents, None, None,
_("""Returns a list of the most common events for the
control.
This will determine which events are displayed in the
PropSheet
for the developer to attach code to. (list)""") )
DesignerProps = property(_getDesProps, None, None,
- _("""Returns a dict of editable properties for the
sizer, with the
- prop names as the keys, and the value for each another
dict,
+ _("""Returns a dict of editable properties for the
sizer, with the
+ prop names as the keys, and the value for each another
dict,
containing the following keys: 'type', which controls
how to display
and edit the property, and 'readonly', which will
prevent editing
when True. (dict)""") )
-
+
ItemDesignerProps = property(_getSzItmProps, None, None,
_("""When the selected object in the ClassDesigner is a
sizer item, we
- need to be able to get the items properties. Since we
can't
+ need to be able to get the items properties. Since we
can't
subclass the sizer item, custom stuff like this will
always have to
be done through the sizer class. (dict)""") )
-
+
Sizer_Border = property(_getSzBorder, _setSzBorder, None,
_("Border setting of controlling sizer item (int)"))
@@ -1354,7 +1354,7 @@
Sizer_VAlign = property(_getSzValign, _setSzValign, None,
_("Vert. Alignment setting of controlling sizer item
(choice)"))
-
+
SlotCount = property(_getSlotCount, _setSlotCount, None,
_("Number of slots available in this sizer. (int)") )
@@ -1363,8 +1363,8 @@
def getBorderedClass(self):
"""Return the class that is the border sizer version of this
class."""
return LayoutBorderSizer
-
-
+
+
class LayoutBorderSizer(LayoutSizerMixin, dabo.ui.dBorderSizer):
def __init__(self, box, caption=None, *args, **kwargs):
if not isinstance(box, dabo.ui.dBox):
@@ -1384,7 +1384,7 @@
def _getDesProps(self):
ret = LayoutBorderSizer.doDefault()
ret.update({"Caption" : {"type" : unicode, "readonly" : False},
- "BackColor" : {"type" : "color", "readonly" :
False,
+ "BackColor" : {"type" : "color", "readonly" :
False,
"customEditor": "editColor"},
"FontBold": {"type" : bool, "readonly" : False},
"FontFace": {"type" : list, "readonly" : False,
@@ -1396,8 +1396,8 @@
DesignerProps = property(_getDesProps, None, None,
- _("""Returns a dict of editable properties for the
sizer, with the
- prop names as the keys, and the value for each another
dict,
+ _("""Returns a dict of editable properties for the
sizer, with the
+ prop names as the keys, and the value for each another
dict,
containing the following keys: 'type', which controls
how to display
and edit the property, and 'readonly', which will
prevent editing
when True. (dict)""") )
@@ -1408,8 +1408,8 @@
def __init__(self, *args, **kwargs):
super(LayoutGridSizer, self).__init__(*args, **kwargs)
self._rows = self._cols = 0
-
-
+
+
def setItemProps(self, itm, props):
"""This accepts a dict of properties and values, and
applies them to the specified sizer item.
@@ -1419,8 +1419,8 @@
currVal = self.getItemProp(itm, prop)
if val != currVal:
self.setItemProp(itm, prop, val)
-
+
def getItemProps(self, itm):
"""Return a dict containing the sizer item properties as keys,
with
their associated values. Must override in each subclass.
@@ -1430,7 +1430,7 @@
ret[prop] = self.getItemProp(itm, prop)
return ret
-
+
def switchObjects(self, obj1, obj2):
"""Swaps the location of the two objects."""
if not obj1 or not obj2:
@@ -1444,11 +1444,11 @@
self.append(obj1, row=row2, col=col2)
self.setItemProps(obj1, props)
self.layout()
-
-
+
+
def createContextMenu(self):
pop = dabo.ui.dMenu()
- isMain = (self.ControllingSizer is None
+ isMain = (self.ControllingSizer is None
and isinstance(self.Parent, dabo.ui.dForm))
if not isMain:
pop.append(_("Cut"), OnHit=self.Controller.onTreeCut)
@@ -1467,8 +1467,8 @@
to edit this slot's sizer information.
"""
self.Controller.editSizerSettings(self)
-
+
def getChildrenPropDict(self, clsChildren=None):
ret = []
kids = self.Children
@@ -1482,7 +1482,7 @@
clsDict = None
if insideClass:
clsDict = self.getChildClassDict(clsChildren,
kid)
-
+
for prop in self.ItemDesignerProps.keys():
itmDict[prop] = self.getItemProp(kid, prop)
itmDiffDict = self._diffSizerItemProps(itmDict, self)
@@ -1493,7 +1493,7 @@
else:
# Spacer
spc = kid.GetSpacer()
- kidDict = {"name" : self.serialName("Spacer",
numItems),
+ kidDict = {"name" : self.serialName("Spacer",
numItems),
"attributes" : {},
"cdata" : kidItem.Spacing,
"children" : [] }
@@ -1504,8 +1504,8 @@
# Add to the result
ret.append(kidDict)
return ret
-
-
+
+
def getChildClassDict(self, clsChildren, itm):
ret = None
obj = self.getItem(itm)
@@ -1534,17 +1534,17 @@
else:
self.release(True)
dabo.ui.callAfter(self.Controller.updateLayout)
-
+
def onCopy(self, evt):
"""Place a copy of this control on the Controller clipboard"""
self.Controller.copyObject(self)
-
+
def onPaste(self, evt):
self.Controller.pasteObject(self)
-
-
+
+
def delete(self, obj, refill=True):
"""Delete the specified object. Add a replacement layout
panel unless refill is False.
@@ -1569,7 +1569,7 @@
def _getColCount(self):
return self._cols
-
+
def _setColCount(self, val):
curr = self._cols
if curr != val:
@@ -1589,9 +1589,9 @@
else:
for cc in range(curr-1, val-1, -1):
self.removeCol(cc)
- self.layout()
-
-
+ self.layout()
+
+
def _getController(self):
try:
return self._controller
@@ -1611,7 +1611,7 @@
def _getDesProps(self):
- ret = {"MaxDimension": {"type" : list, "readonly" : False,
+ ret = {"MaxDimension": {"type" : list, "readonly" : False,
"values" : ["Rows", "Columns"]},
"Rows" : {"type" : int, "readonly" : False},
"Columns" : {"type" : int, "readonly" : False},
@@ -1619,7 +1619,7 @@
"VGap" : {"type" : int, "readonly" : False}}
# Add the controlling sizer props, if applicable
if self.ControllingSizer:
- ret.update({"Sizer_Border": {"type" : int, "readonly" :
False},
+ ret.update({"Sizer_Border": {"type" : int, "readonly" :
False},
"Sizer_BorderSides": {"type" : list,
"readonly" : False,
"values" : ["All", "Top",
"Bottom", "Left", "Right", "None"],
"customEditor":
"editBorderSides"},
@@ -1635,8 +1635,8 @@
"Sizer_RowSpan" : {"type" : int, "readonly" :
False},
"Sizer_ColSpan" : {"type" : int, "readonly" :
False}})
return ret
-
-
+
+
def _getSzItmProps(self):
return {
"Border": {"type" : int, "readonly" : False},
@@ -1649,15 +1649,15 @@
"RowSpan": {"type" : int, "readonly" : False},
"ColSpan": {"type" : int, "readonly" : False},
"Proportion": {"type" : int, "readonly" :
False},
- "HAlign": {"type" : list, "readonly" : False,
+ "HAlign": {"type" : list, "readonly" : False,
"values" : ["Left", "Right", "Center"]},
- "VAlign": {"type" : list, "readonly" : False,
+ "VAlign": {"type" : list, "readonly" : False,
"values" : ["Top", "Bottom", "Middle"]}}
-
-
+
+
def _getRowCount(self):
return self._rows
-
+
def _setRowCount(self, val):
curr = self._rows
if curr != val:
@@ -1677,7 +1677,7 @@
else:
for rr in range(curr-1, val-1, -1):
self.removeRow(rr)
- self.layout()
+ self.layout()
def _getSzBorder(self):
@@ -1685,32 +1685,32 @@
def _setSzBorder(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Border", val)
-
-
+
+
def _getSzBorderSides(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "BorderSides")
def _setSzBorderSides(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"BorderSides", val)
-
-
+
+
def _getSzExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Expand")
-
+
def _setSzExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Expand", val)
def _getSzColExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColExpand")
-
+
def _setSzColExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"ColExpand", val)
-
-
+
+
def _getSzColSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "ColSpan")
-
+
def _setSzColSpan(self, val):
if val == self._getSzColSpan():
return
@@ -1721,18 +1721,18 @@
ok = False
if not ok:
raise PropertyUpdateException, e
-
-
+
+
def _getSzRowExpand(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowExpand")
-
+
def _setSzRowExpand(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"RowExpand", val)
def _getSzRowSpan(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "RowSpan")
-
+
def _setSzRowSpan(self, val):
if val == self._getSzRowSpan():
return
@@ -1743,15 +1743,15 @@
ok = False
if not ok:
raise PropertyUpdateException, e
-
+
def _getSzProp(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Proportion")
def _setSzProp(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Proportion", val)
-
+
def _getSzHalign(self):
return
self.ControllingSizer.getItemProp(self.ControllingSizerItem, "Halign")
@@ -1764,8 +1764,8 @@
def _setSzValign(self, val):
self.ControllingSizer.setItemProp(self.ControllingSizerItem,
"Valign", val)
-
-
+
+
Columns = property(_getColCount, _setColCount, None,
_("Number of columns in this sizer. (int)") )
@@ -1778,18 +1778,18 @@
for the developer to attach code to. (list)""") )
DesignerProps = property(_getDesProps, None, None,
- _("""Returns a dict of editable properties for the
sizer, with the
- prop names as the keys, and the value for each another
dict,
+ _("""Returns a dict of editable properties for the
sizer, with the
+ prop names as the keys, and the value for each another
dict,
containing the following keys: 'type', which controls
how to display
and edit the property, and 'readonly', which will
prevent editing
when True. (dict)""") )
-
+
ItemDesignerProps = property(_getSzItmProps, None, None,
_("""When the selected object in the ClassDesigner is a
sizer item, we
- need to be able to get the items properties. Since we
can't
+ need to be able to get the items properties. Since we
can't
subclass the sizer item, custom stuff like this will
always have to
be done through the sizer class. (dict)""") )
-
+
Rows = property(_getRowCount, _setRowCount, None,
_("Number of rows in this sizer. (int)") )
@@ -1822,9 +1822,9 @@
Sizer_VAlign = property(_getSzValign, _setSzValign, None,
_("Vert. Alignment setting of controlling sizer item
(choice)"))
-
+
class LayoutBasePanel(dabo.ui.dPanel, LayoutSaverMixin):
def _getController(self):
try:
@@ -1842,7 +1842,7 @@
def _getDesProps(self):
return {"BackColor": {"type" : "color", "readonly" : False}}
-
+
Controller = property(_getController, _setController, None,
_("Object to which this one reports events (object
(varies))"))
@@ -1857,8 +1857,8 @@
def afterInit(self):
self.IsContainer = True
# self.bindEvent(dEvents.KeyChar, self.Form.onKeyChar)
-
-
+
+
def setMouseHandling(self, turnOn):
"""When turnOn is True, sets all the mouse event bindings. When
it is False, removes the bindings.
@@ -1876,8 +1876,8 @@
self.Form.onMouseDrag(evt)
else:
self.Form.DragObject = None
-
-
+
+
def onMouseLeftUp(self, evt):
self.Form.processLeftUp(self, evt)
evt.stop()
@@ -1890,29 +1890,29 @@
def onMouseLeftDoubleClick(self, evt):
self.Form.processLeftDoubleClick(evt)
-
+
def onContextMenu(self, evt):
pop = self.createContextMenu()
dabo.ui.callAfter(self.showContextMenu, pop)
evt.stop()
-
-
+
+
def createContextMenu(self):
pop = self.Controller.getControlMenu(self)
if self.Controller.Clipboard:
pop.prependSeparator()
pop.prepend(_("Paste"), OnHit=self.onPaste)
pop.appendSeparator()
- pop.append(_("Add Controls from Data Environment"),
+ pop.append(_("Add Controls from Data Environment"),
OnHit=self.Form.onRunLayoutWiz)
return pop
-
+
def onPaste(self, evt):
self.Controller.pasteObject(self)
-
+
def _getDesEvents(self):
return []
@@ -1921,11 +1921,11 @@
ret = [ch for ch in self.GetChildren()
if not isinstance(ch, DragHandle)]
return ret
-
+
Children = property(_getChildren, None, None,
_("Includes all relevant child objects (list)"))
-
+
DesignerEvents = property(_getDesEvents, None, None,
_("""Returns a list of the most common events for the
control.
This will determine which events are displayed in the
PropSheet
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]