diff --git a/terminatorlib/config.py b/terminatorlib/config.py index b91a8dae..422993c9 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -330,6 +330,10 @@ class Config(object): def add_layout(self, name, layout): """Add a new layout""" return(self.base.add_layout(name, layout)) + + def replace_layout(self, name, layout): + """Replace an existing layout""" + return(self.base.replace_layout(name, layout)) def del_layout(self, layout): """Delete a layout""" @@ -764,6 +768,13 @@ class ConfigBase(Borg): self.layouts[name] = layout return(True) + def replace_layout(self, name, layout): + """Replaces a layout with the given name""" + if not name in self.layouts: + return(False) + self.layouts[name] = layout + return(True) + def get_layout(self, layout): """Return a layout""" if self.layouts.has_key(layout): diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index eede5d7e..15121cbe 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -229,6 +229,11 @@ + + 10000000 + 1 + 10 + @@ -289,11 +294,6 @@ - - 10000000 - 1 - 10 - -1 5 @@ -3405,7 +3405,20 @@ - + + gtk-save + True + True + True + False + True + + + + False + False + 2 + diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 918d900b..b1c3994e 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -1083,6 +1083,20 @@ class PrefsEditor: self.config.save() + def on_layoutrefreshbutton_clicked(self, _button): + """Refresh the terminals status and update""" + terminator = Terminator() + current_layout = terminator.describe_layout() + + guiget = self.builder.get_object + treeview = guiget('layoutlist') + selected = treeview.get_selection() + (model, rowiter) = selected.get_selected() + name = model.get_value(rowiter, 0) + + if self.config.replace_layout(name, current_layout): + treeview.set_cursor(model.get_path(rowiter), column=treeview.get_column(0), start_editing=False) + def on_layoutremovebutton_clicked(self, _button): """Remove a layout from the list""" guiget = self.builder.get_object