Debugger/DebugUI.py

changeset 3021
801289962f4e
parent 3020
542e97d4ecb3
child 3032
927a2f8b3669
child 3058
0a02c433f52d
equal deleted inserted replaced
3020:542e97d4ecb3 3021:801289962f4e
105 self.execHistory = [] 105 self.execHistory = []
106 self.lastDebuggedFile = None 106 self.lastDebuggedFile = None
107 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project 107 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project
108 self.clientType = "" 108 self.clientType = ""
109 self.lastAction = -1 109 self.lastAction = -1
110 self.debugActions = [self.__continue, self.__step,\ 110 self.debugActions = [
111 self.__stepOver, self.__stepOut,\ 111 self.__continue, self.__step, self.__stepOver, self.__stepOut,
112 self.__stepQuit, self.__runToCursor] 112 self.__stepQuit, self.__runToCursor
113 ]
113 self.localsVarFilter, self.globalsVarFilter = \ 114 self.localsVarFilter, self.globalsVarFilter = \
114 Preferences.getVarFilters() 115 Preferences.getVarFilters()
115 self.debugViewer.setVariablesFilter( 116 self.debugViewer.setVariablesFilter(
116 self.globalsVarFilter, self.localsVarFilter) 117 self.globalsVarFilter, self.localsVarFilter)
117 118
165 """ 166 """
166 Method defining the user interface actions. 167 Method defining the user interface actions.
167 """ 168 """
168 self.actions = [] 169 self.actions = []
169 170
170 self.runAct = E5Action(self.trUtf8('Run Script'), 171 self.runAct = E5Action(
171 UI.PixmapCache.getIcon("runScript.png"), 172 self.trUtf8('Run Script'),
172 self.trUtf8('&Run Script...'), 173 UI.PixmapCache.getIcon("runScript.png"),
173 Qt.Key_F2, 0, self, 'dbg_run_script') 174 self.trUtf8('&Run Script...'),
175 Qt.Key_F2, 0, self, 'dbg_run_script')
174 self.runAct.setStatusTip(self.trUtf8('Run the current Script')) 176 self.runAct.setStatusTip(self.trUtf8('Run the current Script'))
175 self.runAct.setWhatsThis(self.trUtf8( 177 self.runAct.setWhatsThis(self.trUtf8(
176 """<b>Run Script</b>""" 178 """<b>Run Script</b>"""
177 """<p>Set the command line arguments and run the script outside""" 179 """<p>Set the command line arguments and run the script outside"""
178 """ the debugger. If the file has unsaved changes it may be""" 180 """ the debugger. If the file has unsaved changes it may be"""
179 """ saved first.</p>""" 181 """ saved first.</p>"""
180 )) 182 ))
181 self.runAct.triggered[()].connect(self.__runScript) 183 self.runAct.triggered[()].connect(self.__runScript)
182 self.actions.append(self.runAct) 184 self.actions.append(self.runAct)
183 185
184 self.runProjectAct = E5Action(self.trUtf8('Run Project'), 186 self.runProjectAct = E5Action(
185 UI.PixmapCache.getIcon("runProject.png"), 187 self.trUtf8('Run Project'),
186 self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, 188 UI.PixmapCache.getIcon("runProject.png"),
187 'dbg_run_project') 189 self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self,
190 'dbg_run_project')
188 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project')) 191 self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project'))
189 self.runProjectAct.setWhatsThis(self.trUtf8( 192 self.runProjectAct.setWhatsThis(self.trUtf8(
190 """<b>Run Project</b>""" 193 """<b>Run Project</b>"""
191 """<p>Set the command line arguments and run the current project""" 194 """<p>Set the command line arguments and run the current project"""
192 """ outside the debugger.""" 195 """ outside the debugger."""
194 """ may be saved first.</p>""" 197 """ may be saved first.</p>"""
195 )) 198 ))
196 self.runProjectAct.triggered[()].connect(self.__runProject) 199 self.runProjectAct.triggered[()].connect(self.__runProject)
197 self.actions.append(self.runProjectAct) 200 self.actions.append(self.runProjectAct)
198 201
199 self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'), 202 self.coverageAct = E5Action(
200 UI.PixmapCache.getIcon("coverageScript.png"), 203 self.trUtf8('Coverage run of Script'),
201 self.trUtf8('Coverage run of Script...'), 0, 0, self, 204 UI.PixmapCache.getIcon("coverageScript.png"),
202 'dbg_coverage_script') 205 self.trUtf8('Coverage run of Script...'), 0, 0, self,
206 'dbg_coverage_script')
203 self.coverageAct.setStatusTip( 207 self.coverageAct.setStatusTip(
204 self.trUtf8('Perform a coverage run of the current Script')) 208 self.trUtf8('Perform a coverage run of the current Script'))
205 self.coverageAct.setWhatsThis(self.trUtf8( 209 self.coverageAct.setWhatsThis(self.trUtf8(
206 """<b>Coverage run of Script</b>""" 210 """<b>Coverage run of Script</b>"""
207 """<p>Set the command line arguments and run the script under""" 211 """<p>Set the command line arguments and run the script under"""
226 """ they may be saved first.</p>""" 230 """ they may be saved first.</p>"""
227 )) 231 ))
228 self.coverageProjectAct.triggered[()].connect(self.__coverageProject) 232 self.coverageProjectAct.triggered[()].connect(self.__coverageProject)
229 self.actions.append(self.coverageProjectAct) 233 self.actions.append(self.coverageProjectAct)
230 234
231 self.profileAct = E5Action(self.trUtf8('Profile Script'), 235 self.profileAct = E5Action(
236 self.trUtf8('Profile Script'),
232 UI.PixmapCache.getIcon("profileScript.png"), 237 UI.PixmapCache.getIcon("profileScript.png"),
233 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script') 238 self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script')
234 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script')) 239 self.profileAct.setStatusTip(self.trUtf8('Profile the current Script'))
235 self.profileAct.setWhatsThis(self.trUtf8( 240 self.profileAct.setWhatsThis(self.trUtf8(
236 """<b>Profile Script</b>""" 241 """<b>Profile Script</b>"""
238 """ If the file has unsaved changes it may be saved first.</p>""" 243 """ If the file has unsaved changes it may be saved first.</p>"""
239 )) 244 ))
240 self.profileAct.triggered[()].connect(self.__profileScript) 245 self.profileAct.triggered[()].connect(self.__profileScript)
241 self.actions.append(self.profileAct) 246 self.actions.append(self.profileAct)
242 247
243 self.profileProjectAct = E5Action(self.trUtf8('Profile Project'), 248 self.profileProjectAct = E5Action(
249 self.trUtf8('Profile Project'),
244 UI.PixmapCache.getIcon("profileProject.png"), 250 UI.PixmapCache.getIcon("profileProject.png"),
245 self.trUtf8('Profile Project...'), 0, 0, self, 251 self.trUtf8('Profile Project...'), 0, 0, self,
246 'dbg_profile_project') 252 'dbg_profile_project')
247 self.profileProjectAct.setStatusTip( 253 self.profileProjectAct.setStatusTip(
248 self.trUtf8('Profile the current Project')) 254 self.trUtf8('Profile the current Project'))
253 """ changes they may be saved first.</p>""" 259 """ changes they may be saved first.</p>"""
254 )) 260 ))
255 self.profileProjectAct.triggered[()].connect(self.__profileProject) 261 self.profileProjectAct.triggered[()].connect(self.__profileProject)
256 self.actions.append(self.profileProjectAct) 262 self.actions.append(self.profileProjectAct)
257 263
258 self.debugAct = E5Action(self.trUtf8('Debug Script'), 264 self.debugAct = E5Action(
265 self.trUtf8('Debug Script'),
259 UI.PixmapCache.getIcon("debugScript.png"), 266 UI.PixmapCache.getIcon("debugScript.png"),
260 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self, 267 self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self,
261 'dbg_debug_script') 268 'dbg_debug_script')
262 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script')) 269 self.debugAct.setStatusTip(self.trUtf8('Debug the current Script'))
263 self.debugAct.setWhatsThis(self.trUtf8( 270 self.debugAct.setWhatsThis(self.trUtf8(
268 """ saved first.</p>""" 275 """ saved first.</p>"""
269 )) 276 ))
270 self.debugAct.triggered[()].connect(self.__debugScript) 277 self.debugAct.triggered[()].connect(self.__debugScript)
271 self.actions.append(self.debugAct) 278 self.actions.append(self.debugAct)
272 279
273 self.debugProjectAct = E5Action(self.trUtf8('Debug Project'), 280 self.debugProjectAct = E5Action(
281 self.trUtf8('Debug Project'),
274 UI.PixmapCache.getIcon("debugProject.png"), 282 UI.PixmapCache.getIcon("debugProject.png"),
275 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, 283 self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self,
276 'dbg_debug_project') 284 'dbg_debug_project')
277 self.debugProjectAct.setStatusTip(self.trUtf8( 285 self.debugProjectAct.setStatusTip(self.trUtf8(
278 'Debug the current Project')) 286 'Debug the current Project'))
284 """ project have unsaved changes they may be saved first.</p>""" 292 """ project have unsaved changes they may be saved first.</p>"""
285 )) 293 ))
286 self.debugProjectAct.triggered[()].connect(self.__debugProject) 294 self.debugProjectAct.triggered[()].connect(self.__debugProject)
287 self.actions.append(self.debugProjectAct) 295 self.actions.append(self.debugProjectAct)
288 296
289 self.restartAct = E5Action(self.trUtf8('Restart'), 297 self.restartAct = E5Action(
298 self.trUtf8('Restart'),
290 UI.PixmapCache.getIcon("restart.png"), 299 UI.PixmapCache.getIcon("restart.png"),
291 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') 300 self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script')
292 self.restartAct.setStatusTip(self.trUtf8( 301 self.restartAct.setStatusTip(self.trUtf8(
293 'Restart the last debugged script')) 302 'Restart the last debugged script'))
294 self.restartAct.setWhatsThis(self.trUtf8( 303 self.restartAct.setWhatsThis(self.trUtf8(
299 """ may be saved first.</p>""" 308 """ may be saved first.</p>"""
300 )) 309 ))
301 self.restartAct.triggered[()].connect(self.__doRestart) 310 self.restartAct.triggered[()].connect(self.__doRestart)
302 self.actions.append(self.restartAct) 311 self.actions.append(self.restartAct)
303 312
304 self.stopAct = E5Action(self.trUtf8('Stop'), 313 self.stopAct = E5Action(
314 self.trUtf8('Stop'),
305 UI.PixmapCache.getIcon("stopScript.png"), 315 UI.PixmapCache.getIcon("stopScript.png"),
306 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0, 316 self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0,
307 self, 'dbg_stop_script') 317 self, 'dbg_stop_script')
308 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script.""")) 318 self.stopAct.setStatusTip(self.trUtf8("""Stop the running script."""))
309 self.stopAct.setWhatsThis(self.trUtf8( 319 self.stopAct.setWhatsThis(self.trUtf8(
313 self.stopAct.triggered[()].connect(self.__stopScript) 323 self.stopAct.triggered[()].connect(self.__stopScript)
314 self.actions.append(self.stopAct) 324 self.actions.append(self.stopAct)
315 325
316 self.debugActGrp = createActionGroup(self) 326 self.debugActGrp = createActionGroup(self)
317 327
318 act = E5Action(self.trUtf8('Continue'), 328 act = E5Action(
329 self.trUtf8('Continue'),
319 UI.PixmapCache.getIcon("continue.png"), 330 UI.PixmapCache.getIcon("continue.png"),
320 self.trUtf8('&Continue'), Qt.Key_F6, 0, 331 self.trUtf8('&Continue'), Qt.Key_F6, 0,
321 self.debugActGrp, 'dbg_continue') 332 self.debugActGrp, 'dbg_continue')
322 act.setStatusTip( 333 act.setStatusTip(
323 self.trUtf8('Continue running the program from the current line')) 334 self.trUtf8('Continue running the program from the current line'))
328 """ is reached.</p>""" 339 """ is reached.</p>"""
329 )) 340 ))
330 act.triggered[()].connect(self.__continue) 341 act.triggered[()].connect(self.__continue)
331 self.actions.append(act) 342 self.actions.append(act)
332 343
333 act = E5Action(self.trUtf8('Continue to Cursor'), 344 act = E5Action(
345 self.trUtf8('Continue to Cursor'),
334 UI.PixmapCache.getIcon("continueToCursor.png"), 346 UI.PixmapCache.getIcon("continueToCursor.png"),
335 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, 347 self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0,
336 self.debugActGrp, 'dbg_continue_to_cursor') 348 self.debugActGrp, 'dbg_continue_to_cursor')
337 act.setStatusTip(self.trUtf8( 349 act.setStatusTip(self.trUtf8(
338 """Continue running the program from the""" 350 """Continue running the program from the"""
343 """ current cursor position.</p>""" 355 """ current cursor position.</p>"""
344 )) 356 ))
345 act.triggered[()].connect(self.__runToCursor) 357 act.triggered[()].connect(self.__runToCursor)
346 self.actions.append(act) 358 self.actions.append(act)
347 359
348 act = E5Action(self.trUtf8('Single Step'), 360 act = E5Action(
361 self.trUtf8('Single Step'),
349 UI.PixmapCache.getIcon("step.png"), 362 UI.PixmapCache.getIcon("step.png"),
350 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0, 363 self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0,
351 self.debugActGrp, 'dbg_single_step') 364 self.debugActGrp, 'dbg_single_step')
352 act.setStatusTip(self.trUtf8('Execute a single Python statement')) 365 act.setStatusTip(self.trUtf8('Execute a single Python statement'))
353 act.setWhatsThis(self.trUtf8( 366 act.setWhatsThis(self.trUtf8(
358 """ debugger at the next statement.</p>""" 371 """ debugger at the next statement.</p>"""
359 )) 372 ))
360 act.triggered[()].connect(self.__step) 373 act.triggered[()].connect(self.__step)
361 self.actions.append(act) 374 self.actions.append(act)
362 375
363 act = E5Action(self.trUtf8('Step Over'), 376 act = E5Action(
377 self.trUtf8('Step Over'),
364 UI.PixmapCache.getIcon("stepOver.png"), 378 UI.PixmapCache.getIcon("stepOver.png"),
365 self.trUtf8('Step &Over'), Qt.Key_F8, 0, 379 self.trUtf8('Step &Over'), Qt.Key_F8, 0,
366 self.debugActGrp, 'dbg_step_over') 380 self.debugActGrp, 'dbg_step_over')
367 act.setStatusTip(self.trUtf8( 381 act.setStatusTip(self.trUtf8(
368 """Execute a single Python statement staying""" 382 """Execute a single Python statement staying"""
376 """ has completed.</p>""" 390 """ has completed.</p>"""
377 )) 391 ))
378 act.triggered[()].connect(self.__stepOver) 392 act.triggered[()].connect(self.__stepOver)
379 self.actions.append(act) 393 self.actions.append(act)
380 394
381 act = E5Action(self.trUtf8('Step Out'), 395 act = E5Action(
396 self.trUtf8('Step Out'),
382 UI.PixmapCache.getIcon("stepOut.png"), 397 UI.PixmapCache.getIcon("stepOut.png"),
383 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0, 398 self.trUtf8('Step Ou&t'), Qt.Key_F9, 0,
384 self.debugActGrp, 'dbg_step_out') 399 self.debugActGrp, 'dbg_step_out')
385 act.setStatusTip(self.trUtf8( 400 act.setStatusTip(self.trUtf8(
386 """Execute Python statements until leaving""" 401 """Execute Python statements until leaving"""
394 """ current frame has been left.</p>""" 409 """ current frame has been left.</p>"""
395 )) 410 ))
396 act.triggered[()].connect(self.__stepOut) 411 act.triggered[()].connect(self.__stepOut)
397 self.actions.append(act) 412 self.actions.append(act)
398 413
399 act = E5Action(self.trUtf8('Stop'), 414 act = E5Action(
415 self.trUtf8('Stop'),
400 UI.PixmapCache.getIcon("stepQuit.png"), 416 UI.PixmapCache.getIcon("stepQuit.png"),
401 self.trUtf8('&Stop'), Qt.Key_F10, 0, 417 self.trUtf8('&Stop'), Qt.Key_F10, 0,
402 self.debugActGrp, 'dbg_stop') 418 self.debugActGrp, 'dbg_stop')
403 act.setStatusTip(self.trUtf8('Stop debugging')) 419 act.setStatusTip(self.trUtf8('Stop debugging'))
404 act.setWhatsThis(self.trUtf8( 420 act.setWhatsThis(self.trUtf8(
408 act.triggered[()].connect(self.__stepQuit) 424 act.triggered[()].connect(self.__stepQuit)
409 self.actions.append(act) 425 self.actions.append(act)
410 426
411 self.debugActGrp2 = createActionGroup(self) 427 self.debugActGrp2 = createActionGroup(self)
412 428
413 act = E5Action(self.trUtf8('Evaluate'), 429 act = E5Action(
430 self.trUtf8('Evaluate'),
414 self.trUtf8('E&valuate...'), 431 self.trUtf8('E&valuate...'),
415 0, 0, self.debugActGrp2, 'dbg_evaluate') 432 0, 0, self.debugActGrp2, 'dbg_evaluate')
416 act.setStatusTip(self.trUtf8('Evaluate in current context')) 433 act.setStatusTip(self.trUtf8('Evaluate in current context'))
417 act.setWhatsThis(self.trUtf8( 434 act.setWhatsThis(self.trUtf8(
418 """<b>Evaluate</b>""" 435 """<b>Evaluate</b>"""
421 """ shell window.</p>""" 438 """ shell window.</p>"""
422 )) 439 ))
423 act.triggered[()].connect(self.__eval) 440 act.triggered[()].connect(self.__eval)
424 self.actions.append(act) 441 self.actions.append(act)
425 442
426 act = E5Action(self.trUtf8('Execute'), 443 act = E5Action(
427 self.trUtf8('E&xecute...'), 444 self.trUtf8('Execute'),
428 0, 0, self.debugActGrp2, 'dbg_execute') 445 self.trUtf8('E&xecute...'),
446 0, 0, self.debugActGrp2, 'dbg_execute')
429 act.setStatusTip( 447 act.setStatusTip(
430 self.trUtf8('Execute a one line statement in the current context')) 448 self.trUtf8('Execute a one line statement in the current context'))
431 act.setWhatsThis(self.trUtf8( 449 act.setWhatsThis(self.trUtf8(
432 """<b>Execute</b>""" 450 """<b>Execute</b>"""
433 """<p>Execute a one line statement in the current context""" 451 """<p>Execute a one line statement in the current context"""
434 """ of the debugged program.</p>""" 452 """ of the debugged program.</p>"""
435 )) 453 ))
436 act.triggered[()].connect(self.__exec) 454 act.triggered[()].connect(self.__exec)
437 self.actions.append(act) 455 self.actions.append(act)
438 456
439 self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'), 457 self.dbgFilterAct = E5Action(
458 self.trUtf8('Variables Type Filter'),
440 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self, 459 self.trUtf8('Varia&bles Type Filter...'), 0, 0, self,
441 'dbg_variables_filter') 460 'dbg_variables_filter')
442 self.dbgFilterAct.setStatusTip(self.trUtf8( 461 self.dbgFilterAct.setStatusTip(self.trUtf8(
443 'Configure variables type filter')) 462 'Configure variables type filter'))
444 self.dbgFilterAct.setWhatsThis(self.trUtf8( 463 self.dbgFilterAct.setWhatsThis(self.trUtf8(
449 )) 468 ))
450 self.dbgFilterAct.triggered[()].connect( 469 self.dbgFilterAct.triggered[()].connect(
451 self.__configureVariablesFilters) 470 self.__configureVariablesFilters)
452 self.actions.append(self.dbgFilterAct) 471 self.actions.append(self.dbgFilterAct)
453 472
454 self.excFilterAct = E5Action(self.trUtf8('Exceptions Filter'), 473 self.excFilterAct = E5Action(
474 self.trUtf8('Exceptions Filter'),
455 self.trUtf8('&Exceptions Filter...'), 0, 0, self, 475 self.trUtf8('&Exceptions Filter...'), 0, 0, self,
456 'dbg_exceptions_filter') 476 'dbg_exceptions_filter')
457 self.excFilterAct.setStatusTip(self.trUtf8( 477 self.excFilterAct.setStatusTip(self.trUtf8(
458 'Configure exceptions filter')) 478 'Configure exceptions filter'))
459 self.excFilterAct.setWhatsThis(self.trUtf8( 479 self.excFilterAct.setWhatsThis(self.trUtf8(
465 )) 485 ))
466 self.excFilterAct.triggered[()].connect( 486 self.excFilterAct.triggered[()].connect(
467 self.__configureExceptionsFilter) 487 self.__configureExceptionsFilter)
468 self.actions.append(self.excFilterAct) 488 self.actions.append(self.excFilterAct)
469 489
470 self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'), 490 self.excIgnoreFilterAct = E5Action(
471 self.trUtf8('&Ignored Exceptions...'), 0, 0, 491 self.trUtf8('Ignored Exceptions'),
472 self, 'dbg_ignored_exceptions') 492 self.trUtf8('&Ignored Exceptions...'), 0, 0,
493 self, 'dbg_ignored_exceptions')
473 self.excIgnoreFilterAct.setStatusTip(self.trUtf8( 494 self.excIgnoreFilterAct.setStatusTip(self.trUtf8(
474 'Configure ignored exceptions')) 495 'Configure ignored exceptions'))
475 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8( 496 self.excIgnoreFilterAct.setWhatsThis(self.trUtf8(
476 """<b>Ignored Exceptions</b>""" 497 """<b>Ignored Exceptions</b>"""
477 """<p>Configure the ignored exceptions. Only exception types""" 498 """<p>Configure the ignored exceptions. Only exception types"""
483 self.__configureIgnoredExceptions) 504 self.__configureIgnoredExceptions)
484 self.actions.append(self.excIgnoreFilterAct) 505 self.actions.append(self.excIgnoreFilterAct)
485 506
486 self.dbgSetBpActGrp = createActionGroup(self) 507 self.dbgSetBpActGrp = createActionGroup(self)
487 508
488 self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'), 509 self.dbgToggleBpAct = E5Action(
510 self.trUtf8('Toggle Breakpoint'),
489 UI.PixmapCache.getIcon("breakpointToggle.png"), 511 UI.PixmapCache.getIcon("breakpointToggle.png"),
490 self.trUtf8('Toggle Breakpoint'), 512 self.trUtf8('Toggle Breakpoint'),
491 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")), 513 QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")),
492 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') 514 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint')
493 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint')) 515 self.dbgToggleBpAct.setStatusTip(self.trUtf8('Toggle Breakpoint'))
497 """ current editor.</p>""" 519 """ current editor.</p>"""
498 )) 520 ))
499 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint) 521 self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint)
500 self.actions.append(self.dbgToggleBpAct) 522 self.actions.append(self.dbgToggleBpAct)
501 523
502 self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'), 524 self.dbgEditBpAct = E5Action(
525 self.trUtf8('Edit Breakpoint'),
503 UI.PixmapCache.getIcon("cBreakpointToggle.png"), 526 UI.PixmapCache.getIcon("cBreakpointToggle.png"),
504 self.trUtf8('Edit Breakpoint...'), 527 self.trUtf8('Edit Breakpoint...'),
505 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0, 528 QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0,
506 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') 529 self.dbgSetBpActGrp, 'dbg_edit_breakpoint')
507 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint')) 530 self.dbgEditBpAct.setStatusTip(self.trUtf8('Edit Breakpoint'))
511 """ It works at the current line of the current editor.</p>""" 534 """ It works at the current line of the current editor.</p>"""
512 )) 535 ))
513 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint) 536 self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint)
514 self.actions.append(self.dbgEditBpAct) 537 self.actions.append(self.dbgEditBpAct)
515 538
516 self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'), 539 self.dbgNextBpAct = E5Action(
540 self.trUtf8('Next Breakpoint'),
517 UI.PixmapCache.getIcon("breakpointNext.png"), 541 UI.PixmapCache.getIcon("breakpointNext.png"),
518 self.trUtf8('Next Breakpoint'), 542 self.trUtf8('Next Breakpoint'),
519 QKeySequence( 543 QKeySequence(
520 self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0, 544 self.trUtf8("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0,
521 self.dbgSetBpActGrp, 'dbg_next_breakpoint') 545 self.dbgSetBpActGrp, 'dbg_next_breakpoint')
525 """<p>Go to next breakpoint of the current editor.</p>""" 549 """<p>Go to next breakpoint of the current editor.</p>"""
526 )) 550 ))
527 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint) 551 self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint)
528 self.actions.append(self.dbgNextBpAct) 552 self.actions.append(self.dbgNextBpAct)
529 553
530 self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'), 554 self.dbgPrevBpAct = E5Action(
555 self.trUtf8('Previous Breakpoint'),
531 UI.PixmapCache.getIcon("breakpointPrevious.png"), 556 UI.PixmapCache.getIcon("breakpointPrevious.png"),
532 self.trUtf8('Previous Breakpoint'), 557 self.trUtf8('Previous Breakpoint'),
533 QKeySequence( 558 QKeySequence(
534 self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")), 559 self.trUtf8("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")),
535 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint') 560 0, self.dbgSetBpActGrp, 'dbg_previous_breakpoint')
539 """<p>Go to previous breakpoint of the current editor.</p>""" 564 """<p>Go to previous breakpoint of the current editor.</p>"""
540 )) 565 ))
541 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint) 566 self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint)
542 self.actions.append(self.dbgPrevBpAct) 567 self.actions.append(self.dbgPrevBpAct)
543 568
544 act = E5Action(self.trUtf8('Clear Breakpoints'), 569 act = E5Action(
570 self.trUtf8('Clear Breakpoints'),
545 self.trUtf8('Clear Breakpoints'), 571 self.trUtf8('Clear Breakpoints'),
546 QKeySequence( 572 QKeySequence(
547 self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0, 573 self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0,
548 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') 574 self.dbgSetBpActGrp, 'dbg_clear_breakpoint')
549 act.setStatusTip(self.trUtf8('Clear Breakpoints')) 575 act.setStatusTip(self.trUtf8('Clear Breakpoints'))
891 # Just save the 10 most recent entries 917 # Just save the 10 most recent entries
892 del self.argvHistory[10:] 918 del self.argvHistory[10:]
893 del self.wdHistory[10:] 919 del self.wdHistory[10:]
894 del self.envHistory[10:] 920 del self.envHistory[10:]
895 921
896 Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory', 922 Preferences.Prefs.settings.setValue(
897 self.argvHistory) 923 'DebugInfo/ArgumentsHistory', self.argvHistory)
898 Preferences.Prefs.settings.setValue( 924 Preferences.Prefs.settings.setValue(
899 'DebugInfo/WorkingDirectoryHistory', self.wdHistory) 925 'DebugInfo/WorkingDirectoryHistory', self.wdHistory)
900 Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory', 926 Preferences.Prefs.settings.setValue(
901 self.envHistory) 927 'DebugInfo/EnvironmentHistory', self.envHistory)
902 Preferences.Prefs.settings.setValue('DebugInfo/Exceptions', 928 Preferences.Prefs.settings.setValue(
903 self.excList) 929 'DebugInfo/Exceptions', self.excList)
904 Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions', 930 Preferences.Prefs.settings.setValue(
905 self.excIgnoreList) 931 'DebugInfo/IgnoredExceptions', self.excIgnoreList)
906 Preferences.Prefs.settings.setValue('DebugInfo/ReportExceptions', 932 Preferences.Prefs.settings.setValue(
907 self.exceptions) 933 'DebugInfo/ReportExceptions', self.exceptions)
908 Preferences.Prefs.settings.setValue('DebugInfo/AutoClearShell', 934 Preferences.Prefs.settings.setValue(
909 self.autoClearShell) 935 'DebugInfo/AutoClearShell', self.autoClearShell)
910 Preferences.Prefs.settings.setValue('DebugInfo/TracePython', 936 Preferences.Prefs.settings.setValue(
911 self.tracePython) 937 'DebugInfo/TracePython', self.tracePython)
912 Preferences.Prefs.settings.setValue('DebugInfo/AutoContinue', 938 Preferences.Prefs.settings.setValue(
913 self.autoContinue) 939 'DebugInfo/AutoContinue', self.autoContinue)
914 Preferences.Prefs.settings.setValue('DebugInfo/ForkAutomatically', 940 Preferences.Prefs.settings.setValue(
915 self.forkAutomatically) 941 'DebugInfo/ForkAutomatically', self.forkAutomatically)
916 Preferences.Prefs.settings.setValue('DebugInfo/ForkIntoChild', 942 Preferences.Prefs.settings.setValue(
917 self.forkIntoChild) 943 'DebugInfo/ForkIntoChild', self.forkIntoChild)
918 944
919 def shutdownServer(self): 945 def shutdownServer(self):
920 """ 946 """
921 Public method to shut down the debug server. 947 Public method to shut down the debug server.
922 948
1078 return 1104 return
1079 1105
1080 if (self.exceptions and \ 1106 if (self.exceptions and \
1081 exceptionType not in self.excIgnoreList and \ 1107 exceptionType not in self.excIgnoreList and \
1082 (not len(self.excList) or \ 1108 (not len(self.excList) or \
1083 (len(self.excList) and exceptionType in self.excList)))\ 1109 (len(self.excList) and exceptionType in self.excList)))\
1084 or exceptionType.startswith('unhandled'): 1110 or exceptionType.startswith('unhandled'):
1085 res = None 1111 res = None
1086 if stackTrace: 1112 if stackTrace:
1087 try: 1113 try:
1088 file, line = stackTrace[0][:2] 1114 file, line = stackTrace[0][:2]
1254 return 1280 return
1255 1281
1256 fn, line, cond, temp, enabled, count = bp[:6] 1282 fn, line, cond, temp, enabled, count = bp[:6]
1257 1283
1258 from .EditBreakpointDialog import EditBreakpointDialog 1284 from .EditBreakpointDialog import EditBreakpointDialog
1259 dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count), 1285 dlg = EditBreakpointDialog(
1286 (fn, line), (cond, temp, enabled, count),
1260 [], self.ui, modal=True) 1287 [], self.ui, modal=True)
1261 if dlg.exec_() == QDialog.Accepted: 1288 if dlg.exec_() == QDialog.Accepted:
1262 cond, temp, enabled, count = dlg.getData() 1289 cond, temp, enabled, count = dlg.getData()
1263 model.setBreakPointByIndex(index, fn, line, 1290 model.setBreakPointByIndex(index, fn, line,
1264 (cond, temp, enabled, count)) 1291 (cond, temp, enabled, count))
1303 if not special: 1330 if not special:
1304 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1331 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1305 """ already exists.</p>""")\ 1332 """ already exists.</p>""")\
1306 .format(Utilities.html_encode(cond)) 1333 .format(Utilities.html_encode(cond))
1307 else: 1334 else:
1308 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1335 msg = self.trUtf8(
1309 """ for the variable <b>{1}</b> already""" 1336 """<p>A watch expression '<b>{0}</b>'"""
1310 """ exists.</p>""")\ 1337 """ for the variable <b>{1}</b> already"""
1311 .format(special, 1338 """ exists.</p>""")\
1312 Utilities.html_encode(cond)) 1339 .format(special,
1340 Utilities.html_encode(cond))
1313 E5MessageBox.warning( 1341 E5MessageBox.warning(
1314 self.ui, 1342 self.ui,
1315 self.trUtf8("Watch expression already exists"), 1343 self.trUtf8("Watch expression already exists"),
1316 msg) 1344 msg)
1317 model.deleteWatchPointByIndex(index) 1345 model.deleteWatchPointByIndex(index)
1460 # exception reporting flag. 1488 # exception reporting flag.
1461 if runProject: 1489 if runProject:
1462 cap = self.trUtf8("Coverage of Project") 1490 cap = self.trUtf8("Coverage of Project")
1463 else: 1491 else:
1464 cap = self.trUtf8("Coverage of Script") 1492 cap = self.trUtf8("Coverage of Script")
1465 dlg = StartDialog(cap, self.argvHistory, self.wdHistory, 1493 dlg = StartDialog(
1494 cap, self.argvHistory, self.wdHistory,
1466 self.envHistory, self.exceptions, self.ui, 2, 1495 self.envHistory, self.exceptions, self.ui, 2,
1467 autoClearShell=self.autoClearShell) 1496 autoClearShell=self.autoClearShell)
1468 if dlg.exec_() == QDialog.Accepted: 1497 if dlg.exec_() == QDialog.Accepted:
1469 argv, wd, env, exceptions, clearShell, clearHistories, console = \ 1498 argv, wd, env, exceptions, clearShell, clearHistories, console = \
1470 dlg.getData() 1499 dlg.getData()
1474 fn = self.project.getMainScript(1) 1503 fn = self.project.getMainScript(1)
1475 if fn is None: 1504 if fn is None:
1476 E5MessageBox.critical( 1505 E5MessageBox.critical(
1477 self.ui, 1506 self.ui,
1478 self.trUtf8("Coverage of Project"), 1507 self.trUtf8("Coverage of Project"),
1479 self.trUtf8("There is no main script defined for the" 1508 self.trUtf8(
1509 "There is no main script defined for the"
1480 " current project. Aborting")) 1510 " current project. Aborting"))
1481 return 1511 return
1482 1512
1483 if Preferences.getDebugger("Autosave") and \ 1513 if Preferences.getDebugger("Autosave") and \
1484 not self.project.saveAllScripts(reportSyntaxErrors=True): 1514 not self.project.saveAllScripts(reportSyntaxErrors=True):
1536 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1566 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1537 1567
1538 self.debugViewer.initCallStackViewer(runProject) 1568 self.debugViewer.initCallStackViewer(runProject)
1539 1569
1540 # Ask the client to open the new program. 1570 # Ask the client to open the new program.
1541 self.debugServer.remoteCoverage(fn, argv, wd, env, 1571 self.debugServer.remoteCoverage(
1572 fn, argv, wd, env,
1542 autoClearShell=self.autoClearShell, erase=eraseCoverage, 1573 autoClearShell=self.autoClearShell, erase=eraseCoverage,
1543 forProject=runProject, runInConsole=console, 1574 forProject=runProject, runInConsole=console,
1544 clientType=self.clientType) 1575 clientType=self.clientType)
1545 1576
1546 self.stopAct.setEnabled(True) 1577 self.stopAct.setEnabled(True)
1589 fn = self.project.getMainScript(1) 1620 fn = self.project.getMainScript(1)
1590 if fn is None: 1621 if fn is None:
1591 E5MessageBox.critical( 1622 E5MessageBox.critical(
1592 self.ui, 1623 self.ui,
1593 self.trUtf8("Profile of Project"), 1624 self.trUtf8("Profile of Project"),
1594 self.trUtf8("There is no main script defined for the" 1625 self.trUtf8(
1626 "There is no main script defined for the"
1595 " current project. Aborting")) 1627 " current project. Aborting"))
1596 return 1628 return
1597 1629
1598 if Preferences.getDebugger("Autosave") and \ 1630 if Preferences.getDebugger("Autosave") and \
1599 not self.project.saveAllScripts(reportSyntaxErrors=True): 1631 not self.project.saveAllScripts(reportSyntaxErrors=True):
1651 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1683 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1652 1684
1653 self.debugViewer.initCallStackViewer(runProject) 1685 self.debugViewer.initCallStackViewer(runProject)
1654 1686
1655 # Ask the client to open the new program. 1687 # Ask the client to open the new program.
1656 self.debugServer.remoteProfile(fn, argv, wd, env, 1688 self.debugServer.remoteProfile(
1689 fn, argv, wd, env,
1657 autoClearShell=self.autoClearShell, erase=eraseTimings, 1690 autoClearShell=self.autoClearShell, erase=eraseTimings,
1658 forProject=runProject, runInConsole=console, 1691 forProject=runProject, runInConsole=console,
1659 clientType=self.clientType) 1692 clientType=self.clientType)
1660 1693
1661 self.stopAct.setEnabled(True) 1694 self.stopAct.setEnabled(True)
1706 fn = self.project.getMainScript(1) 1739 fn = self.project.getMainScript(1)
1707 if fn is None: 1740 if fn is None:
1708 E5MessageBox.critical( 1741 E5MessageBox.critical(
1709 self.ui, 1742 self.ui,
1710 self.trUtf8("Run Project"), 1743 self.trUtf8("Run Project"),
1711 self.trUtf8("There is no main script defined for the" 1744 self.trUtf8(
1745 "There is no main script defined for the"
1712 " current project. Aborting")) 1746 " current project. Aborting"))
1713 return 1747 return
1714 1748
1715 if Preferences.getDebugger("Autosave") and \ 1749 if Preferences.getDebugger("Autosave") and \
1716 not self.project.saveAllScripts(reportSyntaxErrors=True): 1750 not self.project.saveAllScripts(reportSyntaxErrors=True):
1769 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1803 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1770 1804
1771 self.debugViewer.initCallStackViewer(runProject) 1805 self.debugViewer.initCallStackViewer(runProject)
1772 1806
1773 # Ask the client to open the new program. 1807 # Ask the client to open the new program.
1774 self.debugServer.remoteRun(fn, argv, wd, env, 1808 self.debugServer.remoteRun(
1809 fn, argv, wd, env,
1775 autoClearShell=self.autoClearShell, forProject=runProject, 1810 autoClearShell=self.autoClearShell, forProject=runProject,
1776 runInConsole=console, autoFork=forkAutomatically, 1811 runInConsole=console, autoFork=forkAutomatically,
1777 forkChild=forkIntoChild, clientType=self.clientType) 1812 forkChild=forkIntoChild, clientType=self.clientType)
1778 1813
1779 self.stopAct.setEnabled(True) 1814 self.stopAct.setEnabled(True)
1824 fn = self.project.getMainScript(True) 1859 fn = self.project.getMainScript(True)
1825 if fn is None: 1860 if fn is None:
1826 E5MessageBox.critical( 1861 E5MessageBox.critical(
1827 self.ui, 1862 self.ui,
1828 self.trUtf8("Debug Project"), 1863 self.trUtf8("Debug Project"),
1829 self.trUtf8("There is no main script defined for the" 1864 self.trUtf8(
1865 "There is no main script defined for the"
1830 " current project. No debugging possible.")) 1866 " current project. No debugging possible."))
1831 return 1867 return
1832 1868
1833 if Preferences.getDebugger("Autosave") and \ 1869 if Preferences.getDebugger("Autosave") and \
1834 not self.project.saveAllScripts(reportSyntaxErrors=True): 1870 not self.project.saveAllScripts(reportSyntaxErrors=True):
1901 enableCallTrace = self.debugViewer.isCallTraceEnabled() 1937 enableCallTrace = self.debugViewer.isCallTraceEnabled()
1902 self.debugViewer.clearCallTrace() 1938 self.debugViewer.clearCallTrace()
1903 self.debugViewer.setCallTraceToProjectMode(debugProject) 1939 self.debugViewer.setCallTraceToProjectMode(debugProject)
1904 1940
1905 # Ask the client to open the new program. 1941 # Ask the client to open the new program.
1906 self.debugServer.remoteLoad(fn, argv, wd, env, 1942 self.debugServer.remoteLoad(
1943 fn, argv, wd, env,
1907 autoClearShell=self.autoClearShell, 1944 autoClearShell=self.autoClearShell,
1908 tracePython=tracePython, 1945 tracePython=tracePython,
1909 autoContinue=autoContinue, forProject=debugProject, 1946 autoContinue=autoContinue, forProject=debugProject,
1910 runInConsole=console, autoFork=forkAutomatically, 1947 runInConsole=console, autoFork=forkAutomatically,
1911 forkChild=forkIntoChild, clientType=self.clientType, 1948 forkChild=forkIntoChild, clientType=self.clientType,
1926 1963
1927 # first save any changes 1964 # first save any changes
1928 if self.lastStartAction in [1, 3, 5, 7, 9]: 1965 if self.lastStartAction in [1, 3, 5, 7, 9]:
1929 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile) 1966 editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile)
1930 if editor and \ 1967 if editor and \
1931 not self.viewmanager.checkDirty(editor, 1968 not self.viewmanager.checkDirty(
1932 Preferences.getDebugger("Autosave")): 1969 editor, Preferences.getDebugger("Autosave")):
1933 return 1970 return
1934 forProject = False 1971 forProject = False
1935 elif self.lastStartAction in [2, 4, 6, 8, 10]: 1972 elif self.lastStartAction in [2, 4, 6, 8, 10]:
1936 if Preferences.getDebugger("Autosave") and \ 1973 if Preferences.getDebugger("Autosave") and \
1937 not self.project.saveAllScripts(reportSyntaxErrors=True): 1974 not self.project.saveAllScripts(reportSyntaxErrors=True):
2095 """ 2132 """
2096 self.lastAction = 0 2133 self.lastAction = 0
2097 aw = self.viewmanager.activeWindow() 2134 aw = self.viewmanager.activeWindow()
2098 line = aw.getCursorPosition()[0] + 1 2135 line = aw.getCursorPosition()[0] + 1
2099 self.__enterRemote() 2136 self.__enterRemote()
2100 self.debugServer.remoteBreakpoint(aw.getFileName(), 2137 self.debugServer.remoteBreakpoint(
2101 line, 1, None, 1) 2138 aw.getFileName(), line, 1, None, 1)
2102 self.debugServer.remoteContinue() 2139 self.debugServer.remoteContinue()
2103 2140
2104 def __eval(self): 2141 def __eval(self):
2105 """ 2142 """
2106 Private method to handle the Eval action. 2143 Private method to handle the Eval action.

eric ide

mercurial