dabo Commit
Revision 3762
Date: 2007-11-28 05:00:11 -0800 (Wed, 28 Nov 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3762

Changed:
U   trunk/dabo/lib/propertyHelperMixin.py
U   trunk/dabo/ui/uiwx/dPemMixin.py

Log:
This commit fixes several things. First, it properly preserves the Name 
property on composite objects that do not get 'self._constructed()' set until 
later in their creation process. Second, it fixes a bug in _extractKey() that 
only removed the key to be extracted from the first dict in which it occurred, 
instead of from all passed dicts. Third, it updates the code to remove 
designer-specific keywords from both the local 'properties' dict and the 
'self._properties' dict. This was the problem in Trac issue #1121, which should 
be fixed now.



Diff:
Modified: trunk/dabo/lib/propertyHelperMixin.py
===================================================================
--- trunk/dabo/lib/propertyHelperMixin.py       2007-11-24 17:20:01 UTC (rev 
3761)
+++ trunk/dabo/lib/propertyHelperMixin.py       2007-11-28 13:00:11 UTC (rev 
3762)
@@ -86,13 +86,16 @@
                if not isinstance(kwdict, (tuple, list)):
                        kwdict = (kwdict, )
                ret = defaultVal
+               found = False
                for dd in kwdict:
                        if dd is None:
                                continue
                        try:
-                               ret = dd[key]
+                               if not found:
+                                       ret = dd[key]
+                                       found = True
                                del dd[key]
-                               break
+#                              break
                        except KeyError:
                                pass
                return ret

Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2007-11-24 17:20:01 UTC (rev 3761)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2007-11-28 13:00:11 UTC (rev 3762)
@@ -142,9 +142,9 @@
                                self._preInitProperties["ID"] = 
self._preInitProperties["id"]
                                del self._preInitProperties["id"]
                # This is needed when running from a saved design file
-               self._extractKey(properties, "designerClass")
+               self._extractKey((properties, self._properties), 
"designerClass")
                # This attribute is used when saving code with a design file
-               self._extractKey(properties, "code-ID")
+               self._extractKey((properties, self._properties), "code-ID")
                
                # The user's subclass code has had a chance to tweak the init 
properties.
                # Insert any of those into the arguments to send to the wx 
constructor:
@@ -165,22 +165,23 @@
                        self.PostCreate(pre)
 
                self._pemObject = self
-
-               # If a Name isn't given, a default name will be used, and it'll 
-               # autonegotiate by adding an integer until it is a unique name.
-               # If a Name is given explicitly, a NameError will be raised if
-               # the given Name isn't unique among siblings:
-               if not dabo.fastNameSet:
-                       name, _explicitName = self._processName(kwargs, 
self.__class__.__name__)
-                       self._initName(name, _explicitName=_explicitName)
-
-               # Add any properties that were re-set 
-               properties.update(self._properties)
-               # Set the properties *before* calling the afterInit hook
-               self._setProperties(properties)
                
-               # Set any passed event bindings
-               self._setKwEventBindings(self._kwEvents)
+               if self._constructed():
+                       # If a Name isn't given, a default name will be used, 
and it'll 
+                       # autonegotiate by adding an integer until it is a 
unique name.
+                       # If a Name is given explicitly, a NameError will be 
raised if
+                       # the given Name isn't unique among siblings:
+                       if not dabo.fastNameSet:
+                               name, _explicitName = self._processName(kwargs, 
self.__class__.__name__)
+                               self._initName(name, 
_explicitName=_explicitName)
+       
+                       # Add any properties that were re-set 
+                       properties.update(self._properties)
+                       # Set the properties *before* calling the afterInit hook
+                       self._setProperties(properties)
+                       
+                       # Set any passed event bindings
+                       self._setKwEventBindings(self._kwEvents)
                
                self._initEvents()
                self._afterInit()
@@ -2112,7 +2113,12 @@
                return name
        
        def _setName(self, name, _userExplicit=True):
-               if self._constructed():
+               if not self._constructed():
+                       if _userExplicit:
+                               self._properties["Name"] = name
+                       else:
+                               self._properties["NameBase"] = name
+               else:
                        currentName = self._getName()
                        if dabo.fastNameSet:
                                # The user is responsible for setting and 
unsetting the global fastNameSet
@@ -2209,9 +2215,6 @@
 
                        ## When the name changes, we need to autobind again:
                        self.autoBindEvents(force=False)
-
-               else:
-                       self._properties["Name"] = name
        
 
        def _setNameBase(self, val):




_______________________________________________
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]

Reply via email to