Show UI selection ordered by name, none remains at the beginning (#1092)

Fixes random UI selection screen for Python <3.6.
This commit is contained in:
drebrez 2018-01-07 04:55:27 +01:00 committed by Oliver Smith
parent 2eed96201b
commit 748f2ce6b1
2 changed files with 6 additions and 6 deletions

View file

@ -70,11 +70,11 @@ def ask_for_ui(args):
ui_list = pmb.helpers.ui.list(args) ui_list = pmb.helpers.ui.list(args)
logging.info("Available user interfaces (" + logging.info("Available user interfaces (" +
str(len(ui_list) - 1) + "): ") str(len(ui_list) - 1) + "): ")
for ui, description in ui_list.items(): for ui in ui_list:
logging.info("* " + ui + ": " + description) logging.info("* " + ui[0] + ": " + ui[1])
while True: while True:
ret = pmb.helpers.cli.ask(args, "User interface", None, args.ui, True) ret = pmb.helpers.cli.ask(args, "User interface", None, args.ui, True)
if ret in ui_list: if ret in dict(ui_list).keys():
return ret return ret
logging.fatal("ERROR: Invalid user interface specified, please type in" logging.fatal("ERROR: Invalid user interface specified, please type in"
" one from the list above.") " one from the list above.")

View file

@ -25,11 +25,11 @@ def list(args):
""" """
Get all UIs, for which aports are available with their description. Get all UIs, for which aports are available with their description.
:returns: {"none": "No graphical...", "weston": "Wayland reference..."} :returns: [("none", "No graphical..."), ("weston", "Wayland reference...")]
""" """
ret = {"none": "No graphical environment"} ret = [("none", "No graphical environment")]
for path in sorted(glob.glob(args.aports + "/main/postmarketos-ui-*")): for path in sorted(glob.glob(args.aports + "/main/postmarketos-ui-*")):
apkbuild = pmb.parse.apkbuild(args, path + "/APKBUILD") apkbuild = pmb.parse.apkbuild(args, path + "/APKBUILD")
ui = os.path.basename(path).split("-", 2)[2] ui = os.path.basename(path).split("-", 2)[2]
ret[ui] = apkbuild["pkgdesc"] ret.append((ui, apkbuild["pkgdesc"]))
return ret return ret