Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorSecondThundeR <awayfromgalaxy@gmail.com>2021-04-17 16:35:21 +0300
committerSecondThundeR <awayfromgalaxy@gmail.com>2021-04-17 16:35:21 +0300
commita316846121caf4b26f96bed8dbe057b649cc409d (patch)
tree259479f2a723ae9dca4e35d274f9fa0b852286a4 /profiles
parent9991b19a064536defd22a7941504a4699aa906b0 (diff)
Replace input with generic_select where necessary
Here are list of changes: > From now on, `generic_select` will be called "Select function", for clarity - Slightly updated select function - Removed options output for some functions, where it's better to do with select function - Added sorting for all lists passed to select function - Replaced `dict.values()` with `dict` as options parameter - Simplified input checking for all functions that use the select function - Added temporary *(for now)* workaround for passing `?` and `help` inputs - Merged fix for `partition.format()`
Diffstat (limited to 'profiles')
-rw-r--r--profiles/desktop.py2
-rw-r--r--profiles/i3.py2
-rw-r--r--profiles/xorg.py32
3 files changed, 9 insertions, 27 deletions
diff --git a/profiles/desktop.py b/profiles/desktop.py
index 846182e2..b46bf6fd 100644
--- a/profiles/desktop.py
+++ b/profiles/desktop.py
@@ -17,7 +17,7 @@ def _prep_function(*args, **kwargs):
"""
supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate']
- desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ')
+ desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ', False)
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
diff --git a/profiles/i3.py b/profiles/i3.py
index 67028b2d..fc427186 100644
--- a/profiles/i3.py
+++ b/profiles/i3.py
@@ -17,7 +17,7 @@ def _prep_function(*args, **kwargs):
"""
supported_configurations = ['i3-wm', 'i3-gaps']
- desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ')
+ desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ', False)
# Temporarily store the selected desktop profile
# in a session-safe location, since this module will get reloaded
diff --git a/profiles/xorg.py b/profiles/xorg.py
index e905d533..8c6f686d 100644
--- a/profiles/xorg.py
+++ b/profiles/xorg.py
@@ -33,10 +33,7 @@ def select_driver(options):
drivers = sorted(list(options))
if len(drivers) >= 1:
- for index, driver in enumerate(drivers):
- print(f"{index}: {driver}")
-
- print(' -- The above list are supported graphic card drivers. --')
+ print(' -- The below list are supported graphic card drivers. --')
print(' -- You need to select (and read about) which one you need. --')
lspci = archinstall.sys_command(f'/usr/bin/lspci')
@@ -47,7 +44,7 @@ def select_driver(options):
elif b'amd' in line.lower():
print(' ** AMD card detected, suggested driver: AMD / ATI **')
- selected_driver = input('Select your graphics card driver: ')
+ selected_driver = archinstall.generic_select(drivers, 'Select your graphics card driver: ', False)
initial_option = selected_driver
# Disabled search for now, only a few profiles exist anyway
@@ -57,29 +54,14 @@ def select_driver(options):
# filter_string = input('Search for layout containing (example: "sv-"): ')
# new_options = search_keyboard_layout(filter_string)
# return select_language(new_options)
- if selected_driver.isdigit() and (pos := int(selected_driver)) <= len(drivers)-1:
- selected_driver = options[drivers[pos]]
- elif selected_driver in options:
- selected_driver = options[options.index(selected_driver)]
- elif len(selected_driver) == 0:
- raise archinstall.RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.")
- else:
- raise archinstall.RequirementError("Selected driver does not exist.")
+
+ selected_driver = options[selected_driver]
if type(selected_driver) == dict:
driver_options = sorted(list(selected_driver))
- for index, driver_package_group in enumerate(driver_options):
- print(f"{index}: {driver_package_group}")
-
- selected_driver_package_group = input(f'Which driver-type do you want for {initial_option}: ')
- if selected_driver_package_group.isdigit() and (pos := int(selected_driver_package_group)) <= len(driver_options)-1:
- selected_driver_package_group = selected_driver[driver_options[pos]]
- elif selected_driver_package_group in selected_driver:
- selected_driver_package_group = selected_driver[selected_driver.index(selected_driver_package_group)]
- elif len(selected_driver_package_group) == 0:
- raise archinstall.RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.")
- else:
- raise archinstall.RequirementError(f"Selected driver-type does not exist for {initial_option}.")
+
+ selected_driver_package_group = archinstall.generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', False)
+ selected_driver_package_group = selected_driver[selected_driver_package_group]
return selected_driver_package_group