Changeset 187
- Timestamp:
- 05/07/06 15:16:34 (3 years ago)
- Files:
-
- trunk/Makefile.in (modified) (1 diff)
- trunk/src/main.py (modified) (1 diff)
- trunk/src/mesk/common/config.py (modified) (1 diff)
- trunk/src/mesk/plugin/__init__.py (modified) (3 diffs)
- trunk/src/mesk_gui.glade (modified) (1 diff)
- trunk/src/plugins/audioscrobbler.py (modified) (5 diffs)
- trunk/src/plugins/plugins_gui.glade (added)
- trunk/src/preference_window.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Makefile.in
r173 r187 61 61 install -m 755 -d ${libdir}/plugins 62 62 install -m 644 ./src/plugins/*.py ${libdir}/plugins 63 #install -m 644 ./src/plugins/*.glade ${libdir}/plugins63 install -m 644 ./src/plugins/*.glade ${libdir}/plugins 64 64 65 65 install -m 755 -d ${docdir} trunk/src/main.py
r186 r187 64 64 help=_('Select a specific profile other than ' 65 65 'the default'), 66 metavar='PROFILE', default= None)66 metavar='PROFILE', default='') 67 67 68 68 (opts, args) = cmd_line.parse_args() 69 69 70 70 # Load config 71 profile = None71 profile = opts.profile 72 72 if opts.profile: 73 profile = opts.profile 74 config_file = '%s/config.%s' % (mesk.MESK_DIR, profile) 73 config_file = '%s/config.%s' % (mesk.MESK_DIR, opts.profile) 75 74 else: 76 75 config_file = '%s/config' % (mesk.MESK_DIR) 77 76 try: 78 mesk.config.load(config_file )77 mesk.config.load(config_file, opts.profile) 79 78 except IOError: 80 79 first_run = True trunk/src/mesk/common/config.py
r122 r187 49 49 self.set(section, opt, opt_val) 50 50 51 def load(self, config_file): 51 def load(self, config_file, profile_name = ''): 52 self.profile = profile_name 52 53 file_config = ConfigParser.ConfigParser() 53 54 file_config.readfp(file(config_file, 'r')) trunk/src/mesk/plugin/__init__.py
r186 r187 90 90 91 91 def shutdown(self): 92 pass 92 '''Called when the plugin is shutdown or deactivated''' 93 94 def configure(self): 95 '''Plugin implementations should show a config window when called''' 93 96 94 97 class PluginMgr: … … 131 134 mesk.log.warning(_('Plugin not found: %s') % name) 132 135 133 def get_ registry(self):136 def get_plugin_registry(self): 134 137 registry = [] 135 138 for plugin in self.__plugin_registry.values(): … … 146 149 plugins.append(p) 147 150 return plugins 151 152 def get_plugin(self, name): 153 try: 154 return self.__plugins[name] 155 except: 156 return None 148 157 149 158 def activate_plugin(self, plugin_name): trunk/src/mesk_gui.glade
r184 r187 1337 1337 <property name="relief">GTK_RELIEF_NORMAL</property> 1338 1338 <property name="focus_on_click">True</property> 1339 <signal name="clicked" handler="_on_plugin_config_button_clicked" last_modification_time="Sun, 07 May 2006 20:37:23 GMT"/> 1339 1340 1340 1341 <child> trunk/src/plugins/audioscrobbler.py
r181 r187 24 24 import threading 25 25 import pickle 26 import gtk, gtk.glade 26 27 27 28 import mesk … … 47 48 48 49 CONFIG_SECTION = NAME 49 QUEUE_FILE = '/var/tmp/mesk_audioscrobbler_queue.dat'50 50 MAX_SUBMIT = 10 51 51 … … 65 65 self.queue_lock = threading.Lock() 66 66 self.queue = [] 67 profile = '' 68 if mesk.config.profile: 69 profile = '_%s' % mesk.config.profile 67 70 self.queue_filename = mesk.MESK_DIR + os.sep + 'tmp' + os.sep + \ 68 ('%s .queue' % NAME)71 ('%s%s.queue' % (NAME, profile)) 69 72 70 73 self.may_submit = threading.Event() … … 92 95 os.makedirs(q_dir) 93 96 97 self._config_window = None 98 94 99 def shutdown(self): 95 100 self.log.debug('Shutting down...') … … 100 105 self.log.info(_('Saving %d queued items') % len(self.queue)) 101 106 pickle.dump(self.queue, open(self.queue_filename, 'w')) 107 108 def configure(self): 109 if self._config_window is None: 110 xml = gtk.glade.XML('./plugins/plugins_gui.glade', 111 'audioscrobbler_window', 'mesk') 112 xml.signal_autoconnect(self) 113 self._config_window = xml.get_widget('audioscrobbler_window') 114 self._config_window.show() 102 115 103 116 def get_md5(self, s): trunk/src/preference_window.py
r184 r187 71 71 72 72 # Populate plugins list 73 self._plugins = mesk.plugin.get_manager().get_ registry()73 self._plugins = mesk.plugin.get_manager().get_plugin_registry() 74 74 active_plugins = mesk.plugin.get_manager().get_active_plugins() 75 75 if self._plugins: … … 118 118 self._copyright_label.set_text(plugin['COPYRIGHT']) 119 119 self._url_label.set_text(plugin['URL']) 120 121 # TODO: Hide config button if plugin does not support configuration 120 122 is_active = treeview.get_model()[row][0] 121 123 self._config_button.set_sensitive(is_active) … … 123 125 def _on_plugin_toggled(self, cell, path, model): 124 126 new_state = model[path][0] = not model[path][0] 127 128 def _on_plugin_config_button_clicked(self, button): 129 selected_row = self._plugins_view.get_cursor()[0][0] 130 selected_plugin = self._plugins[selected_row] 131 plugin = mesk.plugin.get_manager().get_plugin(selected_plugin['NAME']) 132 plugin.configure()
