DebugClients/Python3/DebugClientBase.py

changeset 96
9624a110667d
parent 72
015c7e35bd84
child 107
918a6be6f051
equal deleted inserted replaced
95:261bc03812fd 96:9624a110667d
14 import traceback 14 import traceback
15 import os 15 import os
16 import time 16 import time
17 import imp 17 import imp
18 import re 18 import re
19 import distutils.sysconfig
20 import imp
21 19
22 20
23 from DebugProtocol import * 21 from DebugProtocol import *
24 import DebugClientCapabilities 22 import DebugClientCapabilities
25 from DebugBase import setRecursionLimit, printerr 23 from DebugBase import setRecursionLimit, printerr
30 28
31 DebugClientInstance = None 29 DebugClientInstance = None
32 30
33 ################################################################################ 31 ################################################################################
34 32
35 def DebugClientInput(prompt = ""): 33 def DebugClientInput(prompt = "", echo = True):
36 """ 34 """
37 Replacement for the standard input builtin. 35 Replacement for the standard input builtin.
38 36
39 This function works with the split debugger. 37 This function works with the split debugger.
40 38
41 @param prompt The prompt to be shown. (string) 39 @param prompt The prompt to be shown. (string)
42 """ 40 """
43 if DebugClientInstance is None or not DebugClientInstance.redirect: 41 if DebugClientInstance is None or not DebugClientInstance.redirect:
44 return DebugClientOrigInput(prompt) 42 return DebugClientOrigInput(prompt)
45 43
46 return DebugClientInstance.input(prompt) 44 return DebugClientInstance.input(prompt, echo)
47 45
48 # Use our own input(). 46 # Use our own input().
49 try: 47 try:
50 DebugClientOrigInput = __builtins__.__dict__['input'] 48 DebugClientOrigInput = __builtins__.__dict__['input']
51 __builtins__.__dict__['input'] = DebugClientInput 49 __builtins__.__dict__['input'] = DebugClientInput
283 d["broken"] = self.isBroken() 281 d["broken"] = self.isBroken()
284 threadList.append(d) 282 threadList.append(d)
285 283
286 self.write("{0}{1!r}\n".format(ResponseThreadList, (currentId, threadList))) 284 self.write("{0}{1!r}\n".format(ResponseThreadList, (currentId, threadList)))
287 285
288 def input(self, prompt): 286 def input(self, prompt, echo = True):
289 """ 287 """
290 Public method to implement input() using the event loop. 288 Public method to implement input() using the event loop.
291 289
292 @param prompt the prompt to be shown (string) 290 @param prompt the prompt to be shown (string)
291 @param echo Flag indicating echoing of the input (boolean)
293 @return the entered string 292 @return the entered string
294 """ 293 """
295 self.write("{0}{1!r}\n".format(ResponseRaw, (prompt, 1))) 294 self.write("{0}{1!r}\n".format(ResponseRaw, (prompt, echo)))
296 self.inRawMode = True 295 self.inRawMode = True
297 self.eventLoop(True) 296 self.eventLoop(True)
298 return self.rawLine 297 return self.rawLine
299 298
300 def __exceptionRaised(self): 299 def __exceptionRaised(self):

eric ide

mercurial