Skip to content

Commit

Permalink
Merge pull request #974 from vssdeo/973-KeyError-when-a-single-window…
Browse files Browse the repository at this point in the history
…-layout-is-selected-after-selecting-a-multiple-tab-layouts

Ensure that when the layout item is changed the layout sub item also gets reset to first item, else KeyError is thrown
  • Loading branch information
mattrose authored Jan 13, 2025
2 parents 91dc655 + 3b07d9b commit 4bf3367
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions terminatorlib/prefseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,12 @@ def update_profiles(self):

def on_layout_selection_changed(self, selection):
"""A different layout was selected"""
#reset the layout item to first item when a diff
#layout is selected and highlight
if self.treestore.get_iter_first():
path = Gtk.TreePath.new_from_indices([0])
self.treeview.set_cursor(path, None, False)

(listmodel, rowiter) = selection.get_selected()
if not rowiter:
# Something is wrong, just jump to the first item in the list
Expand All @@ -2137,6 +2143,7 @@ def on_layout_selection_changed(self, selection):
command.set_sensitive(False)
chooser.set_sensitive(False)
workdir.set_sensitive(False)
self.treeview.grab_focus()

def on_layout_item_selection_changed(self, selection):
"""A different item in the layout was selected"""
Expand Down

0 comments on commit 4bf3367

Please sign in to comment.