Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py59
1 files changed, 15 insertions, 44 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 5eb25b19..16124fd5 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -1,9 +1,9 @@
import getpass, pathlib, os, shutil, re
-import sys, time, signal, ipaddress
+import sys, time, signal, ipaddress, logging
from .exceptions import *
from .profiles import Profile
from .locale_helpers import list_keyboard_languages, verify_keyboard_layout, search_keyboard_layout
-from .output import log, LOG_LEVELS
+from .output import log
from .storage import storage
from .networking import list_interfaces
from .general import sys_command
@@ -26,7 +26,7 @@ def check_for_correct_username(username):
return True
log(
"The username you entered is invalid. Try again",
- level=LOG_LEVELS.Warning,
+ level=logging.WARNING,
fg='red'
)
return False
@@ -141,7 +141,7 @@ def ask_for_a_timezone():
else:
log(
f"Specified timezone {timezone} does not exist.",
- level=LOG_LEVELS.Warning,
+ level=logging.WARNING,
fg='red'
)
@@ -198,7 +198,7 @@ def ask_to_configure_network():
except ValueError:
log(
"You need to enter a valid IP in IP-config mode.",
- level=LOG_LEVELS.Warning,
+ level=logging.WARNING,
fg='red'
)
@@ -214,7 +214,7 @@ def ask_to_configure_network():
except ValueError:
log(
"You need to enter a valid gateway (router) IP address.",
- level=LOG_LEVELS.Warning,
+ level=logging.WARNING,
fg='red'
)
@@ -479,15 +479,7 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
(The template xorg is for beginner users, not advanced, and should
there for appeal to the general public first and edge cases later)
"""
- 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(' -- You need to select (and read about) which one you need. --')
-
+ if len(options) >= 1:
lspci = sys_command(f'/usr/bin/lspci')
for line in lspci.trace_log.split(b'\r\n'):
if b' vga ' in line.lower():
@@ -496,37 +488,16 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS):
elif b'amd' in line.lower():
print(' ** AMD card detected, suggested driver: AMD / ATI **')
- selected_driver = input('Select your graphics card driver: ')
+ selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True)
initial_option = selected_driver
- # Disabled search for now, only a few profiles exist anyway
- #
- #print(' -- You can enter ? or help to search for more drivers --')
- #if selected_driver.lower() in ('?', 'help'):
- # 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 RequirementError("At least one graphics driver is needed to support a graphical environment. Please restart the installer and try again.")
- else:
- raise RequirementError("Selected driver does not exist.")
-
- 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 RequirementError(f"At least one driver package is required for a graphical environment using {selected_driver}. Please restart the installer and try again.")
+ if type(options[initial_option]) == dict:
+ driver_options = sorted(options[initial_option].keys())
+
+ selected_driver_package_group = generic_select(driver_options, input_text=f"Which driver-type do you want for {initial_option}: ")
+ if selected_driver_package_group in options[initial_option].keys():
+ print(options[initial_option][selected_driver_package_group])
+ selected_driver = options[initial_option][selected_driver_package_group]
else:
raise RequirementError(f"Selected driver-type does not exist for {initial_option}.")