Debugger/DebugUI.py

changeset 482
4650a72c307a
parent 481
ad71812ba395
child 486
e4711a55e482
equal deleted inserted replaced
481:ad71812ba395 482:4650a72c307a
39 @signal resetUI() emitted to reset the UI 39 @signal resetUI() emitted to reset the UI
40 @signal exceptionInterrupt() emitted after the execution was interrupted by an 40 @signal exceptionInterrupt() emitted after the execution was interrupted by an
41 exception and acknowledged by the user 41 exception and acknowledged by the user
42 """ 42 """
43 clientStack = pyqtSignal(list) 43 clientStack = pyqtSignal(list)
44 resetUI = pyqtSignal()
45 exceptionInterrupt = pyqtSignal()
46 compileForms = pyqtSignal()
47 compileResources = pyqtSignal()
48 debuggingStarted = pyqtSignal(str)
44 49
45 def __init__(self, ui, vm, debugServer, debugViewer, project): 50 def __init__(self, ui, vm, debugServer, debugViewer, project):
46 """ 51 """
47 Constructor 52 Constructor
48 53
563 dmenu.addAction(self.dbgFilterAct) 568 dmenu.addAction(self.dbgFilterAct)
564 dmenu.addAction(self.excFilterAct) 569 dmenu.addAction(self.excFilterAct)
565 dmenu.addAction(self.excIgnoreFilterAct) 570 dmenu.addAction(self.excIgnoreFilterAct)
566 571
567 self.breakpointsMenu.aboutToShow.connect(self.__showBreakpointsMenu) 572 self.breakpointsMenu.aboutToShow.connect(self.__showBreakpointsMenu)
568 self.connect(self.breakpointsMenu, SIGNAL('triggered(QAction *)'), 573 self.breakpointsMenu.triggered.connect(self.__breakpointSelected)
569 self.__breakpointSelected)
570 dmenu.aboutToShow.connect(self.__showDebugMenu) 574 dmenu.aboutToShow.connect(self.__showDebugMenu)
571 575
572 return smenu, dmenu 576 return smenu, dmenu
573 577
574 def initToolbars(self, toolbarManager): 578 def initToolbars(self, toolbarManager):
914 (self.editorOpen or self.projectOpen): 918 (self.editorOpen or self.projectOpen):
915 self.restartAct.setEnabled(True) 919 self.restartAct.setEnabled(True)
916 else: 920 else:
917 self.restartAct.setEnabled(False) 921 self.restartAct.setEnabled(False)
918 self.stopAct.setEnabled(False) 922 self.stopAct.setEnabled(False)
919 self.emit(SIGNAL('resetUI')) 923 self.resetUI.emit()
920 924
921 def __clientLine(self, fn, line, forStack): 925 def __clientLine(self, fn, line, forStack):
922 """ 926 """
923 Private method to handle a change to the current line. 927 Private method to handle a change to the current line.
924 928
1033 self.trUtf8('<p>The debugged program raised the exception' 1037 self.trUtf8('<p>The debugged program raised the exception'
1034 ' <b>{0}</b><br>"<b>{1}</b>"</p>') 1038 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1035 .format(exceptionType, 1039 .format(exceptionType,
1036 Utilities.html_encode(exceptionMessage))) 1040 Utilities.html_encode(exceptionMessage)))
1037 if res == QMessageBox.Yes: 1041 if res == QMessageBox.Yes:
1038 self.emit(SIGNAL('exceptionInterrupt')) 1042 self.exceptionInterrupt.emit()
1039 stack = [] 1043 stack = []
1040 for fn, ln in stackTrace: 1044 for fn, ln in stackTrace:
1041 stack.append((fn, ln, '')) 1045 stack.append((fn, ln, ''))
1042 self.clientStack.emit(stack) 1046 self.clientStack.emit(stack)
1043 self.__getClientVariables() 1047 self.__getClientVariables()
1310 """ 1314 """
1311 Private method to signal compilation of changed forms and resources 1315 Private method to signal compilation of changed forms and resources
1312 is wanted. 1316 is wanted.
1313 """ 1317 """
1314 if Preferences.getProject("AutoCompileForms"): 1318 if Preferences.getProject("AutoCompileForms"):
1315 self.emit(SIGNAL('compileForms')) 1319 self.compileForms.emit()
1316 if Preferences.getProject("AutoCompileResources"): 1320 if Preferences.getProject("AutoCompileResources"):
1317 self.emit(SIGNAL('compileResources')) 1321 self.compileResources.emit()
1318 QApplication.processEvents() 1322 QApplication.processEvents()
1319 1323
1320 def __coverageScript(self): 1324 def __coverageScript(self):
1321 """ 1325 """
1322 Private slot to handle the coverage of script action. 1326 Private slot to handle the coverage of script action.
1746 autoContinue = autoContinue, forProject = debugProject, 1750 autoContinue = autoContinue, forProject = debugProject,
1747 runInConsole = console, autoFork = forkAutomatically, 1751 runInConsole = console, autoFork = forkAutomatically,
1748 forkChild = forkIntoChild) 1752 forkChild = forkIntoChild)
1749 1753
1750 # Signal that we have started a debugging session 1754 # Signal that we have started a debugging session
1751 self.emit(SIGNAL('debuggingStarted'), fn) 1755 self.debuggingStarted.emit(fn)
1752 1756
1753 self.stopAct.setEnabled(True) 1757 self.stopAct.setEnabled(True)
1754 1758
1755 def __doRestart(self): 1759 def __doRestart(self):
1756 """ 1760 """
1797 autoContinue = self.autoContinue, forProject = forProject, 1801 autoContinue = self.autoContinue, forProject = forProject,
1798 runInConsole = self.runInConsole, autoFork = self.forkAutomatically, 1802 runInConsole = self.runInConsole, autoFork = self.forkAutomatically,
1799 forkChild = self.forkIntoChild) 1803 forkChild = self.forkIntoChild)
1800 1804
1801 # Signal that we have started a debugging session 1805 # Signal that we have started a debugging session
1802 self.emit(SIGNAL('debuggingStarted'), fn) 1806 self.debuggingStarted.emit(fn)
1803 1807
1804 elif self.lastStartAction in [3, 4]: 1808 elif self.lastStartAction in [3, 4]:
1805 # Ask the client to run the new program. 1809 # Ask the client to run the new program.
1806 self.debugServer.remoteRun(fn, argv, wd, env, 1810 self.debugServer.remoteRun(fn, argv, wd, env,
1807 autoClearShell = self.autoClearShell, forProject = forProject, 1811 autoClearShell = self.autoClearShell, forProject = forProject,
1843 1847
1844 # Set exception reporting 1848 # Set exception reporting
1845 self.setExceptionReporting(exc) 1849 self.setExceptionReporting(exc)
1846 1850
1847 # Signal that we have started a debugging session 1851 # Signal that we have started a debugging session
1848 self.emit(SIGNAL('debuggingStarted'), fn) 1852 self.debuggingStarted.emit(fn)
1849 1853
1850 def __continue(self): 1854 def __continue(self):
1851 """ 1855 """
1852 Private method to handle the Continue action. 1856 Private method to handle the Continue action.
1853 """ 1857 """

eric ide

mercurial