--- a/Debugger/DebugUI.py Fri Oct 18 23:00:41 2013 +0200 +++ b/Debugger/DebugUI.py Fri Nov 01 15:48:48 2013 +0100 @@ -109,9 +109,10 @@ self.lastStartAction = 0 # 0=None, 1=Script, 2=Project self.clientType = "" self.lastAction = -1 - self.debugActions = [self.__continue, self.__step,\ - self.__stepOver, self.__stepOut,\ - self.__stepQuit, self.__runToCursor] + self.debugActions = [ + self.__continue, self.__step, self.__stepOver, self.__stepOut, + self.__stepQuit, self.__runToCursor + ] self.localsVarFilter, self.globalsVarFilter = \ Preferences.getVarFilters() self.debugViewer.setVariablesFilter( @@ -169,10 +170,11 @@ """ self.actions = [] - self.runAct = E5Action(self.trUtf8('Run Script'), - UI.PixmapCache.getIcon("runScript.png"), - self.trUtf8('&Run Script...'), - Qt.Key_F2, 0, self, 'dbg_run_script') + self.runAct = E5Action( + self.trUtf8('Run Script'), + UI.PixmapCache.getIcon("runScript.png"), + self.trUtf8('&Run Script...'), + Qt.Key_F2, 0, self, 'dbg_run_script') self.runAct.setStatusTip(self.trUtf8('Run the current Script')) self.runAct.setWhatsThis(self.trUtf8( """<b>Run Script</b>""" @@ -183,10 +185,11 @@ self.runAct.triggered[()].connect(self.__runScript) self.actions.append(self.runAct) - self.runProjectAct = E5Action(self.trUtf8('Run Project'), - UI.PixmapCache.getIcon("runProject.png"), - self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, - 'dbg_run_project') + self.runProjectAct = E5Action( + self.trUtf8('Run Project'), + UI.PixmapCache.getIcon("runProject.png"), + self.trUtf8('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, + 'dbg_run_project') self.runProjectAct.setStatusTip(self.trUtf8('Run the current Project')) self.runProjectAct.setWhatsThis(self.trUtf8( """<b>Run Project</b>""" @@ -198,10 +201,11 @@ self.runProjectAct.triggered[()].connect(self.__runProject) self.actions.append(self.runProjectAct) - self.coverageAct = E5Action(self.trUtf8('Coverage run of Script'), - UI.PixmapCache.getIcon("coverageScript.png"), - self.trUtf8('Coverage run of Script...'), 0, 0, self, - 'dbg_coverage_script') + self.coverageAct = E5Action( + self.trUtf8('Coverage run of Script'), + UI.PixmapCache.getIcon("coverageScript.png"), + self.trUtf8('Coverage run of Script...'), 0, 0, self, + 'dbg_coverage_script') self.coverageAct.setStatusTip( self.trUtf8('Perform a coverage run of the current Script')) self.coverageAct.setWhatsThis(self.trUtf8( @@ -230,7 +234,8 @@ self.coverageProjectAct.triggered[()].connect(self.__coverageProject) self.actions.append(self.coverageProjectAct) - self.profileAct = E5Action(self.trUtf8('Profile Script'), + self.profileAct = E5Action( + self.trUtf8('Profile Script'), UI.PixmapCache.getIcon("profileScript.png"), self.trUtf8('Profile Script...'), 0, 0, self, 'dbg_profile_script') self.profileAct.setStatusTip(self.trUtf8('Profile the current Script')) @@ -242,7 +247,8 @@ self.profileAct.triggered[()].connect(self.__profileScript) self.actions.append(self.profileAct) - self.profileProjectAct = E5Action(self.trUtf8('Profile Project'), + self.profileProjectAct = E5Action( + self.trUtf8('Profile Project'), UI.PixmapCache.getIcon("profileProject.png"), self.trUtf8('Profile Project...'), 0, 0, self, 'dbg_profile_project') @@ -257,7 +263,8 @@ self.profileProjectAct.triggered[()].connect(self.__profileProject) self.actions.append(self.profileProjectAct) - self.debugAct = E5Action(self.trUtf8('Debug Script'), + self.debugAct = E5Action( + self.trUtf8('Debug Script'), UI.PixmapCache.getIcon("debugScript.png"), self.trUtf8('&Debug Script...'), Qt.Key_F5, 0, self, 'dbg_debug_script') @@ -272,7 +279,8 @@ self.debugAct.triggered[()].connect(self.__debugScript) self.actions.append(self.debugAct) - self.debugProjectAct = E5Action(self.trUtf8('Debug Project'), + self.debugProjectAct = E5Action( + self.trUtf8('Debug Project'), UI.PixmapCache.getIcon("debugProject.png"), self.trUtf8('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, 'dbg_debug_project') @@ -288,7 +296,8 @@ self.debugProjectAct.triggered[()].connect(self.__debugProject) self.actions.append(self.debugProjectAct) - self.restartAct = E5Action(self.trUtf8('Restart'), + self.restartAct = E5Action( + self.trUtf8('Restart'), UI.PixmapCache.getIcon("restart.png"), self.trUtf8('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') self.restartAct.setStatusTip(self.trUtf8( @@ -303,7 +312,8 @@ self.restartAct.triggered[()].connect(self.__doRestart) self.actions.append(self.restartAct) - self.stopAct = E5Action(self.trUtf8('Stop'), + self.stopAct = E5Action( + self.trUtf8('Stop'), UI.PixmapCache.getIcon("stopScript.png"), self.trUtf8('Stop'), Qt.SHIFT + Qt.Key_F10, 0, self, 'dbg_stop_script') @@ -317,7 +327,8 @@ self.debugActGrp = createActionGroup(self) - act = E5Action(self.trUtf8('Continue'), + act = E5Action( + self.trUtf8('Continue'), UI.PixmapCache.getIcon("continue.png"), self.trUtf8('&Continue'), Qt.Key_F6, 0, self.debugActGrp, 'dbg_continue') @@ -332,7 +343,8 @@ act.triggered[()].connect(self.__continue) self.actions.append(act) - act = E5Action(self.trUtf8('Continue to Cursor'), + act = E5Action( + self.trUtf8('Continue to Cursor'), UI.PixmapCache.getIcon("continueToCursor.png"), self.trUtf8('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, self.debugActGrp, 'dbg_continue_to_cursor') @@ -347,7 +359,8 @@ act.triggered[()].connect(self.__runToCursor) self.actions.append(act) - act = E5Action(self.trUtf8('Single Step'), + act = E5Action( + self.trUtf8('Single Step'), UI.PixmapCache.getIcon("step.png"), self.trUtf8('Sin&gle Step'), Qt.Key_F7, 0, self.debugActGrp, 'dbg_single_step') @@ -362,7 +375,8 @@ act.triggered[()].connect(self.__step) self.actions.append(act) - act = E5Action(self.trUtf8('Step Over'), + act = E5Action( + self.trUtf8('Step Over'), UI.PixmapCache.getIcon("stepOver.png"), self.trUtf8('Step &Over'), Qt.Key_F8, 0, self.debugActGrp, 'dbg_step_over') @@ -380,7 +394,8 @@ act.triggered[()].connect(self.__stepOver) self.actions.append(act) - act = E5Action(self.trUtf8('Step Out'), + act = E5Action( + self.trUtf8('Step Out'), UI.PixmapCache.getIcon("stepOut.png"), self.trUtf8('Step Ou&t'), Qt.Key_F9, 0, self.debugActGrp, 'dbg_step_out') @@ -398,7 +413,8 @@ act.triggered[()].connect(self.__stepOut) self.actions.append(act) - act = E5Action(self.trUtf8('Stop'), + act = E5Action( + self.trUtf8('Stop'), UI.PixmapCache.getIcon("stepQuit.png"), self.trUtf8('&Stop'), Qt.Key_F10, 0, self.debugActGrp, 'dbg_stop') @@ -412,7 +428,8 @@ self.debugActGrp2 = createActionGroup(self) - act = E5Action(self.trUtf8('Evaluate'), + act = E5Action( + self.trUtf8('Evaluate'), self.trUtf8('E&valuate...'), 0, 0, self.debugActGrp2, 'dbg_evaluate') act.setStatusTip(self.trUtf8('Evaluate in current context')) @@ -425,9 +442,10 @@ act.triggered[()].connect(self.__eval) self.actions.append(act) - act = E5Action(self.trUtf8('Execute'), - self.trUtf8('E&xecute...'), - 0, 0, self.debugActGrp2, 'dbg_execute') + act = E5Action( + self.trUtf8('Execute'), + self.trUtf8('E&xecute...'), + 0, 0, self.debugActGrp2, 'dbg_execute') act.setStatusTip( self.trUtf8('Execute a one line statement in the current context')) act.setWhatsThis(self.trUtf8( @@ -438,7 +456,8 @@ act.triggered[()].connect(self.__exec) self.actions.append(act) - self.dbgFilterAct = E5Action(self.trUtf8('Variables Type Filter'), + self.dbgFilterAct = E5Action( + self.trUtf8('Variables Type Filter'), self.trUtf8('Varia&bles Type Filter...'), 0, 0, self, 'dbg_variables_filter') self.dbgFilterAct.setStatusTip(self.trUtf8( @@ -453,7 +472,8 @@ self.__configureVariablesFilters) self.actions.append(self.dbgFilterAct) - self.excFilterAct = E5Action(self.trUtf8('Exceptions Filter'), + self.excFilterAct = E5Action( + self.trUtf8('Exceptions Filter'), self.trUtf8('&Exceptions Filter...'), 0, 0, self, 'dbg_exceptions_filter') self.excFilterAct.setStatusTip(self.trUtf8( @@ -469,9 +489,10 @@ self.__configureExceptionsFilter) self.actions.append(self.excFilterAct) - self.excIgnoreFilterAct = E5Action(self.trUtf8('Ignored Exceptions'), - self.trUtf8('&Ignored Exceptions...'), 0, 0, - self, 'dbg_ignored_exceptions') + self.excIgnoreFilterAct = E5Action( + self.trUtf8('Ignored Exceptions'), + self.trUtf8('&Ignored Exceptions...'), 0, 0, + self, 'dbg_ignored_exceptions') self.excIgnoreFilterAct.setStatusTip(self.trUtf8( 'Configure ignored exceptions')) self.excIgnoreFilterAct.setWhatsThis(self.trUtf8( @@ -487,7 +508,8 @@ self.dbgSetBpActGrp = createActionGroup(self) - self.dbgToggleBpAct = E5Action(self.trUtf8('Toggle Breakpoint'), + self.dbgToggleBpAct = E5Action( + self.trUtf8('Toggle Breakpoint'), UI.PixmapCache.getIcon("breakpointToggle.png"), self.trUtf8('Toggle Breakpoint'), QKeySequence(self.trUtf8("Shift+F11", "Debug|Toggle Breakpoint")), @@ -501,7 +523,8 @@ self.dbgToggleBpAct.triggered[()].connect(self.__toggleBreakpoint) self.actions.append(self.dbgToggleBpAct) - self.dbgEditBpAct = E5Action(self.trUtf8('Edit Breakpoint'), + self.dbgEditBpAct = E5Action( + self.trUtf8('Edit Breakpoint'), UI.PixmapCache.getIcon("cBreakpointToggle.png"), self.trUtf8('Edit Breakpoint...'), QKeySequence(self.trUtf8("Shift+F12", "Debug|Edit Breakpoint")), 0, @@ -515,7 +538,8 @@ self.dbgEditBpAct.triggered[()].connect(self.__editBreakpoint) self.actions.append(self.dbgEditBpAct) - self.dbgNextBpAct = E5Action(self.trUtf8('Next Breakpoint'), + self.dbgNextBpAct = E5Action( + self.trUtf8('Next Breakpoint'), UI.PixmapCache.getIcon("breakpointNext.png"), self.trUtf8('Next Breakpoint'), QKeySequence( @@ -529,7 +553,8 @@ self.dbgNextBpAct.triggered[()].connect(self.__nextBreakpoint) self.actions.append(self.dbgNextBpAct) - self.dbgPrevBpAct = E5Action(self.trUtf8('Previous Breakpoint'), + self.dbgPrevBpAct = E5Action( + self.trUtf8('Previous Breakpoint'), UI.PixmapCache.getIcon("breakpointPrevious.png"), self.trUtf8('Previous Breakpoint'), QKeySequence( @@ -543,7 +568,8 @@ self.dbgPrevBpAct.triggered[()].connect(self.__previousBreakpoint) self.actions.append(self.dbgPrevBpAct) - act = E5Action(self.trUtf8('Clear Breakpoints'), + act = E5Action( + self.trUtf8('Clear Breakpoints'), self.trUtf8('Clear Breakpoints'), QKeySequence( self.trUtf8("Ctrl+Shift+C", "Debug|Clear Breakpoints")), 0, @@ -895,28 +921,28 @@ del self.wdHistory[10:] del self.envHistory[10:] - Preferences.Prefs.settings.setValue('DebugInfo/ArgumentsHistory', - self.argvHistory) + Preferences.Prefs.settings.setValue( + 'DebugInfo/ArgumentsHistory', self.argvHistory) Preferences.Prefs.settings.setValue( 'DebugInfo/WorkingDirectoryHistory', self.wdHistory) - Preferences.Prefs.settings.setValue('DebugInfo/EnvironmentHistory', - self.envHistory) - Preferences.Prefs.settings.setValue('DebugInfo/Exceptions', - self.excList) - Preferences.Prefs.settings.setValue('DebugInfo/IgnoredExceptions', - self.excIgnoreList) - Preferences.Prefs.settings.setValue('DebugInfo/ReportExceptions', - self.exceptions) - Preferences.Prefs.settings.setValue('DebugInfo/AutoClearShell', - self.autoClearShell) - Preferences.Prefs.settings.setValue('DebugInfo/TracePython', - self.tracePython) - Preferences.Prefs.settings.setValue('DebugInfo/AutoContinue', - self.autoContinue) - Preferences.Prefs.settings.setValue('DebugInfo/ForkAutomatically', - self.forkAutomatically) - Preferences.Prefs.settings.setValue('DebugInfo/ForkIntoChild', - self.forkIntoChild) + Preferences.Prefs.settings.setValue( + 'DebugInfo/EnvironmentHistory', self.envHistory) + Preferences.Prefs.settings.setValue( + 'DebugInfo/Exceptions', self.excList) + Preferences.Prefs.settings.setValue( + 'DebugInfo/IgnoredExceptions', self.excIgnoreList) + Preferences.Prefs.settings.setValue( + 'DebugInfo/ReportExceptions', self.exceptions) + Preferences.Prefs.settings.setValue( + 'DebugInfo/AutoClearShell', self.autoClearShell) + Preferences.Prefs.settings.setValue( + 'DebugInfo/TracePython', self.tracePython) + Preferences.Prefs.settings.setValue( + 'DebugInfo/AutoContinue', self.autoContinue) + Preferences.Prefs.settings.setValue( + 'DebugInfo/ForkAutomatically', self.forkAutomatically) + Preferences.Prefs.settings.setValue( + 'DebugInfo/ForkIntoChild', self.forkIntoChild) def shutdownServer(self): """ @@ -984,11 +1010,13 @@ if not Preferences.getDebugger("SuppressClientExit") or status != 0: if self.ui.currentProg is None: - E5MessageBox.information(self.ui, Program, + E5MessageBox.information( + self.ui, Program, self.trUtf8('<p>The program has terminated with an exit' ' status of {0}.</p>').format(status)) else: - E5MessageBox.information(self.ui, Program, + E5MessageBox.information( + self.ui, Program, self.trUtf8('<p><b>{0}</b> has terminated with an exit' ' status of {1}.</p>') .format(Utilities.normabspath(self.ui.currentProg), @@ -1034,7 +1062,8 @@ self.ui.activateWindow() if message is None: - E5MessageBox.critical(self.ui, Program, + E5MessageBox.critical( + self.ui, Program, self.trUtf8( 'The program being debugged contains an unspecified' ' syntax error.')) @@ -1051,7 +1080,8 @@ if os.path.exists(os.path.join(d, filename)): filename = os.path.join(d, filename) self.viewmanager.setFileLine(filename, lineNo, True, True) - E5MessageBox.critical(self.ui, Program, + E5MessageBox.critical( + self.ui, Program, self.trUtf8('<p>The file <b>{0}</b> contains the syntax error' ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.' '</p>') @@ -1069,7 +1099,8 @@ self.ui.activateWindow() QApplication.processEvents() if exceptionType is None: - E5MessageBox.critical(self.ui, Program, + E5MessageBox.critical( + self.ui, Program, self.trUtf8('An unhandled exception occured.' ' See the shell window for details.')) return @@ -1077,7 +1108,7 @@ if (self.exceptions and \ exceptionType not in self.excIgnoreList and \ (not len(self.excList) or \ - (len(self.excList) and exceptionType in self.excList)))\ + (len(self.excList) and exceptionType in self.excList)))\ or exceptionType.startswith('unhandled'): res = None if stackTrace: @@ -1108,7 +1139,8 @@ E5MessageBox.No | \ E5MessageBox.Yes | \ E5MessageBox.Ignore) - res = E5MessageBox.critical(self.ui, Program, + res = E5MessageBox.critical( + self.ui, Program, self.trUtf8( '<p>The debugged program raised the exception' ' <b>{0}</b><br>"<b>{1}</b>"<br>' @@ -1122,7 +1154,8 @@ buttons, E5MessageBox.No) else: - res = E5MessageBox.critical(self.ui, Program, + res = E5MessageBox.critical( + self.ui, Program, self.trUtf8( '<p>The debugged program raised the exception' ' <b>{0}</b><br>"<b>{1}</b>"</p>') @@ -1158,7 +1191,8 @@ """ self.__resetUI() if unplanned: - E5MessageBox.information(self.ui, Program, + E5MessageBox.information( + self.ui, Program, self.trUtf8('The program being debugged has terminated' ' unexpectedly.')) @@ -1230,7 +1264,8 @@ @param filename filename of the breakpoint (string) @param lineno linenumber of the breakpoint (integer) """ - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Breakpoint Condition Error"), self.trUtf8( """<p>The condition of the breakpoint <b>{0}, {1}</b>""" @@ -1249,7 +1284,8 @@ fn, line, cond, temp, enabled, count = bp[:6] from .EditBreakpointDialog import EditBreakpointDialog - dlg = EditBreakpointDialog((fn, line), (cond, temp, enabled, count), + dlg = EditBreakpointDialog( + (fn, line), (cond, temp, enabled, count), [], self.ui, modal=True) if dlg.exec_() == QDialog.Accepted: cond, temp, enabled, count = dlg.getData() @@ -1264,7 +1300,8 @@ @param cond expression of the watch expression (string) """ - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Watch Expression Error"), self.trUtf8("""<p>The watch expression <b>{0}</b>""" """ contains a syntax error.</p>""")\ @@ -1297,12 +1334,14 @@ """ already exists.</p>""")\ .format(Utilities.html_encode(cond)) else: - msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" - """ for the variable <b>{1}</b> already""" - """ exists.</p>""")\ - .format(special, - Utilities.html_encode(cond)) - E5MessageBox.warning(self, + msg = self.trUtf8( + """<p>A watch expression '<b>{0}</b>'""" + """ for the variable <b>{1}</b> already""" + """ exists.</p>""")\ + .format(special, + Utilities.html_encode(cond)) + E5MessageBox.warning( + self.ui, self.trUtf8("Watch expression already exists"), msg) model.deleteWatchPointByIndex(index) @@ -1453,7 +1492,8 @@ cap = self.trUtf8("Coverage of Project") else: cap = self.trUtf8("Coverage of Script") - dlg = StartDialog(cap, self.argvHistory, self.wdHistory, + dlg = StartDialog( + cap, self.argvHistory, self.wdHistory, self.envHistory, self.exceptions, self.ui, 2, autoClearShell=self.autoClearShell) if dlg.exec_() == QDialog.Accepted: @@ -1464,9 +1504,11 @@ if runProject: fn = self.project.getMainScript(1) if fn is None: - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Coverage of Project"), - self.trUtf8("There is no main script defined for the" + self.trUtf8( + "There is no main script defined for the" " current project. Aborting")) return @@ -1528,7 +1570,8 @@ self.debugViewer.initCallStackViewer(runProject) # Ask the client to open the new program. - self.debugServer.remoteCoverage(fn, argv, wd, env, + self.debugServer.remoteCoverage( + fn, argv, wd, env, autoClearShell=self.autoClearShell, erase=eraseCoverage, forProject=runProject, runInConsole=console, clientType=self.clientType) @@ -1578,9 +1621,11 @@ if runProject: fn = self.project.getMainScript(1) if fn is None: - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Profile of Project"), - self.trUtf8("There is no main script defined for the" + self.trUtf8( + "There is no main script defined for the" " current project. Aborting")) return @@ -1642,7 +1687,8 @@ self.debugViewer.initCallStackViewer(runProject) # Ask the client to open the new program. - self.debugServer.remoteProfile(fn, argv, wd, env, + self.debugServer.remoteProfile( + fn, argv, wd, env, autoClearShell=self.autoClearShell, erase=eraseTimings, forProject=runProject, runInConsole=console, clientType=self.clientType) @@ -1694,9 +1740,11 @@ if runProject: fn = self.project.getMainScript(1) if fn is None: - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Run Project"), - self.trUtf8("There is no main script defined for the" + self.trUtf8( + "There is no main script defined for the" " current project. Aborting")) return @@ -1759,7 +1807,8 @@ self.debugViewer.initCallStackViewer(runProject) # Ask the client to open the new program. - self.debugServer.remoteRun(fn, argv, wd, env, + self.debugServer.remoteRun( + fn, argv, wd, env, autoClearShell=self.autoClearShell, forProject=runProject, runInConsole=console, autoFork=forkAutomatically, forkChild=forkIntoChild, clientType=self.clientType) @@ -1811,9 +1860,11 @@ if debugProject: fn = self.project.getMainScript(True) if fn is None: - E5MessageBox.critical(self.ui, + E5MessageBox.critical( + self.ui, self.trUtf8("Debug Project"), - self.trUtf8("There is no main script defined for the" + self.trUtf8( + "There is no main script defined for the" " current project. No debugging possible.")) return @@ -1890,7 +1941,8 @@ self.debugViewer.setCallTraceToProjectMode(debugProject) # Ask the client to open the new program. - self.debugServer.remoteLoad(fn, argv, wd, env, + self.debugServer.remoteLoad( + fn, argv, wd, env, autoClearShell=self.autoClearShell, tracePython=tracePython, autoContinue=autoContinue, forProject=debugProject, @@ -1915,8 +1967,8 @@ if self.lastStartAction in [1, 3, 5, 7, 9]: editor = self.viewmanager.getOpenEditor(self.lastDebuggedFile) if editor and \ - not self.viewmanager.checkDirty(editor, - Preferences.getDebugger("Autosave")): + not self.viewmanager.checkDirty( + editor, Preferences.getDebugger("Autosave")): return forProject = False elif self.lastStartAction in [2, 4, 6, 8, 10]: @@ -2084,8 +2136,8 @@ aw = self.viewmanager.activeWindow() line = aw.getCursorPosition()[0] + 1 self.__enterRemote() - self.debugServer.remoteBreakpoint(aw.getFileName(), - line, 1, None, 1) + self.debugServer.remoteBreakpoint( + aw.getFileName(), line, 1, None, 1) self.debugServer.remoteContinue() def __eval(self):