Debugger/DebuggerInterfaceRuby.py

changeset 1112
8a7d1b9d18db
parent 945
8cd4d08fa9f6
child 1131
7781e396c903
--- a/Debugger/DebuggerInterfaceRuby.py	Sat Jun 04 11:53:15 2011 +0200
+++ b/Debugger/DebuggerInterfaceRuby.py	Sun Jun 05 18:25:36 2011 +0200
@@ -9,12 +9,12 @@
 
 import os
 
-from PyQt4.QtCore import *
+from PyQt4.QtCore import QObject, QTextCodec, QProcess, QTimer
 
 from E5Gui.E5Application import e5App
 from E5Gui import E5MessageBox
 
-from .DebugProtocol import *
+from . import DebugProtocol
 from . import DebugClientCapabilities
 
 import Preferences
@@ -192,7 +192,7 @@
                 if value.startswith('"') or value.startswith("'"):
                     value = value[1:-1]
                 clientEnv[str(key)] = str(value)
-            except UnpackError:
+            except ValueError:
                 pass
         
         ipaddr = self.debugServer.getHostAddress(True)
@@ -282,7 +282,7 @@
                 if value.startswith('"') or value.startswith("'"):
                     value = value[1:-1]
                 clientEnv[str(key)] = str(value)
-            except UnpackError:
+            except ValueError:
                 pass
         
         ipaddr = self.debugServer.getHostAddress(True)
@@ -365,7 +365,7 @@
         self.qsock.readyRead[()].disconnect(self.__parseClientLine)
         
         # close down socket, and shut down client as well.
-        self.__sendCommand('{0}\n'.format(RequestShutdown))
+        self.__sendCommand('{0}\n'.format(DebugProtocol.RequestShutdown))
         self.qsock.flush()
         
         self.qsock.close()
@@ -388,7 +388,7 @@
         
         @param env environment settings (dictionary)
         """
-        self.__sendCommand('{0}{1}\n'.format(RequestEnv, str(env)))
+        self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEnv, str(env)))
         
     def remoteLoad(self, fn, argv, wd, traceInterpreter=False, autoContinue=True,
                    autoFork=False, forkChild=False):
@@ -411,7 +411,7 @@
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}|{4:d}\n'.format(
-            RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)),
+            DebugProtocol.RequestLoad, wd, fn, str(Utilities.parseOptionString(argv)),
              traceInterpreter))
         
     def remoteRun(self, fn, argv, wd, autoFork=False, forkChild=False):
@@ -428,7 +428,7 @@
         wd = self.translate(wd, False)
         fn = self.translate(os.path.abspath(fn), False)
         self.__sendCommand('{0}{1}|{2}|{3}\n'.format(
-            RequestRun, wd, fn, str(Utilities.parseOptionString(argv))))
+            DebugProtocol.RequestRun, wd, fn, str(Utilities.parseOptionString(argv))))
         
     def remoteCoverage(self, fn, argv, wd, erase=False):
         """
@@ -461,31 +461,31 @@
               should not have a trailing newline.
         """
         self.__sendCommand('{0}\n'.format(stmt))
-        self.__sendCommand(RequestOK + '\n')
+        self.__sendCommand(DebugProtocol.RequestOK + '\n')
 
     def remoteStep(self):
         """
         Public method to single step the debugged program.
         """
-        self.__sendCommand(RequestStep + '\n')
+        self.__sendCommand(DebugProtocol.RequestStep + '\n')
 
     def remoteStepOver(self):
         """
         Public method to step over the debugged program.
         """
-        self.__sendCommand(RequestStepOver + '\n')
+        self.__sendCommand(DebugProtocol.RequestStepOver + '\n')
 
     def remoteStepOut(self):
         """
         Public method to step out the debugged program.
         """
-        self.__sendCommand(RequestStepOut + '\n')
+        self.__sendCommand(DebugProtocol.RequestStepOut + '\n')
 
     def remoteStepQuit(self):
         """
         Public method to stop the debugged program.
         """
-        self.__sendCommand(RequestStepQuit + '\n')
+        self.__sendCommand(DebugProtocol.RequestStepQuit + '\n')
 
     def remoteContinue(self, special=False):
         """
@@ -493,7 +493,7 @@
         
         @param special flag indicating a special continue operation (boolean)
         """
-        self.__sendCommand('{0}{1:d}\n'.format(RequestContinue, special))
+        self.__sendCommand('{0}{1:d}\n'.format(DebugProtocol.RequestContinue, special))
 
     def remoteBreakpoint(self, fn, line, set, cond=None, temp=False):
         """
