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 |