13 |
13 |
14 from PyQt6.QtCore import pyqtSignal, pyqtSlot, QObject, Qt, QKeyCombination |
14 from PyQt6.QtCore import pyqtSignal, pyqtSlot, QObject, Qt, QKeyCombination |
15 from PyQt6.QtGui import QKeySequence |
15 from PyQt6.QtGui import QKeySequence |
16 from PyQt6.QtWidgets import QMenu, QToolBar, QApplication, QDialog |
16 from PyQt6.QtWidgets import QMenu, QToolBar, QApplication, QDialog |
17 |
17 |
18 from E5Gui.E5Action import E5Action, createActionGroup |
18 from E5Gui.EricAction import EricAction, createActionGroup |
19 from E5Gui import E5MessageBox |
19 from E5Gui import EricMessageBox |
20 |
20 |
21 from UI.Info import Program |
21 from UI.Info import Program |
22 from UI.NotificationWidget import NotificationTypes |
22 from UI.NotificationWidget import NotificationTypes |
23 |
23 |
24 from .DebugClientCapabilities import ( |
24 from .DebugClientCapabilities import ( |
203 """ |
203 """ |
204 Public method defining the user interface actions. |
204 Public method defining the user interface actions. |
205 """ |
205 """ |
206 self.actions = [] |
206 self.actions = [] |
207 |
207 |
208 self.runAct = E5Action( |
208 self.runAct = EricAction( |
209 self.tr('Run Script'), |
209 self.tr('Run Script'), |
210 UI.PixmapCache.getIcon("runScript"), |
210 UI.PixmapCache.getIcon("runScript"), |
211 self.tr('&Run Script...'), |
211 self.tr('&Run Script...'), |
212 Qt.Key.Key_F2, 0, self, 'dbg_run_script') |
212 Qt.Key.Key_F2, 0, self, 'dbg_run_script') |
213 self.runAct.setStatusTip(self.tr('Run the current Script')) |
213 self.runAct.setStatusTip(self.tr('Run the current Script')) |
218 """ saved first.</p>""" |
218 """ saved first.</p>""" |
219 )) |
219 )) |
220 self.runAct.triggered.connect(self.__runScript) |
220 self.runAct.triggered.connect(self.__runScript) |
221 self.actions.append(self.runAct) |
221 self.actions.append(self.runAct) |
222 |
222 |
223 self.runProjectAct = E5Action( |
223 self.runProjectAct = EricAction( |
224 self.tr('Run Project'), |
224 self.tr('Run Project'), |
225 UI.PixmapCache.getIcon("runProject"), |
225 UI.PixmapCache.getIcon("runProject"), |
226 self.tr('Run &Project...'), |
226 self.tr('Run &Project...'), |
227 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F2), |
227 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F2), |
228 0, self, 'dbg_run_project') |
228 0, self, 'dbg_run_project') |
235 """ may be saved first.</p>""" |
235 """ may be saved first.</p>""" |
236 )) |
236 )) |
237 self.runProjectAct.triggered.connect(self.__runProject) |
237 self.runProjectAct.triggered.connect(self.__runProject) |
238 self.actions.append(self.runProjectAct) |
238 self.actions.append(self.runProjectAct) |
239 |
239 |
240 self.coverageAct = E5Action( |
240 self.coverageAct = EricAction( |
241 self.tr('Coverage run of Script'), |
241 self.tr('Coverage run of Script'), |
242 UI.PixmapCache.getIcon("coverageScript"), |
242 UI.PixmapCache.getIcon("coverageScript"), |
243 self.tr('Coverage run of Script...'), 0, 0, self, |
243 self.tr('Coverage run of Script...'), 0, 0, self, |
244 'dbg_coverage_script') |
244 'dbg_coverage_script') |
245 self.coverageAct.setStatusTip( |
245 self.coverageAct.setStatusTip( |
251 """ unsaved changes it may be saved first.</p>""" |
251 """ unsaved changes it may be saved first.</p>""" |
252 )) |
252 )) |
253 self.coverageAct.triggered.connect(self.__coverageScript) |
253 self.coverageAct.triggered.connect(self.__coverageScript) |
254 self.actions.append(self.coverageAct) |
254 self.actions.append(self.coverageAct) |
255 |
255 |
256 self.coverageProjectAct = E5Action( |
256 self.coverageProjectAct = EricAction( |
257 self.tr('Coverage run of Project'), |
257 self.tr('Coverage run of Project'), |
258 UI.PixmapCache.getIcon("coverageProject"), |
258 UI.PixmapCache.getIcon("coverageProject"), |
259 self.tr('Coverage run of Project...'), 0, 0, self, |
259 self.tr('Coverage run of Project...'), 0, 0, self, |
260 'dbg_coverage_project') |
260 'dbg_coverage_project') |
261 self.coverageProjectAct.setStatusTip( |
261 self.coverageProjectAct.setStatusTip( |
268 """ they may be saved first.</p>""" |
268 """ they may be saved first.</p>""" |
269 )) |
269 )) |
270 self.coverageProjectAct.triggered.connect(self.__coverageProject) |
270 self.coverageProjectAct.triggered.connect(self.__coverageProject) |
271 self.actions.append(self.coverageProjectAct) |
271 self.actions.append(self.coverageProjectAct) |
272 |
272 |
273 self.profileAct = E5Action( |
273 self.profileAct = EricAction( |
274 self.tr('Profile Script'), |
274 self.tr('Profile Script'), |
275 UI.PixmapCache.getIcon("profileScript"), |
275 UI.PixmapCache.getIcon("profileScript"), |
276 self.tr('Profile Script...'), 0, 0, self, 'dbg_profile_script') |
276 self.tr('Profile Script...'), 0, 0, self, 'dbg_profile_script') |
277 self.profileAct.setStatusTip(self.tr('Profile the current Script')) |
277 self.profileAct.setStatusTip(self.tr('Profile the current Script')) |
278 self.profileAct.setWhatsThis(self.tr( |
278 self.profileAct.setWhatsThis(self.tr( |
281 """ If the file has unsaved changes it may be saved first.</p>""" |
281 """ If the file has unsaved changes it may be saved first.</p>""" |
282 )) |
282 )) |
283 self.profileAct.triggered.connect(self.__profileScript) |
283 self.profileAct.triggered.connect(self.__profileScript) |
284 self.actions.append(self.profileAct) |
284 self.actions.append(self.profileAct) |
285 |
285 |
286 self.profileProjectAct = E5Action( |
286 self.profileProjectAct = EricAction( |
287 self.tr('Profile Project'), |
287 self.tr('Profile Project'), |
288 UI.PixmapCache.getIcon("profileProject"), |
288 UI.PixmapCache.getIcon("profileProject"), |
289 self.tr('Profile Project...'), 0, 0, self, |
289 self.tr('Profile Project...'), 0, 0, self, |
290 'dbg_profile_project') |
290 'dbg_profile_project') |
291 self.profileProjectAct.setStatusTip( |
291 self.profileProjectAct.setStatusTip( |
297 """ changes they may be saved first.</p>""" |
297 """ changes they may be saved first.</p>""" |
298 )) |
298 )) |
299 self.profileProjectAct.triggered.connect(self.__profileProject) |
299 self.profileProjectAct.triggered.connect(self.__profileProject) |
300 self.actions.append(self.profileProjectAct) |
300 self.actions.append(self.profileProjectAct) |
301 |
301 |
302 self.debugAct = E5Action( |
302 self.debugAct = EricAction( |
303 self.tr('Debug Script'), |
303 self.tr('Debug Script'), |
304 UI.PixmapCache.getIcon("debugScript"), |
304 UI.PixmapCache.getIcon("debugScript"), |
305 self.tr('&Debug Script...'), Qt.Key.Key_F5, 0, self, |
305 self.tr('&Debug Script...'), Qt.Key.Key_F5, 0, self, |
306 'dbg_debug_script') |
306 'dbg_debug_script') |
307 self.debugAct.setStatusTip(self.tr('Debug the current Script')) |
307 self.debugAct.setStatusTip(self.tr('Debug the current Script')) |
313 """ saved first.</p>""" |
313 """ saved first.</p>""" |
314 )) |
314 )) |
315 self.debugAct.triggered.connect(self.__debugScript) |
315 self.debugAct.triggered.connect(self.__debugScript) |
316 self.actions.append(self.debugAct) |
316 self.actions.append(self.debugAct) |
317 |
317 |
318 self.debugProjectAct = E5Action( |
318 self.debugProjectAct = EricAction( |
319 self.tr('Debug Project'), |
319 self.tr('Debug Project'), |
320 UI.PixmapCache.getIcon("debugProject"), |
320 UI.PixmapCache.getIcon("debugProject"), |
321 self.tr('Debug &Project...'), |
321 self.tr('Debug &Project...'), |
322 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F5), |
322 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F5), |
323 0, self, 'dbg_debug_project') |
323 0, self, 'dbg_debug_project') |
331 """ project have unsaved changes they may be saved first.</p>""" |
331 """ project have unsaved changes they may be saved first.</p>""" |
332 )) |
332 )) |
333 self.debugProjectAct.triggered.connect(self.__debugProject) |
333 self.debugProjectAct.triggered.connect(self.__debugProject) |
334 self.actions.append(self.debugProjectAct) |
334 self.actions.append(self.debugProjectAct) |
335 |
335 |
336 self.restartAct = E5Action( |
336 self.restartAct = EricAction( |
337 self.tr('Restart'), |
337 self.tr('Restart'), |
338 UI.PixmapCache.getIcon("debugRestart"), |
338 UI.PixmapCache.getIcon("debugRestart"), |
339 self.tr('Restart'), Qt.Key.Key_F4, 0, self, 'dbg_restart_script') |
339 self.tr('Restart'), Qt.Key.Key_F4, 0, self, 'dbg_restart_script') |
340 self.restartAct.setStatusTip(self.tr( |
340 self.restartAct.setStatusTip(self.tr( |
341 'Restart the last debugged script')) |
341 'Restart the last debugged script')) |
347 """ may be saved first.</p>""" |
347 """ may be saved first.</p>""" |
348 )) |
348 )) |
349 self.restartAct.triggered.connect(self.__doRestart) |
349 self.restartAct.triggered.connect(self.__doRestart) |
350 self.actions.append(self.restartAct) |
350 self.actions.append(self.restartAct) |
351 |
351 |
352 self.stopAct = E5Action( |
352 self.stopAct = EricAction( |
353 self.tr('Stop'), |
353 self.tr('Stop'), |
354 UI.PixmapCache.getIcon("stopScript"), |
354 UI.PixmapCache.getIcon("stopScript"), |
355 self.tr('Stop'), |
355 self.tr('Stop'), |
356 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F10), |
356 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F10), |
357 0, |
357 0, |
364 self.stopAct.triggered.connect(self.__stopScript) |
364 self.stopAct.triggered.connect(self.__stopScript) |
365 self.actions.append(self.stopAct) |
365 self.actions.append(self.stopAct) |
366 |
366 |
367 self.debugActGrp = createActionGroup(self) |
367 self.debugActGrp = createActionGroup(self) |
368 |
368 |
369 act = E5Action( |
369 act = EricAction( |
370 self.tr('Continue'), |
370 self.tr('Continue'), |
371 UI.PixmapCache.getIcon("continue"), |
371 UI.PixmapCache.getIcon("continue"), |
372 self.tr('&Continue'), Qt.Key.Key_F6, 0, |
372 self.tr('&Continue'), Qt.Key.Key_F6, 0, |
373 self.debugActGrp, 'dbg_continue') |
373 self.debugActGrp, 'dbg_continue') |
374 act.setStatusTip( |
374 act.setStatusTip( |
380 """ is reached.</p>""" |
380 """ is reached.</p>""" |
381 )) |
381 )) |
382 act.triggered.connect(self.__continue) |
382 act.triggered.connect(self.__continue) |
383 self.actions.append(act) |
383 self.actions.append(act) |
384 |
384 |
385 act = E5Action( |
385 act = EricAction( |
386 self.tr('Continue to Cursor'), |
386 self.tr('Continue to Cursor'), |
387 UI.PixmapCache.getIcon("continueToCursor"), |
387 UI.PixmapCache.getIcon("continueToCursor"), |
388 self.tr('Continue &To Cursor'), |
388 self.tr('Continue &To Cursor'), |
389 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F6), |
389 QKeyCombination(Qt.Modifier.SHIFT, Qt.Key.Key_F6), |
390 0, self.debugActGrp, 'dbg_continue_to_cursor') |
390 0, self.debugActGrp, 'dbg_continue_to_cursor') |
397 """ current cursor position.</p>""" |
397 """ current cursor position.</p>""" |
398 )) |
398 )) |
399 act.triggered.connect(self.__runToCursor) |
399 act.triggered.connect(self.__runToCursor) |
400 self.actions.append(act) |
400 self.actions.append(act) |
401 |
401 |
402 act = E5Action( |
402 act = EricAction( |
403 self.tr('Continue Until'), |
403 self.tr('Continue Until'), |
404 UI.PixmapCache.getIcon("continueUntil"), |
404 UI.PixmapCache.getIcon("continueUntil"), |
405 self.tr('Continue &Until'), |
405 self.tr('Continue &Until'), |
406 QKeyCombination(Qt.Modifier.CTRL, Qt.Key.Key_F6), |
406 QKeyCombination(Qt.Modifier.CTRL, Qt.Key.Key_F6), |
407 0, |
407 0, |
416 """ leaving the current frame.</p>""" |
416 """ leaving the current frame.</p>""" |
417 )) |
417 )) |
418 act.triggered.connect(self.__runUntil) |
418 act.triggered.connect(self.__runUntil) |
419 self.actions.append(act) |
419 self.actions.append(act) |
420 |
420 |
421 act = E5Action( |
421 act = EricAction( |
422 self.tr('Move Instruction Pointer to Cursor'), |
422 self.tr('Move Instruction Pointer to Cursor'), |
423 UI.PixmapCache.getIcon("moveInstructionPointer"), |
423 UI.PixmapCache.getIcon("moveInstructionPointer"), |
424 self.tr('&Jump To Cursor'), Qt.Key.Key_F12, 0, |
424 self.tr('&Jump To Cursor'), Qt.Key.Key_F12, 0, |
425 self.debugActGrp, 'dbg_jump_to_cursor') |
425 self.debugActGrp, 'dbg_jump_to_cursor') |
426 act.setStatusTip(self.tr( |
426 act.setStatusTip(self.tr( |
436 """ message is printed to the log window.</p>""" |
436 """ message is printed to the log window.</p>""" |
437 )) |
437 )) |
438 act.triggered.connect(self.__moveInstructionPointer) |
438 act.triggered.connect(self.__moveInstructionPointer) |
439 self.actions.append(act) |
439 self.actions.append(act) |
440 |
440 |
441 act = E5Action( |
441 act = EricAction( |
442 self.tr('Single Step'), |
442 self.tr('Single Step'), |
443 UI.PixmapCache.getIcon("step"), |
443 UI.PixmapCache.getIcon("step"), |
444 self.tr('Sin&gle Step'), Qt.Key.Key_F7, 0, |
444 self.tr('Sin&gle Step'), Qt.Key.Key_F7, 0, |
445 self.debugActGrp, 'dbg_single_step') |
445 self.debugActGrp, 'dbg_single_step') |
446 act.setStatusTip(self.tr('Execute a single Python statement')) |
446 act.setStatusTip(self.tr('Execute a single Python statement')) |
452 """ debugger at the next statement.</p>""" |
452 """ debugger at the next statement.</p>""" |
453 )) |
453 )) |
454 act.triggered.connect(self.__step) |
454 act.triggered.connect(self.__step) |
455 self.actions.append(act) |
455 self.actions.append(act) |
456 |
456 |
457 act = E5Action( |
457 act = EricAction( |
458 self.tr('Step Over'), |
458 self.tr('Step Over'), |
459 UI.PixmapCache.getIcon("stepOver"), |
459 UI.PixmapCache.getIcon("stepOver"), |
460 self.tr('Step &Over'), Qt.Key.Key_F8, 0, |
460 self.tr('Step &Over'), Qt.Key.Key_F8, 0, |
461 self.debugActGrp, 'dbg_step_over') |
461 self.debugActGrp, 'dbg_step_over') |
462 act.setStatusTip(self.tr( |
462 act.setStatusTip(self.tr( |
471 """ has completed.</p>""" |
471 """ has completed.</p>""" |
472 )) |
472 )) |
473 act.triggered.connect(self.__stepOver) |
473 act.triggered.connect(self.__stepOver) |
474 self.actions.append(act) |
474 self.actions.append(act) |
475 |
475 |
476 act = E5Action( |
476 act = EricAction( |
477 self.tr('Step Out'), |
477 self.tr('Step Out'), |
478 UI.PixmapCache.getIcon("stepOut"), |
478 UI.PixmapCache.getIcon("stepOut"), |
479 self.tr('Step Ou&t'), Qt.Key.Key_F9, 0, |
479 self.tr('Step Ou&t'), Qt.Key.Key_F9, 0, |
480 self.debugActGrp, 'dbg_step_out') |
480 self.debugActGrp, 'dbg_step_out') |
481 act.setStatusTip(self.tr( |
481 act.setStatusTip(self.tr( |
490 """ current frame has been left.</p>""" |
490 """ current frame has been left.</p>""" |
491 )) |
491 )) |
492 act.triggered.connect(self.__stepOut) |
492 act.triggered.connect(self.__stepOut) |
493 self.actions.append(act) |
493 self.actions.append(act) |
494 |
494 |
495 act = E5Action( |
495 act = EricAction( |
496 self.tr('Stop'), |
496 self.tr('Stop'), |
497 UI.PixmapCache.getIcon("stepQuit"), |
497 UI.PixmapCache.getIcon("stepQuit"), |
498 self.tr('&Stop'), Qt.Key.Key_F10, 0, |
498 self.tr('&Stop'), Qt.Key.Key_F10, 0, |
499 self.debugActGrp, 'dbg_stop') |
499 self.debugActGrp, 'dbg_stop') |
500 act.setStatusTip(self.tr('Stop debugging')) |
500 act.setStatusTip(self.tr('Stop debugging')) |
503 """<p>Stop the running debugging session.</p>""" |
503 """<p>Stop the running debugging session.</p>""" |
504 )) |
504 )) |
505 act.triggered.connect(self.__stepQuit) |
505 act.triggered.connect(self.__stepQuit) |
506 self.actions.append(act) |
506 self.actions.append(act) |
507 |
507 |
508 self.dbgFilterAct = E5Action( |
508 self.dbgFilterAct = EricAction( |
509 self.tr('Variables Type Filter'), |
509 self.tr('Variables Type Filter'), |
510 self.tr('Varia&bles Type Filter...'), 0, 0, self, |
510 self.tr('Varia&bles Type Filter...'), 0, 0, self, |
511 'dbg_variables_filter') |
511 'dbg_variables_filter') |
512 self.dbgFilterAct.setStatusTip(self.tr( |
512 self.dbgFilterAct.setStatusTip(self.tr( |
513 'Configure variables type filter')) |
513 'Configure variables type filter')) |
519 )) |
519 )) |
520 self.dbgFilterAct.triggered.connect( |
520 self.dbgFilterAct.triggered.connect( |
521 self.__configureVariablesFilters) |
521 self.__configureVariablesFilters) |
522 self.actions.append(self.dbgFilterAct) |
522 self.actions.append(self.dbgFilterAct) |
523 |
523 |
524 self.excFilterAct = E5Action( |
524 self.excFilterAct = EricAction( |
525 self.tr('Exceptions Filter'), |
525 self.tr('Exceptions Filter'), |
526 self.tr('&Exceptions Filter...'), 0, 0, self, |
526 self.tr('&Exceptions Filter...'), 0, 0, self, |
527 'dbg_exceptions_filter') |
527 'dbg_exceptions_filter') |
528 self.excFilterAct.setStatusTip(self.tr( |
528 self.excFilterAct.setStatusTip(self.tr( |
529 'Configure exceptions filter')) |
529 'Configure exceptions filter')) |
536 )) |
536 )) |
537 self.excFilterAct.triggered.connect( |
537 self.excFilterAct.triggered.connect( |
538 self.__configureExceptionsFilter) |
538 self.__configureExceptionsFilter) |
539 self.actions.append(self.excFilterAct) |
539 self.actions.append(self.excFilterAct) |
540 |
540 |
541 self.excIgnoreFilterAct = E5Action( |
541 self.excIgnoreFilterAct = EricAction( |
542 self.tr('Ignored Exceptions'), |
542 self.tr('Ignored Exceptions'), |
543 self.tr('&Ignored Exceptions...'), 0, 0, |
543 self.tr('&Ignored Exceptions...'), 0, 0, |
544 self, 'dbg_ignored_exceptions') |
544 self, 'dbg_ignored_exceptions') |
545 self.excIgnoreFilterAct.setStatusTip(self.tr( |
545 self.excIgnoreFilterAct.setStatusTip(self.tr( |
546 'Configure ignored exceptions')) |
546 'Configure ignored exceptions')) |
555 self.__configureIgnoredExceptions) |
555 self.__configureIgnoredExceptions) |
556 self.actions.append(self.excIgnoreFilterAct) |
556 self.actions.append(self.excIgnoreFilterAct) |
557 |
557 |
558 self.dbgSetBpActGrp = createActionGroup(self) |
558 self.dbgSetBpActGrp = createActionGroup(self) |
559 |
559 |
560 self.dbgToggleBpAct = E5Action( |
560 self.dbgToggleBpAct = EricAction( |
561 self.tr('Toggle Breakpoint'), |
561 self.tr('Toggle Breakpoint'), |
562 UI.PixmapCache.getIcon("breakpointToggle"), |
562 UI.PixmapCache.getIcon("breakpointToggle"), |
563 self.tr('Toggle Breakpoint'), |
563 self.tr('Toggle Breakpoint'), |
564 QKeySequence(self.tr("Shift+F11", "Debug|Toggle Breakpoint")), |
564 QKeySequence(self.tr("Shift+F11", "Debug|Toggle Breakpoint")), |
565 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') |
565 0, self.dbgSetBpActGrp, 'dbg_toggle_breakpoint') |
570 """ current editor.</p>""" |
570 """ current editor.</p>""" |
571 )) |
571 )) |
572 self.dbgToggleBpAct.triggered.connect(self.__toggleBreakpoint) |
572 self.dbgToggleBpAct.triggered.connect(self.__toggleBreakpoint) |
573 self.actions.append(self.dbgToggleBpAct) |
573 self.actions.append(self.dbgToggleBpAct) |
574 |
574 |
575 self.dbgEditBpAct = E5Action( |
575 self.dbgEditBpAct = EricAction( |
576 self.tr('Edit Breakpoint'), |
576 self.tr('Edit Breakpoint'), |
577 UI.PixmapCache.getIcon("cBreakpointToggle"), |
577 UI.PixmapCache.getIcon("cBreakpointToggle"), |
578 self.tr('Edit Breakpoint...'), |
578 self.tr('Edit Breakpoint...'), |
579 QKeySequence(self.tr("Shift+F12", "Debug|Edit Breakpoint")), 0, |
579 QKeySequence(self.tr("Shift+F12", "Debug|Edit Breakpoint")), 0, |
580 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') |
580 self.dbgSetBpActGrp, 'dbg_edit_breakpoint') |
585 """ It works at the current line of the current editor.</p>""" |
585 """ It works at the current line of the current editor.</p>""" |
586 )) |
586 )) |
587 self.dbgEditBpAct.triggered.connect(self.__editBreakpoint) |
587 self.dbgEditBpAct.triggered.connect(self.__editBreakpoint) |
588 self.actions.append(self.dbgEditBpAct) |
588 self.actions.append(self.dbgEditBpAct) |
589 |
589 |
590 self.dbgNextBpAct = E5Action( |
590 self.dbgNextBpAct = EricAction( |
591 self.tr('Next Breakpoint'), |
591 self.tr('Next Breakpoint'), |
592 UI.PixmapCache.getIcon("breakpointNext"), |
592 UI.PixmapCache.getIcon("breakpointNext"), |
593 self.tr('Next Breakpoint'), |
593 self.tr('Next Breakpoint'), |
594 QKeySequence( |
594 QKeySequence( |
595 self.tr("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0, |
595 self.tr("Ctrl+Shift+PgDown", "Debug|Next Breakpoint")), 0, |
600 """<p>Go to next breakpoint of the current editor.</p>""" |
600 """<p>Go to next breakpoint of the current editor.</p>""" |
601 )) |
601 )) |
602 self.dbgNextBpAct.triggered.connect(self.__nextBreakpoint) |
602 self.dbgNextBpAct.triggered.connect(self.__nextBreakpoint) |
603 self.actions.append(self.dbgNextBpAct) |
603 self.actions.append(self.dbgNextBpAct) |
604 |
604 |
605 self.dbgPrevBpAct = E5Action( |
605 self.dbgPrevBpAct = EricAction( |
606 self.tr('Previous Breakpoint'), |
606 self.tr('Previous Breakpoint'), |
607 UI.PixmapCache.getIcon("breakpointPrevious"), |
607 UI.PixmapCache.getIcon("breakpointPrevious"), |
608 self.tr('Previous Breakpoint'), |
608 self.tr('Previous Breakpoint'), |
609 QKeySequence( |
609 QKeySequence( |
610 self.tr("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")), |
610 self.tr("Ctrl+Shift+PgUp", "Debug|Previous Breakpoint")), |
615 """<p>Go to previous breakpoint of the current editor.</p>""" |
615 """<p>Go to previous breakpoint of the current editor.</p>""" |
616 )) |
616 )) |
617 self.dbgPrevBpAct.triggered.connect(self.__previousBreakpoint) |
617 self.dbgPrevBpAct.triggered.connect(self.__previousBreakpoint) |
618 self.actions.append(self.dbgPrevBpAct) |
618 self.actions.append(self.dbgPrevBpAct) |
619 |
619 |
620 act = E5Action( |
620 act = EricAction( |
621 self.tr('Clear Breakpoints'), |
621 self.tr('Clear Breakpoints'), |
622 self.tr('Clear Breakpoints'), |
622 self.tr('Clear Breakpoints'), |
623 0, 0, |
623 0, 0, |
624 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') |
624 self.dbgSetBpActGrp, 'dbg_clear_breakpoint') |
625 act.setStatusTip(self.tr('Clear Breakpoints')) |
625 act.setStatusTip(self.tr('Clear Breakpoints')) |
688 def initToolbars(self, toolbarManager): |
688 def initToolbars(self, toolbarManager): |
689 """ |
689 """ |
690 Public slot to initialize the debug toolbars. |
690 Public slot to initialize the debug toolbars. |
691 |
691 |
692 @param toolbarManager reference to a toolbar manager object |
692 @param toolbarManager reference to a toolbar manager object |
693 (E5ToolBarManager) |
693 (EricToolBarManager) |
694 @return the generated toolbars (list of QToolBar) |
694 @return the generated toolbars (list of QToolBar) |
695 """ |
695 """ |
696 starttb = QToolBar(self.tr("Start"), self.ui) |
696 starttb = QToolBar(self.tr("Start"), self.ui) |
697 starttb.setIconSize(UI.Config.ToolBarIconSize) |
697 starttb.setIconSize(UI.Config.ToolBarIconSize) |
698 starttb.setObjectName("StartToolbar") |
698 starttb.setObjectName("StartToolbar") |
1198 if ms is not None: |
1198 if ms is not None: |
1199 d = os.path.dirname(ms) |
1199 d = os.path.dirname(ms) |
1200 if os.path.exists(os.path.join(d, filename)): |
1200 if os.path.exists(os.path.join(d, filename)): |
1201 filename = os.path.join(d, filename) |
1201 filename = os.path.join(d, filename) |
1202 self.viewmanager.setFileLine(filename, lineNo, True, True) |
1202 self.viewmanager.setFileLine(filename, lineNo, True, True) |
1203 E5MessageBox.critical( |
1203 EricMessageBox.critical( |
1204 self.ui, Program, |
1204 self.ui, Program, |
1205 self.tr('<p>The file <b>{0}</b> contains the syntax error' |
1205 self.tr('<p>The file <b>{0}</b> contains the syntax error' |
1206 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.' |
1206 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.' |
1207 '</p>') |
1207 '</p>') |
1208 .format(filename, message, lineNo, characterNo)) |
1208 .format(filename, message, lineNo, characterNo)) |
1249 source[line - 1].strip()) |
1249 source[line - 1].strip()) |
1250 with contextlib.suppress(IndexError): |
1250 with contextlib.suppress(IndexError): |
1251 lineFlags += Utilities.extractLineFlags( |
1251 lineFlags += Utilities.extractLineFlags( |
1252 source[line].strip(), flagsLine=True) |
1252 source[line].strip(), flagsLine=True) |
1253 if "__IGNORE_EXCEPTION__" in lineFlags: |
1253 if "__IGNORE_EXCEPTION__" in lineFlags: |
1254 res = E5MessageBox.No |
1254 res = EricMessageBox.No |
1255 if res != E5MessageBox.No: |
1255 if res != EricMessageBox.No: |
1256 self.viewmanager.setFileLine( |
1256 self.viewmanager.setFileLine( |
1257 stackTrace[0][0], stackTrace[0][1], True) |
1257 stackTrace[0][0], stackTrace[0][1], True) |
1258 if res != E5MessageBox.No: |
1258 if res != EricMessageBox.No: |
1259 self.ui.activateWindow() |
1259 self.ui.activateWindow() |
1260 if Preferences.getDebugger("BreakAlways"): |
1260 if Preferences.getDebugger("BreakAlways"): |
1261 res = E5MessageBox.Yes |
1261 res = EricMessageBox.Yes |
1262 else: |
1262 else: |
1263 if stackTrace: |
1263 if stackTrace: |
1264 if exceptionType.startswith('unhandled'): |
1264 if exceptionType.startswith('unhandled'): |
1265 buttons = E5MessageBox.No | E5MessageBox.Yes |
1265 buttons = EricMessageBox.No | EricMessageBox.Yes |
1266 else: |
1266 else: |
1267 buttons = (E5MessageBox.No | |
1267 buttons = (EricMessageBox.No | |
1268 E5MessageBox.Yes | |
1268 EricMessageBox.Yes | |
1269 E5MessageBox.Ignore) |
1269 EricMessageBox.Ignore) |
1270 res = E5MessageBox.critical( |
1270 res = EricMessageBox.critical( |
1271 self.ui, Program, |
1271 self.ui, Program, |
1272 self.tr( |
1272 self.tr( |
1273 '<p>The debugged program raised the exception' |
1273 '<p>The debugged program raised the exception' |
1274 ' <b>{0}</b><br>"<b>{1}</b>"<br>' |
1274 ' <b>{0}</b><br>"<b>{1}</b>"<br>' |
1275 'File: <b>{2}</b>, Line: <b>{3}</b></p>' |
1275 'File: <b>{2}</b>, Line: <b>{3}</b></p>' |
1278 exceptionType, |
1278 exceptionType, |
1279 Utilities.html_encode(exceptionMessage), |
1279 Utilities.html_encode(exceptionMessage), |
1280 stackTrace[0][0], |
1280 stackTrace[0][0], |
1281 stackTrace[0][1]), |
1281 stackTrace[0][1]), |
1282 buttons, |
1282 buttons, |
1283 E5MessageBox.No) |
1283 EricMessageBox.No) |
1284 else: |
1284 else: |
1285 res = E5MessageBox.critical( |
1285 res = EricMessageBox.critical( |
1286 self.ui, Program, |
1286 self.ui, Program, |
1287 self.tr( |
1287 self.tr( |
1288 '<p>The debugged program raised the exception' |
1288 '<p>The debugged program raised the exception' |
1289 ' <b>{0}</b><br>"<b>{1}</b>"</p>') |
1289 ' <b>{0}</b><br>"<b>{1}</b>"</p>') |
1290 .format( |
1290 .format( |
1291 exceptionType, |
1291 exceptionType, |
1292 Utilities.html_encode(exceptionMessage))) |
1292 Utilities.html_encode(exceptionMessage))) |
1293 if res == E5MessageBox.Yes: |
1293 if res == EricMessageBox.Yes: |
1294 self.debugServer.setDebugging(True) |
1294 self.debugServer.setDebugging(True) |
1295 self.exceptionInterrupt.emit() |
1295 self.exceptionInterrupt.emit() |
1296 stack = [] |
1296 stack = [] |
1297 for fn, ln, func, args in stackTrace: |
1297 for fn, ln, func, args in stackTrace: |
1298 stack.append((fn, ln, func, args)) |
1298 stack.append((fn, ln, func, args)) |
1301 self.__getClientDisassembly(debuggerId) |
1301 self.__getClientDisassembly(debuggerId) |
1302 self.ui.setDebugProfile() |
1302 self.ui.setDebugProfile() |
1303 self.debugActGrp.setEnabled(True) |
1303 self.debugActGrp.setEnabled(True) |
1304 return |
1304 return |
1305 elif ( |
1305 elif ( |
1306 res == E5MessageBox.Ignore and |
1306 res == EricMessageBox.Ignore and |
1307 exceptionType not in self.excIgnoreList |
1307 exceptionType not in self.excIgnoreList |
1308 ): |
1308 ): |
1309 self.excIgnoreList.append(exceptionType) |
1309 self.excIgnoreList.append(exceptionType) |
1310 |
1310 |
1311 if self.lastAction != -1: |
1311 if self.lastAction != -1: |
1336 """ |
1336 """ |
1337 self.ui.raise_() |
1337 self.ui.raise_() |
1338 self.ui.activateWindow() |
1338 self.ui.activateWindow() |
1339 QApplication.processEvents() |
1339 QApplication.processEvents() |
1340 self.viewmanager.setFileLine(filename, lineNo, True) |
1340 self.viewmanager.setFileLine(filename, lineNo, True) |
1341 E5MessageBox.critical( |
1341 EricMessageBox.critical( |
1342 self.ui, Program, |
1342 self.ui, Program, |
1343 self.tr("""<p>The program generate the signal "{0}".<br/>""" |
1343 self.tr("""<p>The program generate the signal "{0}".<br/>""" |
1344 """File: <b>{1}</b>, Line: <b>{2}</b></p>""").format( |
1344 """File: <b>{1}</b>, Line: <b>{2}</b></p>""").format( |
1345 message, filename, lineNo)) |
1345 message, filename, lineNo)) |
1346 |
1346 |
1350 |
1350 |
1351 @param unplanned True if the client died, False otherwise |
1351 @param unplanned True if the client died, False otherwise |
1352 """ |
1352 """ |
1353 self.__resetUI() |
1353 self.__resetUI() |
1354 if unplanned: |
1354 if unplanned: |
1355 E5MessageBox.information( |
1355 EricMessageBox.information( |
1356 self.ui, Program, |
1356 self.ui, Program, |
1357 self.tr('The program being debugged has terminated' |
1357 self.tr('The program being debugged has terminated' |
1358 ' unexpectedly.')) |
1358 ' unexpectedly.')) |
1359 |
1359 |
1360 def __getThreadList(self, debuggerId): |
1360 def __getThreadList(self, debuggerId): |
1457 @param lineno line umber of the breakpoint |
1457 @param lineno line umber of the breakpoint |
1458 @type int |
1458 @type int |
1459 @param debuggerId ID of the debugger backend |
1459 @param debuggerId ID of the debugger backend |
1460 @type str |
1460 @type str |
1461 """ |
1461 """ |
1462 E5MessageBox.critical( |
1462 EricMessageBox.critical( |
1463 self.ui, |
1463 self.ui, |
1464 self.tr("Breakpoint Condition Error"), |
1464 self.tr("Breakpoint Condition Error"), |
1465 self.tr( |
1465 self.tr( |
1466 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" |
1466 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" |
1467 """ contains a syntax error.</p>""") |
1467 """ contains a syntax error.</p>""") |
1496 @param cond expression of the watch expression |
1496 @param cond expression of the watch expression |
1497 @type str |
1497 @type str |
1498 @param debuggerId ID of the debugger backend |
1498 @param debuggerId ID of the debugger backend |
1499 @type str |
1499 @type str |
1500 """ |
1500 """ |
1501 E5MessageBox.critical( |
1501 EricMessageBox.critical( |
1502 self.ui, |
1502 self.ui, |
1503 self.tr("Watch Expression Error"), |
1503 self.tr("Watch Expression Error"), |
1504 self.tr("""<p>The watch expression <b>{0}</b>""" |
1504 self.tr("""<p>The watch expression <b>{0}</b>""" |
1505 """ contains a syntax error.</p>""") |
1505 """ contains a syntax error.</p>""") |
1506 .format(cond)) |
1506 .format(cond)) |
1536 msg = self.tr( |
1536 msg = self.tr( |
1537 """<p>A watch expression '<b>{0}</b>'""" |
1537 """<p>A watch expression '<b>{0}</b>'""" |
1538 """ for the variable <b>{1}</b> already""" |
1538 """ for the variable <b>{1}</b> already""" |
1539 """ exists.</p>""" |
1539 """ exists.</p>""" |
1540 ).format(special, Utilities.html_encode(cond)) |
1540 ).format(special, Utilities.html_encode(cond)) |
1541 E5MessageBox.warning( |
1541 EricMessageBox.warning( |
1542 self.ui, |
1542 self.ui, |
1543 self.tr("Watch expression already exists"), |
1543 self.tr("Watch expression already exists"), |
1544 msg) |
1544 msg) |
1545 model.deleteWatchPointByIndex(index) |
1545 model.deleteWatchPointByIndex(index) |
1546 else: |
1546 else: |
1705 eraseCoverage = dlg.getCoverageData() |
1705 eraseCoverage = dlg.getCoverageData() |
1706 |
1706 |
1707 if runProject: |
1707 if runProject: |
1708 fn = self.project.getMainScript(True) |
1708 fn = self.project.getMainScript(True) |
1709 if fn is None: |
1709 if fn is None: |
1710 E5MessageBox.critical( |
1710 EricMessageBox.critical( |
1711 self.ui, |
1711 self.ui, |
1712 self.tr("Coverage of Project"), |
1712 self.tr("Coverage of Project"), |
1713 self.tr( |
1713 self.tr( |
1714 "There is no main script defined for the" |
1714 "There is no main script defined for the" |
1715 " current project. Aborting")) |
1715 " current project. Aborting")) |
1850 eraseTimings = dlg.getProfilingData() |
1850 eraseTimings = dlg.getProfilingData() |
1851 |
1851 |
1852 if runProject: |
1852 if runProject: |
1853 fn = self.project.getMainScript(True) |
1853 fn = self.project.getMainScript(True) |
1854 if fn is None: |
1854 if fn is None: |
1855 E5MessageBox.critical( |
1855 EricMessageBox.critical( |
1856 self.ui, |
1856 self.ui, |
1857 self.tr("Profile of Project"), |
1857 self.tr("Profile of Project"), |
1858 self.tr( |
1858 self.tr( |
1859 "There is no main script defined for the" |
1859 "There is no main script defined for the" |
1860 " current project. Aborting")) |
1860 " current project. Aborting")) |
1994 configOverride = dlg.getGlobalOverrideData() |
1994 configOverride = dlg.getGlobalOverrideData() |
1995 |
1995 |
1996 if runProject: |
1996 if runProject: |
1997 fn = self.project.getMainScript(True) |
1997 fn = self.project.getMainScript(True) |
1998 if fn is None: |
1998 if fn is None: |
1999 E5MessageBox.critical( |
1999 EricMessageBox.critical( |
2000 self.ui, |
2000 self.ui, |
2001 self.tr("Run Project"), |
2001 self.tr("Run Project"), |
2002 self.tr( |
2002 self.tr( |
2003 "There is no main script defined for the" |
2003 "There is no main script defined for the" |
2004 " current project. Aborting")) |
2004 " current project. Aborting")) |
2140 multiprocessNoDebug) = dlg.getDebugData() |
2140 multiprocessNoDebug) = dlg.getDebugData() |
2141 |
2141 |
2142 if debugProject: |
2142 if debugProject: |
2143 fn = self.project.getMainScript(True) |
2143 fn = self.project.getMainScript(True) |
2144 if fn is None: |
2144 if fn is None: |
2145 E5MessageBox.critical( |
2145 EricMessageBox.critical( |
2146 self.ui, |
2146 self.ui, |
2147 self.tr("Debug Project"), |
2147 self.tr("Debug Project"), |
2148 self.tr( |
2148 self.tr( |
2149 "There is no main script defined for the" |
2149 "There is no main script defined for the" |
2150 " current project. No debugging possible.")) |
2150 " current project. No debugging possible.")) |