|
From: Kevin A. <ka...@us...> - 2004-05-13 17:54:09
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1981 Modified Files: model.py Log Message: changed addMethod to use setattr Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** model.py 13 May 2004 05:21:23 -0000 1.173 --- model.py 13 May 2004 17:53:58 -0000 1.174 *************** *** 479,483 **** #print aMethod.__name__ #print aMethod ! self.__class__.__dict__[aMethod.__name__] = aMethod # now add the method info to our handler lookup dictionary # KEA 2001-11-29 simplified _addHandler --- 479,483 ---- #print aMethod.__name__ #print aMethod ! setattr(self.__class__, aMethod.__name__, aMethod) # now add the method info to our handler lookup dictionary # KEA 2001-11-29 simplified _addHandler *************** *** 485,488 **** --- 485,500 ---- #self._addHandler(aMethod.__name__, handler) self._addHandler(aMethod) + + # KEA 2004-05-13 + # will need to call _bindEvents here to make sure the event handler + # is bound to the right component instances + # trying to figure out all the components as well as the reverse mapping + # from an event name like mouseDown to event.MouseDownEvent is tricky + # at best so we'll probably need to have user-code make explicit calls + # to _bindEvents for each component they want to bind + # the name to event class mapping can be found by iterativing over the + # events defined in the spec for a given component to find a name match + # maybe just calling _bindEvents with a full list of relevant events + # would work, since the boundEvents list will prevent double-binding def findHandler(self, aString): |