@@ -507,7 +507,7 @@
         """
         fn = self.translate(fn, False)
         self.__sendCommand('{0}{1}@@{2:d}@@{3:d}@@{4:d}@@{5}\n'.format(
-                           RequestBreak, fn, line, temp, set, cond))
+                           DebugProtocol.RequestBreak, fn, line, temp, set, cond))
         
     def remoteBreakpointEnable(self, fn, line, enable):
         """
@@ -519,7 +519,7 @@
         """
         fn = self.translate(fn, False)
         self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format(
-            RequestBreakEnable, fn, line, enable))
+            DebugProtocol.RequestBreakEnable, fn, line, enable))
         
     def remoteBreakpointIgnore(self, fn, line, count):
         """
@@ -531,7 +531,7 @@
         """
         fn = self.translate(fn, False)
         self.__sendCommand('{0}{1},{2:d},{3:d}\n'.format(
-            RequestBreakIgnore, fn, line, count))
+            DebugProtocol.RequestBreakIgnore, fn, line, count))
         
     def remoteWatchpoint(self, cond, set, temp=False):
         """
@@ -542,7 +542,8 @@
         @param temp flag indicating a temporary watch expression (boolean)
         """
         # cond is combination of cond and special (s. watch expression viewer)
-        self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format(RequestWatch, cond, temp, set))
+        self.__sendCommand('{0}{1}@@{2:d}@@{3:d}\n'.format(
+            DebugProtocol.RequestWatch, cond, temp, set))
     
     def remoteWatchpointEnable(self, cond, enable):
         """
@@ -552,7 +553,8 @@
         @param enable flag indicating enabling or disabling a watch expression (boolean)
         """
         # cond is combination of cond and special (s. watch expression viewer)
-        self.__sendCommand('{0}{1},{2:d}\n'.format(RequestWatchEnable, cond, enable))
+        self.__sendCommand('{0}{1},{2:d}\n'.format(
+            DebugProtocol.RequestWatchEnable, cond, enable))
     
     def remoteWatchpointIgnore(self, cond, count):
         """
@@ -562,7 +564,8 @@
         @param count number of occurrences to ignore (int)
         """
         # cond is combination of cond and special (s. watch expression viewer)
-        self.__sendCommand('{0}{1},{2:d}\n'.format(RequestWatchIgnore, cond, count))
+        self.__sendCommand('{0}{1},{2:d}\n'.format(
+            DebugProtocol.RequestWatchIgnore, cond, count))
     
     def remoteRawInput(self, s):
         """
@@ -595,7 +598,7 @@
         @param framenr framenumber of the variables to retrieve (int)
         """
         self.__sendCommand('{0}{1:d}, {2:d}, {3}\n'.format(
-            RequestVariables, framenr, scope, str(filter)))
+            DebugProtocol.RequestVariables, framenr, scope, str(filter)))
         
     def remoteClientVariable(self, scope, filter, var, framenr=0):
         """
@@ -607,7 +610,7 @@
         @param framenr framenumber of the variables to retrieve (int)
         """
         self.__sendCommand('{0}{1}, {2:d}, {3:d}, {4}\n'.format(
-            RequestVariable, str(var), framenr, scope, str(filter)))
+            DebugProtocol.RequestVariable, str(var), framenr, scope, str(filter)))
         
     def remoteClientSetFilter(self, scope, filter):
         """
@@ -616,7 +619,8 @@
         @param scope the scope of the variables (0 = local, 1 = global)
         @param filter regexp string for variable names to filter out (string)
         """
-        self.__sendCommand('{0}{1:d}, "{2}"\n'.format(RequestSetFilter, scope, filter))
+        self.__sendCommand('{0}{1:d}, "{2}"\n'.format(
+            DebugProtocol.RequestSetFilter, scope, filter))
         
     def remoteEval(self, arg):
         """
@@ -624,7 +628,7 @@
         
         @param arg the arguments to evaluate (string)
         """
-        self.__sendCommand('{0}{1}\n'.format(RequestEval, arg))
+        self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestEval, arg))
         
     def remoteExec(self, stmt):
         """
@@ -632,19 +636,19 @@
         
         @param stmt statement to execute (string)
         """
-        self.__sendCommand('{0}{1}\n'.format(RequestExec, stmt))
+        self.__sendCommand('{0}{1}\n'.format(DebugProtocol.RequestExec, stmt))
         
     def remoteBanner(self):
         """
         Public slot to get the banner info of the remote client.
         """
-        self.__sendCommand(RequestBanner + '\n')
+        self.__sendCommand(DebugProtocol.RequestBanner + '\n')
         
     def remoteCapabilities(self):
         """
         Public slot to get the debug clients capabilities.
         """
-        self.__sendCommand(RequestCapabilities + '\n')
+        self.__sendCommand(DebugProtocol.RequestCapabilities + '\n')
         
     def remoteCompletion(self, text):
         """
