Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-02-15 18:44:58 +1100
committerGitHub <noreply@github.com>2022-02-15 08:44:58 +0100
commit6489a417aa8d43bd58ec0fd1268d0dd734b0073f (patch)
tree476033ff0d6a2650ff5202f42b248e7b4bbe2f8d /archinstall/lib/menu
parentd9118a33b3a25839fde8626cde313115ddb79376 (diff)
Fix #966 - DeferredTranslation errors (#976)
* Fix #966 * Add types to parameters * Update network configuration * Backwards compability for nic config * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/menu')
-rw-r--r--archinstall/lib/menu/menu.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/archinstall/lib/menu/menu.py b/archinstall/lib/menu/menu.py
index ac075b66..ee4b87e3 100644
--- a/archinstall/lib/menu/menu.py
+++ b/archinstall/lib/menu/menu.py
@@ -1,3 +1,5 @@
+from typing import Dict, List, Union, Any
+
from archinstall.lib.menu.simple_menu import TerminalMenu
from ..exceptions import RequirementError
from ..output import log
@@ -7,7 +9,17 @@ import sys
import logging
class Menu(TerminalMenu):
- def __init__(self, title, p_options, skip=True, multi=False, default_option=None, sort=True, preset_values=None, cursor_index=None):
+ def __init__(
+ self,
+ title :str,
+ p_options :Union[List[str], Dict[str, Any]],
+ skip :bool = True,
+ multi :bool = False,
+ default_option :str = None,
+ sort :bool = True,
+ preset_values :Union[str, List[str]] = None,
+ cursor_index :int = None
+ ):
"""
Creates a new menu
@@ -60,6 +72,11 @@ class Menu(TerminalMenu):
log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>",level=logging.WARNING)
raise RequirementError('Menu.__init__() requires at least one option to proceed.')
+ if any([o for o in options if not isinstance(o, str)]):
+ log(" * Menu options must be of type string * ", fg='red')
+ log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>",level=logging.WARNING)
+ raise RequirementError('Menu.__init__() requires the options to be of type string')
+
if sort:
options = sorted(options)