Debugger/DebuggerInterfacePython.py

changeset 3357
2390df6f42ba
parent 3345
071afe8be2a1
child 3484
645c12de6b0c
equal deleted inserted replaced
3356:22633c0739e2 3357:2390df6f42ba
148 Public method to start a remote Python interpreter. 148 Public method to start a remote Python interpreter.
149 149
150 @param port portnumber the debug server is listening on (integer) 150 @param port portnumber the debug server is listening on (integer)
151 @param runInConsole flag indicating to start the debugger in a 151 @param runInConsole flag indicating to start the debugger in a
152 console window (boolean) 152 console window (boolean)
153 @return client process object (QProcess) and a flag to indicate 153 @return client process object (QProcess), a flag to indicate
154 a network connection (boolean) 154 a network connection (boolean) and the name of the interpreter
155 in case of a local execution (string)
155 """ 156 """
156 interpreter = Preferences.getDebugger("PythonInterpreter") 157 interpreter = Preferences.getDebugger("PythonInterpreter")
157 if interpreter == "": 158 if interpreter == "":
158 E5MessageBox.critical( 159 E5MessageBox.critical(
159 None, 160 None,
160 self.tr("Start Debugger"), 161 self.tr("Start Debugger"),
161 self.tr( 162 self.tr(
162 """<p>No Python2 interpreter configured.</p>""")) 163 """<p>No Python2 interpreter configured.</p>"""))
163 return None, False 164 return None, False, ""
164 165
165 debugClientType = Preferences.getDebugger("DebugClientType") 166 debugClientType = Preferences.getDebugger("DebugClientType")
166 if debugClientType == "standard": 167 if debugClientType == "standard":
167 debugClient = os.path.join(getConfig('ericDir'), 168 debugClient = os.path.join(getConfig('ericDir'),
168 "DebugClients", "Python", 169 "DebugClients", "Python",
209 self.translateLocal = \ 210 self.translateLocal = \
210 Preferences.getDebugger("PathTranslationLocal") 211 Preferences.getDebugger("PathTranslationLocal")
211 self.translate = self.__remoteTranslation 212 self.translate = self.__remoteTranslation
212 else: 213 else:
213 self.translate = self.__identityTranslation 214 self.translate = self.__identityTranslation
214 return process, self.__isNetworked 215 return process, self.__isNetworked, ""
215 216
216 # set translation function 217 # set translation function
217 self.translate = self.__identityTranslation 218 self.translate = self.__identityTranslation
218 219
219 # setup the environment for the debugger 220 # setup the environment for the debugger
246 None, 247 None,
247 self.tr("Start Debugger"), 248 self.tr("Start Debugger"),
248 self.tr( 249 self.tr(
249 """<p>The debugger backend could not be""" 250 """<p>The debugger backend could not be"""
250 """ started.</p>""")) 251 """ started.</p>"""))
251 return process, self.__isNetworked 252 return process, self.__isNetworked, interpreter
252 253
253 process = self.__startProcess( 254 process = self.__startProcess(
254 interpreter, 255 interpreter,
255 [debugClient, noencoding, str(port), redirect, ipaddr], 256 [debugClient, noencoding, str(port), redirect, ipaddr],
256 clientEnv) 257 clientEnv)
258 E5MessageBox.critical( 259 E5MessageBox.critical(
259 None, 260 None,
260 self.tr("Start Debugger"), 261 self.tr("Start Debugger"),
261 self.tr( 262 self.tr(
262 """<p>The debugger backend could not be started.</p>""")) 263 """<p>The debugger backend could not be started.</p>"""))
263 return process, self.__isNetworked 264 return process, self.__isNetworked, interpreter
264 265
265 def startRemoteForProject(self, port, runInConsole): 266 def startRemoteForProject(self, port, runInConsole):
266 """ 267 """
267 Public method to start a remote Python interpreter for a project. 268 Public method to start a remote Python interpreter for a project.
268 269
269 @param port portnumber the debug server is listening on (integer) 270 @param port portnumber the debug server is listening on (integer)
270 @param runInConsole flag indicating to start the debugger in a 271 @param runInConsole flag indicating to start the debugger in a
271 console window (boolean) 272 console window (boolean)
272 @return client process object (QProcess) and a flag to indicate 273 @return client process object (QProcess), a flag to indicate
273 a network connection (boolean) 274 a network connection (boolean) and the name of the interpreter
275 in case of a local execution (string)
274 """ 276 """
275 project = e5App().getObject("Project") 277 project = e5App().getObject("Project")
276 if not project.isDebugPropertiesLoaded(): 278 if not project.isDebugPropertiesLoaded():
277 return None, self.__isNetworked 279 return None, self.__isNetworked, ""
278 280
279 # start debugger with project specific settings 281 # start debugger with project specific settings
280 interpreter = project.getDebugProperty("INTERPRETER") 282 interpreter = project.getDebugProperty("INTERPRETER")
281 debugClient = project.getDebugProperty("DEBUGCLIENT") 283 debugClient = project.getDebugProperty("DEBUGCLIENT")
282 284
310 self.translateLocal = \ 312 self.translateLocal = \
311 project.getDebugProperty("LOCALPATH") 313 project.getDebugProperty("LOCALPATH")
312 self.translate = self.__remoteTranslation 314 self.translate = self.__remoteTranslation
313 else: 315 else:
314 self.translate = self.__identityTranslation 316 self.translate = self.__identityTranslation
315 return process, self.__isNetworked 317 return process, self.__isNetworked, ""
316 318
317 # set translation function 319 # set translation function
318 self.translate = self.__identityTranslation 320 self.translate = self.__identityTranslation
319 321
320 # setup the environment for the debugger 322 # setup the environment for the debugger
348 None, 350 None,
349 self.tr("Start Debugger"), 351 self.tr("Start Debugger"),
350 self.tr( 352 self.tr(
351 """<p>The debugger backend could not be""" 353 """<p>The debugger backend could not be"""
352 """ started.</p>""")) 354 """ started.</p>"""))
353 return process, self.__isNetworked 355 return process, self.__isNetworked, interpreter
354 356
355 process = self.__startProcess( 357 process = self.__startProcess(
356 interpreter, 358 interpreter,
357 [debugClient, noencoding, str(port), redirect, ipaddr], 359 [debugClient, noencoding, str(port), redirect, ipaddr],
358 clientEnv) 360 clientEnv)
360 E5MessageBox.critical( 362 E5MessageBox.critical(
361 None, 363 None,
362 self.tr("Start Debugger"), 364 self.tr("Start Debugger"),
363 self.tr( 365 self.tr(
364 """<p>The debugger backend could not be started.</p>""")) 366 """<p>The debugger backend could not be started.</p>"""))
365 return process, self.__isNetworked 367 return process, self.__isNetworked, interpreter
366 368
367 def getClientCapabilities(self): 369 def getClientCapabilities(self):
368 """ 370 """
369 Public method to retrieve the debug clients capabilities. 371 Public method to retrieve the debug clients capabilities.
370 372

eric ide

mercurial