Switch the plugin enabling/disabling to not work online, but to save the state for later
This commit is contained in:
parent
51fe811b85
commit
70a66ee218
|
@ -2865,32 +2865,51 @@
|
||||||
<object class="GtkHBox" id="hbox7">
|
<object class="GtkHBox" id="hbox7">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeView" id="pluginlist">
|
<object class="GtkVBox" id="vbox12">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="model">PluginListStore</property>
|
|
||||||
<property name="hadjustment">adjustment2</property>
|
|
||||||
<property name="vadjustment">adjustment3</property>
|
|
||||||
<property name="search_column">0</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeViewColumn" id="plugincolumn1">
|
<object class="GtkTreeView" id="pluginlist">
|
||||||
<property name="title">Plugin</property>
|
<property name="visible">True</property>
|
||||||
<property name="clickable">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="model">PluginListStore</property>
|
||||||
|
<property name="hadjustment">adjustment2</property>
|
||||||
|
<property name="vadjustment">adjustment3</property>
|
||||||
|
<property name="search_column">0</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererToggle" id="cellrenderertext15">
|
<object class="GtkTreeViewColumn" id="plugincolumn1">
|
||||||
<signal name="toggled" handler="on_plugin_toggled"/>
|
<property name="title">Plugin</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererToggle" id="cellrenderertext15">
|
||||||
|
<signal name="toggled" handler="on_plugin_toggled"/>
|
||||||
|
</object>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="active">1</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext16"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<attributes>
|
|
||||||
<attribute name="active">1</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext16"/>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="text">0</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label13">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Plugins will be enabled/disabled after restarting Terminator</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -28,6 +28,7 @@ class PrefsEditor:
|
||||||
"""Class implementing the various parts of the preferences editor"""
|
"""Class implementing the various parts of the preferences editor"""
|
||||||
config = None
|
config = None
|
||||||
registry = None
|
registry = None
|
||||||
|
plugins = None
|
||||||
keybindings = None
|
keybindings = None
|
||||||
window = None
|
window = None
|
||||||
builder = None
|
builder = None
|
||||||
|
@ -266,11 +267,15 @@ class PrefsEditor:
|
||||||
widget = guiget('pluginlist')
|
widget = guiget('pluginlist')
|
||||||
liststore = widget.get_model()
|
liststore = widget.get_model()
|
||||||
self.registry = PluginRegistry()
|
self.registry = PluginRegistry()
|
||||||
plugins = self.registry.get_available_plugins()
|
|
||||||
self.pluginiters = {}
|
self.pluginiters = {}
|
||||||
for plugin in plugins:
|
pluginlist = self.registry.get_available_plugins()
|
||||||
|
self.plugins = {}
|
||||||
|
for plugin in pluginlist:
|
||||||
|
self.plugins[plugin] = self.registry.is_enabled(plugin)
|
||||||
|
|
||||||
|
for plugin in self.plugins:
|
||||||
self.pluginiters[plugin] = liststore.append([plugin,
|
self.pluginiters[plugin] = liststore.append([plugin,
|
||||||
self.registry.is_enabled(plugin)])
|
self.plugins[plugin]])
|
||||||
selection = widget.get_selection()
|
selection = widget.get_selection()
|
||||||
selection.connect('changed', self.on_plugin_selection_changed)
|
selection.connect('changed', self.on_plugin_selection_changed)
|
||||||
if len(self.pluginiters) > 0:
|
if len(self.pluginiters) > 0:
|
||||||
|
@ -1020,16 +1025,11 @@ class PrefsEditor:
|
||||||
model = treeview.get_model()
|
model = treeview.get_model()
|
||||||
plugin = model[path][0]
|
plugin = model[path][0]
|
||||||
|
|
||||||
state = self.registry.is_enabled(plugin)
|
self.plugins[plugin] = not self.plugins[plugin]
|
||||||
if state:
|
|
||||||
self.registry.disable(plugin)
|
|
||||||
else:
|
|
||||||
self.registry.enable(plugin)
|
|
||||||
state = self.registry.is_enabled(plugin)
|
|
||||||
# Update the treeview
|
# Update the treeview
|
||||||
model[path][1] = state
|
model[path][1] = self.plugins[plugin]
|
||||||
|
|
||||||
enabled_plugins = self.registry.get_all_plugins().keys()
|
enabled_plugins = [x for x in self.plugins if self.plugins[x] == True]
|
||||||
self.config['enabled_plugins'] = enabled_plugins
|
self.config['enabled_plugins'] = enabled_plugins
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue