Updated for auto alignment

This commit is contained in:
Dimitris Zlatanidis 2023-05-11 22:41:43 +03:00
parent 1241b86b4e
commit fa45d494ba

View file

@ -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. """