mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-29 10:26:12 +01:00
Updated for alignment
This commit is contained in:
parent
46cfb23a60
commit
b057f3fb7e
2 changed files with 5 additions and 7 deletions
|
@ -22,7 +22,7 @@ class RepoInfo(Configs):
|
|||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
self.name_alignment: int = (self.columns - 80) + 18
|
||||
self.name_alignment: int = self.columns - 62
|
||||
|
||||
if self.name_alignment < 1:
|
||||
self.name_alignment: int = 1
|
||||
|
|
|
@ -11,8 +11,8 @@ class Ascii(Configs):
|
|||
def __init__(self):
|
||||
super(Configs, self).__init__()
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
self.package_alignment: int = (self.columns - 80) + 25
|
||||
self.version_alignment: int = 27
|
||||
self.package_alignment: int = self.columns - 61
|
||||
self.version_alignment: int = 33
|
||||
self.size_alignment: int = 14
|
||||
self.repo_alignment: int = 10
|
||||
|
||||
|
@ -53,17 +53,15 @@ class Ascii(Configs):
|
|||
print(f"{self.vertical_line} {self.endc}{message.ljust(self.columns - 3, ' ')}"
|
||||
f"{self.bgreen}{self.vertical_line}")
|
||||
self.draw_middle_line()
|
||||
|
||||
print(f"{self.bgreen}{self.vertical_line}{self.endc} {'Package:':<{self.package_alignment}}"
|
||||
f"{'Version:':<{self.version_alignment}}{'Size:':<{self.size_alignment}}{'Repo:':>{self.repo_alignment}} "
|
||||
f"{self.bgreen}{self.vertical_line}{self.endc}")
|
||||
|
||||
def draw_package_line(self, package: str, version: str, size: str, color: str, repo: str) -> None:
|
||||
if len(version) >= 11 and self.columns <= 80:
|
||||
if len(version) >= 20 and self.columns <= 80:
|
||||
version: str = f'{version[:self.version_alignment - 5]}...'
|
||||
if len(package) >= 20 and self.columns <= 80:
|
||||
if len(package) >= 15 and self.columns <= 80:
|
||||
package: str = f'{package[:self.package_alignment - 5]}...'
|
||||
|
||||
print(f"{self.bgreen}{self.vertical_line} {self.bold}{color}{package:<{self.package_alignment}}{self.endc}"
|
||||
f"{self.bgreen}{version:<{self.version_alignment}}{self.endc}{size:<{self.size_alignment}}{self.blue}"
|
||||
f"{repo:>{self.repo_alignment}}{self.bgreen} {self.vertical_line}{self.endc}")
|
||||
|
|
Loading…
Reference in a new issue