diff -r cc920e534ac0 -r 72a72fd56494 eric6/Debugger/DebugViewer.py --- a/eric6/Debugger/DebugViewer.py Thu Jan 30 19:37:03 2020 +0100 +++ b/eric6/Debugger/DebugViewer.py Sat Feb 01 19:48:21 2020 +0100 @@ -62,7 +62,7 @@ self.debugServer = debugServer self.debugUI = None - self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) + self.setWindowIcon(UI.PixmapCache.getIcon("eric")) self.__mainLayout = QVBoxLayout() self.__mainLayout.setContentsMargins(0, 0, 0, 0) @@ -124,7 +124,7 @@ index = self.__tabWidget.addTab( self.glvWidget, - UI.PixmapCache.getIcon("globalVariables.png"), '') + UI.PixmapCache.getIcon("globalVariables"), '') self.__tabWidget.setTabToolTip(index, self.globalsViewer.windowTitle()) self.setGlobalsFilterButton.clicked.connect( @@ -178,7 +178,7 @@ index = self.__tabWidget.addTab( self.lvWidget, - UI.PixmapCache.getIcon("localVariables.png"), '') + UI.PixmapCache.getIcon("localVariables"), '') self.__tabWidget.setTabToolTip(index, self.localsViewer.windowTitle()) self.sourceButton.clicked.connect(self.__showSource) @@ -196,7 +196,7 @@ self.callStackViewer = CallStackViewer(self.debugServer) index = self.__tabWidget.addTab( self.callStackViewer, - UI.PixmapCache.getIcon("step.png"), "") + UI.PixmapCache.getIcon("step"), "") self.__tabWidget.setTabToolTip( index, self.callStackViewer.windowTitle()) self.callStackViewer.sourceFile.connect(self.sourceFile) @@ -205,10 +205,10 @@ from .CallTraceViewer import CallTraceViewer # add the call trace viewer - self.callTraceViewer = CallTraceViewer(self.debugServer) + self.callTraceViewer = CallTraceViewer(self.debugServer, self) index = self.__tabWidget.addTab( self.callTraceViewer, - UI.PixmapCache.getIcon("callTrace.png"), "") + UI.PixmapCache.getIcon("callTrace"), "") self.__tabWidget.setTabToolTip( index, self.callTraceViewer.windowTitle()) self.callTraceViewer.sourceFile.connect(self.sourceFile) @@ -219,7 +219,7 @@ self.breakpointViewer.setModel(self.debugServer.getBreakPointModel()) index = self.__tabWidget.addTab( self.breakpointViewer, - UI.PixmapCache.getIcon("breakpoints.png"), '') + UI.PixmapCache.getIcon("breakpoints"), '') self.__tabWidget.setTabToolTip( index, self.breakpointViewer.windowTitle()) self.breakpointViewer.sourceFile.connect(self.sourceFile) @@ -230,7 +230,7 @@ self.watchpointViewer.setModel(self.debugServer.getWatchPointModel()) index = self.__tabWidget.addTab( self.watchpointViewer, - UI.PixmapCache.getIcon("watchpoints.png"), '') + UI.PixmapCache.getIcon("watchpoints"), '') self.__tabWidget.setTabToolTip( index, self.watchpointViewer.windowTitle()) @@ -239,7 +239,7 @@ self.exceptionLogger = ExceptionLogger() index = self.__tabWidget.addTab( self.exceptionLogger, - UI.PixmapCache.getIcon("exceptions.png"), '') + UI.PixmapCache.getIcon("exceptions"), '') self.__tabWidget.setTabToolTip( index, self.exceptionLogger.windowTitle()) @@ -278,6 +278,10 @@ self.handleDebuggingStarted) self.debugServer.clientLine.connect( self.__clientLine) + self.debugServer.clientSyntaxError.connect( + self.__clientSyntaxError) + self.debugServer.clientException.connect( + self.__clientException) self.debugServer.clientException.connect( self.exceptionLogger.addException) @@ -432,7 +436,50 @@ index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) if index >= 0: self.__debuggersCombo.setItemIcon( - index, UI.PixmapCache.getIcon("exceptions.png")) + index, UI.PixmapCache.getIcon("exceptions")) + + # TODO: Refactor the icon setting code into a method + def __clientSyntaxError(self, message, filename, lineNo, characterNo, + debuggerId): + """ + Private method to handle a syntax error in the debugged program. + + @param message message of the syntax error + @type str + @param filename translated filename of the syntax error position + @type str + @param lineNo line number of the syntax error position + @type int + @param characterNo character number of the syntax error position + @type int + @param debuggerId ID of the debugger backend + @type str + """ + if debuggerId: + index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) + if index >= 0: + self.__debuggersCombo.setItemIcon( + index, UI.PixmapCache.getIcon("syntaxError22")) + + def __clientException(self, exceptionType, exceptionMessage, stackTrace, + debuggerId): + """ + Private method to handle an exception of the debugged program. + + @param exceptionType type of exception raised + @type str + @param exceptionMessage message given by the exception + @type (str + @param stackTrace list of stack entries + @type list of str + @param debuggerId ID of the debugger backend + @type str + """ + if debuggerId: + index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) + if index >= 0: + self.__debuggersCombo.setItemIcon( + index, UI.PixmapCache.getIcon("exceptions")) def setVariablesFilter(self, globalsFilter, localsFilter): """ @@ -465,7 +512,7 @@ self.framenr = frmnr if self.debugServer.isDebugging(): self.debugServer.remoteClientVariables( - 0, self.localsFilter, frmnr) + self.getSelectedDebuggerId(), 0, self.localsFilter, frmnr) if self.__autoViewSource: self.__showSource() @@ -477,7 +524,8 @@ if self.debugServer.isDebugging(): filterStr = self.globalsFilterEdit.text() self.debugServer.remoteClientSetFilter(1, filterStr) - self.debugServer.remoteClientVariables(2, self.globalsFilter) + self.debugServer.remoteClientVariables( + self.getSelectedDebuggerId(), 2, self.globalsFilter) def setLocalsFilter(self): """ @@ -488,7 +536,8 @@ self.debugServer.remoteClientSetFilter(0, filterStr) if self.currentStack: self.debugServer.remoteClientVariables( - 0, self.localsFilter, self.framenr) + self.getSelectedDebuggerId(), 0, self.localsFilter, + self.framenr) def handleDebuggingStarted(self): """ @@ -536,16 +585,16 @@ for thread in threadList: if thread.get('except', False): state = self.tr("waiting at exception") - icon = "exceptions.png" + icon = "exceptions" debugStatus = 1 elif thread['broken']: state = self.tr("waiting at breakpoint") - icon = "mediaPlaybackPause.png" + icon = "mediaPlaybackPause" if debugStatus < 1: debugStatus = 0 else: state = self.tr("running") - icon = "mediaPlaybackStart.png" + icon = "mediaPlaybackStart" itm = QTreeWidgetItem(self.__threadList, ["{0:d}".format(thread['id']), thread['name'], state]) @@ -570,11 +619,11 @@ debugStatus = 0 if debugStatus == -1: - icon = "mediaPlaybackStart.png" + icon = "mediaPlaybackStart" elif debugStatus == 0: - icon = "mediaPlaybackPause.png" + icon = "mediaPlaybackPause" else: - icon = "exceptions.png" + icon = "exceptions" self.__debuggersCombo.setItemIcon(self.__debuggersCombo.currentIndex(), UI.PixmapCache.getIcon(icon)) @@ -588,7 +637,7 @@ """ if current is not None and self.__doThreadListUpdate: tid = int(current.text(0)) - self.debugServer.remoteSetThread(tid) + self.debugServer.remoteSetThread(self.getSelectedDebuggerId(), tid) def __callStackFrameSelected(self, frameNo): """