Changeset 9762
- Timestamp:
- 06/07/08 19:28:34 (4 months ago)
- Location:
- branches/plugin-system
- Files:
-
- 2 added
- 7 modified
-
data/glade/plugins_window.glade (added)
-
data/glade/roster_window.glade (modified) (1 diff)
-
launch.sh (modified) (1 diff)
-
plugins/length_notifier.py (modified) (1 diff)
-
src/gajim.py (modified) (3 diffs)
-
src/plugins/gui.py (added)
-
src/plugins/pluginmanager.py (modified) (8 diffs)
-
src/plugins/plugin.py (modified) (5 diffs)
-
src/roster_window.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin-system/data/glade/roster_window.glade
r9521 r9762 194 194 </widget> 195 195 </child> 196 <child> 197 <widget class="GtkImageMenuItem" id="plugins_menuitem"> 198 <property name="visible">True</property> 199 <property name="label" translatable="yes">P_lugins</property> 200 <property name="use_underline">True</property> 201 <signal name="activate" handler="on_plugins_menuitem_activate"/> 202 <child internal-child="image"> 203 <widget class="GtkImage" id="menu-item-image16"> 204 <property name="visible">True</property> 205 <property name="stock">gtk-disconnect</property> 206 <property name="icon_size">1</property> 207 </widget> 208 </child> 209 </widget> 210 </child> 196 211 </widget> 197 212 </child> -
branches/plugin-system/launch.sh
r9680 r9762 16 16 17 17 cd ${BASE}/src 18 exec -a gajim python -t gajim.py $@18 exec -a gajim python2.5 -t gajim.py $@ -
branches/plugin-system/plugins/length_notifier.py
r9754 r9762 33 33 34 34 class LengthNotifierPlugin(GajimPlugin): 35 name = 'Message Length Notifier'36 short_name = 'length_notifier'37 version = '0.1'38 description = '''Highlights message entry field in chat window when given39 length of message is exceeded.''' 40 authors = ['Mateusz Biliński <mateusz@bilinski.it>']35 name = u'Message Length Notifier' 36 short_name = u'length_notifier' 37 version = u'0.1' 38 description = u'''Highlights message entry field in chat window when given length of message is exceeded.''' 39 authors = [u'Mateusz Biliński <mateusz@bilinski.it>'] 40 homepage = u'http://blog.bilinski.it' 41 41 42 42 @log_calls('LengthNotifierPlugin') -
branches/plugin-system/src/gajim.py
r9752 r9762 27 27 28 28 import os 29 import pycallgraph 30 29 31 30 32 if os.name == 'nt': … … 603 605 import osx 604 606 osx.shutdown() 607 608 #pycallgraph.make_dot_graph('common.xmpp-only.dot', format='dot') 605 609 606 610 import atexit … … 3232 3236 3233 3237 def __init__(self): 3238 #filter_func = pycallgraph.GlobbingFilter(include=['common.xmpp.*']) 3239 #pycallgraph.start_trace(filter_func=filter_func) 3240 3234 3241 gajim.interface = self 3235 3242 # This is the manager and factory of message windows set by the module -
branches/plugin-system/src/plugins/pluginmanager.py
r9754 r9762 95 95 96 96 for path in gajim.PLUGINS_DIRS: 97 self. plugins.extend(PluginManager.scan_dir_for_plugins(path))97 self._add_plugins(PluginManager.scan_dir_for_plugins(path)) 98 98 99 99 log.debug('plugins: %s'%(self.plugins)) … … 103 103 log.debug('active: %s'%(self.active_plugins)) 104 104 105 106 @log_calls('PluginManager') 107 def _add_plugin(self, plugin_class): 108 ''' 109 :todo: what about adding plug-ins that are already added? Module reload 110 and adding class from reloaded module or ignoring adding plug-in? 111 ''' 112 plugin_class._active = False 113 plugin_class._instance = None 114 self.plugins.append(plugin_class) 115 116 @log_calls('PluginManager') 117 def _add_plugins(self, plugin_classes): 118 for plugin_class in plugin_classes: 119 self._add_plugin(plugin_class) 120 105 121 @log_calls('PluginManager') 106 122 def gui_extension_point(self, gui_extpoint_name, *args): … … 125 141 Looking closer - we only rewrite tuples here. Real check should be 126 142 made in method that invokes gui_extpoints handlers. 127 128 143 ''' 129 144 … … 142 157 143 158 @log_calls('PluginManager') 144 def activate_plugin(self, plugin ):159 def activate_plugin(self, plugin_class): 145 160 ''' 146 161 :param plugin: plugin to be activated … … 148 163 ''' 149 164 150 plugin_object = plugin ()165 plugin_object = plugin_class() 151 166 152 167 success = True … … 157 172 if success: 158 173 self.active_plugins.append(plugin_object) 174 plugin_class._instance = plugin_object 175 plugin_class._active = True 159 176 160 177 return success … … 166 183 for gui_extpoint_name, gui_extpoint_handlers in \ 167 184 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) 185 if gui_extpoint_name in self.gui_extension_points: 186 for gui_extension_point_args in self.gui_extension_points[gui_extpoint_name]: 187 gui_extpoint_handlers[1](*gui_extension_point_args) 170 188 171 189 # remove GUI extension points handlers (provided by plug-in) from … … 177 195 # removing plug-in from active plug-ins list 178 196 self.active_plugins.remove(plugin_object) 197 plugin_object.__class__._active = False 198 del plugin_object 179 199 180 200 def deactivate_all_plugins(self): -
branches/plugin-system/src/plugins/plugin.py
r9745 r9762 31 31 Base class for implementing Gajim plugins. 32 32 ''' 33 name = ''33 name = u'' 34 34 ''' 35 35 Name of plugin. … … 39 39 :type: unicode 40 40 ''' 41 short_name = ''41 short_name = u'' 42 42 ''' 43 43 Short name of plugin. … … 50 50 module name) can act as such short name 51 51 ''' 52 version = ''52 version = u'' 53 53 ''' 54 54 Version of plugin. … … 62 62 one to be active - is such policy good? 63 63 ''' 64 description = ''64 description = u'' 65 65 ''' 66 66 Plugin description. … … 79 79 Especially: should we force format of giving author's e-mail? 80 80 ''' 81 homepage = u'' 82 ''' 83 URL to plug-in's homepage. 84 85 :type: unicode 86 87 :todo: should we check whether provided string is valid URI? (Maybe 88 using 'property') 89 ''' 81 90 gui_extension_points = {} 82 91 ''' -
branches/plugin-system/src/roster_window.py
r9745 r9762 45 45 import notify 46 46 import features_window 47 import plugins 48 import plugins.gui 47 49 48 50 from common import gajim … … 3130 3132 else: 3131 3133 gajim.interface.instances['preferences'] = config.PreferencesWindow() 3134 3135 def on_plugins_menuitem_activate(self, widget): 3136 if gajim.interface.instances.has_key('plugins'): 3137 gajim.interface.instances['plugins'].window.present() 3138 else: 3139 gajim.interface.instances['plugins'] = plugins.gui.PluginsWindow() 3132 3140 3133 3141 def on_publish_tune_checkbutton_toggled(self, widget, account):
