Debugger/DebugUI.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3021
801289962f4e
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
107 self.execHistory = [] 107 self.execHistory = []
108 self.lastDebuggedFile = None 108 self.lastDebuggedFile = None
109 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project 109 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project
110 self.clientType = "" 110 self.clientType = ""
111 self.lastAction = -1 111 self.lastAction = -1
112 self.debugActions = [self.__continue, self.__step,\ 112 self.debugActions = [
113 self.__stepOver, self.__stepOut,\ 113 self.__continue, self.__step, self.__stepOver, self.__stepOut,
114 self.__stepQuit, self.__runToCursor] 114 self.__stepQuit, self.__runToCursor
115 ]
115 self.localsVarFilter, self.globalsVarFilter = \ 116 self.localsVarFilter, self.globalsVarFilter = \
116 Preferences.getVarFilters() 117 Preferences.getVarFilters()
117 self.debugViewer.setVariablesFilter( 118 self.debugViewer.setVariablesFilter(
118 self.globalsVarFilter, self.localsVarFilter) 119 self.globalsVarFilter, self.localsVarFilter)
119 120
167 """ 168 """
168 Method defining the user interface actions. 169 Method defining the user interface actions.
169 """ 170 """
170 self.actions = [] 171 self.actions = []
171 172
172 self.runAct = E5Action(self.trUtf8('Run Script'), 173 self.runAct = E5Action(
173 UI.PixmapCache.getIcon("runScript.png"), 174 self.trUtf8('Run Script'),
174 self.trUtf8('&Run Script...'), 175 UI.PixmapCache.getIcon("runScript.png"),
175 Qt.Key_F2, 0, self, 'dbg_run_script') 176 self.trUtf8('&Run Script...'),
177 Qt.Key_F2, 0, self, 'dbg_run_script')
176 self.runAct.setStatusTip(self.trUtf8('Run the current Script')) 178 self.runAct.setStatusTip(self.trUtf8('Run the current Script'))
177 self.runAct.setWhatsThis(self.trUtf8( 179 self.runAct.setWhatsThis(self.trUtf8(
178 """<b>Run Script</b>""" 180 """<b>Run Script</b>"""
179 """<p>Set the command line arguments and run the script outside""" 181 """<p>Set the command line arguments and run the script outside"""
180 """ the debugger. If the file has unsaved changes it may be""" 182 """ the debugger. If the file has unsaved changes it may be"""
181 """ saved first.</p>""" 183 """ saved first.</p>"""
182 )) 184 ))
183 self.runAct.triggered[()].connect(self.__runScript) 185 self.runAct.triggered[()].connect(self.__runScript)
184 self.actions.append(self.runAct) 186 self.actions.append(self.runAct)
185 187
186 self.runProjectAct = E5Action(self.trUtf8('Run Project'), 188 self.runProjectAct = E5Action(
187 UI.PixmapCache.getIcon("runProject.png"), 189 self.trUtf8('Run Project'),
188 self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, 190 UI.PixmapCache.getIcon("runProject.png"),
189 'dbg_run_project') 191 self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self,
192 'dbg_run_project')
190 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project')) 193 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project'))
191 self.runProjectAct.setWhatsThis(self.trUtf8( 194 self.runProjectAct.setWhatsThis(self.trUtf8(
192 """<b>Run Project</b>""" 195 """<b>Run Project</b>"""
193 """<p>Set the command line arguments and run the current project""" 196 """<p>Set the command line arguments and run the current project"""
194 """ outside the debugger.""" 197 """ outside the debugger."""
196 """ may be saved first.</p>""" 199 """ may be saved first.</p>"""
197 )) 200 ))
198 self.runProjectAct.triggered[()].connect(self.__runProject) 201 self.runProjectAct.triggered[()].connect(self.__runProject)
199 self.actions.append(self.runProjectAct) 202 self.actions.append(self.runProjectAct)
200 203
201 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'), 204 self.coverageAct = E5Action(
202 UI.PixmapCache.getIcon("coverageScript.png"), 205 self.trUtf8('Coverage run of Script'),
203 self.trUtf8('Coverage run of Script...'), 0, 0, self, 206 UI.PixmapCache.getIcon("coverageScript.png"),
204 'dbg_coverage_script') 207 self.trUtf8('Coverage run of Script...'), 0, 0, self,
208 'dbg_coverage_script')
205 self.coverageAct.setStatusTip( 209 self.coverageAct.setStatusTip(
206 self.trUtf8('Perform a coverage run of the current Script')) 210 self.trUtf8('Perform a coverage run of the current Script'))
207 self.coverageAct.setWhatsThis(self.trUtf8( 211 self.coverageAct.setWhatsThis(self.trUtf8(
208 """<b>Coverage run of Script</b>""" 212 """<b>Coverage run of Script</b>"""
209 """<p>Set the command line arguments and run the script under""" 213 """<p>Set the command line arguments and run the script under"""
228 """ they may be saved first.</p>""" 232 """ they may be saved first.</p>"""
229 )) 233 ))
230 self.coverageProjectAct.triggered[()].connect(self.__coverageProject) 234 self.coverageProjectAct.triggered[()].connect(self.__coverageProject)
231 self.actions.append(self.coverageProjectAct) 235 self.actions.append(self.coverageProjectAct)
232 236
233 self.profileAct = E5Action(self.trUtf8('Profile Script'), 237 self.profileAct = E5Action(
238 self.trUtf8('Profile Script'),
234 UI.PixmapCache.getIcon("profileScript.png"), 239 UI.PixmapCache.getIcon("profileScript.png"),
235 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script') 240 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script')
236 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script')) 241 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script'))
237 self.profileAct.setWhatsThis(self.trUtf8( 242 self.profileAct.setWhatsThis(self.trUtf8(
238 """<b>Profile Script</b>""" 243 """<b>Profile Script</b>"""
240 """ If the file has unsaved changes it may be saved first.</p>""" 245 """ If the file has unsaved changes it may be saved first.</p>"""
241 )) 246 ))
242 self.profileAct.triggered[()].connect(self.__profileScript) 247 self.profileAct.triggered[()].connect(self.__profileScript)
243 self.actions.append(self.profileAct) 248 self.actions.append(self.profileAct)
244 249
245 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'), 250 self.profileProjectAct = E5Action(
251 self.trUtf8('Profile Project'),
246 UI.PixmapCache.getIcon("profileProject.png"), 252 UI.PixmapCache.getIcon("profileProject.png"),
247 self.trUtf8('Profile Project...'), 0, 0, self, 253 self.trUtf8('Profile Project...'), 0, 0, self,
248 'dbg_profile_project') 254 'dbg_profile_project')
249 self.profileProjectAct.setStatusTip( 255 self.profileProjectAct.setStatusTip(
250 self.trUtf8('Profile the current Project')) 256 self.trUtf8('Profile the current Project'))
255 """ changes they may be saved first.</p>""" 261 """ changes they may be saved first.</p>"""
256 )) 262 ))
257 self.profileProjectAct.triggered[()].connect(self.__profileProject) 263 self.profileProjectAct.triggered[()].connect(self.__profileProject)
258 self.actions.append(self.profileProjectAct) 264 self.actions.append(self.profileProjectAct)
259 265
260 self.debugAct = E5Action(self.trUtf8('Debug Script'), 266 self.debugAct = E5Action(
267 self.trUtf8('Debug Script'),
261 UI.PixmapCache.getIcon("debugScript.png"), 268 UI.PixmapCache.getIcon("debugScript.png"),
262 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self, 269 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self,
263 'dbg_debug_script') 270 'dbg_debug_script')
264 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script')) 271 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script'))
265 self.debugAct.setWhatsThis(self.trUtf8( 272 self.debugAct.setWhatsThis(self.trUtf8(
270 """ saved first.</p>""" 277 """ saved first.</p>"""
271 )) 278 ))
272 self.debugAct.triggered[()].connect(self.__debugScript) 279 self.debugAct.triggered[()].connect(self.__debugScript)
273 self.actions.append(self.debugAct) 280 self.actions.append(self.debugAct)
274 281
275 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'), 282 self.debugProjectAct = E5Action(
283 self.trUtf8('Debug Project'),
276 UI.PixmapCache.getIcon("debugProject.png"), 284 UI.PixmapCache.getIcon("debugProject.png"),
277 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, 285 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self,
278 'dbg_debug_project') 286 'dbg_debug_project')
279 self.debugProjectAct.setStatusTip(self.trUtf8( 287 self.debugProjectAct.setStatusTip(self.trUtf8(
280 'Debug the current Project')) 288 'Debug the current Project'))
286 """ project have unsaved changes they may be saved first.</p>""" 294 """ project have unsaved changes they may be saved first.</p>"""
287 )) 295 ))
288 self.debugProjectAct.triggered[()].connect(self.__debugProject) 296 self.debugProjectAct.triggered[()].connect(self.__debugProject)
289 self.actions.append(self.debugProjectAct) 297 self.actions.append(self.debugProjectAct)
290 298
291 self.restartAct = E5Action(self.trUtf8('Restart'), 299 self.restartAct = E5Action(
300 self.trUtf8('Restart'),
292 UI.PixmapCache.getIcon("restart.png"), 301 UI.PixmapCache.getIcon("restart.png"),
293 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') 302 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script')
294 self.restartAct.setStatusTip(self.trUtf8( 303 self.restartAct.setStatusTip(self.trUtf8(
295 'Restart the last debugged script')) 304 'Restart the last debugged script'))
296 self.restartAct.setWhatsThis(self.trUtf8( 305 self.restartAct.setWhatsThis(self.trUtf8(
301 """ may be saved first.</p>""" 310 """ may be saved first.</p>"""
302 )) 311 ))
303 self.restartAct.triggered[()].connect(self.__doRestart) 312 self.restartAct.triggered[()].connect(self.__doRestart)
304 self.actions.append(self.restartAct) 313 self.actions.append(self.restartAct)
305 314
306 self.stopAct = E5Action(self.trUtf8('Stop'), 315 self.stopAct = E5Action(
316 self.trUtf8('Stop'),
307 UI.PixmapCache.getIcon("stopScript.png"), 317 UI.PixmapCache.getIcon("stopScript.png"),
308 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0, 318 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0,
309 self, 'dbg_stop_script') 319 self, 'dbg_stop_script')
310 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script.""")) 320 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script."""))
311 self.stopAct.setWhatsThis(self.trUtf8( 321 self.stopAct.setWhatsThis(self.trUtf8(
315 self.stopAct.triggered[()].connect(self.__stopScript) 325 self.stopAct.triggered[()].connect(self.__stopScript)
316 self.actions.append(self.stopAct) 326 self.actions.append(self.stopAct)
317 327
318 self.debugActGrp = createActionGroup(self) 328 self.debugActGrp = createActionGroup(self)
319 329
320 act = E5Action(self.trUtf8('Continue'), 330 act = E5Action(
331 self.trUtf8('Continue'),
321 UI.PixmapCache.getIcon("continue.png"), 332 UI.PixmapCache.getIcon("continue.png"),
322 self.trUtf8('&Continue'), Qt.Key_F6, 0, 333 self.trUtf8('&Continue'), Qt.Key_F6, 0,
323 self.debugActGrp, 'dbg_continue') 334 self.debugActGrp, 'dbg_continue')
324 act.setStatusTip( 335 act.setStatusTip(
325 self.trUtf8('Continue running the program from the current line')) 336 self.trUtf8('Continue running the program from the current line'))
330 """ is reached.</p>""" 341 """ is reached.</p>"""
331 )) 342 ))
332 act.triggered[()].connect(self.__continue) 343 act.triggered[()].connect(self.__continue)
333 self.actions.append(act) 344 self.actions.append(act)
334 345
335 act = E5Action(self.trUtf8('Continue to Cursor'), 346 act = E5Action(
347 self.trUtf8('Continue to Cursor'),
336 UI.PixmapCache.getIcon("continueToCursor.png"), 348 UI.PixmapCache.getIcon("continueToCursor.png"),
337 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, 349 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0,
338 self.debugActGrp, 'dbg_continue_to_cursor') 350 self.debugActGrp, 'dbg_continue_to_cursor')
339 act.setStatusTip(self.trUtf8( 351 act.setStatusTip(self.trUtf8(
340 """Continue running the program from the""" 352 """Continue running the program from the"""
345 """ current cursor position.</p>""" 357 """ current cursor position.</p>"""
346 )) 358 ))
347 act.triggered[()].connect(self.__runToCursor) 359 act.triggered[()].connect(self.__runToCursor)
348 self.actions.append(act) 360 self.actions.append(act)
349 361
350 act = E5Action(self.trUtf8('Single Step'), 362 act = E5Action(
363 self.trUtf8('Single Step'),
351 UI.PixmapCache.getIcon("step.png"), 364 UI.PixmapCache.getIcon("step.png"),
352 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0, 365 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0,
353 self.debugActGrp, 'dbg_single_step') 366 self.debugActGrp, 'dbg_single_step')
354 act.setStatusTip(self.trUtf8('Execute a single Python statement')) 367 act.setStatusTip(self.trUtf8('Execute a single Python statement'))
355 act.setWhatsThis(self.trUtf8( 368 act.setWhatsThis(self.trUtf8(
360 """ debugger at the next statement.</p>""" 373 """ debugger at the next statement.</p>"""
361 )) 374 ))
362 act.triggered[()].connect(self.__step) 375 act.triggered[()].connect(self.__step)
363 self.actions.append(act) 376 self.actions.append(act)
364 377
365 act = E5Action(self.trUtf8('Step Over'), 378 act = E5Action(
379 self.trUtf8('Step Over'),
366 UI.PixmapCache.getIcon("stepOver.png"), 380 UI.PixmapCache.getIcon("stepOver.png"),
367 self.trUtf8('Step &Over'), Qt.Key_F8, 0, 381 self.trUtf8('Step &Over'), Qt.Key_F8, 0,
368 self.debugActGrp, 'dbg_step_over') 382 self.debugActGrp, 'dbg_step_over')
369 act.setStatusTip(self.trUtf8( 383 act.setStatusTip(self.trUtf8(
370 """Execute a single Python statement staying""" 384 """Execute a single Python statement staying"""
378 """ has completed.</p>""" 392 """ has completed.</p>"""
379 )) 393 ))
380 act.triggered[()].connect(self.__stepOver) 394 act.triggered[()].connect(self.__stepOver)
381 self.actions.append(act) 395 self.actions.append(act)
382 396
383 act = E5Action(self.trUtf8('Step Out'), 397 act = E5Action(
398 self.trUtf8('Step Out'),
384 UI.PixmapCache.getIcon("stepOut.png"), 399 UI.PixmapCache.getIcon("stepOut.png"),
385 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0, 400 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0,
386 self.debugActGrp, 'dbg_step_out') 401 self.debugActGrp, 'dbg_step_out')
387 act.setStatusTip(self.trUtf8( 402 act.setStatusTip(self.trUtf8(
388 """Execute Python statements until leaving""" 403 """Execute Python statements until leaving"""
396 """ current frame has been left.</p>""" 411 """ current frame has been left.</p>"""
397 )) 412 ))
398 act.triggered[()].connect(self.__stepOut) 413 act.triggered[()].connect(self.__stepOut)
399 self.actions.append(act) 414 self.actions.append(act)
400 415
401 act = E5Action(self.trUtf8('Stop'), 416 act = E5Action(
417 self.trUtf8('Stop'),
402 UI.PixmapCache.getIcon("stepQuit.png"), 418 UI.PixmapCache.getIcon("stepQuit.png"),
403 self.trUtf8('&Stop'), Qt.Key_F10, 0, 419 self.trUtf8('&Stop'), Qt.Key_F10, 0,
404 self.debugActGrp, 'dbg_stop') 420 self.debugActGrp, 'dbg_stop')
405 act.setStatusTip(self.trUtf8('Stop debugging')) 421 act.setStatusTip(self.trUtf8('Stop debugging'))
406 act.setWhatsThis(self.trUtf8( 422 act.setWhatsThis(self.trUtf8(
410 act.triggered[()].connect(self.__stepQuit) 426 act.triggered[()].connect(self.__stepQuit)
411 self.actions.append(act) 427 self.actions.append(act)
412 428
413 self.debugActGrp2 = createActionGroup(self) 429 self.debugActGrp2 = createActionGroup(self)
414 430
415 act = E5Action(self.trUtf8('Evaluate'), 431 act = E5Action(
432 self.trUtf8('Evaluate'),
416 self.trUtf8('E&valuate...'), 433 self.trUtf8('E&valuate...'),
417 0, 0, self.debugActGrp2, 'dbg_evaluate') 434 0, 0, self.debugActGrp2, 'dbg_evaluate')
418 act.setStatusTip(self.trUtf8('Evaluate in current context')) 435 act.setStatusTip(self.trUtf8('Evaluate in current context'))
419 act.setWhatsThis(self.trUtf8( 436 act.setWhatsThis(self.trUtf8(
420 """<b>Evaluate</b>""" 437 """<b>Evaluate</b>"""
423 """ shell window.</p>""" 440 """ shell window.</p>"""
424 )) 441 ))
425 act.triggered[()].connect(self.__eval) 442 act.triggered[()].connect(self.__eval)
426 self.actions.append(act) 443 self.actions.append(act)
427 444
428 act = E5Action(self.trUtf8('Execute'), 445 act = E5Action(
429 self.trUtf8('E&xecute...'), 446 self.trUtf8('Execute'),
430 0, 0, self.debugActGrp2, 'dbg_execute') 447 self.trUtf8('E&xecute...'),
448 0, 0, self.debugActGrp2, 'dbg_execute')
431 act.setStatusTip( 449 act.setStatusTip(
432 self.trUtf8('Execute a one line statement in the current context')) 450 self.trUtf8('Execute a one line statement in the current context'))
433 act.setWhatsThis(self.trUtf8( 451 act.setWhatsThis(self.trUtf8(
434 """<b>Execute</b>""" 452 """<b>Execute</b>"""
435 """<p>Execute a one line statement in the current context""" 453 """<p>Execute a one line statement in the current context"""
436 """ of the debugged program.</p>""" 454 """ of the debugged program.</p>"""
437 )) 455 ))
438 act.triggered[()].connect(self.__exec) 456 act.triggered[()].connect(self.__exec)
439 self.actions.append(act) 457 self.actions.append(act)
440 458
441 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'), 459 self.dbgFilterAct = E5Action(
460 self.trUtf8('Variables Type Filter'),
442 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self, 461 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self,
443 'dbg_variables_filter') 462 'dbg_variables_filter')
444 self.dbgFilterAct.setStatusTip(self.trUtf8( 463 self.dbgFilterAct.setStatusTip(self.trUtf8(
445 'Configure variables type filter')) 464 'Configure variables type filter'))
446 self.dbgFilterAct.setWhatsThis(self.trUtf8( 465 self.dbgFilterAct.setWhatsThis(self.trUtf8(
451 )) 470 ))
452 self.dbgFilterAct.triggered[()].connect( 471 self.dbgFilterAct.triggered[()].connect(
453 self.__configureVariablesFilters) 472 self.__configureVariablesFilters)
454 self.actions.append(self.dbgFilterAct) 473 self.actions.append(self.dbgFilterAct)
455 474
456 self.excFilterAct = E5Action(self.trUtf8('Exceptions Filter'), 475 self.excFilterAct = E5Action(
476 self.trUtf8('Exceptions Filter'),
457 self.trUtf8('&Exceptions Filter...'), 0, 0, self, 477 self.trUtf8('&Exceptions Filter...'), 0, 0, self,
458 'dbg_exceptions_filter') 478 'dbg_exceptions_filter')
459 self.excFilterAct.setStatusTip(self.trUtf8( 479 self.excFilterAct.setStatusTip(self.trUtf8(
460 'Configure exceptions filter')) 480 'Configure exceptions filter'))
461 self.excFilterAct.setWhatsThis(self.trUtf8( 481 self.excFilterAct.setWhatsThis(self.trUtf8(
467 )) 487 ))
468 self.excFilterAct.triggered[()].connect( 488 self.excFilterAct.triggered[()].connect(
469 self.__configureExceptionsFilter) 489 self.__configureExceptionsFilter)
470 self.actions.append(self.excFilterAct) 490 self.actions.append(self.excFilterAct)
471 491
472 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'), 492 self.excIgnoreFilterAct = E5Action(
473 self.trUtf8('&Ignored Exceptions...'), 0, 0, 493 self.trUtf8('Ignored Exceptions'),
474 self, 'dbg_ignored_exceptions') 494 self.trUtf8('&Ignored Exceptions...'), 0, 0,
495 self, 'dbg_ignored_exceptions')
475 self.excIgnoreFilterAct.setStatusTip(self.trUtf8( 496 self.excIgnoreFilterAct.setStatusTip(self.trUtf8(
476 'Configure ignored exceptions')) 497 'Configure ignored exceptions'))
477 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8( 498 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8(
478 """<b>Ignored Exceptions</b>""" 499 """<b>Ignored Exceptions</b>"""
479 """<p>Configure the ignored exceptions. Only exception types""" 500 """<p>Configure the ignored exceptions. Only exception types"""
485 self.__configureIgnoredExceptions) 506 self.__configureIgnoredExceptions)
486 self.actions.append(self.excIgnoreFilterAct) 507 self.actions.append(self.excIgnoreFilterAct)
487 508
488 self.dbgSetBpActGrp = createActionGroup(self) 509 self.dbgSetBpActGrp = createActionGroup(self)
489 510
490 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'), 511 self.dbgToggleBpAct = E5Action(
512 self.trUtf8('Toggle Breakpoint'),
491 UI.PixmapCache.getIcon("breakpointToggle.png"), 513 UI.PixmapCache.getIcon("breakpointToggle.png"),
492 self.trUtf8('Toggle Breakpoint'), 514 self.trUtf8('Toggle Breakpoint'),
493 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")), 515 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")),
494 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') 516 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint')
495 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint')) 517 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint'))
499 """ current editor.</p>""" 521 """ current editor.</p>"""
500 )) 522 ))
501 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint) 523 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint)
502 self.actions.append(self.dbgToggleBpAct) 524 self.actions.append(self.dbgToggleBpAct)
503 525
504 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'), 526 self.dbgEditBpAct = E5Action(
527 self.trUtf8('Edit Breakpoint'),
505 UI.PixmapCache.getIcon("cBreakpointToggle.png"), 528 UI.PixmapCache.getIcon("cBreakpointToggle.png"),
506 self.trUtf8('Edit Breakpoint...'), 529 self.trUtf8('Edit Breakpoint...'),
507 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0, 530 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0,
508 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') 531 self.dbgSetBpActGrp, 'dbg_edit_breakpoint')
509 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint')) 532 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint'))
513 """ It works at the current line of the current editor.</p>""" 536 """ It works at the current line of the current editor.</p>"""
514 )) 537 ))
515 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint) 538 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint)
516 self.actions.append(self.dbgEditBpAct) 539 self.actions.append(self.dbgEditBpAct)
517 540
518 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'), 541 self.dbgNextBpAct = E5Action(
542 self.trUtf8('Next Breakpoint'),
519 UI.PixmapCache.getIcon("breakpointNext.png"), 543 UI.PixmapCache.getIcon("breakpointNext.png"),
520 self.trUtf8('Next Breakpoint'), 544 self.trUtf8('Next Breakpoint'),
521 QKeySequence( 545 QKeySequence(
522 self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0, 546 self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0,
523 self.dbgSetBpActGrp, 'dbg_next_breakpoint') 547 self.dbgSetBpActGrp, 'dbg_next_breakpoint')
527 """<p>Go to next breakpoint of the current editor.</p>""" 551 """<p>Go to next breakpoint of the current editor.</p>"""
528 )) 552 ))
529 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint) 553 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint)
530 self.actions.append(self.dbgNextBpAct) 554 self.actions.append(self.dbgNextBpAct)
531 555
532 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'), 556 self.dbgPrevBpAct = E5Action(
557 self.trUtf8('Previous Breakpoint'),
533 UI.PixmapCache.getIcon("breakpointPrevious.png"), 558 UI.PixmapCache.getIcon("breakpointPrevious.png"),
534 self.trUtf8('Previous Breakpoint'), 559 self.trUtf8('Previous Breakpoint'),
535 QKeySequence( 560 QKeySequence(
536 self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")), 561 self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")),
537 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint') 562 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint')
541 """<p>Go to previous breakpoint of the current editor.</p>""" 566 """<p>Go to previous breakpoint of the current editor.</p>"""
542 )) 567 ))
543 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint) 568 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint)
544 self.actions.append(self.dbgPrevBpAct) 569 self.actions.append(self.dbgPrevBpAct)
545 570
546 act = E5Action(self.trUtf8('Clear Breakpoints'), 571 act = E5Action(
572 self.trUtf8('Clear Breakpoints'),
547 self.trUtf8('Clear Breakpoints'), 573 self.trUtf8('Clear Breakpoints'),
548 QKeySequence( 574 QKeySequence(
549 self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0, 575 self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0,
550 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') 576 self.dbgSetBpActGrp, 'dbg_clear_breakpoint')
551 act.setStatusTip(self.trUtf8('Clear Breakpoints')) 577 act.setStatusTip(self.trUtf8('Clear Breakpoints'))
893 # Just save the 10 most recent entries 919 # Just save the 10 most recent entries
894 del self.argvHistory[10:] 920 del self.argvHistory[10:]
895 del self.wdHistory[10:] 921 del self.wdHistory[10:]
896 del self.envHistory[10:] 922 del self.envHistory[10:]
897 923
898 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory', 924 Preferences.Prefs.settings.setValue(
899 self.argvHistory) 925 'DebugInfo/ArgumentsHistory', self.argvHistory)
900 Preferences.Prefs.settings.setValue( 926 Preferences.Prefs.settings.setValue(
901 'DebugInfo/WorkingDirectoryHistory', self.wdHistory) 927 'DebugInfo/WorkingDirectoryHistory', self.wdHistory)
902 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory', 928 Preferences.Prefs.settings.setValue(
903 self.envHistory) 929 'DebugInfo/EnvironmentHistory', self.envHistory)
904 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions', 930 Preferences.Prefs.settings.setValue(
905 self.excList) 931 'DebugInfo/Exceptions', self.excList)
906 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions', 932 Preferences.Prefs.settings.setValue(
907 self.excIgnoreList) 933 'DebugInfo/IgnoredExceptions', self.excIgnoreList)
908 Preferences.Prefs.settings.setValue('DebugInfo/ReportExceptions', 934 Preferences.Prefs.settings.setValue(
909 self.exceptions) 935 'DebugInfo/ReportExceptions', self.exceptions)
910 Preferences.Prefs.settings.setValue('DebugInfo/AutoClearShell', 936 Preferences.Prefs.settings.setValue(
911 self.autoClearShell) 937 'DebugInfo/AutoClearShell', self.autoClearShell)
912 Preferences.Prefs.settings.setValue('DebugInfo/TracePython', 938 Preferences.Prefs.settings.setValue(
913 self.tracePython) 939 'DebugInfo/TracePython', self.tracePython)
914 Preferences.Prefs.settings.setValue('DebugInfo/AutoContinue', 940 Preferences.Prefs.settings.setValue(
915 self.autoContinue) 941 'DebugInfo/AutoContinue', self.autoContinue)
916 Preferences.Prefs.settings.setValue('DebugInfo/ForkAutomatically', 942 Preferences.Prefs.settings.setValue(
917 self.forkAutomatically) 943 'DebugInfo/ForkAutomatically', self.forkAutomatically)
918 Preferences.Prefs.settings.setValue('DebugInfo/ForkIntoChild', 944 Preferences.Prefs.settings.setValue(
919 self.forkIntoChild) 945 'DebugInfo/ForkIntoChild', self.forkIntoChild)
920 946
921 def shutdownServer(self): 947 def shutdownServer(self):
922 """ 948 """
923 Public method to shut down the debug server. 949 Public method to shut down the debug server.
924 950
982 1008
983 self.__resetUI() 1009 self.__resetUI()
984 1010
985 if not Preferences.getDebugger("SuppressClientExit") or status != 0: 1011 if not Preferences.getDebugger("SuppressClientExit") or status != 0:
986 if self.ui.currentProg is None: 1012 if self.ui.currentProg is None:
987 E5MessageBox.information(self.ui, Program, 1013 E5MessageBox.information(
1014 self.ui, Program,
988 self.trUtf8('<p>The program has terminated with an exit' 1015 self.trUtf8('<p>The program has terminated with an exit'
989 ' status of {0}.</p>').format(status)) 1016 ' status of {0}.</p>').format(status))
990 else: 1017 else:
991 E5MessageBox.information(self.ui, Program, 1018 E5MessageBox.information(
1019 self.ui, Program,
992 self.trUtf8('<p><b>{0}</b> has terminated with an exit' 1020 self.trUtf8('<p><b>{0}</b> has terminated with an exit'
993 ' status of {1}.</p>') 1021 ' status of {1}.</p>')
994 .format(Utilities.normabspath(self.ui.currentProg), 1022 .format(Utilities.normabspath(self.ui.currentProg),
995 status)) 1023 status))
996 else: 1024 else:
1032 self.__resetUI() 1060 self.__resetUI()
1033 self.ui.raise_() 1061 self.ui.raise_()
1034 self.ui.activateWindow() 1062 self.ui.activateWindow()
1035 1063
1036 if message is None: 1064 if message is None:
1037 E5MessageBox.critical(self.ui, Program, 1065 E5MessageBox.critical(
1066 self.ui, Program,
1038 self.trUtf8( 1067 self.trUtf8(
1039 'The program being debugged contains an unspecified' 1068 'The program being debugged contains an unspecified'
1040 ' syntax error.')) 1069 ' syntax error.'))
1041 return 1070 return
1042 1071
1049 d = os.path.dirname( 1078 d = os.path.dirname(
1050 self.project.getMainScript(normalized=True)) 1079 self.project.getMainScript(normalized=True))
1051 if os.path.exists(os.path.join(d, filename)): 1080 if os.path.exists(os.path.join(d, filename)):
1052 filename = os.path.join(d, filename) 1081 filename = os.path.join(d, filename)
1053 self.viewmanager.setFileLine(filename, lineNo, True, True) 1082 self.viewmanager.setFileLine(filename, lineNo, True, True)
1054 E5MessageBox.critical(self.ui, Program, 1083 E5MessageBox.critical(
1084 self.ui, Program,
1055 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error' 1085 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error'
1056 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.' 1086 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.'
1057 '</p>') 1087 '</p>')
1058 .format(filename, message, lineNo, characterNo)) 1088 .format(filename, message, lineNo, characterNo))
1059 1089
1067 """ 1097 """
1068 self.ui.raise_() 1098 self.ui.raise_()
1069 self.ui.activateWindow() 1099 self.ui.activateWindow()
1070 QApplication.processEvents() 1100 QApplication.processEvents()
1071 if exceptionType is None: 1101 if exceptionType is None:
1072 E5MessageBox.critical(self.ui, Program, 1102 E5MessageBox.critical(
1103 self.ui, Program,
1073 self.trUtf8('An unhandled exception occured.' 1104 self.trUtf8('An unhandled exception occured.'
1074 ' See the shell window for details.')) 1105 ' See the shell window for details.'))
1075 return 1106 return
1076 1107
1077 if (self.exceptions and \ 1108 if (self.exceptions and \
1078 exceptionType not in self.excIgnoreList and \ 1109 exceptionType not in self.excIgnoreList and \
1079 (not len(self.excList) or \ 1110 (not len(self.excList) or \
1080 (len(self.excList) and exceptionType in self.excList)))\ 1111 (len(self.excList) and exceptionType in self.excList)))\
1081 or exceptionType.startswith('unhandled'): 1112 or exceptionType.startswith('unhandled'):
1082 res = None 1113 res = None
1083 if stackTrace: 1114 if stackTrace:
1084 try: 1115 try:
1085 file, line = stackTrace[0][:2] 1116 file, line = stackTrace[0][:2]
1106 else: 1137 else:
1107 buttons = E5MessageBox.StandardButtons( 1138 buttons = E5MessageBox.StandardButtons(
1108 E5MessageBox.No | \ 1139 E5MessageBox.No | \
1109 E5MessageBox.Yes | \ 1140 E5MessageBox.Yes | \
1110 E5MessageBox.Ignore) 1141 E5MessageBox.Ignore)
1111 res = E5MessageBox.critical(self.ui, Program, 1142 res = E5MessageBox.critical(
1143 self.ui, Program,
1112 self.trUtf8( 1144 self.trUtf8(
1113 '<p>The debugged program raised the exception' 1145 '<p>The debugged program raised the exception'
1114 ' <b>{0}</b><br>"<b>{1}</b>"<br>' 1146 ' <b>{0}</b><br>"<b>{1}</b>"<br>'
1115 'File: <b>{2}</b>, Line: <b>{3}</b></p>' 1147 'File: <b>{2}</b>, Line: <b>{3}</b></p>'
1116 '<p>Break here?</p>') 1148 '<p>Break here?</p>')
1120 stackTrace[0][0], 1152 stackTrace[0][0],
1121 stackTrace[0][1]), 1153 stackTrace[0][1]),
1122 buttons, 1154 buttons,
1123 E5MessageBox.No) 1155 E5MessageBox.No)
1124 else: 1156 else:
1125 res = E5MessageBox.critical(self.ui, Program, 1157 res = E5MessageBox.critical(
1158 self.ui, Program,
1126 self.trUtf8( 1159 self.trUtf8(
1127 '<p>The debugged program raised the exception' 1160 '<p>The debugged program raised the exception'
1128 ' <b>{0}</b><br>"<b>{1}</b>"</p>') 1161 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1129 .format( 1162 .format(
1130 exceptionType, 1163 exceptionType,
1156 1189
1157 @param unplanned True if the client died, False otherwise 1190 @param unplanned True if the client died, False otherwise
1158 """ 1191 """
1159 self.__resetUI() 1192 self.__resetUI()
1160 if unplanned: 1193 if unplanned:
1161 E5MessageBox.information(self.ui, Program, 1194 E5MessageBox.information(
1195 self.ui, Program,
1162 self.trUtf8('The program being debugged has terminated' 1196 self.trUtf8('The program being debugged has terminated'
1163 ' unexpectedly.')) 1197 ' unexpectedly.'))
1164 1198
1165 def __getThreadList(self): 1199 def __getThreadList(self):
1166 """ 1200 """
1228 Private method to handle a condition error of a breakpoint. 1262 Private method to handle a condition error of a breakpoint.
1229 1263
1230 @param filename filename of the breakpoint (string) 1264 @param filename filename of the breakpoint (string)
1231 @param lineno linenumber of the breakpoint (integer) 1265 @param lineno linenumber of the breakpoint (integer)
1232 """ 1266 """
1233 E5MessageBox.critical(self.ui, 1267 E5MessageBox.critical(
1268 self.ui,
1234 self.trUtf8("Breakpoint Condition Error"), 1269 self.trUtf8("Breakpoint Condition Error"),
1235 self.trUtf8( 1270 self.trUtf8(
1236 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" 1271 """<p>The condition of the breakpoint <b>{0}, {1}</b>"""
1237 """ contains a syntax error.</p>""")\ 1272 """ contains a syntax error.</p>""")\
1238 .format(filename, lineno)) 1273 .format(filename, lineno))
1247 return 1282 return
1248 1283
1249 fn, line, cond, temp, enabled, count = bp[:6] 1284 fn, line, cond, temp, enabled, count = bp[:6]
1250 1285
1251 from .EditBreakpointDialog import EditBreakpointDialog 1286 from .EditBreakpointDialog import EditBreakpointDialog
1252 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count), 1287 dlg = EditBreakpointDialog(
1288 (fn, line), (cond, temp, enabled, count),
1253 [], self.ui, modal=True) 1289 [], self.ui, modal=True)
1254 if dlg.exec_() == QDialog.Accepted: 1290 if dlg.exec_() == QDialog.Accepted:
1255 cond, temp, enabled, count = dlg.getData() 1291 cond, temp, enabled, count = dlg.getData()
1256 model.setBreakPointByIndex(index, fn, line, 1292 model.setBreakPointByIndex(index, fn, line,
1257 (cond, temp, enabled, count)) 1293 (cond, temp, enabled, count))
1262 1298
1263 Note: This can only happen for normal watch expressions 1299 Note: This can only happen for normal watch expressions
1264 1300
1265 @param cond expression of the watch expression (string) 1301 @param cond expression of the watch expression (string)
1266 """ 1302 """
1267 E5MessageBox.critical(self.ui, 1303 E5MessageBox.critical(
1304 self.ui,
1268 self.trUtf8("Watch Expression Error"), 1305 self.trUtf8("Watch Expression Error"),
1269 self.trUtf8("""<p>The watch expression <b>{0}</b>""" 1306 self.trUtf8("""<p>The watch expression <b>{0}</b>"""
1270 """ contains a syntax error.</p>""")\ 1307 """ contains a syntax error.</p>""")\
1271 .format(cond)) 1308 .format(cond))
1272 1309
1295 if not special: 1332 if not special:
1296 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1333 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1297 """ already exists.</p>""")\ 1334 """ already exists.</p>""")\
1298 .format(Utilities.html_encode(cond)) 1335 .format(Utilities.html_encode(cond))
1299 else: 1336 else:
1300 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1337 msg = self.trUtf8(
1301 """ for the variable <b>{1}</b> already""" 1338 """<p>A watch expression '<b>{0}</b>'"""
1302 """ exists.</p>""")\ 1339 """ for the variable <b>{1}</b> already"""
1303 .format(special, 1340 """ exists.</p>""")\
1304 Utilities.html_encode(cond)) 1341 .format(special,
1305 E5MessageBox.warning(self, 1342 Utilities.html_encode(cond))
1343 E5MessageBox.warning(
1344 self.ui,
1306 self.trUtf8("Watch expression already exists"), 1345 self.trUtf8("Watch expression already exists"),
1307 msg) 1346 msg)
1308 model.deleteWatchPointByIndex(index) 1347 model.deleteWatchPointByIndex(index)
1309 else: 1348 else:
1310 model.setWatchPointByIndex(index, cond, special, 1349 model.setWatchPointByIndex(index, cond, special,
1451 # exception reporting flag. 1490 # exception reporting flag.
1452 if runProject: 1491 if runProject:
1453 cap = self.trUtf8("Coverage of Project") 1492 cap = self.trUtf8("Coverage of Project")
1454 else: 1493 else:
1455 cap = self.trUtf8("Coverage of Script") 1494 cap = self.trUtf8("Coverage of Script")
1456 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, 1495 dlg = StartDialog(
1496 cap, self.argvHistory, self.wdHistory,
1457 self.envHistory, self.exceptions, self.ui, 2, 1497 self.envHistory, self.exceptions, self.ui, 2,
1458 autoClearShell=self.autoClearShell) 1498 autoClearShell=self.autoClearShell)
1459 if dlg.exec_() == QDialog.Accepted: 1499 if dlg.exec_() == QDialog.Accepted:
1460 argv, wd, env, exceptions, clearShell, clearHistories, console = \ 1500 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1461 dlg.getData() 1501 dlg.getData()
1462 eraseCoverage = dlg.getCoverageData() 1502 eraseCoverage = dlg.getCoverageData()
1463 1503
1464 if runProject: 1504 if runProject:
1465 fn = self.project.getMainScript(1) 1505 fn = self.project.getMainScript(1)
1466 if fn is None: 1506 if fn is None:
1467 E5MessageBox.critical(self.ui, 1507 E5MessageBox.critical(
1508 self.ui,
1468 self.trUtf8("Coverage of Project"), 1509 self.trUtf8("Coverage of Project"),
1469 self.trUtf8("There is no main script defined for the" 1510 self.trUtf8(
1511 "There is no main script defined for the"
1470 " current project. Aborting")) 1512 " current project. Aborting"))
1471 return 1513 return
1472 1514
1473 if Preferences.getDebugger("Autosave") and \ 1515 if Preferences.getDebugger("Autosave") and \
1474 not self.project.saveAllScripts(reportSyntaxErrors=True): 1516 not self.project.saveAllScripts(reportSyntaxErrors=True):
1526 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1568 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1527 1569
1528 self.debugViewer.initCallStackViewer(runProject) 1570 self.debugViewer.initCallStackViewer(runProject)
1529 1571
1530 # Ask the client to open the new program. 1572 # Ask the client to open the new program.
1531 self.debugServer.remoteCoverage(fn, argv, wd, env, 1573 self.debugServer.remoteCoverage(
1574 fn, argv, wd, env,
1532 autoClearShell=self.autoClearShell, erase=eraseCoverage, 1575 autoClearShell=self.autoClearShell, erase=eraseCoverage,
1533 forProject=runProject, runInConsole=console, 1576 forProject=runProject, runInConsole=console,
1534 clientType=self.clientType) 1577 clientType=self.clientType)
1535 1578
1536 self.stopAct.setEnabled(True) 1579 self.stopAct.setEnabled(True)
1576 eraseTimings = dlg.getProfilingData() 1619 eraseTimings = dlg.getProfilingData()
1577 1620
1578 if runProject: 1621 if runProject:
1579 fn = self.project.getMainScript(1) 1622 fn = self.project.getMainScript(1)
1580 if fn is None: 1623 if fn is None:
1581 E5MessageBox.critical(self.ui, 1624 E5MessageBox.critical(
1625 self.ui,
1582 self.trUtf8("Profile of Project"), 1626 self.trUtf8("Profile of Project"),
1583 self.trUtf8("There is no main script defined for the" 1627 self.trUtf8(
1628 "There is no main script defined for the"
1584 " current project. Aborting")) 1629 " current project. Aborting"))
1585 return 1630 return
1586 1631
1587 if Preferences.getDebugger("Autosave") and \ 1632 if Preferences.getDebugger("Autosave") and \
1588 not self.project.saveAllScripts(reportSyntaxErrors=True): 1633 not self.project.saveAllScripts(reportSyntaxErrors=True):
1640 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1685 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1641 1686
1642 self.debugViewer.initCallStackViewer(runProject) 1687 self.debugViewer.initCallStackViewer(runProject)
1643 1688
1644 # Ask the client to open the new program. 1689 # Ask the client to open the new program.
1645 self.debugServer.remoteProfile(fn, argv, wd, env, 1690 self.debugServer.remoteProfile(
1691 fn, argv, wd, env,
1646 autoClearShell=self.autoClearShell, erase=eraseTimings, 1692 autoClearShell=self.autoClearShell, erase=eraseTimings,
1647 forProject=runProject, runInConsole=console, 1693 forProject=runProject, runInConsole=console,
1648 clientType=self.clientType) 1694 clientType=self.clientType)
1649 1695
1650 self.stopAct.setEnabled(True) 1696 self.stopAct.setEnabled(True)
1692 forkAutomatically, forkIntoChild = dlg.getRunData() 1738 forkAutomatically, forkIntoChild = dlg.getRunData()
1693 1739
1694 if runProject: 1740 if runProject:
1695 fn = self.project.getMainScript(1) 1741 fn = self.project.getMainScript(1)
1696 if fn is None: 1742 if fn is None:
1697 E5MessageBox.critical(self.ui, 1743 E5MessageBox.critical(
1744 self.ui,
1698 self.trUtf8("Run Project"), 1745 self.trUtf8("Run Project"),
1699 self.trUtf8("There is no main script defined for the" 1746 self.trUtf8(
1747 "There is no main script defined for the"
1700 " current project. Aborting")) 1748 " current project. Aborting"))
1701 return 1749 return
1702 1750
1703 if Preferences.getDebugger("Autosave") and \ 1751 if Preferences.getDebugger("Autosave") and \
1704 not self.project.saveAllScripts(reportSyntaxErrors=True): 1752 not self.project.saveAllScripts(reportSyntaxErrors=True):
1757 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1805 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1758 1806
1759 self.debugViewer.initCallStackViewer(runProject) 1807 self.debugViewer.initCallStackViewer(runProject)
1760 1808
1761 # Ask the client to open the new program. 1809 # Ask the client to open the new program.
1762 self.debugServer.remoteRun(fn, argv, wd, env, 1810 self.debugServer.remoteRun(
1811 fn, argv, wd, env,
1763 autoClearShell=self.autoClearShell, forProject=runProject, 1812 autoClearShell=self.autoClearShell, forProject=runProject,
1764 runInConsole=console, autoFork=forkAutomatically, 1813 runInConsole=console, autoFork=forkAutomatically,
1765 forkChild=forkIntoChild, clientType=self.clientType) 1814 forkChild=forkIntoChild, clientType=self.clientType)
1766 1815
1767 self.stopAct.setEnabled(True) 1816 self.stopAct.setEnabled(True)
1809 dlg.getDebugData() 1858 dlg.getDebugData()
1810 1859
1811 if debugProject: 1860 if debugProject:
1812 fn = self.project.getMainScript(True) 1861 fn = self.project.getMainScript(True)
1813 if fn is None: 1862 if fn is None:
1814 E5MessageBox.critical(self.ui, 1863 E5MessageBox.critical(
1864 self.ui,
1815 self.trUtf8("Debug Project"), 1865 self.trUtf8("Debug Project"),
1816 self.trUtf8("There is no main script defined for the" 1866 self.trUtf8(
1867 "There is no main script defined for the"
1817 " current project. No debugging possible.")) 1868 " current project. No debugging possible."))
1818 return 1869 return
1819 1870
1820 if Preferences.getDebugger("Autosave") and \ 1871 if Preferences.getDebugger("Autosave") and \
1821 not self.project.saveAllScripts(reportSyntaxErrors=True): 1872 not self.project.saveAllScripts(reportSyntaxErrors=True):
1888 enableCallTrace = self.debugViewer.isCallTraceEnabled() 1939 enableCallTrace = self.debugViewer.isCallTraceEnabled()
1889 self.debugViewer.clearCallTrace() 1940 self.debugViewer.clearCallTrace()
1890 self.debugViewer.setCallTraceToProjectMode(debugProject) 1941 self.debugViewer.setCallTraceToProjectMode(debugProject)
1891 1942
1892 # Ask the client to open the new program. 1943 # Ask the client to open the new program.
1893 self.debugServer.remoteLoad(fn, argv, wd, env, 1944 self.debugServer.remoteLoad(
1945 fn, argv, wd, env,
1894 autoClearShell=self.autoClearShell, 1946 autoClearShell=self.autoClearShell,
1895 tracePython=tracePython, 1947 tracePython=tracePython,
1896 autoContinue=autoContinue, forProject=debugProject, 1948 autoContinue=autoContinue, forProject=debugProject,
1897 runInConsole=console, autoFork=forkAutomatically, 1949 runInConsole=console, autoFork=forkAutomatically,
1898 forkChild=forkIntoChild, clientType=self.clientType, 1950 forkChild=forkIntoChild, clientType=self.clientType,
1913 1965
1914 # first save any changes 1966 # first save any changes
1915 if self.lastStartAction in [1, 3, 5, 7, 9]: 1967 if self.lastStartAction in [1, 3, 5, 7, 9]:
1916 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile) 1968 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile)
1917 if editor and \ 1969 if editor and \
1918 not self.viewmanager.checkDirty(editor, 1970 not self.viewmanager.checkDirty(
1919 Preferences.getDebugger("Autosave")): 1971 editor, Preferences.getDebugger("Autosave")):
1920 return 1972 return
1921 forProject = False 1973 forProject = False
1922 elif self.lastStartAction in [2, 4, 6, 8, 10]: 1974 elif self.lastStartAction in [2, 4, 6, 8, 10]:
1923 if Preferences.getDebugger("Autosave") and \ 1975 if Preferences.getDebugger("Autosave") and \
1924 not self.project.saveAllScripts(reportSyntaxErrors=True): 1976 not self.project.saveAllScripts(reportSyntaxErrors=True):
2082 """ 2134 """
2083 self.lastAction = 0 2135 self.lastAction = 0
2084 aw = self.viewmanager.activeWindow() 2136 aw = self.viewmanager.activeWindow()
2085 line = aw.getCursorPosition()[0] + 1 2137 line = aw.getCursorPosition()[0] + 1
2086 self.__enterRemote() 2138 self.__enterRemote()
2087 self.debugServer.remoteBreakpoint(aw.getFileName(), 2139 self.debugServer.remoteBreakpoint(
2088 line, 1, None, 1) 2140 aw.getFileName(), line, 1, None, 1)
2089 self.debugServer.remoteContinue() 2141 self.debugServer.remoteContinue()
2090 2142
2091 def __eval(self): 2143 def __eval(self):
2092 """ 2144 """
2093 Private method to handle the Eval action. 2145 Private method to handle the Eval action.

eric ide

mercurial