373 module.eric6PluginModuleName = name |
373 module.eric6PluginModuleName = name |
374 module.eric6PluginModuleFilename = fname |
374 module.eric6PluginModuleFilename = fname |
375 self.__modulesCount += 1 |
375 self.__modulesCount += 1 |
376 if reload_: |
376 if reload_: |
377 imp.reload(module) |
377 imp.reload(module) |
|
378 self.initOnDemandPlugin(name) |
|
379 try: |
|
380 pluginObject = self.__onDemandInactivePlugins[name] |
|
381 pluginObject.initToolbar( |
|
382 self.__ui, e5App().getObject("ToolbarManager")) |
|
383 except (KeyError, AttributeError): |
|
384 pass |
378 except PluginLoadError: |
385 except PluginLoadError: |
379 print("Error loading plug-in module:", name) |
386 print("Error loading plug-in module:", name) |
380 except PluginPy2IncompatibleError: |
387 except PluginPy2IncompatibleError: |
381 print("Error loading plug-in module:", name) |
388 print("Error loading plug-in module:", name) |
382 print("The plug-in is not Python2 compatible.") |
389 print("The plug-in is not Python2 compatible.") |
402 if name in self.__activeModules: |
409 if name in self.__activeModules: |
403 self.deactivatePlugin(name) |
410 self.deactivatePlugin(name) |
404 |
411 |
405 if name in self.__inactiveModules: |
412 if name in self.__inactiveModules: |
406 try: |
413 try: |
|
414 pluginObject = self.__inactivePlugins[name] |
|
415 try: |
|
416 pluginObject.prepareUnload() |
|
417 except AttributeError: |
|
418 pass |
407 del self.__inactivePlugins[name] |
419 del self.__inactivePlugins[name] |
408 except KeyError: |
420 except KeyError: |
409 pass |
421 pass |
410 del self.__inactiveModules[name] |
422 del self.__inactiveModules[name] |
411 elif name in self.__onDemandInactiveModules: |
423 elif name in self.__onDemandInactiveModules: |
412 try: |
424 try: |
|
425 pluginObject = self.__onDemandInactivePlugins[name] |
|
426 try: |
|
427 pluginObject.prepareUnload() |
|
428 except AttributeError: |
|
429 pass |
413 del self.__onDemandInactivePlugins[name] |
430 del self.__onDemandInactivePlugins[name] |
414 except KeyError: |
431 except KeyError: |
415 pass |
432 pass |
416 del self.__onDemandInactiveModules[name] |
433 del self.__onDemandInactiveModules[name] |
417 elif name in self.__failedModules: |
434 elif name in self.__failedModules: |
490 |
507 |
491 @param toolbarManager reference to the toolbar manager object |
508 @param toolbarManager reference to the toolbar manager object |
492 (E5ToolBarManager) |
509 (E5ToolBarManager) |
493 """ |
510 """ |
494 self.initOnDemandPlugins() |
511 self.initOnDemandPlugins() |
495 for name, ref in e5App().getPluginObjects(): |
512 for pluginObject in self.__onDemandInactivePlugins.values(): |
496 try: |
513 try: |
497 tb = ref.initToolbar(self.__ui, toolbarManager) |
514 pluginObject.initToolbar(self.__ui, toolbarManager) |
498 if tb is not None: |
|
499 self.__ui.addToolBar(tb) |
|
500 except AttributeError: |
515 except AttributeError: |
501 # ignore it |
516 # ignore it |
502 pass |
517 pass |
503 |
518 |
504 def activatePlugins(self): |
519 def activatePlugins(self): |