mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Added config for spinning bar
This commit is contained in:
parent
b19b046947
commit
5be574ed2e
5 changed files with 26 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
4.8.2 - 25/04/2023
|
||||||
|
Added:
|
||||||
|
- Disable or enable the spinning bar
|
||||||
|
|
||||||
4.8.1 - 21/04/2023
|
4.8.1 - 21/04/2023
|
||||||
Updated:
|
Updated:
|
||||||
- For error messages
|
- For error messages
|
||||||
|
|
|
@ -44,6 +44,9 @@ PARALLEL_DOWNLOADS = false
|
||||||
# add '*_SBo' pattern. Default is the '*'.
|
# add '*_SBo' pattern. Default is the '*'.
|
||||||
FILE_PATTERN = "*"
|
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.
|
# There are 5 predefined spinners for the progress bar.
|
||||||
# Default is pixel. [spinner/pie/moon/line/pixel]
|
# Default is pixel. [spinner/pie/moon/line/pixel]
|
||||||
PROGRESS_SPINNER = "pixel"
|
PROGRESS_SPINNER = "pixel"
|
||||||
|
|
|
@ -44,6 +44,7 @@ class Configs:
|
||||||
ask_question: bool = True
|
ask_question: bool = True
|
||||||
parallel_downloads: bool = False
|
parallel_downloads: bool = False
|
||||||
file_pattern: str = '*'
|
file_pattern: str = '*'
|
||||||
|
spinning_bar: str = True
|
||||||
progress_spinner: str = 'pixel'
|
progress_spinner: str = 'pixel'
|
||||||
spinner_color: str = 'green'
|
spinner_color: str = 'green'
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ class Configs:
|
||||||
file_list_suffix: str = config['FILE_LIST_SUFFIX']
|
file_list_suffix: str = config['FILE_LIST_SUFFIX']
|
||||||
parallel_downloads: bool = config['PARALLEL_DOWNLOADS']
|
parallel_downloads: bool = config['PARALLEL_DOWNLOADS']
|
||||||
file_pattern_conf: str = config['FILE_PATTERN']
|
file_pattern_conf: str = config['FILE_PATTERN']
|
||||||
|
spinning_bar: str = config['SPINNING_BAR']
|
||||||
progress_spinner: str = config['PROGRESS_SPINNER']
|
progress_spinner: str = config['PROGRESS_SPINNER']
|
||||||
spinner_color: str = config['SPINNER_COLOR']
|
spinner_color: str = config['SPINNER_COLOR']
|
||||||
proxy_address: str = config['PROXY_ADDRESS']
|
proxy_address: str = config['PROXY_ADDRESS']
|
||||||
|
|
|
@ -75,7 +75,8 @@ class FormConfigs(Configs):
|
||||||
'SILENT_MODE',
|
'SILENT_MODE',
|
||||||
'ASCII_CHARACTERS',
|
'ASCII_CHARACTERS',
|
||||||
'ASK_QUESTION',
|
'ASK_QUESTION',
|
||||||
'PARALLEL_DOWNLOADS'
|
'PARALLEL_DOWNLOADS',
|
||||||
|
'SPINNING_BAR'
|
||||||
]
|
]
|
||||||
values: list = ['true', 'false']
|
values: list = ['true', 'false']
|
||||||
|
|
||||||
|
@ -110,11 +111,13 @@ class FormConfigs(Configs):
|
||||||
|
|
||||||
if line.lstrip().startswith(
|
if line.lstrip().startswith(
|
||||||
|
|
||||||
('COLORS =', 'DIALOG =',
|
('COLORS =',
|
||||||
|
'DIALOG =',
|
||||||
'SILENT_MODE =',
|
'SILENT_MODE =',
|
||||||
'ASCII_CHARACTERS =',
|
'ASCII_CHARACTERS =',
|
||||||
'ASK_QUESTION =',
|
'ASK_QUESTION =',
|
||||||
'PARALLEL_DOWNLOADS =')
|
'PARALLEL_DOWNLOADS =',
|
||||||
|
'SPINNING_BAR =')
|
||||||
):
|
):
|
||||||
line: str = line.replace('"', '')
|
line: str = line.replace('"', '')
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class ProgressBar(Configs):
|
||||||
spinner = PixelSpinner
|
spinner = PixelSpinner
|
||||||
color: str = self.endc
|
color: str = self.endc
|
||||||
|
|
||||||
|
if self.spinning_bar:
|
||||||
bar_spinner = spinner(f'{self.endc}{message} {filename} {color}')
|
bar_spinner = spinner(f'{self.endc}{message} {filename} {color}')
|
||||||
# print('\033[F', end='', flush=True)
|
# print('\033[F', end='', flush=True)
|
||||||
try:
|
try:
|
||||||
|
@ -48,3 +49,5 @@ class ProgressBar(Configs):
|
||||||
bar_spinner.next()
|
bar_spinner.next()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
else:
|
||||||
|
print(f'{message} ', end='', flush=True)
|
||||||
|
|
Loading…
Reference in a new issue