Don't try and set an active dropdown item that doesn't exist. Closes LP #361481

This commit is contained in:
Chris Jones 2009-06-16 18:50:52 +01:00
parent 46b73f406a
commit 8825cdc8ba
1 changed files with 14 additions and 7 deletions

View File

@ -142,26 +142,31 @@ class ProfileEditor:
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.scrollbar_position: for item in self.scrollbar_position:
widget.append_text (item) widget.append_text (item)
if value in self.scrollbar_position:
widget.set_active (self.scrollbar_position.index(value)) widget.set_active (self.scrollbar_position.index(value))
elif key == 'backspace_binding': elif key == 'backspace_binding':
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.backspace_del_binding: for item in self.backspace_del_binding:
widget.append_text (item) widget.append_text (item)
if value in self.backspace_del_binding:
widget.set_active (self.backspace_del_binding.index(value)) widget.set_active (self.backspace_del_binding.index(value))
elif key == 'delete_binding': elif key == 'delete_binding':
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.backspace_del_binding: for item in self.backspace_del_binding:
widget.append_text (item) widget.append_text (item)
if value in self.backspace_del_binding:
widget.set_active (self.backspace_del_binding.index(value)) widget.set_active (self.backspace_del_binding.index(value))
elif key == 'focus': elif key == 'focus':
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.focus: for item in self.focus:
widget.append_text (item) widget.append_text (item)
if value in self.focus:
widget.set_active (self.focus.index(value)) widget.set_active (self.focus.index(value))
elif key == 'background_type': elif key == 'background_type':
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.background_type: for item in self.background_type:
widget.append_text (item) widget.append_text (item)
if value in self.background_type:
widget.set_active (self.background_type.index(value)) widget.set_active (self.background_type.index(value))
elif key == 'background_darkness': elif key == 'background_darkness':
widget = gtk.HScale () widget = gtk.HScale ()
@ -209,11 +214,13 @@ class ProfileEditor:
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.tab_position: for item in self.tab_position:
widget.append_text (item) widget.append_text (item)
if value in self.tab_position:
widget.set_active (self.tab_position.index(value)) widget.set_active (self.tab_position.index(value))
elif key == 'cursor_shape': elif key == 'cursor_shape':
widget = gtk.combo_box_new_text() widget = gtk.combo_box_new_text()
for item in self.cursor_shape: for item in self.cursor_shape:
widget.append_text (item) widget.append_text (item)
if value in self.cursor_shape:
widget.set_active (self.cursor_shape.index (value)) widget.set_active (self.cursor_shape.index (value))
else: else:
if type == "bool": if type == "bool":