src/eric7/RemoteServerInterface/EricServerDebuggerInterface.py

branch
server
changeset 10561
be23a662d709
parent 10555
08e853c0c77b
child 10563
b4b47c1a02ba
equal deleted inserted replaced
10560:28b14d2df6a1 10561:be23a662d709
20 """ 20 """
21 Class implementing the file system interface to the eric-ide server. 21 Class implementing the file system interface to the eric-ide server.
22 """ 22 """
23 23
24 debugClientResponse = pyqtSignal(str) 24 debugClientResponse = pyqtSignal(str)
25 debugClientDisconnected = pyqtSignal(str)
26 lastClientExited = pyqtSignal()
25 27
26 def __init__(self, serverInterface): 28 def __init__(self, serverInterface):
27 """ 29 """
28 Constructor 30 Constructor
29 31
31 @type EricServerInterface 33 @type EricServerInterface
32 """ 34 """
33 super().__init__(parent=serverInterface) 35 super().__init__(parent=serverInterface)
34 36
35 self.__serverInterface = serverInterface 37 self.__serverInterface = serverInterface
38 self.__clientStarted = False
36 39
37 self.__replyMethodMapping = { 40 self.__replyMethodMapping = {
38 "DebuggerRequestError": self.__handleDbgRequestError, 41 "DebuggerRequestError": self.__handleDbgRequestError,
39 "DebugClientResponse": self.__handleDbgClientResponse, 42 "DebugClientResponse": self.__handleDbgClientResponse,
40 "DebugClientDisconnected": self.__handleDbgClientDisconnected, 43 "DebugClientDisconnected": self.__handleDbgClientDisconnected,
41 "LastDebugClientExited": self.__handleLastDbgClientExited, 44 "LastDebugClientExited": self.__handleLastDbgClientExited,
45 "MainClientExited": self.__handleMainClientExited,
42 } 46 }
43 47
44 # connect some signals 48 # connect some signals
45 self.__serverInterface.remoteDebuggerReply.connect(self.__handleDebuggerReply) 49 self.__serverInterface.remoteDebuggerReply.connect(self.__handleDebuggerReply)
46 50
117 eric-ide server. 121 eric-ide server.
118 122
119 @param params dictionary containing the reply data 123 @param params dictionary containing the reply data
120 @type dict 124 @type dict
121 """ 125 """
122 ericApp().getObject("DebugServer").signalClientDisconnected( 126 self.debugClientDisconnected.emit(params["debugger_id"])
123 params["debugger_id"] 127
124 ) 128 def __handleLastDbgClientExited(self, params): # noqa: U100
125
126 def __handleLastDbgClientExited(self, params):
127 """ 129 """
128 Private method to handle a report of the eric-ide server, that the last 130 Private method to handle a report of the eric-ide server, that the last
129 debug client has disconnected. 131 debug client has disconnected.
130 132
131 @param params dictionary containing the reply data 133 @param params dictionary containing the reply data
132 @type dict 134 @type dict
133 """ 135 """
134 ericApp().getObject("DebugServer").signalLastClientExited() 136 self.__clientStarted = False
137 self.lastClientExited.emit()
138
139 def __handleMainClientExited(self, params): # noqa: U100
140 """
141 Private method to handle the main client exiting.
142
143 @param params dictionary containing the reply data
144 @type dict
145 """
146 self.__clientStarted = False
147 ericApp().getObject("DebugServer").signalMainClientExit()
135 148
136 ####################################################################### 149 #######################################################################
137 ## Methods for sending debug server commands to the eric-ide server. 150 ## Methods for sending debug server commands to the eric-ide server.
138 ####################################################################### 151 #######################################################################
139 152
158 "path": originalPathString, 171 "path": originalPathString,
159 "arguments": args, 172 "arguments": args,
160 "working_dir": FileSystemUtilities.plainFileName(workingDir), 173 "working_dir": FileSystemUtilities.plainFileName(workingDir),
161 }, 174 },
162 ) 175 )
176 self.__clientStarted = True
163 177
164 def stopClient(self): 178 def stopClient(self):
165 """ 179 """
166 Public method to stop the debug client synchronously. 180 Public method to stop the debug client synchronously.
167 """ 181 """
168 if self.__serverInterface.isServerConnected(): 182 if self.__serverInterface.isServerConnected() and self.__clientStarted:
169 loop = QEventLoop() 183 loop = QEventLoop()
170 184
171 def callback(reply, params): 185 def callback(reply, params): # noqa: U100
172 """ 186 """
173 Function to handle the server reply 187 Function to handle the server reply
174 188
175 @param reply name of the server reply 189 @param reply name of the server reply
176 @type str 190 @type str
186 params={}, 200 params={},
187 callback=callback, 201 callback=callback,
188 ) 202 )
189 203
190 loop.exec() 204 loop.exec()
205 self.__clientStarted = False

eric ide

mercurial