Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2022-05-18 21:59:49 +1000
committerGitHub <noreply@github.com>2022-05-18 13:59:49 +0200
commit65a5a335aa21ea44fd99fb200e238df54b3c2e47 (patch)
tree5b7a1d3937fc283c91734b7ab4f06e376bb59fdb /archinstall/lib/user_interaction
parent089c46db4a3c89dd8ba670419369c405bec3a270 (diff)
Enhance view (#1210)
* Add preview for menu entries * Fix mypy * Update * Update * Fix mypy Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/user_interaction')
-rw-r--r--archinstall/lib/user_interaction/general_conf.py1
-rw-r--r--archinstall/lib/user_interaction/network_conf.py12
-rw-r--r--archinstall/lib/user_interaction/partitioning_conf.py19
-rw-r--r--archinstall/lib/user_interaction/utils.py1
4 files changed, 18 insertions, 15 deletions
diff --git a/archinstall/lib/user_interaction/general_conf.py b/archinstall/lib/user_interaction/general_conf.py
index c3a2a7a7..d4dc60db 100644
--- a/archinstall/lib/user_interaction/general_conf.py
+++ b/archinstall/lib/user_interaction/general_conf.py
@@ -142,7 +142,6 @@ def select_profile(preset) -> Optional[Profile]:
options[option] = profile
title = _('This is a list of pre-programmed profiles, they might make it easier to install things like desktop environments')
-
warning = str(_('Are you sure you want to reset this setting?'))
selection = Menu(
diff --git a/archinstall/lib/user_interaction/network_conf.py b/archinstall/lib/user_interaction/network_conf.py
index e4e681ce..25e9d4c6 100644
--- a/archinstall/lib/user_interaction/network_conf.py
+++ b/archinstall/lib/user_interaction/network_conf.py
@@ -64,7 +64,7 @@ class ManualNetworkConfig(ListManager):
elif self.action == self._action_delete:
del data[iface_name]
- def _select_iface(self, existing_ifaces: List[str]) -> Optional[str]:
+ def _select_iface(self, existing_ifaces: List[str]) -> Optional[Any]:
all_ifaces = list_interfaces().values()
available = set(all_ifaces) - set(existing_ifaces)
choice = Menu(str(_('Select interface to add')), list(available), skip=True).run()
@@ -94,14 +94,14 @@ class ManualNetworkConfig(ListManager):
log("You need to enter a valid IP in IP-config mode.", level=logging.WARNING, fg='red')
# Implemented new check for correct gateway IP address
+ gateway = None
+
while 1:
- gateway = TextInput(_('Enter your gateway (router) IP address or leave blank for none: '),
+ gateway_input = TextInput(_('Enter your gateway (router) IP address or leave blank for none: '),
edit_iface.gateway).run().strip()
try:
- if len(gateway) == 0:
- gateway = None
- else:
- ipaddress.ip_address(gateway)
+ if len(gateway_input) > 0:
+ ipaddress.ip_address(gateway_input)
break
except ValueError:
log("You need to enter a valid gateway (router) IP address.", level=logging.WARNING, fg='red')
diff --git a/archinstall/lib/user_interaction/partitioning_conf.py b/archinstall/lib/user_interaction/partitioning_conf.py
index 741decc1..bfff5705 100644
--- a/archinstall/lib/user_interaction/partitioning_conf.py
+++ b/archinstall/lib/user_interaction/partitioning_conf.py
@@ -20,9 +20,9 @@ def partition_overlap(partitions: list, start: str, end: str) -> bool:
return False
-def _current_partition_layout(partitions: List[Partition], with_idx: bool = False) -> str:
+def current_partition_layout(partitions: List[Dict[str, Any]], with_idx: bool = False, with_title: bool = True) -> str:
- def do_padding(name, max_len):
+ def do_padding(name: str, max_len: int):
spaces = abs(len(str(name)) - max_len) + 2
pad_left = int(spaces / 2)
pad_right = spaces - pad_left
@@ -62,8 +62,11 @@ def _current_partition_layout(partitions: List[Partition], with_idx: bool = Fals
current_layout += f'{row[:-1]}\n'
- title = str(_('Current partition layout'))
- return f'\n\n{title}:\n\n{current_layout}'
+ if with_title:
+ title = str(_('Current partition layout'))
+ return f'\n\n{title}:\n\n{current_layout}'
+
+ return current_layout
def _get_partitions(partitions :List[Partition], filter_ :Callable = None) -> List[str]:
@@ -173,7 +176,7 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
# show current partition layout:
if len(block_device_struct["partitions"]):
- title += _current_partition_layout(block_device_struct['partitions']) + '\n'
+ title += current_partition_layout(block_device_struct['partitions']) + '\n'
modes += [save_and_exit, cancel]
@@ -246,7 +249,7 @@ def manage_new_and_existing_partitions(block_device: 'BlockDevice') -> Dict[str,
block_device_struct.update(suggest_single_disk_layout(block_device)[block_device.path])
else:
- current_layout = _current_partition_layout(block_device_struct['partitions'], with_idx=True)
+ current_layout = current_partition_layout(block_device_struct['partitions'], with_idx=True)
if task == delete_partition:
title = _('{}\n\nSelect by index which partitions to delete').format(current_layout)
@@ -375,7 +378,7 @@ def select_encrypted_partitions(
# show current partition layout:
if len(partitions):
- title += _current_partition_layout(partitions) + '\n'
+ title += current_partition_layout(partitions) + '\n'
choice = Menu(title, partition_indexes, multi=multiple).run()
@@ -386,4 +389,4 @@ def select_encrypted_partitions(
for partition_index in choice.value:
yield int(partition_index)
else:
- yield (partition_index) \ No newline at end of file
+ yield (partition_index)
diff --git a/archinstall/lib/user_interaction/utils.py b/archinstall/lib/user_interaction/utils.py
index ce48607d..fa079bc2 100644
--- a/archinstall/lib/user_interaction/utils.py
+++ b/archinstall/lib/user_interaction/utils.py
@@ -52,6 +52,7 @@ def get_password(prompt: str = '') -> Optional[str]:
continue
return passwd
+
return None