예제 #1
0
파일: plugins.py 프로젝트: bigdrum/snaked
    def show_plugins_prefs(self, editor):
        from snaked.core.gui.plugin_prefs import PluginDialog
        dialog = PluginDialog()
        editor.request_transient_for.emit(dialog.window)

        def set_plugin_list(plugin_list):
            self.enabled_plugins = plugin_list
            self.save_enabled_plugins()
            editor.message('Enabled plugins list saved')
            self.unload_unnecessary_plugins()
            editor.plugins_changed.emit()

        dialog.show(self.enabled_plugins, set_plugin_list)
예제 #2
0
def show_plugins_prefs(window):
    from snaked.core.gui.plugin_prefs import PluginDialog
    dialog = PluginDialog()
    dialog.window.set_transient_for(window)

    def set_plugin_list(plugin_list):
        enabled_plugins_prefs.store(plugin_list)
        plugins_activated = False
        for name in [r for r in plugin_list if r not in enabled_plugins]:
            plugins_activated = True
            enabled_plugins.append(name)
            init_plugin(name, window.manager.plugin_manager)

        window.message('Enabled plugins list saved', 'done', 5000)

        if plugins_activated:
            window.message('Enabled plugins have been activated', 'done', 5000)

        if any(r not in plugin_list for r in enabled_plugins):
            window.message('You should restart snaked to deactivate disabled plugins', 'warn', 5000)

    dialog.show(enabled_plugins_prefs.load(default_enabled_plugins), set_plugin_list)