From bedd8a1241eab7773c160d164ae0a27d002998b0 Mon Sep 17 00:00:00 2001 From: Владислав Date: Tue, 27 Apr 2021 21:26:58 +0300 Subject: Fixed a crash before choosing a video card driver --- archinstall/lib/user_interaction.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 79b0e0b9..5cfb0a1b 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -480,7 +480,10 @@ 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) """ - if len(options) >= 1: + + drivers = sorted(list(options)) + + if drivers: lspci = sys_command(f'/usr/bin/lspci') for line in lspci.trace_log.split(b'\r\n'): if b' vga ' in line.lower(): @@ -489,20 +492,17 @@ def select_driver(options=AVAILABLE_GFX_DRIVERS): elif b'amd' in line.lower(): print(' ** AMD card detected, suggested driver: AMD / ATI **') - selected_driver = generic_select(options, input_text="Select your graphics card driver: ", sort=True) - initial_option = selected_driver + initial_option = generic_select(drivers, input_text="Select your graphics card driver: ") + selected_driver = options[initial_option] - if type(options[initial_option]) == dict: - driver_options = sorted(options[initial_option].keys()) + if type(selected_driver) == dict: + driver_options = sorted(list(selected_driver)) - 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}.") + driver_package_group = generic_select(driver_options, f'Which driver-type do you want for {initial_option}: ', + allow_empty_input=False) + driver_package_group = selected_driver[driver_package_group] - return selected_driver_package_group + return driver_package_group return selected_driver -- cgit v1.2.3-70-g09d2