147 Public method to start a remote Python interpreter. |
147 Public method to start a remote Python interpreter. |
148 |
148 |
149 @param port portnumber the debug server is listening on (integer) |
149 @param port portnumber the debug server is listening on (integer) |
150 @param runInConsole flag indicating to start the debugger in a |
150 @param runInConsole flag indicating to start the debugger in a |
151 console window (boolean) |
151 console window (boolean) |
152 @return client process object (QProcess) and a flag to indicate |
152 @return client process object (QProcess), a flag to indicate |
153 a network connection (boolean) |
153 a network connection (boolean) and the name of the interpreter |
|
154 in case of a local execution (string) |
154 """ |
155 """ |
155 interpreter = Preferences.getDebugger("Python3Interpreter") |
156 interpreter = Preferences.getDebugger("Python3Interpreter") |
156 if interpreter == "": |
157 if interpreter == "": |
157 E5MessageBox.critical( |
158 E5MessageBox.critical( |
158 None, |
159 None, |
159 self.trUtf8("Start Debugger"), |
160 self.tr("Start Debugger"), |
160 self.trUtf8( |
161 self.tr( |
161 """<p>No Python3 interpreter configured.</p>""")) |
162 """<p>No Python3 interpreter configured.</p>""")) |
162 return None, False |
163 return None, False, "" |
163 |
164 |
164 debugClientType = Preferences.getDebugger("DebugClientType3") |
165 debugClientType = Preferences.getDebugger("DebugClientType3") |
165 if debugClientType == "standard": |
166 if debugClientType == "standard": |
166 debugClient = os.path.join(getConfig('ericDir'), |
167 debugClient = os.path.join(getConfig('ericDir'), |
167 "DebugClients", "Python3", |
168 "DebugClients", "Python3", |
194 args[0] = Utilities.getExecutablePath(args[0]) |
195 args[0] = Utilities.getExecutablePath(args[0]) |
195 process = self.__startProcess(args[0], args[1:]) |
196 process = self.__startProcess(args[0], args[1:]) |
196 if process is None: |
197 if process is None: |
197 E5MessageBox.critical( |
198 E5MessageBox.critical( |
198 None, |
199 None, |
199 self.trUtf8("Start Debugger"), |
200 self.tr("Start Debugger"), |
200 self.trUtf8( |
201 self.tr( |
201 """<p>The debugger backend could not be""" |
202 """<p>The debugger backend could not be""" |
202 """ started.</p>""")) |
203 """ started.</p>""")) |
203 |
204 |
204 # set translation function |
205 # set translation function |
205 if Preferences.getDebugger("PathTranslation"): |
206 if Preferences.getDebugger("PathTranslation"): |
208 self.translateLocal = \ |
209 self.translateLocal = \ |
209 Preferences.getDebugger("PathTranslationLocal") |
210 Preferences.getDebugger("PathTranslationLocal") |
210 self.translate = self.__remoteTranslation |
211 self.translate = self.__remoteTranslation |
211 else: |
212 else: |
212 self.translate = self.__identityTranslation |
213 self.translate = self.__identityTranslation |
213 return process, self.__isNetworked |
214 return process, self.__isNetworked, "" |
214 |
215 |
215 # set translation function |
216 # set translation function |
216 self.translate = self.__identityTranslation |
217 self.translate = self.__identityTranslation |
217 |
218 |
218 # setup the environment for the debugger |
219 # setup the environment for the debugger |
241 args[0] = Utilities.getExecutablePath(args[0]) |
242 args[0] = Utilities.getExecutablePath(args[0]) |
242 process = self.__startProcess(args[0], args[1:], clientEnv) |
243 process = self.__startProcess(args[0], args[1:], clientEnv) |
243 if process is None: |
244 if process is None: |
244 E5MessageBox.critical( |
245 E5MessageBox.critical( |
245 None, |
246 None, |
246 self.trUtf8("Start Debugger"), |
247 self.tr("Start Debugger"), |
247 self.trUtf8( |
248 self.tr( |
248 """<p>The debugger backend could not be""" |
249 """<p>The debugger backend could not be""" |
249 """ started.</p>""")) |
250 """ started.</p>""")) |
250 return process, self.__isNetworked |
251 return process, self.__isNetworked, interpreter |
251 |
252 |
252 process = self.__startProcess( |
253 process = self.__startProcess( |
253 interpreter, |
254 interpreter, |
254 [debugClient, noencoding, str(port), redirect, ipaddr], |
255 [debugClient, noencoding, str(port), redirect, ipaddr], |
255 clientEnv) |
256 clientEnv) |
256 if process is None: |
257 if process is None: |
257 E5MessageBox.critical( |
258 E5MessageBox.critical( |
258 None, |
259 None, |
259 self.trUtf8("Start Debugger"), |
260 self.tr("Start Debugger"), |
260 self.trUtf8( |
261 self.tr( |
261 """<p>The debugger backend could not be started.</p>""")) |
262 """<p>The debugger backend could not be started.</p>""")) |
262 return process, self.__isNetworked |
263 return process, self.__isNetworked, interpreter |
263 |
264 |
264 def startRemoteForProject(self, port, runInConsole): |
265 def startRemoteForProject(self, port, runInConsole): |
265 """ |
266 """ |
266 Public method to start a remote Python interpreter for a project. |
267 Public method to start a remote Python interpreter for a project. |
267 |
268 |
268 @param port portnumber the debug server is listening on (integer) |
269 @param port portnumber the debug server is listening on (integer) |
269 @param runInConsole flag indicating to start the debugger in a |
270 @param runInConsole flag indicating to start the debugger in a |
270 console window (boolean) |
271 console window (boolean) |
271 @return client process object (QProcess) and a flag to indicate |
272 @return client process object (QProcess), a flag to indicate |
272 a network connection (boolean) |
273 a network connection (boolean) and the name of the interpreter |
|
274 in case of a local execution (string) |
273 """ |
275 """ |
274 project = e5App().getObject("Project") |
276 project = e5App().getObject("Project") |
275 if not project.isDebugPropertiesLoaded(): |
277 if not project.isDebugPropertiesLoaded(): |
276 return None, self.__isNetworked |
278 return None, self.__isNetworked, "" |
277 |
279 |
278 # start debugger with project specific settings |
280 # start debugger with project specific settings |
279 interpreter = project.getDebugProperty("INTERPRETER") |
281 interpreter = project.getDebugProperty("INTERPRETER") |
280 debugClient = project.getDebugProperty("DEBUGCLIENT") |
282 debugClient = project.getDebugProperty("DEBUGCLIENT") |
281 |
283 |
296 args[0] = Utilities.getExecutablePath(args[0]) |
298 args[0] = Utilities.getExecutablePath(args[0]) |
297 process = self.__startProcess(args[0], args[1:]) |
299 process = self.__startProcess(args[0], args[1:]) |
298 if process is None: |
300 if process is None: |
299 E5MessageBox.critical( |
301 E5MessageBox.critical( |
300 None, |
302 None, |
301 self.trUtf8("Start Debugger"), |
303 self.tr("Start Debugger"), |
302 self.trUtf8( |
304 self.tr( |
303 """<p>The debugger backend could not be""" |
305 """<p>The debugger backend could not be""" |
304 """ started.</p>""")) |
306 """ started.</p>""")) |
305 # set translation function |
307 # set translation function |
306 if project.getDebugProperty("PATHTRANSLATION"): |
308 if project.getDebugProperty("PATHTRANSLATION"): |
307 self.translateRemote = \ |
309 self.translateRemote = \ |
309 self.translateLocal = \ |
311 self.translateLocal = \ |
310 project.getDebugProperty("LOCALPATH") |
312 project.getDebugProperty("LOCALPATH") |
311 self.translate = self.__remoteTranslation |
313 self.translate = self.__remoteTranslation |
312 else: |
314 else: |
313 self.translate = self.__identityTranslation |
315 self.translate = self.__identityTranslation |
314 return process, self.__isNetworked |
316 return process, self.__isNetworked, "" |
315 |
317 |
316 # set translation function |
318 # set translation function |
317 self.translate = self.__identityTranslation |
319 self.translate = self.__identityTranslation |
318 |
320 |
319 # setup the environment for the debugger |
321 # setup the environment for the debugger |
343 args[0] = Utilities.getExecutablePath(args[0]) |
345 args[0] = Utilities.getExecutablePath(args[0]) |
344 process = self.__startProcess(args[0], args[1:], clientEnv) |
346 process = self.__startProcess(args[0], args[1:], clientEnv) |
345 if process is None: |
347 if process is None: |
346 E5MessageBox.critical( |
348 E5MessageBox.critical( |
347 None, |
349 None, |
348 self.trUtf8("Start Debugger"), |
350 self.tr("Start Debugger"), |
349 self.trUtf8( |
351 self.tr( |
350 """<p>The debugger backend could not be""" |
352 """<p>The debugger backend could not be""" |
351 """ started.</p>""")) |
353 """ started.</p>""")) |
352 return process, self.__isNetworked |
354 return process, self.__isNetworked, interpreter |
353 |
355 |
354 process = self.__startProcess( |
356 process = self.__startProcess( |
355 interpreter, |
357 interpreter, |
356 [debugClient, noencoding, str(port), redirect, ipaddr], |
358 [debugClient, noencoding, str(port), redirect, ipaddr], |
357 clientEnv) |
359 clientEnv) |
358 if process is None: |
360 if process is None: |
359 E5MessageBox.critical( |
361 E5MessageBox.critical( |
360 None, |
362 None, |
361 self.trUtf8("Start Debugger"), |
363 self.tr("Start Debugger"), |
362 self.trUtf8( |
364 self.tr( |
363 """<p>The debugger backend could not be started.</p>""")) |
365 """<p>The debugger backend could not be started.</p>""")) |
364 return process, self.__isNetworked |
366 return process, self.__isNetworked, interpreter |
365 |
367 |
366 def getClientCapabilities(self): |
368 def getClientCapabilities(self): |
367 """ |
369 """ |
368 Public method to retrieve the debug clients capabilities. |
370 Public method to retrieve the debug clients capabilities. |
369 |
371 |
795 |
797 |
796 def __askForkTo(self): |
798 def __askForkTo(self): |
797 """ |
799 """ |
798 Private method to ask the user which branch of a fork to follow. |
800 Private method to ask the user which branch of a fork to follow. |
799 """ |
801 """ |
800 selections = [self.trUtf8("Parent Process"), |
802 selections = [self.tr("Parent Process"), |
801 self.trUtf8("Child process")] |
803 self.tr("Child process")] |
802 res, ok = QInputDialog.getItem( |
804 res, ok = QInputDialog.getItem( |
803 None, |
805 None, |
804 self.trUtf8("Client forking"), |
806 self.tr("Client forking"), |
805 self.trUtf8("Select the fork branch to follow."), |
807 self.tr("Select the fork branch to follow."), |
806 selections, |
808 selections, |
807 0, False) |
809 0, False) |
808 if not ok or res == selections[0]: |
810 if not ok or res == selections[0]: |
809 self.__sendCommand(DebugProtocol.ResponseForkTo + 'parent\n') |
811 self.__sendCommand(DebugProtocol.ResponseForkTo + 'parent\n') |
810 else: |
812 else: |