eric6/Debugger/DebugViewer.py

branch
multi_processing
changeset 7410
401791e6f50f
parent 7407
a0b6acee2c20
child 7411
6d8dcb3551b3
diff -r 1413bfe73d41 -r 401791e6f50f eric6/Debugger/DebugViewer.py
--- a/eric6/Debugger/DebugViewer.py	Tue Feb 11 18:58:38 2020 +0100
+++ b/eric6/Debugger/DebugViewer.py	Wed Feb 12 20:04:31 2020 +0100
@@ -23,7 +23,7 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSignal, Qt
+from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt
 from PyQt5.QtWidgets import (
     QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QSizePolicy, QPushButton,
     QComboBox, QLabel, QTreeWidget, QTreeWidgetItem, QHeaderView, QFrame
@@ -282,6 +282,8 @@
             self.__clientSyntaxError)
         self.debugServer.clientException.connect(
             self.__clientException)
+        self.debugServer.clientExit.connect(
+            self.__clientExit)
         
         self.debugServer.clientException.connect(
             self.exceptionLogger.addException)
@@ -432,8 +434,35 @@
         @param debuggerId ID of the debugger backend
         @type str
         """
-        self.__setDebuggerIconAndState(debuggerId, "mediaPlaybackPause",
-                                       "broken")
+        self.__setDebuggerIconAndState(debuggerId, "break", "broken")
+        if debuggerId != self.getSelectedDebuggerId():
+            self.__debuggersCombo.setCurrentText(debuggerId)
+    
+    @pyqtSlot(int, str, bool, str)
+    def __clientExit(self, status, message, quiet, debuggerId):
+        """
+        Private method to handle the debugged program terminating.
+        
+        @param status exit code of the debugged program
+        @type int
+        @param message exit message of the debugged program
+        @type str
+        @param quiet flag indicating to suppress exit info display
+        @type bool
+        @param debuggerId ID of the debugger backend
+        @type str
+        """
+        self.__setDebuggerIconAndState(debuggerId, "exit", "exited")
+        if debuggerId == self.getSelectedDebuggerId():
+            # the current client has exited
+            self.globalsViewer.handleResetUI()
+            self.localsViewer.handleResetUI()
+            self.setGlobalsFilter()
+            self.setLocalsFilter()
+            self.sourceButton.setEnabled(False)
+            self.currentStack = None
+            self.stackComboBox.clear()
+            self.__threadList.clear()
     
     def __clientSyntaxError(self, message, filename, lineNo, characterNo,
                             debuggerId):
@@ -580,7 +609,7 @@
                     debugStatus = 1
                 elif thread['broken']:
                     state = self.tr("waiting at breakpoint")
-                    icon = "mediaPlaybackPause"
+                    icon = "break"
                     if debugStatus < 1:
                         debugStatus = 0
                 else:
@@ -608,16 +637,22 @@
                 elif thread['broken']:
                     if debugStatus < 1:
                         debugStatus = 0
+        if not threadList:
+            # empty threadlist means 'exited'
+            debugStatus = 2
         
         if debugStatus == -1:
             icon = "mediaPlaybackStart"
             state = "running"
         elif debugStatus == 0:
-            icon = "mediaPlaybackPause"
+            icon = "break"
             state = "broken"
-        else:
+        elif debugStatus == 1:
             icon = "exceptions"
             state = "exception"
+        else:
+            icon = "exit"
+            state = "exited"
         self.__setDebuggerIconAndState("", icon, state)
     
     def __threadSelected(self, current, previous):
@@ -694,7 +729,7 @@
         """
         Public method to get the currently selected debugger's state.
         
-        @return selected debugger's state (running, broken, exception)
+        @return selected debugger's state (broken, exception, exited, running)
         @rtype str
         """
         return self.__debuggersCombo.currentData()
@@ -708,7 +743,7 @@
         @type str
         @param iconName name of the icon to be used
         @type str
-        @param state state of the debugger (running, broken, exception)
+        @param state state of the debugger (broken, exception, exited, running)
         @type str
         """
         if debuggerId:

eric ide

mercurial