Changeset 9754 for branches/plugin-system/src/plugins/pluginmanager.py
- Timestamp:
- 06/03/08 15:40:27 (6 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin-system/src/plugins/pluginmanager.py
r9752 r9754 50 50 :todo: implement mechanism to dynamically load plugins where GUI extension 51 51 points have been already called (i.e. when plugin is activated 52 after GUI object creation) 52 after GUI object creation). [DONE?] 53 53 :todo: implement mechanism to dynamically deactive plugins (call plugin's 54 deactivation handler) 54 deactivation handler) [DONE?] 55 :todo: when plug-in is deactivated all GUI extension points are removed 56 from `PluginManager.gui_extension_points_handlers`. But when 57 object that invoked GUI extension point is abandoned by Gajim, eg. 58 closed ChatControl object, the reference to called GUI extension 59 points is still in `PluginManager.gui_extension_points`. These 60 should be removed, so that object can be destroyed by Python. 61 Possible solution: add call to clean up method in classes 62 'destructors' (classes that register GUI extension points) 55 63 ''' 56 64 57 65 __metaclass__ = Singleton 58 66 59 @log_calls('PluginManager')67 #@log_calls('PluginManager') 60 68 def __init__(self): 61 69 self.plugins = [] … … 69 77 self.active_plugins = [] 70 78 ''' 71 Objectsof active plugins.79 Instance objects of active plugins. 72 80 73 81 These are object instances of classes held `plugins`, but only those … … 91 99 log.debug('plugins: %s'%(self.plugins)) 92 100 93 #self._activate_all_plugins()101 self.activate_all_plugins() 94 102 95 103 log.debug('active: %s'%(self.active_plugins)) … … 134 142 135 143 @log_calls('PluginManager') 136 def _activate_plugin(self, plugin):144 def activate_plugin(self, plugin): 137 145 ''' 138 146 :param plugin: plugin to be activated … … 151 159 152 160 return success 161 162 def deactivate_plugin(self, plugin_object): 163 # detaching plug-in from handler GUI extension points (calling 164 # cleaning up method that must be provided by plug-in developer 165 # for each handled GUI extension point) 166 for gui_extpoint_name, gui_extpoint_handlers in \ 167 plugin_object.gui_extension_points.iteritems(): 168 for gui_extension_point_args in self.gui_extension_points[gui_extpoint_name]: 169 gui_extpoint_handlers[1](*gui_extension_point_args) 170 171 # remove GUI extension points handlers (provided by plug-in) from 172 # handlers list 173 for gui_extpoint_name, gui_extpoint_handlers in \ 174 plugin_object.gui_extension_points.iteritems(): 175 self.gui_extension_points_handlers[gui_extpoint_name].remove(gui_extpoint_handlers) 176 177 # removing plug-in from active plug-ins list 178 self.active_plugins.remove(plugin_object) 179 180 def deactivate_all_plugins(self): 181 for plugin_object in self.active_plugins: 182 self.deactivate_plugin(plugin_object) 153 183 154 184 @log_calls('PluginManager') … … 168 198 169 199 @log_calls('PluginManager') 170 def _activate_all_plugins(self):200 def activate_all_plugins(self): 171 201 ''' 172 202 Activates all plugins in `plugins`. … … 176 206 self.active_plugins = [] 177 207 for plugin in self.plugins: 178 self. _activate_plugin(plugin)208 self.activate_plugin(plugin) 179 209 180 210 @staticmethod
