Exemplo n.º 1
0
    def on_config(self, *args):
        '''Called when user hits the Preferences button'''
        pluginmanager = get_pluginmanager()
        name = self.get_selected_name(self.list_view)

        if name and pluginmanager.plugin_is_active(name):
            pluginmanager.plugin_config(name, self.session)
Exemplo n.º 2
0
    def on_config(self, *args):
        '''Called when user hits the Preferences button'''
        pluginmanager = get_pluginmanager()
        name = self.get_selected_name(self.list_view)

        if name and pluginmanager.plugin_is_active(name):
                pluginmanager.plugin_config(name, self.session)
Exemplo n.º 3
0
    def on_cursor_changed(self, list_view, type_='plugin'):
        '''called when a row is selected'''
        name = self.get_selected_name(self.list_view)
        pluginmanager = get_pluginmanager()
        self.config_button.set_sensitive(pluginmanager.plugin_configurable(name))

        DownloadList.on_cursor_changed(self, list_view, type_,
                                       self.config_button)
Exemplo n.º 4
0
    def on_cursor_changed(self, list_view, type_='plugin'):
        '''called when a row is selected'''
        name = self.get_selected_name(self.list_view)
        pluginmanager = get_pluginmanager()
        self.config_button.set_sensitive(pluginmanager.plugin_configurable(name))

        DownloadList.on_cursor_changed(self, list_view, type_,
                                       self.config_button)
Exemplo n.º 5
0
    def on_start(self, name):
        '''start the selected plugin'''
        pluginmanager = get_pluginmanager()

        pluginmanager.plugin_start(name, self.session)
        if name not in self.session.config.l_active_plugins:
            self.session.config.l_active_plugins.append(name)

        self.on_cursor_changed(self.list_view)
Exemplo n.º 6
0
    def on_start(self, name):
        '''start the selected plugin'''
        pluginmanager = get_pluginmanager()

        pluginmanager.plugin_start(name, self.session)
        if name not in self.session.config.l_active_plugins:
            self.session.config.l_active_plugins.append(name)

        self.on_cursor_changed(self.list_view)
Exemplo n.º 7
0
    def on_stop(self, name):
        '''stop the selected plugin'''
        pluginmanager = get_pluginmanager()

        pluginmanager.plugin_stop(name)

        if name in self.session.config.l_active_plugins:
            self.session.config.l_active_plugins.remove(name)

        self.on_cursor_changed(self.list_view)
Exemplo n.º 8
0
    def on_stop(self, name):
        '''stop the selected plugin'''
        pluginmanager = get_pluginmanager()

        pluginmanager.plugin_stop(name)

        if name in self.session.config.l_active_plugins:
            self.session.config.l_active_plugins.remove(name)

        self.on_cursor_changed(self.list_view)
Exemplo n.º 9
0
 def on_toggled(self, widget, path, model, type_):
     '''called when the toggle button in list view is pressed'''
     pluginmanager = get_pluginmanager()
     name = model[path][2]
     if not model[path][0]:
         self.on_start(name)
         self.removable_list[type_].pop(name, None)
     else:
         self.on_stop(name)
         if model[path][5].startswith(self.config_dir.base_dir):
             self.removable_list[type_][name] = model[path][5]
     model[path][0] = pluginmanager.plugin_is_active(name)
Exemplo n.º 10
0
 def on_toggled(self, widget, path, model, type_):
     '''called when the toggle button in list view is pressed'''
     pluginmanager = get_pluginmanager()
     name = model[path][2]
     if not model[path][0]:
         self.on_start(name)
         self.removable_list[type_].pop(name, None)
     else:
         self.on_stop(name)
         if model[path][5].startswith(self.config_dir.base_dir):
             self.removable_list[type_][name] = model[path][5]
     model[path][0] = pluginmanager.plugin_is_active(name)
Exemplo n.º 11
0
    def _setup_plugins(self):
        plugin_manager = get_pluginmanager()
        plugin_manager.scan_directory('plugins')
        plugin_dir = self.config_dir.join('plugins')
        if not os.path.exists(plugin_dir):
            os.makedirs(plugin_dir)
        plugin_manager.scan_directory(plugin_dir)

        self.session.config.get_or_set('l_active_plugins', [])

        for plugin in self.session.config.l_active_plugins:
            plugin_manager.plugin_start(plugin, self.session)
        self.session.set_default_extensions_from_config()
