From: Kevin A. <ka...@us...> - 2004-05-05 03:52:04
|
Update of /cvsroot/pythoncard/PythonCard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3487 Modified Files: component.py debug.py error.py event.py menu.py model.py widget.py Log Message: tossed unneeded classes from event.py, removed references to Handler Index: debug.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/debug.py,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** debug.py 4 May 2004 20:40:39 -0000 1.128 --- debug.py 5 May 2004 03:51:53 -0000 1.129 *************** *** 124,153 **** self.SetSize(size) - event.EventQueue().addListener( self ) event.EventLog.getInstance().addEventListener( self ) def eventOccurred(self, eventAdapter): ! if isinstance(eventAdapter, tuple): ! # new way hack to stay compatible with one arg notifyEventListeners ! eventName, sourceName, used = eventAdapter ! if eventName == event.IdleEvent.name: ! return ! else: ! # old way ! evt = eventAdapter.getDispatchedEvent() ! eventName = evt.getName() ! sourceName = evt.getSource().name ! evt = None ! ! # KEA 2002-06-10 ! # displaying idle is a losing proposition ! # the act of displaying the idle event ends up ! # causing another idle event as the queue empties ! # with the wxSTC or at least that is what I think was ! # happening ! if eventName == event.IdleEvent.name: ! # print eventAdapter.getEventWasUsed(), eventName, sourceName ! return ! used = eventAdapter.getEventWasUsed() if used: --- 124,134 ---- self.SetSize(size) event.EventLog.getInstance().addEventListener( self ) def eventOccurred(self, eventAdapter): ! # new way hack to stay compatible with one arg notifyEventListeners ! eventName, sourceName, used = eventAdapter ! if eventName == event.IdleEvent.name: ! return if used: *************** *** 185,189 **** # event listeners so that we don't end up trying to access # a dead object - event.EventQueue().removeListener( self ) event.EventLog.getInstance().removeEventListener( self ) evt.Skip() --- 166,169 ---- Index: widget.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/widget.py,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** widget.py 4 May 2004 20:49:11 -0000 1.125 --- widget.py 5 May 2004 03:51:53 -0000 1.126 *************** *** 22,26 **** class WidgetSpec( component.ComponentSpec ) : def __init__( self, name, parent, events, subclassAttributes ) : ! events.extend( event.MOUSE_EVENTS ) attributes = { 'id':{'presence':'optional', 'default':-1}, --- 22,26 ---- class WidgetSpec( component.ComponentSpec ) : def __init__( self, name, parent, events, subclassAttributes ) : ! events.extend( event.WIDGET_EVENTS ) attributes = { 'id':{'presence':'optional', 'default':-1}, *************** *** 332,336 **** # is created than to reparse for each component #self.eventIdToHandler[eventClass.id] = handler ! self.eventIdToHandler[eventClass.id] = handler.getFunction() if 0: --- 332,337 ---- # is created than to reparse for each component #self.eventIdToHandler[eventClass.id] = handler ! #self.eventIdToHandler[eventClass.id] = handler.getFunction() ! self.eventIdToHandler[eventClass.id] = handler if 0: *************** *** 351,355 **** eventClass = self.wxEventIdMap[eventType] ! eventClassInstance = eventClass(self) # decorate will add the relevant event attributes aWxEvent = eventClassInstance.decorate(aWxEvent, self) --- 352,356 ---- eventClass = self.wxEventIdMap[eventType] ! eventClassInstance = eventClass() # decorate will add the relevant event attributes aWxEvent = eventClassInstance.decorate(aWxEvent, self) Index: event.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/event.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** event.py 4 May 2004 17:15:41 -0000 1.66 --- event.py 5 May 2004 03:51:53 -0000 1.67 *************** *** 5,11 **** import error - import log import singleton ! import sys, types import wx --- 5,10 ---- import error [...1233 lines suppressed...] - - return True - else : - return False - - # KEA 2004-04-26 - # some event types use _createEvent and others don't - # sometimes the line below is used - # evt = self.wxEventIdMap[eventType](self._component) - # which is part of the _dispatch method above - def _createEvent( self, aEventClass, aWxEvent ) : - if 0: - print "DefaultEventBinding._createEvent", aEventClass - evt = aEventClass( self._component ) - evt.setNativeEvent( aWxEvent ) - return evt - - - --- 519,520 ---- Index: error.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/error.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** error.py 6 Aug 2001 19:53:12 -0000 1.1.1.1 --- error.py 5 May 2004 03:51:53 -0000 1.2 *************** *** 17,29 **** PythonCardException.__init__( self, aValue ) ! class EventBindingException( PythonCardException ) : ! ! def __init__( self, aValue ) : ! PythonCardException.__init__( self, aValue ) ! ! class EventQueueException( PythonCardException ) : ! ! def __init__( self, aValue ) : ! PythonCardException.__init__( self, aValue ) --- 17,29 ---- PythonCardException.__init__( self, aValue ) ! ##class EventBindingException( PythonCardException ) : ! ## ! ## def __init__( self, aValue ) : ! ## PythonCardException.__init__( self, aValue ) ! ## ! ##class EventQueueException( PythonCardException ) : ! ## ! ## def __init__( self, aValue ) : ! ## PythonCardException.__init__( self, aValue ) *************** *** 34,41 **** ! class HandlerException( PythonCardException ) : ! ! def __init__( self, aValue ) : ! PythonCardException.__init__( self, aValue ) --- 34,41 ---- ! ##class HandlerException( PythonCardException ) : ! ## ! ## def __init__( self, aValue ) : ! ## PythonCardException.__init__( self, aValue ) Index: model.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/model.py,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** model.py 1 May 2004 18:11:24 -0000 1.163 --- model.py 5 May 2004 03:51:53 -0000 1.164 *************** *** 412,416 **** if aMethod.__name__ not in self._handlers: log.debug("_addHandler: " + aMethod.__name__) ! self._handlers[aMethod.__name__] = event.Handler(aMethod) def addMethod(self, aFunction): --- 412,417 ---- if aMethod.__name__ not in self._handlers: log.debug("_addHandler: " + aMethod.__name__) ! #self._handlers[aMethod.__name__] = event.Handler(aMethod) ! self._handlers[aMethod.__name__] = aMethod def addMethod(self, aFunction): *************** *** 512,516 **** - ##class Background( event.Changeable, Scriptable, wx.Frame, event.EventSource): class Background(Scriptable, wx.Frame, event.EventSource): """ --- 513,516 ---- *************** *** 522,526 **** Initialize this instance. """ - ## event.Changeable.__init__( self ) Scriptable.__init__(self, aStack) event.EventSource.__init__(self) --- 522,525 ---- *************** *** 534,538 **** self.menuBar = None self.statusBar = None - ## self.dispatch = event.EventDispatch(self, self) self._exiting = False --- 533,536 ---- *************** *** 601,605 **** # for some reason the Message Watcher isn't a listener yet # so calling EventLog doesn't do anything - #print event.EventQueue()._impl._listeners #event.EventLog.getInstance().log('initialize', self.name, True) --- 599,602 ---- *************** *** 630,640 **** self.panel.Layout() - ## def _dispatchOpenBackground( self, evt ) : - ## # KEA 2002-06-10 - ## # don't need this dispatch since dispatch is already - ## # bound in the background - ## ##self.event.eventOccurred( event.InitializationEvent( self.scriptable ) ) - ## self.dispatch.eventOccurred( event.InitializationEvent( self ) ) - # KEA 2004-04-28 --- 627,630 ---- *************** *** 777,781 **** # this is what is in event.py # aHandler.getFunction()( aOwner, self.getSource(), self ) ! handler.getFunction()(self, aWxEvent) # do we have to clean up this alias? aWxEvent.skip = None --- 767,772 ---- # this is what is in event.py # aHandler.getFunction()( aOwner, self.getSource(), self ) ! #handler.getFunction()(self, aWxEvent) ! handler(self, aWxEvent) # do we have to clean up this alias? aWxEvent.skip = None *************** *** 1014,1020 **** wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) - # def postEvent( self, aEvent ) : - # self.eventQueue.postEvent( aEvent ) - # KEA 2002-07-09 # make sure wxSTC text, bitmaps, etc. aren't lost --- 1005,1008 ---- *************** *** 1135,1139 **** ! class CustomDialog( event.Changeable, Scriptable, wx.Dialog, event.EventSource): """The dialog class used by all custom dialogs.""" --- 1123,1127 ---- ! class CustomDialog( Scriptable, wx.Dialog, event.EventSource): """The dialog class used by all custom dialogs.""" Index: component.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/component.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** component.py 2 May 2004 22:09:29 -0000 1.11 --- component.py 5 May 2004 03:51:53 -0000 1.12 *************** *** 310,314 **** # are defined in a Scriptable object. ! event.EventDispatch(component, aScriptable) # Return the newly created Component --- 310,314 ---- # are defined in a Scriptable object. ! ## event.EventDispatch(component, aScriptable) # Return the newly created Component Index: menu.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/menu.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** menu.py 4 May 2004 20:49:11 -0000 1.32 --- menu.py 5 May 2004 03:51:53 -0000 1.33 *************** *** 79,89 **** wx.CallAfter(self.Enable, aResource.enabled) - ## # events are bound to the parent wxFrame - ## # aka aParent.parent.parent - ## wx.EVT_MENU(aScriptable, id, aParent.parent.doMenu) component.Component.__init__( self ) - ## event.EventDispatch(self, aScriptable) self._bindEvents((MenuSelectEvent,), aScriptable, id) --- 79,85 ---- *************** *** 138,142 **** if 0: print " binding", self.name, eventClass.name, handler._name, eventClass.id ! self.eventIdToHandler[eventClass.id] = handler.getFunction() if 0: --- 134,139 ---- if 0: print " binding", self.name, eventClass.name, handler._name, eventClass.id ! #self.eventIdToHandler[eventClass.id] = handler.getFunction() ! self.eventIdToHandler[eventClass.id] = handler if 0: *************** *** 161,165 **** eventClass = self.wxEventIdMap[eventType] ! eventClassInstance = eventClass(self) # decorate will add the relevant event attributes aWxEvent = eventClassInstance.decorate(aWxEvent, self) --- 158,162 ---- eventClass = self.wxEventIdMap[eventType] ! eventClassInstance = eventClass() # decorate will add the relevant event attributes aWxEvent = eventClassInstance.decorate(aWxEvent, self) *************** *** 259,266 **** - ## def parseMenuItems( self, aParent, aResource ) : - ## for item in aResource : - ## self.appendMenuItem( MenuItem( aParent, item ) ) - def _getName( self ) : return self.name --- 256,259 ---- *************** *** 334,371 **** self.EnableTop(i, 0) - def doMenu( self, aWxMenuEvent ) : - id = aWxMenuEvent.GetId() - #if id in self.id2cmdMap: - # command = self.id2cmdMap[ id ] - # if command is None : - # evt = MenuEvent( self.id2nameMap[ id ], self ) - # else : - - item = self.id2itemMap[ id ] - if item.getCommand() is not None : - evt = event.CommandEvent( item.getCommand(), item ) - else : - evt = event.SelectEvent( item ) - # KEA 2002-03-07 - # change to (self, event) event handler dispatch - # add target manually since this is a custom event - # and doesn't go through normal dispatch - aWxMenuEvent.target = self.id2itemMap[id] - aWxMenuEvent.eventObject = aWxMenuEvent.target - try: - aWxMenuEvent.checked = aWxMenuEvent.IsChecked() - except: - pass - #aWxMenuEvent.target = aWxMenuEvent.GetEventObject() - - # KEA 2001-12-03 - # added missing setNativeEvent - evt.setNativeEvent(aWxMenuEvent) - item.notifyEventListeners(evt) - - ## def parseMenus(self, aParent, aResource): - ## for menu in aResource: - ## self.menus.append(Menu(aParent, menu)) - def __repr__(self): return 'MenuBar=' + str(self.__dict__) --- 327,330 ---- |