mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Updated for inheritance classes
This commit is contained in:
parent
834901244d
commit
7a983fa441
3 changed files with 38 additions and 39 deletions
|
@ -8,35 +8,35 @@ from slpkg.configs import Configs
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Ascii:
|
class Ascii(Configs):
|
||||||
""" ascii characters. """
|
""" ascii characters. """
|
||||||
vertical_line = '│'
|
def __init__(self):
|
||||||
horizontal_line = '─'
|
super(Configs, self).__init__()
|
||||||
horizontal_vertical = '┼'
|
self.vertical_line = '│'
|
||||||
upper_right_corner = '┐'
|
self.horizontal_line = '─'
|
||||||
lower_left_corner = '└'
|
self.horizontal_vertical = '┼'
|
||||||
lower_right_corner = '┘'
|
self.upper_right_corner = '┐'
|
||||||
upper_left_corner = '┌'
|
self.lower_left_corner = '└'
|
||||||
horizontal_and_up = '┴'
|
self.lower_right_corner = '┘'
|
||||||
horizontal_and_down = '┬'
|
self.upper_left_corner = '┌'
|
||||||
vertical_and_right = '├'
|
self.horizontal_and_up = '┴'
|
||||||
vertical_and_left = '┤'
|
self.horizontal_and_down = '┬'
|
||||||
|
self.vertical_and_right = '├'
|
||||||
|
self.vertical_and_left = '┤'
|
||||||
|
|
||||||
configs = Configs
|
self.color = self.colour()
|
||||||
colors = configs.colour
|
self.bold = self.color['bold']
|
||||||
color = colors()
|
self.blue = self.color['blue']
|
||||||
bold = color['bold']
|
self.green = self.color['green']
|
||||||
blue = color['blue']
|
self.cyan = self.color['cyan']
|
||||||
green = color['green']
|
self.red = self.color['red']
|
||||||
cyan = color['cyan']
|
self.yellow = self.color['yellow']
|
||||||
red = color['red']
|
self.violet = self.color['violet']
|
||||||
yellow = color['yellow']
|
self.endc = self.color['endc']
|
||||||
violet = color['violet']
|
self.bgreen = f'{self.bold}{self.green}'
|
||||||
endc = color['endc']
|
self.bred = f'{self.bold}{self.red}'
|
||||||
bgreen = f'{bold}{green}'
|
|
||||||
bred = f'{bold}{red}'
|
|
||||||
|
|
||||||
columns, rows = shutil.get_terminal_size()
|
self.columns, self.rows = shutil.get_terminal_size()
|
||||||
|
|
||||||
def draw_package_title_box(self, message, title):
|
def draw_package_title_box(self, message, title):
|
||||||
""" Drawing package title box. """
|
""" Drawing package title box. """
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
|
|
||||||
|
|
||||||
class Usage:
|
class Usage(Configs):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
colors = Configs.colour
|
super(Configs, self).__init__()
|
||||||
color = colors()
|
color = self.colour()
|
||||||
|
|
||||||
self.bold = color['bold']
|
self.bold = color['bold']
|
||||||
self.red = color['red']
|
self.red = color['red']
|
||||||
|
|
|
@ -9,17 +9,16 @@ from slpkg.models.models import SBoTable
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
|
||||||
|
|
||||||
class ViewPackage:
|
class ViewPackage(Configs):
|
||||||
""" View the repository packages. """
|
""" View the repository packages. """
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
super(Configs, self).__init__()
|
||||||
self.session = Session
|
self.session = Session
|
||||||
self.configs = Configs
|
|
||||||
self.colors = self.configs.colour
|
|
||||||
|
|
||||||
def package(self, packages: list):
|
def package(self, packages: list):
|
||||||
""" View the packages from the repository. """
|
""" View the packages from the repository. """
|
||||||
color = self.colors()
|
color = self.colour()
|
||||||
green = color['green']
|
green = color['green']
|
||||||
blue = color['blue']
|
blue = color['blue']
|
||||||
yellow = color['yellow']
|
yellow = color['yellow']
|
||||||
|
@ -42,9 +41,9 @@ class ViewPackage:
|
||||||
SBoTable.location
|
SBoTable.location
|
||||||
).filter(SBoTable.name == package).first()
|
).filter(SBoTable.name == package).first()
|
||||||
|
|
||||||
readme = self.http_request(f'{self.configs.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
readme = self.http_request(f'{self.sbo_repo_url}/{info[9]}/{info[0]}/README')
|
||||||
|
|
||||||
info_file = self.http_request(f'{self.configs.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info')
|
info_file = self.http_request(f'{self.sbo_repo_url}/{info[9]}/{info[0]}/{info[0]}.info')
|
||||||
|
|
||||||
maintainer, email, homepage = '', '', ''
|
maintainer, email, homepage = '', '', ''
|
||||||
for line in info_file.data.decode().splitlines():
|
for line in info_file.data.decode().splitlines():
|
||||||
|
@ -61,17 +60,17 @@ class ViewPackage:
|
||||||
f'Version: {green}{info[1]}{endc}\n'
|
f'Version: {green}{info[1]}{endc}\n'
|
||||||
f'Requires: {green}{deps}{endc}\n'
|
f'Requires: {green}{deps}{endc}\n'
|
||||||
f'Homepage: {blue}{homepage}{endc}\n'
|
f'Homepage: {blue}{homepage}{endc}\n'
|
||||||
f'Download SlackBuild: {blue}{self.configs.sbo_repo_url}/{info[9]}/{info[0]}'
|
f'Download SlackBuild: {blue}{self.sbo_repo_url}/{info[9]}/{info[0]}'
|
||||||
f'{self.configs.sbo_tar_suffix}{endc}\n'
|
f'{self.sbo_tar_suffix}{endc}\n'
|
||||||
f'Download sources: {blue}{info[3]}{endc}\n'
|
f'Download sources: {blue}{info[3]}{endc}\n'
|
||||||
f'Download_x86_64 sources: {blue}{info[4]}{endc}\n'
|
f'Download_x86_64 sources: {blue}{info[4]}{endc}\n'
|
||||||
f'Md5sum: {yellow}{info[5]}{endc}\n'
|
f'Md5sum: {yellow}{info[5]}{endc}\n'
|
||||||
f'Md5sum_x86_64: {yellow}{info[6]}{endc}\n'
|
f'Md5sum_x86_64: {yellow}{info[6]}{endc}\n'
|
||||||
f'Files: {green}{info[7]}{endc}\n'
|
f'Files: {green}{info[7]}{endc}\n'
|
||||||
f'Description: {green}{info[8]}{endc}\n'
|
f'Description: {green}{info[8]}{endc}\n'
|
||||||
f'Slackware: {cyan}{self.configs.sbo_repo_url.split("/")[-1]}{endc}\n'
|
f'Slackware: {cyan}{self.sbo_repo_url.split("/")[-1]}{endc}\n'
|
||||||
f'Category: {red}{info[9]}{endc}\n'
|
f'Category: {red}{info[9]}{endc}\n'
|
||||||
f'SBo url: {blue}{self.configs.sbo_repo_url}/{info[9]}/{info[0]}{endc}\n'
|
f'SBo url: {blue}{self.sbo_repo_url}/{info[9]}/{info[0]}{endc}\n'
|
||||||
f'Maintainer: {yellow}{maintainer}{endc}\n'
|
f'Maintainer: {yellow}{maintainer}{endc}\n'
|
||||||
f'Email: {yellow}{email}{endc}\n'
|
f'Email: {yellow}{email}{endc}\n'
|
||||||
f'\nREADME: {cyan}{readme.data.decode()}{endc}')
|
f'\nREADME: {cyan}{readme.data.decode()}{endc}')
|
||||||
|
|
Loading…
Reference in a new issue