From f610a89d38b898385435b15dcd15bb1651e9d49e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 27 Mar 2023 12:09:01 +0300 Subject: [PATCH] Added package size --- slpkg/views/ascii.py | 11 ++++++----- slpkg/views/views.py | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/slpkg/views/ascii.py b/slpkg/views/ascii.py index b0cf9f54..010520e7 100644 --- a/slpkg/views/ascii.py +++ b/slpkg/views/ascii.py @@ -66,13 +66,14 @@ class Ascii(Configs): self.draw_middle_line() - print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 27 + 'Version:' + - ' ' * (self.columns - 57) + f'Repository{self.bgreen} {self.vertical_line}{self.endc}') + print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 22 + 'Version:' + + ' ' * (self.columns - 65) + 'Size:' + ' ' * 13 + f'Repo:{self.bgreen} {self.vertical_line}{self.endc}') - def draw_view_package(self, package: str, version: str, color: str, repo: str) -> None: + def draw_view_package(self, package: str, version: str, size: str, color: str, repo: str) -> None: """ Draw nad print the packages. """ - print(f'{self.bgreen}{self.vertical_line} {self.bold}{color}{package}{self.endc}' + ' ' * (35 - len(package)) + - f'{self.bgreen}{version}' + ' ' * ((self.columns - 39) - len(version) - len(repo)) + + print(f'{self.bgreen}{self.vertical_line} {self.bold}{color}{package}{self.endc}' + ' ' * (30 - len(package)) + + f'{self.bgreen}{version}' + ' ' * ((self.columns - 50) - len(version) - len(repo)) + + f'{self.endc}{size}' + ' ' * (16 - len(size)) + f'{self.blue}{repo} {self.bgreen}{self.vertical_line}{self.endc}') def draw_log_package(self, package: str) -> None: diff --git a/slpkg/views/views.py b/slpkg/views/views.py index ae5a02f3..d15f79ff 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -45,10 +45,12 @@ class ViewMessage(Configs): def view_packages(self, package: str, mode: str) -> None: """ Printing the main packages. """ + size: str = '' color: str = self.red if self.utils.is_option(self.flag_binary, self.flags): version: str = BinQueries(package).version() + size: str = BinQueries(package).size_comp() repo: str = BinQueries(package).repository() else: version: str = SBoQueries(package).version() @@ -65,7 +67,7 @@ class ViewMessage(Configs): if package in self.utils.installed_package_names and mode == 'install': color = self.grey - self.ascii.draw_view_package(package, version, color, repo) + self.ascii.draw_view_package(package, version, size, color, repo) def view_skipping_packages(self, package: str, version: str) -> None: """ Print the skipping packages. """