Updated for view mode

This commit is contained in:
Dimitris Zlatanidis 2023-01-03 00:12:06 +02:00
parent 69c8bfd364
commit e4cb5f0f80
3 changed files with 20 additions and 7 deletions

View file

@ -18,6 +18,11 @@ class Downloader:
self.url = url
self.filename = url.split('/')[-1]
self.configs = Configs
self.colors = self.configs.colour
self.color = self.colors()
self.green = self.color['green']
self.yellow = self.color['yellow']
self.endc = self.color['endc']
self.progress = ProgressBar()
self.stderr = None
self.stdout = None
@ -33,9 +38,11 @@ class Downloader:
self.stderr = subprocess.DEVNULL
self.stdout = subprocess.DEVNULL
message = f'[{self.green} Downloading {self.endc}]'
# Starting multiprocessing
p1 = Process(target=self.wget)
p2 = Process(target=self.progress.bar, args=('[ Downloading ]', self.filename))
p2 = Process(target=self.progress.bar, args=(message, self.filename))
p1.start()
p2.start()
@ -45,7 +52,7 @@ class Downloader:
# Terminate process 2 if process 1 finished
if not p1.is_alive():
print(' Done', end='')
print(f'{self.yellow} Done{self.endc}', end='')
p2.terminate()
# Wait until process 2 finish

View file

@ -33,6 +33,12 @@ class Slackbuilds:
self.utils = Utilities()
self.dialog = DialogBox()
self.configs = Configs
self.colors = self.configs.colour
self.color = self.colors()
self.cyan = self.color['cyan']
self.red = self.color['red']
self.yellow = self.color['yellow']
self.endc = self.color['endc']
self.install_order = []
self.dependencies = []
self.sbos = {}
@ -212,7 +218,7 @@ class Slackbuilds:
self.utils.is_installed(pkg)):
execute = self.configs.reinstall
message = f'Installing'
message = f'{self.cyan}Installing{self.endc}'
command = f'{execute} {self.configs.tmp_path}/{package}'
self.multi_process(command, package, message)
@ -243,7 +249,7 @@ class Slackbuilds:
if '--jobs' in self.flags:
self.set_makeflags()
message = f'Build'
message = f'{self.red}Build{self.endc}'
self.multi_process(execute, name, message)
@staticmethod
@ -281,7 +287,7 @@ class Slackbuilds:
# Terminate process 2 if process 1 finished
if not p1.is_alive():
print(' Done', end='')
print(f'{self.yellow} Done{self.endc}', end='')
p2.terminate()
# Wait until process 2 finish

View file

@ -64,7 +64,7 @@ class ViewMessage:
self._view_build(sbo, version)
if dependencies:
print('\nDependencies:')
print(f'\n{self.bold}{self.green}──{self.endc} Dependencies', f'{self.bold}{self.green}{self.endc}' * (self.columns - 16))
for sbo in dependencies:
version = SBoQueries(sbo).version()
self._view_build(sbo, version)
@ -80,7 +80,7 @@ class ViewMessage:
self._view_install(sbo, version)
if dependencies:
print('\nDependencies:')
print(f'\n{self.bold}{self.green}──{self.endc} Dependencies', f'{self.bold}{self.green}{self.endc}' * (self.columns - 16))
for sbo in dependencies:
version = SBoQueries(sbo).version()
self._view_install(sbo, version)