From e4cb5f0f8063749dd8696561f101e3ee81666fbf Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 3 Jan 2023 00:12:06 +0200 Subject: [PATCH] Updated for view mode --- slpkg/downloader.py | 11 +++++++++-- slpkg/slackbuild.py | 12 +++++++++--- slpkg/views/views.py | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 9d760a5a..c2d7812a 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -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 diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index 0a23b009..7f85a968 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -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 diff --git a/slpkg/views/views.py b/slpkg/views/views.py index e359c048..72abda56 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -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)