28 |
28 |
29 import Preferences |
29 import Preferences |
30 import Utilities |
30 import Utilities |
31 |
31 |
32 |
32 |
|
33 # TODO: change this to a list of debugger interfaces and unite the two Python |
|
34 # variants because they are nearly identical |
33 DebuggerInterfaces = { |
35 DebuggerInterfaces = { |
34 "Python2": "DebuggerInterfacePython2", |
36 "Python2": "DebuggerInterfacePython2", |
35 "Python3": "DebuggerInterfacePython3", |
37 "Python3": "DebuggerInterfacePython3", |
36 "None": "DebuggerInterfaceNone", |
38 "None": "DebuggerInterfaceNone", |
37 } |
39 } |
290 |
292 |
291 def preferencesChanged(self): |
293 def preferencesChanged(self): |
292 """ |
294 """ |
293 Public slot to handle the preferencesChanged signal. |
295 Public slot to handle the preferencesChanged signal. |
294 """ |
296 """ |
|
297 # TODO: just build a set of registry data functions and call |
|
298 # registerDebuggerInterface with each of them |
295 registeredInterfaces = {} |
299 registeredInterfaces = {} |
296 for language in self.__debuggerInterfaceRegistry: |
300 for language in self.__debuggerInterfaceRegistry: |
297 registeredInterfaces[language] = \ |
301 registeredInterfaces[language] = \ |
298 self.__debuggerInterfaceRegistry[language][-1] |
302 self.__debuggerInterfaceRegistry[language][-1] |
299 # last entry is the registry data function |
303 # last entry is the registry data function |
313 return the client language, the client capabilities, the |
317 return the client language, the client capabilities, the |
314 list of associated file extensions and a function reference |
318 list of associated file extensions and a function reference |
315 to create the debugger interface (see __createDebuggerInterface()) |
319 to create the debugger interface (see __createDebuggerInterface()) |
316 @type function |
320 @type function |
317 """ |
321 """ |
|
322 # TODO: remove the 'name' parameter and move the check below against |
|
323 # clientLanguage |
318 if name in self.__debuggerInterfaceRegistry: |
324 if name in self.__debuggerInterfaceRegistry: |
319 E5MessageBox.warning( |
325 E5MessageBox.warning( |
320 None, |
326 None, |
321 self.tr("Register Debugger Interface"), |
327 self.tr("Register Debugger Interface"), |
322 self.tr("""<p>The debugger interface <b>{0}</b> has already""" |
328 self.tr("""<p>The debugger interface <b>{0}</b> has already""" |
323 """ been registered. Ignoring this request.</p>""")) |
329 """ been registered. Ignoring this request.</p>""")) |
324 return |
330 return |
325 |
331 |
|
332 # TODO: change getRegistryData to return a list of registry entries |
326 clientLanguage, clientCapabilities, clientExtensions, \ |
333 clientLanguage, clientCapabilities, clientExtensions, \ |
327 interfaceCreator = getRegistryData() |
334 interfaceCreator = getRegistryData() |
328 if clientLanguage: |
335 if clientLanguage: |
329 self.__debuggerInterfaceRegistry[clientLanguage] = \ |
336 self.__debuggerInterfaceRegistry[clientLanguage] = \ |
330 [clientCapabilities, clientExtensions, interfaceCreator, |
337 [clientCapabilities, clientExtensions, interfaceCreator, |
335 Public method to unregister a debugger interface. |
342 Public method to unregister a debugger interface. |
336 |
343 |
337 @param name name of the debugger interface |
344 @param name name of the debugger interface |
338 @type str |
345 @type str |
339 """ |
346 """ |
|
347 # TODO: change name to a list of names |
340 if name in self.__debuggerInterfaceRegistry: |
348 if name in self.__debuggerInterfaceRegistry: |
341 del self.__debuggerInterfaceRegistry[name] |
349 del self.__debuggerInterfaceRegistry[name] |
342 |
350 |
343 def __findLanguageForExtension(self, ext): |
351 def __findLanguageForExtension(self, ext): |
344 """ |
352 """ |
357 |
365 |
358 def __registerDebuggerInterfaces(self): |
366 def __registerDebuggerInterfaces(self): |
359 """ |
367 """ |
360 Private method to register the available internal debugger interfaces. |
368 Private method to register the available internal debugger interfaces. |
361 """ |
369 """ |
|
370 # TODO: apply DebuggerInterfaces being a list |
362 for name, interface in DebuggerInterfaces.items(): |
371 for name, interface in DebuggerInterfaces.items(): |
363 modName = "Debugger.{0}".format(interface) |
372 modName = "Debugger.{0}".format(interface) |
364 mod = __import__(modName) |
373 mod = __import__(modName) |
365 components = modName.split('.') |
374 components = modName.split('.') |
366 for comp in components[1:]: |
375 for comp in components[1:]: |
367 mod = getattr(mod, comp) |
376 mod = getattr(mod, comp) |
368 |
377 |
|
378 # TODO: remove name parameter |
369 self.registerDebuggerInterface(name, mod.getRegistryData) |
379 self.registerDebuggerInterface(name, mod.getRegistryData) |
370 |
380 |
371 def getSupportedLanguages(self, shellOnly=False): |
381 def getSupportedLanguages(self, shellOnly=False): |
372 """ |
382 """ |
373 Public slot to return the supported programming languages. |
383 Public slot to return the supported programming languages. |