diff --git a/ChangeLog.txt b/ChangeLog.txt index 05cd0237..440634c1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.8.2 - 25/04/2023 +Added: +- Disable or enable the spinning bar + 4.8.1 - 21/04/2023 Updated: - For error messages diff --git a/configs/slpkg.toml b/configs/slpkg.toml index 2930ceaf..17771231 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -44,6 +44,9 @@ PARALLEL_DOWNLOADS = false # add '*_SBo' pattern. Default is the '*'. FILE_PATTERN = "*" +# Enable or disable the spinning bar. Default is true. [true/false] +SPINNING_BAR = true + # There are 5 predefined spinners for the progress bar. # Default is pixel. [spinner/pie/moon/line/pixel] PROGRESS_SPINNER = "pixel" diff --git a/slpkg/configs.py b/slpkg/configs.py index 0471e1e7..e7f7c06c 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -44,6 +44,7 @@ class Configs: ask_question: bool = True parallel_downloads: bool = False file_pattern: str = '*' + spinning_bar: str = True progress_spinner: str = 'pixel' spinner_color: str = 'green' @@ -79,6 +80,7 @@ class Configs: file_list_suffix: str = config['FILE_LIST_SUFFIX'] parallel_downloads: bool = config['PARALLEL_DOWNLOADS'] file_pattern_conf: str = config['FILE_PATTERN'] + spinning_bar: str = config['SPINNING_BAR'] progress_spinner: str = config['PROGRESS_SPINNER'] spinner_color: str = config['SPINNER_COLOR'] proxy_address: str = config['PROXY_ADDRESS'] diff --git a/slpkg/dialog_configs.py b/slpkg/dialog_configs.py index b8c2fd1d..0a1dee6b 100644 --- a/slpkg/dialog_configs.py +++ b/slpkg/dialog_configs.py @@ -75,7 +75,8 @@ class FormConfigs(Configs): 'SILENT_MODE', 'ASCII_CHARACTERS', 'ASK_QUESTION', - 'PARALLEL_DOWNLOADS' + 'PARALLEL_DOWNLOADS', + 'SPINNING_BAR' ] values: list = ['true', 'false'] @@ -110,11 +111,13 @@ class FormConfigs(Configs): if line.lstrip().startswith( - ('COLORS =', 'DIALOG =', + ('COLORS =', + 'DIALOG =', 'SILENT_MODE =', 'ASCII_CHARACTERS =', 'ASK_QUESTION =', - 'PARALLEL_DOWNLOADS =') + 'PARALLEL_DOWNLOADS =', + 'SPINNING_BAR =') ): line: str = line.replace('"', '') diff --git a/slpkg/progress_bar.py b/slpkg/progress_bar.py index 5502813f..102e73ec 100644 --- a/slpkg/progress_bar.py +++ b/slpkg/progress_bar.py @@ -40,11 +40,14 @@ class ProgressBar(Configs): spinner = PixelSpinner color: str = self.endc - bar_spinner = spinner(f'{self.endc}{message} {filename} {color}') - # print('\033[F', end='', flush=True) - try: - while True: - time.sleep(0.1) - bar_spinner.next() - except KeyboardInterrupt: - raise SystemExit(1) + if self.spinning_bar: + bar_spinner = spinner(f'{self.endc}{message} {filename} {color}') + # print('\033[F', end='', flush=True) + try: + while True: + time.sleep(0.1) + bar_spinner.next() + except KeyboardInterrupt: + raise SystemExit(1) + else: + print(f'{message} ', end='', flush=True)