mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-11 20:48:11 +01:00
Refactor ascii package
This commit is contained in:
parent
47e0502245
commit
a649ae27c4
5 changed files with 17 additions and 17 deletions
|
@ -7,10 +7,10 @@ from pathlib import Path
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
from slpkg.views.ascii import Ascii
|
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.error_messages import Errors
|
from slpkg.error_messages import Errors
|
||||||
from slpkg.views.views import ViewMessage
|
from slpkg.views.views import ViewMessage
|
||||||
|
from slpkg.views.asciibox import AsciiBox
|
||||||
from slpkg.logging_config import LoggingConfig
|
from slpkg.logging_config import LoggingConfig
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class Md5sum:
|
||||||
def __init__(self, flags: list):
|
def __init__(self, flags: list):
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
|
|
||||||
self.ascii = Ascii()
|
self.ascii = AsciiBox()
|
||||||
self.errors = Errors()
|
self.errors = Errors()
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.views.ascii import Ascii
|
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
from slpkg.views.asciibox import AsciiBox
|
||||||
|
|
||||||
|
|
||||||
class Dependees(Configs):
|
class Dependees(Configs):
|
||||||
|
@ -16,7 +16,7 @@ class Dependees(Configs):
|
||||||
self.packages: list = packages
|
self.packages: list = packages
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
|
|
||||||
self.ascii = Ascii()
|
self.ascii = AsciiBox()
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
|
|
||||||
self.llc: str = self.ascii.lower_left_corner
|
self.llc: str = self.ascii.lower_left_corner
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.views.ascii import Ascii
|
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
from slpkg.views.asciibox import AsciiBox
|
||||||
|
|
||||||
|
|
||||||
class Tracking(Configs):
|
class Tracking(Configs):
|
||||||
|
@ -15,7 +15,7 @@ class Tracking(Configs):
|
||||||
self.packages: list = packages
|
self.packages: list = packages
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
|
|
||||||
self.ascii = Ascii()
|
self.ascii = AsciiBox()
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
|
|
||||||
self.llc: str = self.ascii.lower_left_corner
|
self.llc: str = self.ascii.lower_left_corner
|
||||||
|
|
|
@ -6,7 +6,7 @@ import shutil
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
|
|
||||||
|
|
||||||
class Ascii(Configs):
|
class AsciiBox(Configs):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
|
@ -44,7 +44,7 @@ class Ascii(Configs):
|
||||||
self.vertical_and_right: str = '├'
|
self.vertical_and_right: str = '├'
|
||||||
self.vertical_and_left: str = '┤'
|
self.vertical_and_left: str = '┤'
|
||||||
|
|
||||||
def draw_package_title_box(self, message: str, title: str) -> None:
|
def draw_package_title(self, message: str, title: str) -> None:
|
||||||
title = title.title()
|
title = title.title()
|
||||||
print(f"{self.bgreen}{self.upper_left_corner}{self.horizontal_line * (self.columns - 2)}"
|
print(f"{self.bgreen}{self.upper_left_corner}{self.horizontal_line * (self.columns - 2)}"
|
||||||
f"{self.upper_right_corner}")
|
f"{self.upper_right_corner}")
|
||||||
|
@ -66,9 +66,6 @@ class Ascii(Configs):
|
||||||
f"{self.bgreen}{version:<{self.version_alignment}}{self.endc}{size:<{self.size_alignment}}{self.blue}"
|
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}")
|
f"{repo:>{self.repo_alignment}}{self.bgreen} {self.vertical_line}{self.endc}")
|
||||||
|
|
||||||
def draw_log_package(self, package: str) -> None:
|
|
||||||
print(f"{'':>2}{self.lower_left_corner}{self.horizontal_line}{self.cyan} {package}{self.endc}\n")
|
|
||||||
|
|
||||||
def draw_middle_line(self) -> None:
|
def draw_middle_line(self) -> None:
|
||||||
print(f"{self.bgreen}{self.vertical_and_right}{self.horizontal_line * (self.columns - 2)}"
|
print(f"{self.bgreen}{self.vertical_and_right}{self.horizontal_line * (self.columns - 2)}"
|
||||||
f"{self.vertical_and_left}")
|
f"{self.vertical_and_left}")
|
||||||
|
@ -94,3 +91,6 @@ class Ascii(Configs):
|
||||||
f"{' ' * (self.columns - (len(file_check)) - 10)}{self.vertical_line}")
|
f"{' ' * (self.columns - (len(file_check)) - 10)}{self.vertical_line}")
|
||||||
print(f"{self.bred}{self.lower_left_corner}{self.horizontal_line * (self.columns - 2)}"
|
print(f"{self.bred}{self.lower_left_corner}{self.horizontal_line * (self.columns - 2)}"
|
||||||
f"{self.lower_right_corner}{self.endc}")
|
f"{self.lower_right_corner}{self.endc}")
|
||||||
|
|
||||||
|
def draw_log_package(self, package: str) -> None:
|
||||||
|
print(f"{'':>2}{self.lower_left_corner}{self.horizontal_line}{self.cyan} {package}{self.endc}\n")
|
|
@ -7,9 +7,9 @@ from pathlib import Path
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.upgrade import Upgrade
|
from slpkg.upgrade import Upgrade
|
||||||
from slpkg.views.ascii import Ascii
|
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
from slpkg.dialog_box import DialogBox
|
from slpkg.dialog_box import DialogBox
|
||||||
|
from slpkg.views.asciibox import AsciiBox
|
||||||
|
|
||||||
|
|
||||||
class ViewMessage(Configs):
|
class ViewMessage(Configs):
|
||||||
|
@ -22,7 +22,7 @@ class ViewMessage(Configs):
|
||||||
|
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.dialogbox = DialogBox()
|
self.dialogbox = DialogBox()
|
||||||
self.ascii = Ascii()
|
self.ascii = AsciiBox()
|
||||||
self.upgrade = Upgrade(repository, data)
|
self.upgrade = Upgrade(repository, data)
|
||||||
|
|
||||||
self.download_only = None
|
self.download_only = None
|
||||||
|
@ -39,7 +39,7 @@ class ViewMessage(Configs):
|
||||||
|
|
||||||
def build_packages(self, slackbuilds: list, dependencies: list) -> None:
|
def build_packages(self, slackbuilds: list, dependencies: list) -> None:
|
||||||
mode: str = 'build'
|
mode: str = 'build'
|
||||||
self.ascii.draw_package_title_box('The following packages will be build:', 'slpkg build packages')
|
self.ascii.draw_package_title('The following packages will be build:', 'slpkg build packages')
|
||||||
|
|
||||||
for slackbuild in slackbuilds:
|
for slackbuild in slackbuilds:
|
||||||
self.view_build_package(slackbuild)
|
self.view_build_package(slackbuild)
|
||||||
|
@ -57,7 +57,7 @@ class ViewMessage(Configs):
|
||||||
title: str = 'slpkg install packages'
|
title: str = 'slpkg install packages'
|
||||||
if mode == 'upgrade':
|
if mode == 'upgrade':
|
||||||
title: str = 'slpkg upgrade packages'
|
title: str = 'slpkg upgrade packages'
|
||||||
self.ascii.draw_package_title_box('The following packages will be installed or upgraded:', title)
|
self.ascii.draw_package_title('The following packages will be installed or upgraded:', title)
|
||||||
|
|
||||||
for package in packages:
|
for package in packages:
|
||||||
self.view_install_upgrade_package(package)
|
self.view_install_upgrade_package(package)
|
||||||
|
@ -74,7 +74,7 @@ class ViewMessage(Configs):
|
||||||
def download_packages(self, packages: list, directory: Path) -> None:
|
def download_packages(self, packages: list, directory: Path) -> None:
|
||||||
mode: str = 'download'
|
mode: str = 'download'
|
||||||
self.download_only: Path = directory
|
self.download_only: Path = directory
|
||||||
self.ascii.draw_package_title_box('The following packages will be downloaded:',
|
self.ascii.draw_package_title('The following packages will be downloaded:',
|
||||||
'slpkg download packages')
|
'slpkg download packages')
|
||||||
|
|
||||||
for package in packages:
|
for package in packages:
|
||||||
|
@ -84,7 +84,7 @@ class ViewMessage(Configs):
|
||||||
|
|
||||||
def remove_packages(self, packages: list, dependencies: list) -> Any:
|
def remove_packages(self, packages: list, dependencies: list) -> Any:
|
||||||
mode: str = 'remove'
|
mode: str = 'remove'
|
||||||
self.ascii.draw_package_title_box('The following packages will be removed:',
|
self.ascii.draw_package_title('The following packages will be removed:',
|
||||||
'slpkg remove packages')
|
'slpkg remove packages')
|
||||||
for package in packages:
|
for package in packages:
|
||||||
self.view_remove_package(package)
|
self.view_remove_package(package)
|
||||||
|
|
Loading…
Add table
Reference in a new issue