Exemplo n.º 12
0
    def _setup_plugins(self):
        plugin_manager = get_pluginmanager()
        plugin_manager.scan_directory('plugins')
        plugin_dir = self.config_dir.join('plugins')
        if not os.path.exists(plugin_dir):
            os.makedirs(plugin_dir)
        plugin_manager.scan_directory(plugin_dir)

        self.session.config.get_or_set('l_active_plugins', [])

        for plugin in self.session.config.l_active_plugins:
            plugin_manager.plugin_start(plugin, self.session)
        self.session.set_default_extensions_from_config()
Exemplo n.º 13
0
    def show_update(self):
        '''called when the liststore need to be changed'''
        self.clear_all()
        self.update_amount = 0

        for theme_type in self.themes.iterkeys():
            first = True
            if theme_type not in self.update_list['themes']:
                self.update_list['themes'][theme_type] = {}

            for path in self.themes[theme_type].list():
                if not self.check_updates('themes', theme_type, path):
                    continue
                if first:
                    self.append(False,
                                self.theme_names[theme_type],
                                theme_type,
                                visible=False)
                    first = False
                name = os.path.basename(path)
                label = self.themes[theme_type].get_name_from_path(path)
                self.update_list['themes'][theme_type][name] = path
                self.update_amount += 1
                self.append(True, label, name, path=path, type_=theme_type)

        pluginmanager = get_pluginmanager()

        first = True
        if 'plugin' not in self.update_list['plugins']:
            self.update_list['plugins']['plugin'] = {}

        for name, plugin in pluginmanager.get_plugins():
            path = plugin.path
            if not self.check_updates('plugins', 'plugin', path, plugin):
                continue
            if first:
                self.append(False, _('Plugins'), 'installed', True, False)
                first = False
            self.update_list['plugins']['plugin'][name] = path
            self.update_amount += 1
            self.append(True,
                        name,
                        name,
                        path=path,
                        type_='plugin',
                        description=pluginmanager.plugin_description(name))
Exemplo n.º 14
0
    def show_update(self):
        '''called when the liststore need to be changed'''
        self.removable_list = {}
        self.removable_list['plugin'] = {}

        self.clear_all()
        self.append(False, _('Installed'), 'installed', True, False)

        pluginmanager = get_pluginmanager()

        for name, plugin in pluginmanager.get_plugins():
            is_active = pluginmanager.plugin_is_active(name)
            path = plugin.path
            if path.startswith(self.config_dir.base_dir) and not is_active:
                self.removable_list['plugin'][name] = path
            self.append(is_active, name, name, path=path,
                        description=pluginmanager.plugin_description(name))
        DownloadList.show_update(self)
Exemplo n.º 15
0
    def show_update(self, installed_only=False):
        '''called when the liststore need to be changed'''
        self.removable_list = {}
        self.removable_list['plugin'] = {}

        self.clear_all()
        self.append(False, _('Installed'), 'installed', True, False)

        pluginmanager = get_pluginmanager()

        for name, plugin in pluginmanager.get_plugins():
            is_active = pluginmanager.plugin_is_active(name)
            path = plugin.path
            if path.startswith(self.config_dir.base_dir) and not is_active:
                self.removable_list['plugin'][name] = path
            self.append(is_active, name, name, path=path,
                        description=pluginmanager.plugin_description(name))
        DownloadList.show_update(self, installed_only)
Exemplo n.º 16
0
    def show_update(self, installed_only=False):
        '''called when the liststore need to be changed'''
        self.clear_all()
        self.update_amount = 0

        for theme_type in self.themes.iterkeys():
            first = True
            if theme_type not in self.update_list['themes']:
                self.update_list['themes'][theme_type] = {}

            for path in self.themes[theme_type].list():
                if not self.check_updates('themes', theme_type, path):
                    continue
                if first:
                    self.append(False, self.theme_names[theme_type], theme_type, visible=False)
                    first = False
                name = os.path.basename(path)
                label = self.themes[theme_type].get_name_from_path(path)
                self.update_list['themes'][theme_type][name] = path
                self.update_amount += 1
                self.append(True, label, name, path=path, type_=theme_type)

        pluginmanager = get_pluginmanager()

        first = True
        if 'plugin' not in self.update_list['plugins']:
            self.update_list['plugins']['plugin'] = {}

        for name, plugin in pluginmanager.get_plugins():
            path = plugin.path
            if not self.check_updates('plugins', 'plugin', path, plugin):
                continue
            if first:
                self.append(False, _('Plugins'), 'installed', True, False)
                first = False
            self.update_list['plugins']['plugin'][name] = path
            self.update_amount += 1
            self.append(True, name, name, path=path, type_='plugin',
                        description=pluginmanager.plugin_description(name))

        if self.update_amount > 0 and self.first:
            self.first = False
            extension.get_instance('preferences').show_updates_tab()