From: Kevin A. <ka...@us...> - 2004-05-03 00:00:30
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11106 Modified Files: widget.py Log Message: Handler class really isn't needed, since we're just looking up the the method to call based on the id of the event passed into _dispatch Index: widget.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/widget.py,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** widget.py 2 May 2004 19:56:16 -0000 1.121 --- widget.py 3 May 2004 00:00:20 -0000 1.122 *************** *** 321,327 **** if 0: print " binding", self.name, eventClass.name, handler._name, eventClass.id ! self.eventIdToHandler[eventClass.id] = handler ! if 0: print "\n boundEvents:" for name in self.boundEvents.values(): --- 321,338 ---- if 0: print " binding", self.name, eventClass.name, handler._name, eventClass.id ! # KEA 2004-05-02 ! # change to just using the method directly, Handler class not needed ! # actually the Handler class isn't needed at all ! # so if the initial list built to simplify findHandler ! # just stores a reference to the method that would be fine ! # as long as the whole system uses that ! # the only reason we don't just build the list ourselves ! # in _bindEvents is that every component needs to do findHandler ! # so it is more efficient to do once when the Scriptable object ! # is created than to reparse for each component ! #self.eventIdToHandler[eventClass.id] = handler ! self.eventIdToHandler[eventClass.id] = handler.getFunction() ! if 1: print "\n boundEvents:" for name in self.boundEvents.values(): *************** *** 330,334 **** print "\n self.eventIdToHandler:" for id in self.eventIdToHandler: ! print " ", id, self.eventIdToHandler[id]._function print "\n\n" --- 341,348 ---- print "\n self.eventIdToHandler:" for id in self.eventIdToHandler: ! # KEA 2004-05-02 ! # change to just using the method directly, Handler class not needed ! #print " ", id, self.eventIdToHandler[id]._function ! print " ", id, self.eventIdToHandler[id] print "\n\n" *************** *** 426,429 **** --- 440,446 ---- # it shouldn't be possible to be in _dispatch for an event # that wasn't bound above, but just in case... + # KEA 2004-05-02 + # change to just using the method directly, Handler class not needed + #handler = self.eventIdToHandler.get(eventType, None) handler = self.eventIdToHandler.get(eventType, None) if handler: *************** *** 446,450 **** # this is what is in event.py # aHandler.getFunction()( aOwner, self.getSource(), self ) ! handler.getFunction()(background, aWxEvent) # do we have to clean up this alias? --- 463,470 ---- # this is what is in event.py # aHandler.getFunction()( aOwner, self.getSource(), self ) ! # KEA 2004-05-02 ! # change to just using the method directly, Handler class not needed ! #handler.getFunction()(background, aWxEvent) ! handler(background, aWxEvent) # do we have to clean up this alias? |