Skip to content

Commit

Permalink
Select pre-existing URI's in URIComboBox
Browse files Browse the repository at this point in the history
This makes it so when the popup is shown, the current URI is selected
and scrolled to instead of having nothing selected and the scroll area
is at the top of the list.
  • Loading branch information
MHendricks committed Sep 29, 2023
1 parent 8950c8f commit 23b2364
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hab_gui/widgets/uri_combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@ def uri(self):
return self.currentText()

def set_uri(self, uri):
self.setEditText(uri)
# If the uri is already an item in the combo box, select it
index = self.findText(uri)
if index > -1:
self.setCurrentIndex(index)
else:
# Otherwise update the text of the combo box to match
self.setEditText(uri)

0 comments on commit 23b2364

Please sign in to comment.