From fa45d494ba540cd34e8fee90c1cbc7af84655d61 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 11 May 2023 22:41:43 +0300 Subject: [PATCH] Updated for auto alignment --- slpkg/views/ascii.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/slpkg/views/ascii.py b/slpkg/views/ascii.py index d3030bef..901a5a44 100644 --- a/slpkg/views/ascii.py +++ b/slpkg/views/ascii.py @@ -40,23 +40,18 @@ class Ascii(Configs): def draw_package_title_box(self, message: str, title: str) -> None: """ Drawing package title box. """ title = title.title() - middle_title: int = int((self.columns / 2) - len(title) + 10) - print(f'{self.bgreen}{self.upper_left_corner}' + f'{self.horizontal_line}' * (self.columns - 2) + - f'{self.upper_right_corner}') + print(f'{self.bgreen}{self.upper_left_corner}' + f'{self.horizontal_line}' * (self.columns - 2) + f'{self.upper_right_corner}') - print(f'{self.vertical_line}' + ' ' * middle_title + f'{title}' + ' ' * - (self.columns - middle_title - len(title) - 2) + f'{self.vertical_line}') + print(f'{self.vertical_line}{title.center(self.columns - 2, " ")}{self.vertical_line}') self.draw_middle_line() - print(f'{self.vertical_line}{self.endc} {message}' + ' ' * (self.columns - len(message) - 3) + - f'{self.bgreen}{self.vertical_line}') + print(f'{self.vertical_line} {self.endc}{message.ljust(self.columns - 3, " ")}{self.bgreen}{self.vertical_line}') self.draw_middle_line() - print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 22 + 'Version:' + - ' ' * (self.columns - 66) + 'Size:' + ' ' * 14 + f'Repo:{self.bgreen} {self.vertical_line}{self.endc}') + print(f'{self.bgreen}{self.vertical_line}{self.endc} Package:' + ' ' * 22 + 'Version:' + ' ' * (self.columns - 66) + 'Size:' + ' ' * 14 + f'Repo:{self.bgreen} {self.vertical_line}{self.endc}') def draw_package_line(self, package: str, version: str, size: str, color: str, repo: str) -> None: """ Draw nad print the packages. """