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
1=== modified file 'terminatorlib/config.py'
2--- terminatorlib/config.py 2014-01-24 22:29:07 +0000
3+++ terminatorlib/config.py 2014-05-19 20:15:32 +0000
4@@ -320,6 +320,10 @@
5 def add_layout(self, name, layout):
6 """Add a new layout"""
7 return(self.base.add_layout(name, layout))
8+
9+ def replace_layout(self, name, layout):
10+ """Replace an existing layout"""
11+ return(self.base.replace_layout(name, layout))
12
13 def del_layout(self, layout):
14 """Delete a layout"""
15@@ -734,6 +738,13 @@
16 self.layouts[name] = layout
17 return(True)
18
19+ def replace_layout(self, name, layout):
20+ """Replaces a layout with the given name"""
21+ if not name in self.layouts:
22+ return(False)
23+ self.layouts[name] = layout
24+ return(True)
25+
26 def get_layout(self, layout):
27 """Return a layout"""
28 if self.layouts.has_key(layout):
29
30=== modified file 'terminatorlib/preferences.glade'
31--- terminatorlib/preferences.glade 2013-09-04 20:56:43 +0000
32+++ terminatorlib/preferences.glade 2014-05-19 20:15:32 +0000
33@@ -3412,6 +3412,21 @@
34 <property name="position">2</property>
35 </packing>
36 </child>
37+ <child>
38+ <object class="GtkButton" id="layoutrefreshbutton">
39+ <property name="label">gtk-save</property>
40+ <property name="visible">True</property>
41+ <property name="can_focus">True</property>
42+ <property name="receives_default">True</property>
43+ <property name="use_stock">True</property>
44+ <signal name="clicked" handler="on_layoutrefreshbutton_clicked"/>
45+ </object>
46+ <packing>
47+ <property name="expand">False</property>
48+ <property name="fill">False</property>
49+ <property name="position">3</property>
50+ </packing>
51+ </child>
52 </object>
53 <packing>
54 <property name="expand">False</property>
55
56=== modified file 'terminatorlib/prefseditor.py'
57--- terminatorlib/prefseditor.py 2014-01-24 22:29:07 +0000
58+++ terminatorlib/prefseditor.py 2014-05-19 20:15:32 +0000
59@@ -1090,6 +1090,20 @@
60
61 self.config.save()
62
63+ def on_layoutrefreshbutton_clicked(self, _button):
64+ """Refresh the terminals status and update"""
65+ terminator = Terminator()
66+ current_layout = terminator.describe_layout()
67+
68+ guiget = self.builder.get_object
69+ treeview = guiget('layoutlist')
70+ selected = treeview.get_selection()
71+ (model, rowiter) = selected.get_selected()
72+ name = model.get_value(rowiter, 0)
73+
74+ if self.config.replace_layout(name, current_layout):
75+ treeview.set_cursor(model.get_path(rowiter), focus_column=treeview.get_column(0), start_editing=False)
76+
77 def on_layoutremovebutton_clicked(self, _button):
78 """Remove a layout from the list"""
79 guiget = self.builder.get_object