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:
parent
2eed96201b
commit
748f2ce6b1
|
@ -70,11 +70,11 @@ def ask_for_ui(args):
|
|||
ui_list = pmb.helpers.ui.list(args)
|
||||
logging.info("Available user interfaces (" +
|
||||
str(len(ui_list) - 1) + "): ")
|
||||
for ui, description in ui_list.items():
|
||||
logging.info("* " + ui + ": " + description)
|
||||
for ui in ui_list:
|
||||
logging.info("* " + ui[0] + ": " + ui[1])
|
||||
while 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
|
||||
logging.fatal("ERROR: Invalid user interface specified, please type in"
|
||||
" one from the list above.")
|
||||
|
|
|
@ -25,11 +25,11 @@ def list(args):
|
|||
"""
|
||||
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-*")):
|
||||
apkbuild = pmb.parse.apkbuild(args, path + "/APKBUILD")
|
||||
ui = os.path.basename(path).split("-", 2)[2]
|
||||
ret[ui] = apkbuild["pkgdesc"]
|
||||
ret.append((ui, apkbuild["pkgdesc"]))
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue