diff --git a/src/sticker_convert/gui.py b/src/sticker_convert/gui.py index 7d3793a..35cacf2 100755 --- a/src/sticker_convert/gui.py +++ b/src/sticker_convert/gui.py @@ -549,6 +549,7 @@ def cancel_job(self): if self.job: self.cb_msg(msg="Cancelling job...") self.job.cancel() + self.cb_bar(set_progress_mode="clear") def set_inputs(self, state: str): # state: 'normal', 'disabled' @@ -630,9 +631,22 @@ def cb_msg_block( return self.response - def cb_bar(self, *args: Any, **kwargs: Any): + def cb_bar( + self, + set_progress_mode: Optional[str] = None, + steps: int = 0, + update_bar: bool = False, + *args: Any, + **kwargs: Any + ): with self.bar_lock: - self.progress_frame.update_progress_bar(*args, **kwargs) + self.progress_frame.update_progress_bar( + set_progress_mode, + steps, + update_bar, + *args, + **kwargs + ) def highlight_fields(self) -> bool: if not self.init_done: diff --git a/src/sticker_convert/gui_components/frames/progress_frame.py b/src/sticker_convert/gui_components/frames/progress_frame.py index 13aa2ad..329fc1f 100644 --- a/src/sticker_convert/gui_components/frames/progress_frame.py +++ b/src/sticker_convert/gui_components/frames/progress_frame.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Optional from tqdm import tqdm from ttkbootstrap import LabelFrame, Progressbar # type: ignore @@ -32,7 +32,10 @@ def __init__(self, gui: "GUI", *args: Any, **kwargs: Any): self.progress_bar.pack(expand=True, fill="x") def update_progress_bar( - self, set_progress_mode: str = "", steps: int = 0, update_bar: bool = False + self, + set_progress_mode: Optional[str] = None, + steps: int = 0, + update_bar: bool = False, ): if update_bar and self.progress_bar_cli: self.progress_bar_cli.update() diff --git a/src/sticker_convert/utils/callback.py b/src/sticker_convert/utils/callback.py index bd1a2d2..8ba8abc 100644 --- a/src/sticker_convert/utils/callback.py +++ b/src/sticker_convert/utils/callback.py @@ -86,7 +86,7 @@ def cb_msg(self, *args: Any, **kwargs: Any): def cb_bar( self, set_progress_mode: Optional[str] = None, - steps: Optional[int] = None, + steps: int = 0, update_bar: bool = False, ): if self.silent: