--- a/Debugger/DebugUI.py Fri Sep 02 19:08:02 2016 +0200 +++ b/Debugger/DebugUI.py Sun Sep 04 13:51:33 2016 +0200 @@ -13,8 +13,7 @@ from PyQt5.QtCore import pyqtSignal, QObject, Qt from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import QMenu, QToolBar, QApplication, QDialog, \ - QInputDialog +from PyQt5.QtWidgets import QMenu, QToolBar, QApplication, QDialog from UI.Info import Program @@ -104,8 +103,6 @@ self.forkIntoChild = Preferences.toBool( Preferences.Prefs.settings.value('DebugInfo/ForkIntoChild', False)) - self.evalHistory = [] - self.execHistory = [] self.lastDebuggedFile = None self.lastStartAction = 0 # 0=None, 1=Script, 2=Project self.clientType = "" @@ -428,36 +425,6 @@ act.triggered.connect(self.__stepQuit) self.actions.append(act) - self.debugActGrp2 = createActionGroup(self) - - act = E5Action( - self.tr('Evaluate'), - self.tr('E&valuate...'), - 0, 0, self.debugActGrp2, 'dbg_evaluate') - act.setStatusTip(self.tr('Evaluate in current context')) - act.setWhatsThis(self.tr( - """<b>Evaluate</b>""" - """<p>Evaluate an expression in the current context of the""" - """ debugged program. The result is displayed in the""" - """ shell window.</p>""" - )) - act.triggered.connect(self.__eval) - self.actions.append(act) - - act = E5Action( - self.tr('Execute'), - self.tr('E&xecute...'), - 0, 0, self.debugActGrp2, 'dbg_execute') - act.setStatusTip( - self.tr('Execute a one line statement in the current context')) - act.setWhatsThis(self.tr( - """<b>Execute</b>""" - """<p>Execute a one line statement in the current context""" - """ of the debugged program.</p>""" - )) - act.triggered.connect(self.__exec) - self.actions.append(act) - self.dbgFilterAct = E5Action( self.tr('Variables Type Filter'), self.tr('Varia&bles Type Filter...'), 0, 0, self, @@ -585,7 +552,6 @@ self.actions.append(act) self.debugActGrp.setEnabled(False) - self.debugActGrp2.setEnabled(False) self.dbgSetBpActGrp.setEnabled(False) self.runAct.setEnabled(False) self.runProjectAct.setEnabled(False) @@ -627,8 +593,6 @@ dmenu.addActions(self.debugActGrp.actions()) dmenu.addSeparator() - dmenu.addActions(self.debugActGrp2.actions()) - dmenu.addSeparator() dmenu.addActions(self.dbgSetBpActGrp.actions()) self.menuBreakpointsAct = dmenu.addMenu(self.breakpointsMenu) dmenu.addSeparator() @@ -806,7 +770,6 @@ self.profileAct.setEnabled(False) self.coverageAct.setEnabled(False) self.debugActGrp.setEnabled(False) - self.debugActGrp2.setEnabled(False) self.dbgSetBpActGrp.setEnabled(False) self.lastAction = -1 if not self.projectOpen: @@ -978,7 +941,6 @@ """ self.lastAction = -1 self.debugActGrp.setEnabled(False) - self.debugActGrp2.setEnabled(False) if not self.passive: if self.editorOpen: editor = self.viewmanager.activeWindow() @@ -1016,41 +978,53 @@ self.__getClientVariables() self.debugActGrp.setEnabled(True) - self.debugActGrp2.setEnabled(True) - def __clientExit(self, status): + def __clientExit(self, status, message): """ Private method to handle the debugged program terminating. - @param status exit code of the debugged program (int) + @param status exit code of the debugged program + @type int + @param message exit message of the debugged program + @type str """ self.viewmanager.exit() self.__resetUI() if not Preferences.getDebugger("SuppressClientExit") or status != 0: + if message: + info = self.tr("<p>Message: {0}</p>").format( + Utilities.html_uencode(message)) + else: + info = "" if self.ui.currentProg is None: E5MessageBox.information( self.ui, Program, self.tr('<p>The program has terminated with an exit' - ' status of {0}.</p>').format(status)) + ' status of {0}.</p>{1}').format(status, info)) else: E5MessageBox.information( self.ui, Program, self.tr('<p><b>{0}</b> has terminated with an exit' - ' status of {1}.</p>') + ' status of {1}.</p>{2}') .format(Utilities.normabspath(self.ui.currentProg), - status)) + status, info)) else: + if message: + info = self.tr("Message: {0}").format( + Utilities.html_uencode(message)) + else: + info = "" if self.ui.notificationsEnabled(): if self.ui.currentProg is None: msg = self.tr('The program has terminated with an exit' - ' status of {0}.').format(status) + ' status of {0}.\n{1}').format(status, info) else: msg = self.tr('"{0}" has terminated with an exit' - ' status of {1}.')\ + ' status of {1}.\n{2}')\ .format(os.path.basename(self.ui.currentProg), - status) + status, info) self.ui.showNotification( UI.PixmapCache.getPixmap("debug48.png"), self.tr("Program terminated"), msg) @@ -1058,13 +1032,13 @@ if self.ui.currentProg is None: self.appendStdout.emit( self.tr('The program has terminated with an exit' - ' status of {0}.\n').format(status)) + ' status of {0}.\n{1}\n').format(status, info)) else: self.appendStdout.emit( self.tr('"{0}" has terminated with an exit' - ' status of {1}.\n') + ' status of {1}.\n{2}\n') .format(Utilities.normabspath(self.ui.currentProg), - status)) + status, info)) def __clientSyntaxError(self, message, filename, lineNo, characterNo): """ @@ -1192,7 +1166,6 @@ self.__getClientVariables() self.ui.setDebugProfile() self.debugActGrp.setEnabled(True) - self.debugActGrp2.setEnabled(True) return elif res == E5MessageBox.Ignore: if exceptionType not in self.excIgnoreList: @@ -2192,64 +2165,6 @@ aw.getFileName(), line, 1, None, 1) self.debugServer.remoteContinue() - def __eval(self): - """ - Private method to handle the Eval action. - """ - # Get the command line arguments. - if len(self.evalHistory) > 0: - curr = 0 - else: - curr = -1 - - arg, ok = QInputDialog.getItem( - self.ui, - self.tr("Evaluate"), - self.tr("Enter the statement to evaluate"), - self.evalHistory, - curr, True) - - if ok: - if not arg: - return - - # This moves any previous occurrence of this expression to the head - # of the list. - if arg in self.evalHistory: - self.evalHistory.remove(arg) - self.evalHistory.insert(0, arg) - - self.debugServer.remoteEval(arg) - - def __exec(self): - """ - Private method to handle the Exec action. - """ - # Get the command line arguments. - if len(self.execHistory) > 0: - curr = 0 - else: - curr = -1 - - stmt, ok = QInputDialog.getItem( - self.ui, - self.tr("Execute"), - self.tr("Enter the statement to execute"), - self.execHistory, - curr, True) - - if ok: - if not stmt: - return - - # This moves any previous occurrence of this statement to the head - # of the list. - if stmt in self.execHistory: - self.execHistory.remove(stmt) - self.execHistory.insert(0, stmt) - - self.debugServer.remoteExec(stmt) - def __enterRemote(self): """ Private method to update the user interface. @@ -2259,7 +2174,6 @@ """ # Disable further debug commands from the user. self.debugActGrp.setEnabled(False) - self.debugActGrp2.setEnabled(False) self.viewmanager.unhighlight(True)