eric6/DebugClients/Python/DebugClientBase.py

changeset 7639
422fd05e9c91
parent 7637
c878e8255972
child 7646
39e3db2b4936
child 7707
6abcf4275d0e
equal deleted inserted replaced
7638:176145438b1e 7639:422fd05e9c91
36 DebugClientInstance = None 36 DebugClientInstance = None
37 37
38 ############################################################################### 38 ###############################################################################
39 39
40 40
41 def DebugClientRawInput(prompt=""): 41 def DebugClientInput(prompt=""):
42 """ 42 """
43 Replacement for the standard input() builtin. 43 Replacement for the standard input() builtin.
44 44
45 This function works with the split debugger. 45 This function works with the split debugger.
46 46
47 @param prompt prompt to be shown 47 @param prompt prompt to be shown
48 @type str 48 @type str
49 @return result of the raw_input()/input() call 49 @return result of the input() call
50 @rtype str 50 @rtype str
51 """ 51 """
52 if DebugClientInstance is None or not DebugClientInstance.redirect: 52 if DebugClientInstance is None or not DebugClientInstance.redirect:
53 return DebugClientOrigInput(prompt) 53 return DebugClientOrigInput(prompt)
54 54
55 return DebugClientInstance.input(prompt) 55 return DebugClientInstance.input(prompt)
56 56
57 # Use our own input(). 57 # Use our own input().
58 try: 58 try:
59 DebugClientOrigInput = __builtins__.__dict__['input'] 59 DebugClientOrigInput = __builtins__.__dict__['input']
60 __builtins__.__dict__['input'] = DebugClientRawInput 60 __builtins__.__dict__['input'] = DebugClientInput
61 except (AttributeError, KeyError): 61 except (AttributeError, KeyError):
62 import __main__ 62 import __main__
63 DebugClientOrigInput = __main__.__builtins__.__dict__['input'] 63 DebugClientOrigInput = __main__.__builtins__.__dict__['input']
64 __main__.__builtins__.__dict__['input'] = DebugClientRawInput 64 __main__.__builtins__.__dict__['input'] = DebugClientInput
65 65
66 ############################################################################### 66 ###############################################################################
67 67
68 68
69 def DebugClientFork(): 69 def DebugClientFork():
231 if m: 231 if m:
232 self.__coding = m.group(1) 232 self.__coding = m.group(1)
233 return 233 return
234 self.__coding = default 234 self.__coding = default
235 235
236 def input(self, prompt): 236 def input(self, prompt, echo=True):
237 """ 237 """
238 Public method to implement input() using the event loop. 238 Public method to implement input() using the event loop.
239 239
240 @param prompt the prompt to be shown (string) 240 @param prompt the prompt to be shown (string)
241 @param echo Flag indicating echoing of the input (boolean) 241 @param echo Flag indicating echoing of the input (boolean)
242 @return the entered string 242 @return the entered string
243 """ 243 """
244 self.sendJsonCommand("RequestRaw", { 244 self.sendJsonCommand("RequestRaw", {
245 "prompt": prompt, 245 "prompt": prompt,
246 "echo": True, 246 "echo": echo,
247 }) 247 })
248 self.eventLoop(True) 248 self.eventLoop(True)
249 return self.rawLine 249 return self.rawLine
250 250
251 def sessionClose(self, terminate=True): 251 def sessionClose(self, terminate=True):
1723 if 0 in filterList and str(key)[:2] == '__': 1723 if 0 in filterList and str(key)[:2] == '__':
1724 continue 1724 continue
1725 1725
1726 # special handling for '__builtins__' (it's way too big) 1726 # special handling for '__builtins__' (it's way too big)
1727 if key == '__builtins__': 1727 if key == '__builtins__':
1728 rvalue = '<module __builtin__ (built-in)>' 1728 rvalue = '<module builtins (built-in)>'
1729 valtype = 'module' 1729 valtype = 'module'
1730 if ConfigVarTypeStrings.index(valtype) in filterList: 1730 if ConfigVarTypeStrings.index(valtype) in filterList:
1731 continue 1731 continue
1732 else: 1732 else:
1733 isQt = False 1733 isQt = False
2199 if "" in sysPath: 2199 if "" in sysPath:
2200 sysPath.remove("") 2200 sysPath.remove("")
2201 sysPath.insert(0, firstEntry) 2201 sysPath.insert(0, firstEntry)
2202 sysPath.insert(0, '') 2202 sysPath.insert(0, '')
2203 return sysPath 2203 return sysPath
2204
2205 #
2206 # eflag: noqa = M702

eric ide

mercurial