Changeset 9752

Show
Ignore:
Timestamp:
06/03/08 10:25:16 (6 months ago)
Author:
vardo
Message:

Added mechanism to successfully load plugins after GUI extension points have been created, e.g. when we want to modify ChatControl? behaviour and objects of this class have already been created.

Also: customized IPython console look

Location:
branches/plugin-system/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/plugin-system/src/gajim.py

    r9737 r9752  
    32093209                else: 
    32103210                        font = 'Luxi Mono 10' 
     3211                font="Terminus 10" 
    32113212 
    32123213                window = gtk.Window() 
     
    32183219                view.modify_font(pango.FontDescription(font)) 
    32193220                view.set_wrap_mode(gtk.WRAP_CHAR) 
     3221                view.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("black")); 
     3222                view.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse("white")); 
    32203223                sw.add(view) 
    32213224                window.add(sw) 
  • branches/plugin-system/src/plugins/pluginmanager.py

    r9745 r9752  
    5353        :todo: implement mechanism to dynamically deactive plugins (call plugin's 
    5454                   deactivation handler) 
    55          
    5655        ''' 
    5756         
     
    8180                Registered GUI extension points. 
    8281                ''' 
     82                 
     83                self.gui_extension_points_handlers = {} 
     84                ''' 
     85                Registered handlers of GUI extension points. 
     86                ''' 
    8387 
    8488                for path in gajim.PLUGINS_DIRS: 
     
    8791                log.debug('plugins: %s'%(self.plugins)) 
    8892 
    89                 self._activate_all_plugins() 
     93                #self._activate_all_plugins() 
    9094 
    9195                log.debug('active: %s'%(self.active_plugins)) 
     
    116120                ''' 
    117121 
    118                 log.debug(type(args)) 
    119  
    120                 if gui_extpoint_name in self.gui_extension_points: 
    121                         for handlers in self.gui_extension_points[gui_extpoint_name]: 
     122                self._add_gui_extension_point_call_to_list(gui_extpoint_name, *args) 
     123                self._execute_all_handlers_of_gui_extension_point(gui_extpoint_name, *args) 
     124                                 
     125        @log_calls('PluginManager') 
     126        def _add_gui_extension_point_call_to_list(self, gui_extpoint_name, *args): 
     127                self.gui_extension_points.setdefault(gui_extpoint_name, []).append(args) 
     128         
     129        @log_calls('PluginManager') 
     130        def _execute_all_handlers_of_gui_extension_point(self, gui_extpoint_name, *args): 
     131                if gui_extpoint_name in self.gui_extension_points_handlers: 
     132                        for handlers in self.gui_extension_points_handlers[gui_extpoint_name]: 
    122133                                handlers[0](*args) 
    123134 
     
    133144                success = True 
    134145 
     146                self._add_gui_extension_points_handlers_from_plugin(plugin_object) 
     147                self._handle_all_gui_extension_points_with_plugin(plugin_object) 
     148 
     149                if success: 
     150                        self.active_plugins.append(plugin_object) 
     151 
     152                return success 
     153         
     154        @log_calls('PluginManager') 
     155        def _add_gui_extension_points_handlers_from_plugin(self, plugin_object): 
    135156                for gui_extpoint_name, gui_extpoint_handlers in \ 
    136157                                plugin_object.gui_extension_points.iteritems(): 
    137                         self.gui_extension_points.setdefault(gui_extpoint_name, []).append( 
     158                        self.gui_extension_points_handlers.setdefault(gui_extpoint_name, []).append( 
    138159                                        gui_extpoint_handlers) 
    139  
    140                 if success: 
    141                         self.active_plugins.append(plugin_object) 
    142  
    143                 return success 
     160         
     161        @log_calls('PluginManager') 
     162        def _handle_all_gui_extension_points_with_plugin(self, plugin_object): 
     163                for gui_extpoint_name, gui_extpoint_handlers in \ 
     164                                plugin_object.gui_extension_points.iteritems(): 
     165                        if gui_extpoint_name in self.gui_extension_points: 
     166                                for gui_extension_point_args in self.gui_extension_points[gui_extpoint_name]: 
     167                                        gui_extpoint_handlers[0](*gui_extension_point_args) 
    144168 
    145169        @log_calls('PluginManager')