Fix to split the summary message

This commit is contained in:
Dimitris Zlatanidis 2024-04-01 17:26:33 +03:00
parent 25aaaf2055
commit 7c2f6aabf2

View file

@ -1,6 +1,7 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import shutil
from typing import Any
from pathlib import Path
@ -32,6 +33,7 @@ class View(Configs):
self.sum_size_comp = 0
self.sum_size_uncomp = 0
self.sum_size_remove = 0
self.columns, self.rows = shutil.get_terminal_size()
self.download_only = None
self.summary_message: str = ''
@ -201,11 +203,14 @@ class View(Configs):
f'will be build in {self.tmp_path} folder.{self.endc}')
def set_summary_for_install_and_upgrade(self, install: int, upgrade: int, size_comp: int, size_uncomp: int) -> None:
self.summary_message: str = (
f'{self.grey}Total {install} packages will be '
f'installed and {upgrade} will be upgraded, and total '
f'{self.utils.convert_file_sizes(size_comp)} will be downloaded and '
f'{self.utils.convert_file_sizes(size_uncomp)} will be installed.{self.endc}')
split_message: str = '\n'
if self.columns > 80:
split_message: str = ''
total_packages: str = (f'{self.grey}Total {install} packages will be installed and {upgrade} '
f'will be upgraded, while a total ')
total_sizes: str = (f'{self.utils.convert_file_sizes(size_comp)} will be downloaded and '
f'{self.utils.convert_file_sizes(size_uncomp)} will be installed.{self.endc}')
self.summary_message: str = f'{total_packages}{split_message}{total_sizes}'
def set_summary_for_remove(self, remove: int, size_rmv: int) -> None:
self.summary_message: str = (