Updated for progress messages

This commit is contained in:
Dimitris Zlatanidis 2023-05-16 23:10:43 +03:00
parent 8f629c6a00
commit 23d6266700
4 changed files with 11 additions and 7 deletions

View file

@ -142,7 +142,7 @@ class CheckUpdates(Configs):
# Starting multiprocessing
p1 = Process(target=self.check_for_updates)
p2 = Process(target=self.progress.progress_bar, args=(message, ''))
p2 = Process(target=self.progress.progress_bar, args=(message,))
p1.start()
p2.start()

View file

@ -6,8 +6,8 @@ from multiprocessing import Process
from slpkg.configs import Configs
from slpkg.utilities import Utilities
from slpkg.progress_bar import ProgressBar
from slpkg.views.asciibox import AsciiBox
from slpkg.progress_bar import ProgressBar
class MultiProcess(Configs):
@ -34,7 +34,7 @@ class MultiProcess(Configs):
# Starting multiprocessing
p1 = Process(target=self.utils.process, args=(command, self.stderr, self.stdout))
p2 = Process(target=self.progress.progress_bar, args=(filename, progress_message))
p2 = Process(target=self.progress.progress_bar, args=(progress_message, filename))
p1.start()
p2.start()

View file

@ -20,16 +20,20 @@ class ProgressBar(Configs):
self.spinners: dict = {}
self.spinners_color: dict = {}
def progress_bar(self, filename: str, message: str) -> None:
def progress_bar(self, message: str, filename=None) -> None:
""" Creating progress bar. """
self.assign_spinners()
self.assign_spinner_colors()
self.set_spinner()
self.set_color()
bar_message: str = (f"{'':>2}{self.red}{self.ascii.bullet}{self.endc} {filename}: "
f"{message}... ")
if not filename:
bar_message: str = f"{self.endc}{message} "
if self.spinning_bar:
bar_spinner = self.spinner(f"{'':>2}{self.red}{self.ascii.bullet}{self.endc} {filename}: "
f"{message}... {self.color}")
bar_spinner = self.spinner(f'{bar_message} {self.color}')
# print('\033[F', end='', flush=True)
try:
while True:

View file

@ -616,7 +616,7 @@ class UpdateRepository(Configs):
# Starting multiprocessing
p1 = Process(target=self.check_for_updates, args=(queue,))
p2 = Process(target=self.progress.progress_bar, args=(message, ''))
p2 = Process(target=self.progress.progress_bar, args=(message,))
p1.start()
p2.start()