Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 8137
97d37389fbfd
child 8139
418c2d9a767d

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

eric6/APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
eric6/Debugger/DebugServer.py file | annotate | diff | comparison | revisions
eric6/Debugger/DebuggerInterfacePython.py file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
eric6/Documentation/Source/eric6.Debugger.DebugServer.html file | annotate | diff | comparison | revisions
eric6/Documentation/Source/eric6.MicroPython.MicroPythonWidget.html file | annotate | diff | comparison | revisions
eric6/QScintilla/Shell.py file | annotate | diff | comparison | revisions
--- a/eric6/APIs/Python3/eric6.api	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/APIs/Python3/eric6.api	Sat Feb 27 12:08:23 2021 +0100
@@ -580,6 +580,7 @@
 eric6.Debugger.DebugServer.DebugServer.isConnected?4()
 eric6.Debugger.DebugServer.DebugServer.isDebugging?4()
 eric6.Debugger.DebugServer.DebugServer.lastClientExited?7
+eric6.Debugger.DebugServer.DebugServer.mainClientExit?7
 eric6.Debugger.DebugServer.DebugServer.masterClientConnected?4()
 eric6.Debugger.DebugServer.DebugServer.passiveDebugStarted?7
 eric6.Debugger.DebugServer.DebugServer.passiveStartUp?4(fn, exc, debuggerId)
@@ -642,6 +643,7 @@
 eric6.Debugger.DebugServer.DebugServer.signalClientVariables?4(scope, variables, debuggerId)
 eric6.Debugger.DebugServer.DebugServer.signalClientWatchConditionError?4(condition, debuggerId)
 eric6.Debugger.DebugServer.DebugServer.signalLastClientExited?4()
+eric6.Debugger.DebugServer.DebugServer.signalMainClientExit?4()
 eric6.Debugger.DebugServer.DebugServer.startClient?4(unplanned=True, clType=None, forProject=False, runInConsole=False, venvName="", workingDir=None)
 eric6.Debugger.DebugServer.DebugServer.unregisterDebuggerInterface?4(interfaceName)
 eric6.Debugger.DebugServer.DebugServer.utDiscovered?7
@@ -2517,6 +2519,7 @@
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.DevicePortRole?7
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.DeviceTypeRole?7
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.DeviceVidRole?7
+eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.ManualMarker?7
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.ZoomMax?7
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.ZoomMin?7
 eric6.MicroPython.MicroPythonWidget.MicroPythonWidget.commandsInterface?4()
--- a/eric6/Debugger/DebugServer.py	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/Debugger/DebugServer.py	Sat Feb 27 12:08:23 2021 +0100
@@ -73,6 +73,8 @@
     @signal clientExit(str, int, str, bool, str) emitted after the client has
         exited giving the program name, the exit status, an exit message, an
         indication to be quiet and the ID of the exited client
+    @signal mainClientExit() emitted to indicate that the main client process
+        has exited
     @signal lastClientExited() emitted to indicate that the last connected
         debug client has terminated
     @signal clientClearBreak(filename, lineno, debuggerId) emitted after the
@@ -145,6 +147,7 @@
     clientSignal = pyqtSignal(str, str, int, str, str, str)
     clientDisconnected = pyqtSignal(str)
     clientExit = pyqtSignal(str, int, str, bool, str)
+    mainClientExit = pyqtSignal()
     lastClientExited = pyqtSignal()
     clientBreakConditionError = pyqtSignal(str, int, str)
     clientWatchConditionError = pyqtSignal(str, str)
@@ -1850,6 +1853,12 @@
         """
         self.clientExit.emit(program, int(status), message, False, debuggerId)
     
+    def signalMainClientExit(self):
+        """
+        Public method to process the main client exiting.
+        """
+        self.mainClientExit.emit()
+    
     def signalLastClientExited(self):
         """
         Public method to process the last client exit event.
--- a/eric6/Debugger/DebuggerInterfacePython.py	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Sat Feb 27 12:08:23 2021 +0100
@@ -1510,6 +1510,8 @@
             self.debugServer.signalClientExit(
                 params["program"], params["status"], params["message"],
                 params["debuggerId"])
