index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2023-04-02 13:50:24 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2023-04-02 13:50:24 +0200 |
commit | af7ab9833c9f9944874f0162ae0975175ddc628d (patch) | |
tree | c486d4948b5994125f95c8aa1d61a059c1351127 /archinstall/lib/menu | |
parent | 2caad35a885f9be30d5bf79a47f5456f276ae67b (diff) | |
parent | 6e3c6f8863041b54f6d8cf7af37f9719c493eadd (diff) |
-rw-r--r-- | archinstall/lib/menu/abstract_menu.py | 20 | ||||
-rw-r--r-- | archinstall/lib/menu/global_menu.py | 14 |
diff --git a/archinstall/lib/menu/abstract_menu.py b/archinstall/lib/menu/abstract_menu.py index 5a7ca03a..d659d709 100644 --- a/archinstall/lib/menu/abstract_menu.py +++ b/archinstall/lib/menu/abstract_menu.py @@ -17,14 +17,14 @@ class Selector: def __init__( self, description :str, - func :Callable = None, - display_func :Callable = None, + func :Optional[Callable] = None, + display_func :Optional[Callable] = None, default :Any = None, enabled :bool = False, dependencies :List = [], dependencies_not :List = [], - exec_func :Callable = None, - preview_func :Callable = None, + exec_func :Optional[Callable] = None, + preview_func :Optional[Callable] = None, mandatory :bool = False, no_store :bool = False ): @@ -165,7 +165,7 @@ class Selector: class AbstractMenu: - def __init__(self, data_store: Dict[str, Any] = None, auto_cursor=False, preview_size :float = 0.2): + def __init__(self, data_store: Optional[Dict[str, Any]] = None, auto_cursor=False, preview_size :float = 0.2): """ Create a new selection menu. @@ -226,7 +226,7 @@ class AbstractMenu: """ will be called before each action in the menu """ return - def post_callback(self, selection_name: str = None, value: Any = None): + def post_callback(self, selection_name: Optional[str] = None, value: Any = None): """ will be called after each action in the menu """ return True @@ -356,7 +356,7 @@ class AbstractMenu: config_name, selector = self._find_selection(selection_name) return self.exec_option(config_name, selector) - def exec_option(self, config_name :str, p_selector :Selector = None) -> bool: + def exec_option(self, config_name :str, p_selector :Optional[Selector] = None) -> bool: """ processes the execution of a given menu entry - pre process callback - selection function @@ -372,13 +372,13 @@ class AbstractMenu: self.pre_callback(config_name) result = None - if selector.func: + if selector.func is not None: presel_val = self.option(config_name).get_selection() result = selector.func(presel_val) self._menu_options[config_name].set_current_selection(result) if selector.do_store(): self._data_store[config_name] = result - exec_ret_val = selector.exec_func(config_name,result) if selector.exec_func else False + exec_ret_val = selector.exec_func(config_name,result) if selector.exec_func is not None else False self.post_callback(config_name,result) if exec_ret_val and self._check_mandatory_status(): @@ -478,7 +478,7 @@ class AbstractMenu: class AbstractSubMenu(AbstractMenu): - def __init__(self, data_store: Dict[str, Any] = None): + def __init__(self, data_store: Optional[Dict[str, Any]] = None): super().__init__(data_store=data_store) self._menu_options['__separator__'] = Selector('') diff --git a/archinstall/lib/menu/global_menu.py b/archinstall/lib/menu/global_menu.py index 0d348227..7c5b153e 100644 --- a/archinstall/lib/menu/global_menu.py +++ b/archinstall/lib/menu/global_menu.py @@ -197,11 +197,11 @@ class GlobalMenu(AbstractMenu): self._menu_options['abort'] = Selector(_('Abort'), exec_func=lambda n,v:exit(1)) - def _update_install_text(self, name :str = None, result :Any = None): + def _update_install_text(self, name :Optional[str] = None, result :Any = None): text = self._install_text() self._menu_options['install'].update_description(text) - def post_callback(self,name :str = None ,result :Any = None): + def post_callback(self,name :Optional[str] = None ,result :Any = None): self._update_install_text(name, result) def _install_text(self): @@ -279,8 +279,8 @@ class GlobalMenu(AbstractMenu): output = str(_('Encryption type')) + f': {enc_type}\n' output += str(_('Password')) + f': {secret(encryption.encryption_password)}\n' - if encryption.partitions: - output += 'Partitions: {} selected'.format(len(encryption.partitions)) + '\n' + if encryption.all_partitions: + output += 'Partitions: {} selected'.format(len(encryption.all_partitions)) + '\n' if encryption.hsm_device: output += f'HSM: {encryption.hsm_device.manufacturer}' @@ -377,9 +377,9 @@ class GlobalMenu(AbstractMenu): return harddrives - def _select_profile(self, preset): + def _select_profile(self, preset) -> Optional[Profile]: + ret: Optional[Profile] = None profile = select_profile(preset) - ret = None if profile is None: if any([ @@ -403,7 +403,7 @@ class GlobalMenu(AbstractMenu): namespace = f'{profile.namespace}.py' with profile.load_instructions(namespace=namespace) as imported: if imported._prep_function(servers=servers, desktop=desktop, desktop_env=desktop_env, gfx_driver=gfx_driver): - ret: Profile = profile + ret = profile match ret.name: case 'minimal': |