dabo Commit
Revision 4943
Date: 2009-01-21 17:48:43 -0800 (Wed, 21 Jan 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/4943

Changed:
U   trunk/dabo/lib/eventMixin.py

Log:
This fixes a problem with my previous change that only allowed one auto-binding 
per object. It also replaces the parent hierarchy with just the current object, 
as well as its Parent and Form, if those exist.


Diff:
Modified: trunk/dabo/lib/eventMixin.py
===================================================================
--- trunk/dabo/lib/eventMixin.py        2009-01-21 14:28:32 UTC (rev 4942)
+++ trunk/dabo/lib/eventMixin.py        2009-01-22 01:48:43 UTC (rev 4943)
@@ -194,25 +194,21 @@
                # the object is changing: we don't want the old bindings to 
stay active).
                self._removeAutoBindings()
 
-               # We call _autoBindEvents for self and all parent containers, 
and force 
-               # it because it was asked for explicitly.
+               # We call _autoBindEvents for self, as well as the self.Parent 
object and  
+               # the self.Form object, if they exist.
                self._autoBindEvents(context=self, force=force)
-
                try:
-                       parent = self.Parent
+                       prnt = self.Parent
                except AttributeError:
-                       parent = None
-               stop = False
-               while parent:
-                       lastParent = parent
-                       stop = self._autoBindEvents(context=parent, force=force)
-                       if stop:
-                               break
-                       try:
-                               parent = parent.Parent
-                       except AttributeError:
-                               parent = self.Form
-                               stop = True
+                       prnt = None
+               try:
+                       frm = self.Form
+               except AttributeError:
+                       frm = None
+               if prnt:
+                       self._autoBindEvents(context=prnt, force=force)
+               if frm:
+                       self._autoBindEvents(context=frm, force=force)
 
 
        def _autoBindEvents(self, context, force=False):
@@ -266,7 +262,6 @@
                        # If we got this far, we have a match. 
                        # Get the object reference to the function:
                        funcObj = None
-                       retVal = False
                        ### Paul: this is the major change I propose: looking
                        ### in the 'context' object first, instead of its 
__class__
                        try:
@@ -288,8 +283,6 @@
                                        evtObj = dEvents.__dict__[parsedEvtName]
                                        funcObj = eval("context.%s" % funcName) 
 ## (can't use __class__.dict...)
                                        self.bindEvent(evtObj, funcObj, 
_auto=True)
-                                       retVal = True
-                       return retVal
 
 
        def getEventList(cls):



_______________________________________________
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