--- a/eric6/Debugger/DebugViewer.py Sat Feb 08 17:02:40 2020 +0100 +++ b/eric6/Debugger/DebugViewer.py Sun Feb 09 19:27:49 2020 +0100 @@ -432,7 +432,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "exceptions") + self.__setDebuggerIconAndState(debuggerId, "mediaPlaybackPause", "broken") def __clientSyntaxError(self, message, filename, lineNo, characterNo, debuggerId): @@ -450,7 +450,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "syntaxError22") + self.__setDebuggerIconAndState(debuggerId, "syntaxError22", "exception") def __clientException(self, exceptionType, exceptionMessage, stackTrace, debuggerId): @@ -466,7 +466,7 @@ @param debuggerId ID of the debugger backend @type str """ - self.__setDebuggerIcon(debuggerId, "exceptions") + self.__setDebuggerIconAndState(debuggerId, "exceptions", "exception") def setVariablesFilter(self, globalsFilter, localsFilter): """ @@ -609,11 +609,14 @@ if debugStatus == -1: icon = "mediaPlaybackStart" + state = "running" elif debugStatus == 0: icon = "mediaPlaybackPause" + state = "broken" else: icon = "exceptions" - self.__setDebuggerIcon("", icon) + state = "exception" + self.__setDebuggerIconAndState("", icon, state) def __threadSelected(self, current, previous): """ @@ -653,6 +656,9 @@ self.callStackViewer.clear() self.debugUI.getDebuggerData(debuggerId) + self.debugUI.setDebugActionsEnabled( + self.getSelectedDebuggerState() != "running") + self.__showSource() def showDebuggersList(self, debuggerIds): """ @@ -682,7 +688,16 @@ """ return self.__debuggersCombo.currentText() - def __setDebuggerIcon(self, debuggerId, iconName): + def getSelectedDebuggerState(self): + """ + Public method to get the currently selected debugger's state. + + @return selected debugger's state (running, broken, exception) + @rtype str + """ + return self.__debuggersCombo.currentData() + + def __setDebuggerIconAndState(self, debuggerId, iconName, state): """ Private method to set the icon for a specific debugger ID. @@ -691,6 +706,8 @@ @type str @param iconName name of the icon to be used @type str + @param state state of the debugger (running, broken, exception) + @type str """ if debuggerId: index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly) @@ -699,3 +716,4 @@ if index >= 0: self.__debuggersCombo.setItemIcon( index, UI.PixmapCache.getIcon(iconName)) + self.__debuggersCombo.setItemData(index, state)