Merge lp:~ariel-zelivans/terminator/layout-button-update into lp:terminator/trunk

Proposed by Ariel Zelivansky
Status: Merged
Merged at revision: 1576
Proposed branch: lp:~ariel-zelivans/terminator/layout-button-update
Merge into: lp:terminator/trunk
Diff against target: 79 lines (+40/-0)
3 files modified
terminatorlib/config.py (+11/-0)
terminatorlib/preferences.glade (+15/-0)
terminatorlib/prefseditor.py (+14/-0)
To merge this branch: bzr merge lp:~ariel-zelivans/terminator/layout-button-update
Reviewer Review Type Date Requested Status
Terminator Pending
Review via email: mp+220126@code.launchpad.net

Description of the change

I've added a button in the layout management window to catch the current layout and update the layout configuration accordingly.

To post a comment you must log in.
Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Thanks for the addition.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'terminatorlib/config.py'
--- terminatorlib/config.py 2014-01-24 22:29:07 +0000
+++ terminatorlib/config.py 2014-05-19 20:15:32 +0000
@@ -320,6 +320,10 @@
320 def add_layout(self, name, layout):320 def add_layout(self, name, layout):
321 """Add a new layout"""321 """Add a new layout"""
322 return(self.base.add_layout(name, layout))322 return(self.base.add_layout(name, layout))
323
324 def replace_layout(self, name, layout):
325 """Replace an existing layout"""
326 return(self.base.replace_layout(name, layout))
323327
324 def del_layout(self, layout):328 def del_layout(self, layout):
325 """Delete a layout"""329 """Delete a layout"""
@@ -734,6 +738,13 @@
734 self.layouts[name] = layout738 self.layouts[name] = layout
735 return(True)739 return(True)
736740
741 def replace_layout(self, name, layout):
742 """Replaces a layout with the given name"""
743 if not name in self.layouts:
744 return(False)
745 self.layouts[name] = layout
746 return(True)
747
737 def get_layout(self, layout):748 def get_layout(self, layout):
738 """Return a layout"""749 """Return a layout"""
739 if self.layouts.has_key(layout):750 if self.layouts.has_key(layout):
740751
=== modified file 'terminatorlib/preferences.glade'
--- terminatorlib/preferences.glade 2013-09-04 20:56:43 +0000
+++ terminatorlib/preferences.glade 2014-05-19 20:15:32 +0000
@@ -3412,6 +3412,21 @@
3412 <property name="position">2</property>3412 <property name="position">2</property>
3413 </packing>3413 </packing>
3414 </child>3414 </child>
3415 <child>
3416 <object class="GtkButton" id="layoutrefreshbutton">
3417 <property name="label">gtk-save</property>
3418 <property name="visible">True</property>
3419 <property name="can_focus">True</property>
3420 <property name="receives_default">True</property>
3421 <property name="use_stock">True</property>
3422 <signal name="clicked" handler="on_layoutrefreshbutton_clicked"/>
3423 </object>
3424 <packing>
3425 <property name="expand">False</property>
3426 <property name="fill">False</property>
3427 <property name="position">3</property>
3428 </packing>
3429 </child>
3415 </object>3430 </object>
3416 <packing>3431 <packing>
3417 <property name="expand">False</property>3432 <property name="expand">False</property>
34183433
=== modified file 'terminatorlib/prefseditor.py'
--- terminatorlib/prefseditor.py 2014-01-24 22:29:07 +0000
+++ terminatorlib/prefseditor.py 2014-05-19 20:15:32 +0000
@@ -1090,6 +1090,20 @@
10901090
1091 self.config.save()1091 self.config.save()
10921092
1093 def on_layoutrefreshbutton_clicked(self, _button):
1094 """Refresh the terminals status and update"""
1095 terminator = Terminator()
1096 current_layout = terminator.describe_layout()
1097
1098 guiget = self.builder.get_object
1099 treeview = guiget('layoutlist')
1100 selected = treeview.get_selection()
1101 (model, rowiter) = selected.get_selected()
1102 name = model.get_value(rowiter, 0)
1103
1104 if self.config.replace_layout(name, current_layout):
1105 treeview.set_cursor(model.get_path(rowiter), focus_column=treeview.get_column(0), start_editing=False)
1106
1093 def on_layoutremovebutton_clicked(self, _button):1107 def on_layoutremovebutton_clicked(self, _button):
1094 """Remove a layout from the list"""1108 """Remove a layout from the list"""
1095 guiget = self.builder.get_object1109 guiget = self.builder.get_object