Debugger/DebugServer.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
16 from PyQt4.QtGui import QMessageBox 16 from PyQt4.QtGui import QMessageBox
17 from PyQt4.QtNetwork import QTcpServer, QHostAddress, QHostInfo 17 from PyQt4.QtNetwork import QTcpServer, QHostAddress, QHostInfo
18 18
19 from E4Gui.E4Application import e4App 19 from E4Gui.E4Application import e4App
20 20
21 from BreakPointModel import BreakPointModel 21 from .BreakPointModel import BreakPointModel
22 from WatchPointModel import WatchPointModel 22 from .WatchPointModel import WatchPointModel
23 import DebugClientCapabilities 23 from . import DebugClientCapabilities
24 24
25 import Preferences 25 import Preferences
26 import Utilities 26 import Utilities
27 27
28 28
216 216
217 @param shellOnly flag indicating only languages supporting an 217 @param shellOnly flag indicating only languages supporting an
218 interactive shell should be returned 218 interactive shell should be returned
219 @return list of supported languages (list of strings) 219 @return list of supported languages (list of strings)
220 """ 220 """
221 languages = self.__clientCapabilities.keys() 221 languages = list(self.__clientCapabilities.keys())
222 try: 222 try:
223 del languages[languages.index("None")] 223 del languages[languages.index("None")]
224 except ValueError: 224 except ValueError:
225 pass # it is not in the list 225 pass # it is not in the list
226 226
237 237
238 @param language language to get extensions for (string) 238 @param language language to get extensions for (string)
239 @return tuple of extensions associated with the language (tuple of strings) 239 @return tuple of extensions associated with the language (tuple of strings)
240 """ 240 """
241 extensions = [] 241 extensions = []
242 for ext, lang in self.__clientAssociations.items(): 242 for ext, lang in list(self.__clientAssociations.items()):
243 if lang == language: 243 if lang == language:
244 extensions.append(ext) 244 extensions.append(ext)
245 245
246 return tuple(extensions) 246 return tuple(extensions)
247 247
253 """ 253 """
254 if self.lastClientType != self.clientType or clientType is not None: 254 if self.lastClientType != self.clientType or clientType is not None:
255 if clientType is None: 255 if clientType is None:
256 clientType = self.clientType 256 clientType = self.clientType
257 if clientType == "Python": 257 if clientType == "Python":
258 from DebuggerInterfacePython import DebuggerInterfacePython 258 from .DebuggerInterfacePython import DebuggerInterfacePython
259 self.debuggerInterface = DebuggerInterfacePython(self, self.passive) 259 self.debuggerInterface = DebuggerInterfacePython(self, self.passive)
260 elif clientType == "Python3": 260 elif clientType == "Python3":
261 from DebuggerInterfacePython3 import DebuggerInterfacePython3 261 from .DebuggerInterfacePython3 import DebuggerInterfacePython3
262 self.debuggerInterface = DebuggerInterfacePython3(self, self.passive) 262 self.debuggerInterface = DebuggerInterfacePython3(self, self.passive)
263 elif clientType == "Ruby": 263 elif clientType == "Ruby":
264 from DebuggerInterfaceRuby import DebuggerInterfaceRuby 264 from .DebuggerInterfaceRuby import DebuggerInterfaceRuby
265 self.debuggerInterface = DebuggerInterfaceRuby(self, self.passive) 265 self.debuggerInterface = DebuggerInterfaceRuby(self, self.passive)
266 elif clientType == "None": 266 elif clientType == "None":
267 from DebuggerInterfaceNone import DebuggerInterfaceNone 267 from .DebuggerInterfaceNone import DebuggerInterfaceNone
268 self.debuggerInterface = DebuggerInterfaceNone(self, self.passive) 268 self.debuggerInterface = DebuggerInterfaceNone(self, self.passive)
269 else: 269 else:
270 from DebuggerInterfaceNone import DebuggerInterfaceNone 270 from .DebuggerInterfaceNone import DebuggerInterfaceNone
271 self.debuggerInterface = DebuggerInterfaceNone(self, self.passive) 271 self.debuggerInterface = DebuggerInterfaceNone(self, self.passive)
272 self.clientType = "None" 272 self.clientType = "None"
273 273
274 def __setClientType(self, clType): 274 def __setClientType(self, clType):
275 """ 275 """
350 350
351 def __clientProcessOutput(self): 351 def __clientProcessOutput(self):
352 """ 352 """
353 Private slot to process client output received via stdout. 353 Private slot to process client output received via stdout.
354 """ 354 """
355 output = unicode(self.clientProcess.readAllStandardOutput()) 355 output = str(self.clientProcess.readAllStandardOutput(),
356 Preferences.getSystem("IOEncoding"),
357 'replace')
356 self.emit(SIGNAL("clientProcessStdout"), output) 358 self.emit(SIGNAL("clientProcessStdout"), output)
357 359
358 def __clientProcessError(self): 360 def __clientProcessError(self):
359 """ 361 """
360 Private slot to process client output received via stderr. 362 Private slot to process client output received via stderr.
361 """ 363 """
362 error = unicode(self.clientProcess.readAllStandardError()) 364 error = str(self.clientProcess.readAllStandardError(),
365 Preferences.getSystem("IOEncoding"),
366 'replace')
363 self.emit(SIGNAL("clientProcessStderr"), error) 367 self.emit(SIGNAL("clientProcessStderr"), error)
364 368
365 def __clientClearBreakPoint(self, fn, lineno): 369 def __clientClearBreakPoint(self, fn, lineno):
366 """ 370 """
367 Private slot to handle the clientClearBreak signal. 371 Private slot to handle the clientClearBreak signal.
1199 Public method to handle a passive debug connection. 1203 Public method to handle a passive debug connection.
1200 1204
1201 @param fn filename of the debugged script (string) 1205 @param fn filename of the debugged script (string)
1202 @param exc flag to enable exception reporting of the IDE (boolean) 1206 @param exc flag to enable exception reporting of the IDE (boolean)
1203 """ 1207 """
1204 print self.trUtf8("Passive debug connection received") 1208 print(self.trUtf8("Passive debug connection received"))
1205 self.passiveClientExited = False 1209 self.passiveClientExited = False
1206 self.debugging = True 1210 self.debugging = True
1207 self.__restoreBreakpoints() 1211 self.__restoreBreakpoints()
1208 self.__restoreWatchpoints() 1212 self.__restoreWatchpoints()
1209 self.emit(SIGNAL('passiveDebugStarted'), fn, exc) 1213 self.emit(SIGNAL('passiveDebugStarted'), fn, exc)
1212 """ 1216 """
1213 Private method to shut down a passive debug connection. 1217 Private method to shut down a passive debug connection.
1214 """ 1218 """
1215 self.passiveClientExited = True 1219 self.passiveClientExited = True
1216 self.shutdownServer() 1220 self.shutdownServer()
1217 print self.trUtf8("Passive debug connection closed") 1221 print(self.trUtf8("Passive debug connection closed"))
1218 1222
1219 def __restoreBreakpoints(self): 1223 def __restoreBreakpoints(self):
1220 """ 1224 """
1221 Private method to restore the breakpoints after a restart. 1225 Private method to restore the breakpoints after a restart.
1222 """ 1226 """

eric ide

mercurial