(trunk-1576) Add 'Save' button for saving to the selected Layout (Ariel Zelivansky)
This commit is contained in:
commit
758863f363
|
@ -331,6 +331,10 @@ class Config(object):
|
|||
"""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"""
|
||||
if self.base.layouts.has_key(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):
|
||||
|
|
|
@ -229,6 +229,11 @@
|
|||
<column type="gboolean"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="ScrollbackAdjustmend">
|
||||
<property name="upper">10000000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ScrollbarPositionListStore">
|
||||
<columns>
|
||||
<!-- column-name Position -->
|
||||
|
@ -289,11 +294,6 @@
|
|||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="ScrollbackAdjustmend">
|
||||
<property name="upper">10000000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="lower">-1</property>
|
||||
<property name="upper">5</property>
|
||||
|
@ -3405,7 +3405,20 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkButton" id="layoutrefreshbutton">
|
||||
<property name="label">gtk-save</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_layoutrefreshbutton_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue