From 4b4473632df0fbc92e85f6e32f6e940ad4fb6fa7 Mon Sep 17 00:00:00 2001 From: Werner Llácer Date: Mon, 28 Mar 2022 13:55:15 +0200 Subject: Subvolume User Interface (#1032) * Deflate the user interactions file * Fix flake8 * GlobalMenu split from selection_menu.py * Upgrades to ListManager: Can now show an empty list if there is no null action. More information to the user at the header * Put only_hd.py and swiss.py to use new config printing mechanism Solved a couple of bugs at ListManager adding a str and a DeferredTranslation ManageUser was missing an self argument in _check ... * Create list and menus to manage subvolumes in btrfs partitions Needed to modify manage_new_and_existing_partitions Added a new parameter filter to select_partition, to allow filtering there * Update internationalization strings Co-authored-by: Daniel Girtler Co-authored-by: Anton Hvornum --- archinstall/lib/menu/list_manager.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'archinstall/lib/menu/list_manager.py') diff --git a/archinstall/lib/menu/list_manager.py b/archinstall/lib/menu/list_manager.py index bacfc60e..4ca33db2 100644 --- a/archinstall/lib/menu/list_manager.py +++ b/archinstall/lib/menu/list_manager.py @@ -87,7 +87,6 @@ The contents in the base class of this methods serve for a very basic usage, and from .text_input import TextInput from .menu import Menu -from ..general import RequirementError from os import system from copy import copy from typing import Union @@ -115,11 +114,11 @@ class ListManager: type param: string or list """ - if not null_action and len(base_list) == 0: - raise RequirementError('Data list for ListManager can not be empty if there is no null_action') + explainer = str(_('\n Choose an object from the list, and select one of the available actions for it to execute')) + self.prompt = prompt + explainer if prompt else explainer + + self.null_action = str(null_action) if null_action else None - self.prompt = prompt if prompt else _('Choose an object from the list') - self.null_action = str(null_action) if not default_action: self.default_action = [self.null_action,] elif isinstance(default_action,(list,tuple)): @@ -140,7 +139,7 @@ class ListManager: # default values for the null case self.target = None self.action = self.null_action - if len(self.data) == 0: + if len(self.data) == 0 and self.null_action: self.exec_action() def run(self): -- cgit v1.2.3-54-g00ecf