PluginManager/PluginManager.py

changeset 1112
8a7d1b9d18db
parent 945
8cd4d08fa9f6
child 1131
7781e396c903
equal deleted inserted replaced
1109:9552b5e16a07 1112:8a7d1b9d18db
9 9
10 import os 10 import os
11 import sys 11 import sys
12 import imp 12 import imp
13 13
14 from PyQt4.QtCore import * 14 from PyQt4.QtCore import pyqtSignal, QObject
15 from PyQt4.QtGui import QPixmap 15 from PyQt4.QtGui import QPixmap
16 16
17 from E5Gui import E5MessageBox 17 from E5Gui import E5MessageBox
18 18
19 from .PluginExceptions import * 19 from .PluginExceptions import PluginPathError, PluginModulesError, PluginLoadError, \
20 PluginActivationError, PluginModuleFormatError, PluginClassFormatError
20 21
21 import UI.PixmapCache 22 import UI.PixmapCache
22 23
23 import Utilities 24 import Utilities
24 import Preferences 25 import Preferences
731 (dictionary of string) 732 (dictionary of string)
732 """ 733 """
733 pluginDict = {} 734 pluginDict = {}
734 735
735 for name, module in \ 736 for name, module in \
736 list(self.__onDemandActiveModules.items()) + list(self.__onDemandInactiveModules.items()): 737 list(self.__onDemandActiveModules.items()) + \
738 list(self.__onDemandInactiveModules.items()):
737 if getattr(module, "pluginType") == type_ and \ 739 if getattr(module, "pluginType") == type_ and \
738 getattr(module, "error", "") == "": 740 getattr(module, "error", "") == "":
739 plugin_name = getattr(module, "pluginTypename") 741 plugin_name = getattr(module, "pluginTypename")
740 if hasattr(module, "displayString"): 742 if hasattr(module, "displayString"):
741 try: 743 try:
756 @param type_ type of the plugin (string) 758 @param type_ type of the plugin (string)
757 @param name name of the plugin type (string) 759 @param name name of the plugin type (string)
758 @return preview pixmap (QPixmap) 760 @return preview pixmap (QPixmap)
759 """ 761 """
760 for modname, module in \ 762 for modname, module in \
761 list(self.__onDemandActiveModules.items()) + list(self.__onDemandInactiveModules.items()): 763 list(self.__onDemandActiveModules.items()) + \
764 list(self.__onDemandInactiveModules.items()):
762 if getattr(module, "pluginType") == type_ and \ 765 if getattr(module, "pluginType") == type_ and \
763 getattr(module, "pluginTypename") == name: 766 getattr(module, "pluginTypename") == name:
764 if hasattr(module, "previewPix"): 767 if hasattr(module, "previewPix"):
765 return module.previewPix() 768 return module.previewPix()
766 else: 769 else:
909 Each tuple contains the vcs name (string) and vcs display string (string). 912 Each tuple contains the vcs name (string) and vcs display string (string).
910 """ 913 """
911 vcsDict = {} 914 vcsDict = {}
912 915
913 for name, module in \ 916 for name, module in \
914 list(self.__onDemandActiveModules.items()) + list(self.__onDemandInactiveModules.items()): 917 list(self.__onDemandActiveModules.items()) + \
918 list(self.__onDemandInactiveModules.items()):
915 if getattr(module, "pluginType") == "version_control": 919 if getattr(module, "pluginType") == "version_control":
916 if hasattr(module, "getVcsSystemIndicator"): 920 if hasattr(module, "getVcsSystemIndicator"):
917 res = module.getVcsSystemIndicator() 921 res = module.getVcsSystemIndicator()
918 for indicator, vcsData in list(res.items()): 922 for indicator, vcsData in list(res.items()):
919 if indicator in vcsDict: 923 if indicator in vcsDict:

eric ide

mercurial