previous_selection was being mistakenly overloaded for profiles and layouts. split it out into two variables

This commit is contained in:
Chris Jones 2010-01-31 16:24:45 +00:00
parent f5dfd404c9
commit 5392585893

View File

@ -23,7 +23,8 @@ class PrefsEditor:
keybindings = None keybindings = None
window = None window = None
builder = None builder = None
previous_selection = None previous_layout_selection = None
previous_profile_selection = None
colorschemevalues = {'black_on_yellow': 0, colorschemevalues = {'black_on_yellow': 0,
'black_on_white': 1, 'black_on_white': 1,
'grey_on_black': 2, 'grey_on_black': 2,
@ -275,7 +276,7 @@ class PrefsEditor:
self.store_profile_values() self.store_profile_values()
## Layouts tab ## Layouts tab
self.store_layout() self.store_layout(self.previous_layout_selection)
## Keybindings tab ## Keybindings tab
keybindings = self.config['keybindings'] keybindings = self.config['keybindings']
@ -654,7 +655,7 @@ class PrefsEditor:
# We shouldn't let people delete this profile # We shouldn't let people delete this profile
return return
self.previous_selection = None self.previous_profile_selection = None
self.config.del_profile(profile) self.config.del_profile(profile)
model.remove(rowiter) model.remove(rowiter)
selection.select_iter(model.get_iter_first()) selection.select_iter(model.get_iter_first())
@ -758,9 +759,9 @@ class PrefsEditor:
def on_profile_selection_changed(self, selection): def on_profile_selection_changed(self, selection):
"""A different profile was selected""" """A different profile was selected"""
if self.previous_selection is not None: if self.previous_profile_selection is not None:
dbg('PrefsEditor::on_profile_selection_changed: Storing: %s' % dbg('PrefsEditor::on_profile_selection_changed: Storing: %s' %
self.previous_selection) self.previous_profile_selection)
self.store_profile_values() self.store_profile_values()
(listmodel, rowiter) = selection.get_selected() (listmodel, rowiter) = selection.get_selected()
@ -772,7 +773,7 @@ class PrefsEditor:
return return
profile = listmodel.get_value(rowiter, 0) profile = listmodel.get_value(rowiter, 0)
self.set_profile_values(profile) self.set_profile_values(profile)
self.previous_selection = profile self.previous_profile_selection = profile
widget = self.builder.get_object('profileremovebutton') widget = self.builder.get_object('profileremovebutton')
if profile == 'default': if profile == 'default':
@ -794,14 +795,14 @@ class PrefsEditor:
itera = model.get_iter(path) itera = model.get_iter(path)
model.set_value(itera, 0, newtext) model.set_value(itera, 0, newtext)
if oldname == self.previous_selection: if oldname == self.previous_profile_selection:
self.previous_selection = newtext self.previous_profile_selection = newtext
def on_layout_selection_changed(self, selection): def on_layout_selection_changed(self, selection):
"""A different layout was selected""" """A different layout was selected"""
if self.previous_selection is not None: if self.previous_layout_selection is not None:
dbg('Storing: %s' % self.previous_selection) dbg('Storing: %s' % self.previous_layout_selection)
self.store_layout(self.previous_selection) self.store_layout(self.previous_layout_selection)
(listmodel, rowiter) = selection.get_selected() (listmodel, rowiter) = selection.get_selected()
if not rowiter: if not rowiter:
@ -812,7 +813,7 @@ class PrefsEditor:
return return
layout = listmodel.get_value(rowiter, 0) layout = listmodel.get_value(rowiter, 0)
self.set_layout(layout) self.set_layout(layout)
self.previous_selection = layout self.previous_layout_selection = layout
widget = self.builder.get_object('layoutremovebutton') widget = self.builder.get_object('layoutremovebutton')
if layout == 'default': if layout == 'default':
@ -833,8 +834,8 @@ class PrefsEditor:
itera = model.get_iter(path) itera = model.get_iter(path)
model.set_value(itera, 0, newtext) model.set_value(itera, 0, newtext)
if oldname == self.previous_selection: if oldname == self.previous_layout_selection:
self.previous_selection = newtext self.previous_layout_selection = newtext
def on_color_scheme_combobox_changed(self, widget): def on_color_scheme_combobox_changed(self, widget):
"""Update the fore/background colour pickers""" """Update the fore/background colour pickers"""