diff --git a/slpkg/views/views.py b/slpkg/views/views.py index e8544cda..0ce0bce3 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -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 = (