Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles/desktop.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-05-09 20:02:48 +1000
committerGitHub <noreply@github.com>2022-05-09 12:02:48 +0200
commit0fa52a5424e28ed62ef84bdc92868bbfc434e015 (patch)
tree4b88e7799319aa9489f7e16beedf5517b6feba34 /profiles/desktop.py
parent20ffebac50478554a7582de5e5c1d8b4504ea8be (diff)
Introduce ctrl+c and other bug fixes (#1152)
* Intergrate ctrl+c * stash * Update * Fix profile reset * flake8 Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'profiles/desktop.py')
-rw-r--r--profiles/desktop.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/profiles/desktop.py b/profiles/desktop.py
index eaece9f5..e94d3505 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -1,6 +1,12 @@
# A desktop environment selector.
+from typing import Any, TYPE_CHECKING
+
import archinstall
-from archinstall import log
+from archinstall import log, Menu
+from archinstall.lib.menu.menu import MenuSelectionType
+
+if TYPE_CHECKING:
+ _: Any
is_top_level_profile = True
@@ -46,23 +52,26 @@ def _prep_function(*args, **kwargs) -> bool:
other code in this stage. So it's a safe way to ask the user
for more input before any other installer steps start.
"""
- desktop = archinstall.Menu(str(_('Select your desired desktop environment')), __supported__).run()
+ choice = Menu(str(_('Select your desired desktop environment')), __supported__).run()
+
+ if choice.type_ != MenuSelectionType.Selection:
+ return False
- if desktop:
+ if choice.value:
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
# the next time it gets executed.
if not archinstall.storage.get('_desktop_profile', None):
- archinstall.storage['_desktop_profile'] = desktop
+ archinstall.storage['_desktop_profile'] = choice.value
if not archinstall.arguments.get('desktop-environment', None):
- archinstall.arguments['desktop-environment'] = desktop
- profile = archinstall.Profile(None, desktop)
+ archinstall.arguments['desktop-environment'] = choice.value
+ profile = archinstall.Profile(None, choice.value)
# Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered.
- with profile.load_instructions(namespace=f"{desktop}.py") as imported:
+ with profile.load_instructions(namespace=f"{choice.value}.py") as imported:
if hasattr(imported, '_prep_function'):
return imported._prep_function()
else:
- log(f"Deprecated (??): {desktop} profile has no _prep_function() anymore")
+ log(f"Deprecated (??): {choice.value} profile has no _prep_function() anymore")
exit(1)
return False