+            if params["debuggerId"] == self.__master:
+                self.debugServer.signalMainClientExit()
         
         elif method == "PassiveStartup":
             self.debugServer.passiveStartUp(
Binary file eric6/Documentation/Help/source.qch has changed
--- a/eric6/Documentation/Help/source.qhp	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/Documentation/Help/source.qhp	Sat Feb 27 12:08:23 2021 +0100
@@ -3394,6 +3394,7 @@
       <keyword name="DebugServer.signalClientVariables" id="DebugServer.signalClientVariables" ref="eric6.Debugger.DebugServer.html#DebugServer.signalClientVariables" />
       <keyword name="DebugServer.signalClientWatchConditionError" id="DebugServer.signalClientWatchConditionError" ref="eric6.Debugger.DebugServer.html#DebugServer.signalClientWatchConditionError" />
       <keyword name="DebugServer.signalLastClientExited" id="DebugServer.signalLastClientExited" ref="eric6.Debugger.DebugServer.html#DebugServer.signalLastClientExited" />
+      <keyword name="DebugServer.signalMainClientExit" id="DebugServer.signalMainClientExit" ref="eric6.Debugger.DebugServer.html#DebugServer.signalMainClientExit" />
       <keyword name="DebugServer.startClient" id="DebugServer.startClient" ref="eric6.Debugger.DebugServer.html#DebugServer.startClient" />
       <keyword name="DebugServer.unregisterDebuggerInterface" id="DebugServer.unregisterDebuggerInterface" ref="eric6.Debugger.DebugServer.html#DebugServer.unregisterDebuggerInterface" />
       <keyword name="DebugUI" id="DebugUI" ref="eric6.Debugger.DebugUI.html#DebugUI" />
--- a/eric6/Documentation/Source/eric6.Debugger.DebugServer.html	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/Documentation/Source/eric6.Debugger.DebugServer.html	Sat Feb 27 12:08:23 2021 +0100
@@ -212,6 +212,11 @@
 emitted to indicate that the last connected
         debug client has terminated
 </dd>
+<dt>mainClientExit()</dt>
+<dd>
+emitted to indicate that the main client process
+        has exited
+</dd>
 <dt>passiveDebugStarted(str, bool)</dt>
 <dd>
 emitted after the debug client has
@@ -740,6 +745,10 @@
 <td>Public method to process the last client exit event.</td>
 </tr>
 <tr>
+<td><a href="#DebugServer.signalMainClientExit">signalMainClientExit</a></td>
+<td>Public method to process the main client exiting.</td>
+</tr>
+<tr>
 <td><a href="#DebugServer.startClient">startClient</a></td>
 <td>Public method to start a debug client.</td>
 </tr>
@@ -3188,6 +3197,13 @@
 <p>
         Public method to process the last client exit event.
 </p>
+<a NAME="DebugServer.signalMainClientExit" ID="DebugServer.signalMainClientExit"></a>
+<h4>DebugServer.signalMainClientExit</h4>
+<b>signalMainClientExit</b>(<i></i>)
+
+<p>
+        Public method to process the main client exiting.
+</p>
 <a NAME="DebugServer.startClient" ID="DebugServer.startClient"></a>
 <h4>DebugServer.startClient</h4>
 <b>startClient</b>(<i>unplanned=True, clType=None, forProject=False, runInConsole=False, venvName="", workingDir=None</i>)
--- a/eric6/Documentation/Source/eric6.MicroPython.MicroPythonWidget.html	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/Documentation/Source/eric6.MicroPython.MicroPythonWidget.html	Sat Feb 27 12:08:23 2021 +0100
@@ -66,7 +66,7 @@
 <h3>Class Attributes</h3>
 
 <table>
-<tr><td>DeviceBoardRole</td></tr><tr><td>DevicePidRole</td></tr><tr><td>DevicePortRole</td></tr><tr><td>DeviceTypeRole</td></tr><tr><td>DeviceVidRole</td></tr><tr><td>ZoomMax</td></tr><tr><td>ZoomMin</td></tr>
+<tr><td>DeviceBoardRole</td></tr><tr><td>DevicePidRole</td></tr><tr><td>DevicePortRole</td></tr><tr><td>DeviceTypeRole</td></tr><tr><td>DeviceVidRole</td></tr><tr><td>ManualMarker</td></tr><tr><td>ZoomMax</td></tr><tr><td>ZoomMin</td></tr>
 </table>
 <h3>Class Methods</h3>
 
--- a/eric6/QScintilla/Shell.py	Sat Feb 27 11:28:22 2021 +0100
+++ b/eric6/QScintilla/Shell.py	Sat Feb 27 12:08:23 2021 +0100
@@ -238,10 +238,24 @@
         dbs.clientException.connect(self.__clientException)
         dbs.clientSyntaxError.connect(self.__clientSyntaxError)
         dbs.clientSignal.connect(self.__clientSignal)
+        dbs.mainClientExit.connect(self.__writePrompt)
         self.dbs = dbs
         
         self.__debugUI = None
         
+        # Make sure we have prompts.
+        if self.passive:
+            sys.ps1 = self.tr("Passive >>> ")
+        else:
+            try:
+                sys.ps1
+            except AttributeError:
+                sys.ps1 = ">>> "
+        try:
+            sys.ps2
+        except AttributeError:
+            sys.ps2 = "... "
+        
         # Initialize instance variables.
         self.__initialise()
         self.prline = 0
@@ -269,19 +283,6 @@
         self.clearKeys()
         self.__actionsAdded = False
         
-        # Make sure we have prompts.
-        if self.passive:
-            sys.ps1 = self.tr("Passive >>> ")
-        else:
-            try:
-                sys.ps1
-            except AttributeError:
-                sys.ps1 = ">>> "
-        try:
-            sys.ps2
-        except AttributeError:
-            sys.ps2 = "... "
-        
         if self.passive:
             self.__getBanner()
         

eric ide

mercurial