diff options
| author | Warry <FunWarry@users.noreply.github.com> | 2025-12-04 12:03:31 +0100 |
|---|---|---|
| committer | Warry <FunWarry@users.noreply.github.com> | 2025-12-04 12:03:31 +0100 |
| commit | 75868b32d07aafe46b69649d2da0dc2c833f112d (patch) | |
| tree | 970a50f4cbf141af0e5e0856e087e347f3b5be48 /tidal_dl_ng/gui/progress.py | |
| parent | 428d34056be16ed9d28597253b333dfbd7f21a47 (diff) | |
| download | tidal-dl-ng-75868b32d07aafe46b69649d2da0dc2c833f112d.tar.gz | |
refactor: Restructure GUI components into separate modules for improved maintainability
Diffstat (limited to 'tidal_dl_ng/gui/progress.py')
| -rw-r--r-- | tidal_dl_ng/gui/progress.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tidal_dl_ng/gui/progress.py b/tidal_dl_ng/gui/progress.py new file mode 100644 index 0000000..d46ea3d --- /dev/null +++ b/tidal_dl_ng/gui/progress.py @@ -0,0 +1,31 @@ +"""Progress bars mixin for MainWindow. + +Handles progress bar updates and formatting. +""" + +import math + + +class ProgressMixin: + """Mixin containing progress bar management methods.""" + + def on_progress_reset(self): + """Reset progress bars to zero.""" + self.pb_list.setValue(0) + self.pb_item.setValue(0) + + def on_progress_list(self, value: float) -> None: + """Update the progress of the list progress bar.""" + self.pb_list.setValue(int(math.ceil(value))) + + def on_progress_item(self, value: float) -> None: + """Update the progress of the item progress bar.""" + self.pb_item.setValue(int(math.ceil(value))) + + def on_progress_item_name(self, value: str) -> None: + """Set the format of the item progress bar.""" + self.pb_item.setFormat(f"%p% {value}") + + def on_progress_list_name(self, value: str) -> None: + """Set the format of the list progress bar.""" + self.pb_list.setFormat(f"%p% {value}") |
