Skip to content

Commit

Permalink
Fix issue using set-uri if no user-prefs have been saved yet
Browse files Browse the repository at this point in the history
Ignore case when sorting URI's to display.
  • Loading branch information
MHendricks committed Sep 29, 2023
1 parent 600ed10 commit 8950c8f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hab_gui/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,16 @@ def set_uri(settings, uri):
# TODO: Use fancy hab-gui widgets configured by site
current_uri = settings.resolver.user_prefs().uri
uris = list(settings.resolver.dump_forest(settings.resolver.configs, indent=""))
if current_uri not in uris:
if current_uri and current_uri not in uris:
uris.append(current_uri)
uris.sort()
current = uris.index(current_uri)
uris.sort(key=lambda i: i.lower())

current_index = -1
if current_uri:
current_index = uris.index(current_uri)

uri, ok = QInputDialog.getItem(
None, "Set hab URI", "Set default hab URI to:", uris, current=current
None, "Set hab URI", "Set default hab URI to:", uris, current=current_index
)
if ok:
settings.resolver.user_prefs().uri = uri

0 comments on commit 8950c8f

Please sign in to comment.