mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Updated for spinner message
This commit is contained in:
parent
caf29d6262
commit
4e8ded584a
1 changed files with 9 additions and 6 deletions
|
@ -19,6 +19,7 @@ class ProgressBar(Configs):
|
|||
self.color: str = self.endc
|
||||
self.spinners: dict = {}
|
||||
self.spinners_color: dict = {}
|
||||
self.bar_message: str = str()
|
||||
|
||||
def progress_bar(self, message: str, filename=None) -> None:
|
||||
""" Creating progress bar. """
|
||||
|
@ -26,14 +27,10 @@ class ProgressBar(Configs):
|
|||
self.assign_spinner_colors()
|
||||
self.set_spinner()
|
||||
self.set_color()
|
||||
|
||||
bar_message: str = f"{self.endc}{message} "
|
||||
if filename:
|
||||
bar_message: str = (f"{'':>2}{self.red}{self.ascii.bullet}{self.endc} {filename}: "
|
||||
f"{message}... ")
|
||||
self.set_the_spinner_message(filename, message)
|
||||
|
||||
if self.spinning_bar:
|
||||
bar_spinner = self.spinner(f'{bar_message}{self.color}')
|
||||
bar_spinner = self.spinner(f'{self.bar_message}{self.color}')
|
||||
# print('\033[F', end='', flush=True)
|
||||
try:
|
||||
while True:
|
||||
|
@ -66,6 +63,12 @@ class ProgressBar(Configs):
|
|||
'white': self.endc
|
||||
}
|
||||
|
||||
def set_the_spinner_message(self, filename: str, message: str) -> None:
|
||||
self.bar_message: str = f"{self.endc}{message} "
|
||||
if filename:
|
||||
self.bar_message: str = (f"{'':>2}{self.red}{self.ascii.bullet}{self.endc} {filename}: "
|
||||
f"{message}... ")
|
||||
|
||||
def set_spinner(self) -> None:
|
||||
try:
|
||||
self.spinner: str = self.spinners[self.progress_spinner]
|
||||
|
|
Loading…
Reference in a new issue