@@ -653,7 +657,7 @@
         
         @param text the text to be completed (string)
         """
-        self.__sendCommand("{0}{1}\n".format(RequestCompletion, text))
+        self.__sendCommand("{0}{1}\n".format(DebugProtocol.RequestCompletion, text))
         
     def remoteUTPrepare(self, fn, tn, tfn, cov, covname, coverase):
         """
@@ -691,8 +695,8 @@
                 line = self.codec.toUnicode(qs)
             else:
                 line = bytes(qs).decode()
-            if line.endswith(EOT):
-                line = line[:-len(EOT)]
+            if line.endswith(DebugProtocol.EOT):
+                line = line[:-len(DebugProtocol.EOT)]
                 if not line:
                     continue
             
@@ -714,7 +718,7 @@
             if boc >= 0 and eoc > boc:
                 resp = line[boc:eoc]
                 
-                if resp == ResponseLine:
+                if resp == DebugProtocol.ResponseLine:
                     stack = eval(line[eoc:-1])
                     for s in stack:
                         s[0] = self.translate(s[0], True)
@@ -727,7 +731,7 @@
                         self.debugServer.signalClientStack(stack)
                     continue
                 
-                if resp == ResponseVariables:
+                if resp == DebugProtocol.ResponseVariables:
                     vlist = eval(line[eoc:-1])
                     scope = vlist[0]
                     try:
@@ -737,7 +741,7 @@
                     self.debugServer.signalClientVariables(scope, variables)
                     continue
                 
-                if resp == ResponseVariable:
+                if resp == DebugProtocol.ResponseVariable:
                     vlist = eval(line[eoc:-1])
                     scope = vlist[0]
                     try:
@@ -747,15 +751,15 @@
                     self.debugServer.signalClientVariable(scope, variables)
                     continue
                 
-                if resp == ResponseOK:
+                if resp == DebugProtocol.ResponseOK:
                     self.debugServer.signalClientStatement(False)
                     continue
                 
-                if resp == ResponseContinue:
+                if resp == DebugProtocol.ResponseContinue:
                     self.debugServer.signalClientStatement(True)
                     continue
                 
-                if resp == ResponseException:
+                if resp == DebugProtocol.ResponseException:
                     exc = line[eoc:-1]
                     exc = self.translate(exc, True)
                     try:
@@ -770,7 +774,7 @@
                     self.debugServer.signalClientException(exctype, excmessage, stack)
                     continue
                 
-                if resp == ResponseSyntax:
+                if resp == DebugProtocol.ResponseSyntax:
                     exc = line[eoc:-1]
                     exc = self.translate(exc, True)
                     try:
@@ -785,40 +789,40 @@
                     self.debugServer.signalClientSyntaxError(message, fn, ln, cn)
                     continue
                 
-                if resp == ResponseExit:
+                if resp == DebugProtocol.ResponseExit:
                     self.debugServer.signalClientExit(line[eoc:-1])
                     continue
                 
-                if resp == ResponseClearBreak:
+                if resp == DebugProtocol.ResponseClearBreak:
                     fn, lineno = line[eoc:-1].split(',')
                     lineno = int(lineno)
                     fn = self.translate(fn, True)
                     self.debugServer.signalClientClearBreak(fn, lineno)
                     continue
                 
-                if resp == ResponseClearWatch:
+                if resp == DebugProtocol.ResponseClearWatch:
                     cond = line[eoc:-1]
                     self.debugServer.signalClientClearWatch(cond)
                     continue
                 
-                if resp == ResponseBanner:
+                if resp == DebugProtocol.ResponseBanner:
                     version, platform, dbgclient = eval(line[eoc:-1])
                     self.debugServer.signalClientBanner(version, platform, dbgclient)
                     continue
                 
-                if resp == ResponseCapabilities:
+                if resp == DebugProtocol.ResponseCapabilities:
                     cap, clType = eval(line[eoc:-1])
                     self.clientCapabilities = cap
                     self.debugServer.signalClientCapabilities(cap, clType)
                     continue
                 
-                if resp == ResponseCompletion:
+                if resp == DebugProtocol.ResponseCompletion:
                     clstring, text = line[eoc:-1].split('||')
                     cl = eval(clstring)
                     self.debugServer.signalClientCompletionList(cl, text)
                     continue
                 
-                if resp == PassiveStartup:
+                if resp == DebugProtocol.PassiveStartup:
                     fn, exc = line[eoc:-1].split('|')
                     exc = bool(exc)
                     fn = self.translate(fn, True)

eric ide

mercurial