Changeset 4238
- Timestamp:
- 07/06/08 12:34:37 (5 months ago)
- Files:
-
- trunk/dabo/dObject.py (modified) (3 diffs)
- trunk/dabo/lib/DesignerXmlConverter.py (modified) (1 diff)
- trunk/dabo/lib/propertyHelperMixin.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/dObject.py
r4179 r4238 34 34 _call_beforeInit, _call_afterInit, _call_initProperties = True, True, True 35 35 36 def __init__(self, properties=None, *args, **kwargs):36 def __init__(self, properties=None, attProperties=None, *args, **kwargs): 37 37 if not hasattr(self, "_properties"): 38 38 self._properties = {} … … 46 46 # or override the properties set in beforeInit(). 47 47 48 # Some classes that are not inherited from the ui-layer PEM mixin classes 49 # can have attProperties passed. Since these are all passed as strings, we 50 # need to convert them to their proper type and add them to the properties 51 # dict. 52 if properties is None: 53 properties = {} 54 if attProperties: 55 for prop, val in attProperties.items(): 56 if prop in ("designerClass", ): 57 continue 58 if prop in properties: 59 # The properties value has precedence, so ignore. 60 continue 61 typ = type(getattr(self, prop)) 62 if not issubclass(typ, basestring): 63 val = typ(val) 64 properties[prop] = val 65 48 66 # The keyword properties can come from either, both, or none of: 49 67 # + the properties dict … … 55 73 self._properties[k] = v 56 74 properties = self._extractKeywordProperties(kwargs, self._properties) 57 # if kwargs:58 # # Some kwargs haven't been handled.59 # raise TypeError, _("__init__() got an unexpected keyword argument '%s'") % kwargs.keys()[0]60 75 if kwargs: 61 76 # Some kwargs haven't been handled. trunk/dabo/lib/DesignerXmlConverter.py
r4183 r4238 757 757 self._grdColText = """ col = dabo.ui.dColumn(obj, attProperties=%(kidCleanAtts)s) 758 758 obj.addColumn(col) 759 col.setPropertiesFromAtts(%(kidCleanAtts)s)760 759 """ 761 760 self._pgfPageText = """ pg = %(moduleString)s%(nm)s(%(prntName)s%(attPropString)s) trunk/dabo/lib/propertyHelperMixin.py
r4190 r4238 231 231 raise AttributeError, "'%s' is not a property." % prop 232 232 setattr(self, prop, val) 233 # if isinstance(eval("self.%s" % prop), basestring):234 # # If this is property holds strings, we need to quote the value.235 # try:236 # exec("self.%s = '%s'" % (prop, val) )237 # except :238 # raise ValueError, "Could not set property '%s' to value: %s" % (prop, val)239 # else:240 # try:241 # exec("self.%s = %s" % (prop, val) )242 # except:243 # # Still could be a string, if the original value was None244 # try:245 # exec("self.%s = '%s'" % (prop, val) )246 # except:247 # raise ValueError, "Could not set property '%s' to value: %s" % (prop, val)248 233 249 234
