Changeset 279

Show
Ignore:
Timestamp:
08/11/06 12:25:19 (2 years ago)
Author:
mj
Message:

Simplify IDE connection events somewhat; no real point in putting them on a new thread if we send them from the service instead. Clarify when the events are sent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • z3wingdbg/trunk/debugger/networkdebugger.py

    r276 r279  
    11import logging 
    22 
    3 from zope import component, event, interface 
     3from zope import component, interface 
    44 
    55from z3wingdbg.interfaces import INetworkDebugger, INetworkDebuggerFactory 
    6 from z3wingdbg.interfaces import IWingPathInformation, IDEConnectedEvent 
    7 from z3wingdbg.interfaces import IDEDisconnectedEvent 
     6from z3wingdbg.interfaces import IWingPathInformation 
    87from netservermodule import INetServerModule 
    98from randomstring import IRandomString 
     
    7069    def connectClient(self): 
    7170        self._networkserver.ConnectToClient() 
    72         # Send events through a reactor.threadpool event so they are not 
    73         # processed on the debug thread 
    74         from twisted.internet import reactor 
    75         reactor.callInThread(event.notify, (IDEConnectedEvent(),)) 
    7671     
    7772    def disconnectClient(self): 
     
    8075        # results in the same method being called. 
    8176        self._networkserver._CNetworkServer__CloseChannel() 
    82         # Send events through a reactor.threadpool event so they are not 
    83         # processed on the debug thread 
    84         from twisted.internet import reactor 
    85         reactor.callInThread(event.notify, (IDEDisconnectedEvent(),)) 
    8677     
    8778    @property 
  • z3wingdbg/trunk/interfaces.py

    r277 r279  
    180180# Events 
    181181class IDebugStateChangedEvent(interface.Interface): 
    182     """Indicates that the debugger states changed. 
    183      
    184     Note that these events may be fired from a thread that does not have 
    185     a request context! Do not rely on a correct security context or context- 
    186     sensitive api methods like getSite to work! 
    187      
    188     """ 
     182    """Indicates that the debugger states changed.""" 
    189183    service = interface.Attribute('The debug service') 
    190184     
     
    196190     
    197191class IIDEConnectedEvent(IDebugStateChangedEvent): 
    198     """The debugger connected to the IDE""" 
     192    """The debugger connected to the IDE 
     193     
     194    Note that this event is only fired when the connection is started by the 
     195    Zope3 service, not when the IDE starts the connection. 
     196     
     197    """ 
    199198     
    200199class IIDEDisconnectedEvent(IDebugStateChangedEvent): 
    201     """The debugger disconnected from the IDE""" 
     200    """The debugger disconnected from the IDE 
     201     
     202    Note that this event is only fired when the connection is closed by the 
     203    Zope3 service, not when the IDE closes the connection. 
     204     
     205    """ 
    202206     
    203207class DebugStateChangedEvent(object): 
  • z3wingdbg/trunk/wingdebugservice.py

    r278 r279  
    11import time 
    22 
    3 from zope import component, interface 
     3from zope import component, event, interface 
    44from zope.i18nmessageid import MessageFactory 
    55 
     
    99from interfaces import IDebugServerConfiguration, INetworkDebuggerFactory 
    1010from interfaces import IDebugServerFactory, DebugServerStartError 
    11 from interfaces import IDEConnectionError 
     11from interfaces import IDEConnectionError, IDEConnectedEvent 
     12from interfaces import IDEDisconnectedEvent 
    1213 
    1314_ = MessageFactory('z3wingdbg') 
     
    8788                            u'Connection to IDE timed out') 
    8889            raise IDEConnectionError(message) 
     90        else: 
     91            event.notify(IDEConnectedEvent()) 
    8992     
    9093    def disconnectIDE(self): 
     
    98101        except: 
    99102            pass 
     103        else: 
     104            event.notify(IDEDisconnectedEvent()) 
    100105     
    101106    @property