eric6/Debugger/DebugViewer.py

branch
multi_processing
changeset 7389
770ffcb88be5
parent 7379
72a72fd56494
child 7405
bf6be3cff6cf
diff -r 3de001de249c -r 770ffcb88be5 eric6/Debugger/DebugViewer.py
--- a/eric6/Debugger/DebugViewer.py	Sun Feb 02 12:01:27 2020 +0100
+++ b/eric6/Debugger/DebugViewer.py	Sun Feb 02 16:41:40 2020 +0100
@@ -8,15 +8,15 @@
 
 The views avaliable are:
 <ul>
-  <li>variables viewer for global variables</li>
-  <li>variables viewer for local variables</li>
+  <li>selector showing all connected debugger backends</li>
+  <li>variables viewer for global variables for the selected debug client</li>
+  <li>variables viewer for local variables for the selected debug client</li>
+  <li>call stack viewer for the selected debug client</li>
   <li>call trace viewer</li>
   <li>viewer for breakpoints</li>
   <li>viewer for watch expressions</li>
   <li>viewer for exceptions</li>
-  <li>viewer for threads</li>
-  <li>a file browser (optional)</li>
-  <li>an interpreter shell (optional)</li>
+  <li>viewer for threads for the selected debug client</li>
 </ul>
 """
 
@@ -432,13 +432,8 @@
         @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"))
+        self.__setDebuggerIcon(debuggerId, "exceptions")
     
-    # TODO: Refactor the icon setting code into a method
     def __clientSyntaxError(self, message, filename, lineNo, characterNo,
                             debuggerId):
         """
@@ -455,11 +450,7 @@
         @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"))
+        self.__setDebuggerIcon(debuggerId, "syntaxError22")
     
     def __clientException(self, exceptionType, exceptionMessage, stackTrace,
                           debuggerId):
@@ -475,11 +466,7 @@
         @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"))
+        self.__setDebuggerIcon(debuggerId, "exceptions")
     
     def setVariablesFilter(self, globalsFilter, localsFilter):
         """
@@ -523,7 +510,8 @@
         """
         if self.debugServer.isDebugging():
             filterStr = self.globalsFilterEdit.text()
-            self.debugServer.remoteClientSetFilter(1, filterStr)
+            self.debugServer.remoteClientSetFilter(
+                self.getSelectedDebuggerId(), 1, filterStr)
             self.debugServer.remoteClientVariables(
                 self.getSelectedDebuggerId(), 2, self.globalsFilter)
         
@@ -533,7 +521,8 @@
         """
         if self.debugServer.isDebugging():
             filterStr = self.localsFilterEdit.text()
-            self.debugServer.remoteClientSetFilter(0, filterStr)
+            self.debugServer.remoteClientSetFilter(
+                self.getSelectedDebuggerId(), 0, filterStr)
             if self.currentStack:
                 self.debugServer.remoteClientVariables(
                     self.getSelectedDebuggerId(), 0, self.localsFilter,
@@ -624,8 +613,7 @@
             icon = "mediaPlaybackPause"
         else:
             icon = "exceptions"
-        self.__debuggersCombo.setItemIcon(self.__debuggersCombo.currentIndex(),
-                                          UI.PixmapCache.getIcon(icon))
+        self.__setDebuggerIcon("", icon)
     
     def __threadSelected(self, current, previous):
         """
@@ -693,3 +681,21 @@
         @rtype str
         """
         return self.__debuggersCombo.currentText()
+    
+    def __setDebuggerIcon(self, debuggerId, iconName):
+        """
+        Private method to set the icon for a specific debugger ID.
+        
+        @param debuggerId ID of the debugger backend (empty ID means the
+            currently selected one)
+        @type str
+        @param iconName name of the icon to be used
+        @type str
+        """
+        if debuggerId:
+            index = self.__debuggersCombo.findText(debuggerId, Qt.MatchExactly)
+        else:
+            index = self.__debuggersCombo.currentIndex()
+        if index >= 0:
+            self.__debuggersCombo.setItemIcon(
+                index, UI.PixmapCache.getIcon(iconName))

eric ide

mercurial