(trunk-1577) Preselect the current layout when opening Prefs window, and also save config after using the layout 'Save' button (Steve Boddy)

This commit is contained in:
Stephen Boddy 2015-07-15 02:51:18 +02:00
parent 758863f363
commit 7f452e5b64
3 changed files with 12 additions and 3 deletions

View File

@ -330,7 +330,7 @@ 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))

View File

@ -329,7 +329,12 @@ class PrefsEditor:
self.layoutiters[layout] = liststore.append([layout, editable])
selection = widget.get_selection()
selection.connect('changed', self.on_layout_selection_changed)
selection.select_iter(self.layoutiters['default'])
terminator = Terminator()
if terminator.layoutname:
layout_to_highlight = terminator.layoutname
else:
layout_to_highlight = 'default'
selection.select_iter(self.layoutiters[layout_to_highlight])
# Now set up the selection changed handler for the layout itself
widget = guiget('LayoutTreeView')
selection = widget.get_selection()
@ -1093,9 +1098,10 @@ class PrefsEditor:
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)
self.config.save()
def on_layoutremovebutton_clicked(self, _button):
"""Remove a layout from the list"""

View File

@ -49,6 +49,7 @@ class Terminator(Borg):
debug_address = None
doing_layout = None
layoutname = None
last_active_window = None
groupsend = None
@ -302,6 +303,8 @@ class Terminator(Borg):
window.set_fullscreen(window.isfullscreen)
window.create_layout(layout[windef])
self.layoutname = layoutname
def layout_done(self):
"""Layout operations have finished, record that fact"""
self.doing_layout = False