Debugger/DebuggerInterfacePython3.py

branch
jsonrpc
changeset 5131
889ed5ff7a68
parent 5129
e4ab234cf071
child 5136
b1dde2dc14bd
--- a/Debugger/DebuggerInterfacePython3.py	Fri Sep 02 19:08:02 2016 +0200
+++ b/Debugger/DebuggerInterfacePython3.py	Sat Sep 03 18:01:19 2016 +0200
@@ -32,7 +32,7 @@
 
 class DebuggerInterfacePython3(QObject):
     """
-    Class implementing the Python debugger interface for the debug server.
+    Class implementing the Python 3 debugger interface for the debug server.
     """
     def __init__(self, debugServer, passive):
         """
@@ -405,7 +405,6 @@
         # close down socket, and shut down client as well.
         self.__sendJsonCommand("RequestShutdown", {})
         self.qsock.flush()
-        
         self.qsock.close()
         
         # reinitialize
@@ -922,14 +921,13 @@
                 params["prompt"], params["echo"])
         
         elif method == "ResponseBPConditionError":
-            params["filename"] = self.translate(params["filename"], True)
+            fn = self.translate(params["filename"], True)
             self.debugServer.signalClientBreakConditionError(
-                params["filename"], params["line"])
+                fn, params["line"])
         
         elif method == "ResponseClearBreakpoint":
-            params["filename"] = self.translate(params["filename"], True)
-            self.debugServer.signalClientClearBreak(
-                params["filename"], params["line"])
+            fn = self.translate(params["filename"], True)
+            self.debugServer.signalClientClearBreak(fn, params["line"])
         
         elif method == "ResponseWatchConditionError":
             self.debugServer.signalClientWatchConditionError(
@@ -972,6 +970,7 @@
         
         elif method == "ResponseExit":
             self.__scriptName = ""
+            # TODO: combine these into signalClientExit
             self.debugServer.signalClientExit(params["status"])
             if params["message"]:
                 self.debugServer.signalClientOutput(params["message"])
@@ -1021,17 +1020,6 @@
         elif method == "RequestForkTo":
             self.__askForkTo()
     
-    def __sendCommand(self, cmd):
-        """
-        Private method to send a single line command to the client.
-        
-        @param cmd command to send to the debug client (string)
-        """
-        if self.qsock is not None:
-            self.qsock.write(cmd.encode('utf8', 'backslashreplace'))
-        else:
-            self.queue.append(cmd)
-    
     def __sendJsonCommand(self, command, params):
         """
         Private method to send a single command to the client.
@@ -1085,7 +1073,7 @@
         else:
             exts.append(".{0}".format(ext))
     
-    if exts:
+    if exts and Preferences.getDebugger("Python3Interpreter"):
         return ["Python3", ClientDefaultCapabilities, exts,
                 createDebuggerInterfacePython3]
     else:

eric ide

mercurial