Simplify logic

This commit is contained in:
Kovid Goyal 2025-03-11 10:12:29 +05:30
parent 85d47dc64b
commit 08b4e3f2e0
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1131,11 +1131,13 @@ def desktop_notify(self, osc_code: int, raw_datab: memoryview) -> None:
def clear_progress_if_needed(self, timer_id: int | None = None) -> None:
# Clear stuck or completed progress
if timer_id is not None: # this is a timer callback
self.clear_progress_timer = 0
if self.progress.clear_progress():
if (tab := self.tabref()) is not None:
tab.update_progress()
else:
if (timer_id is None and not self.clear_progress_timer) or timer_id is not None:
if not self.clear_progress_timer:
self.clear_progress_timer = add_timer(self.clear_progress_if_needed, 1.0, False)
def on_mouse_event(self, event: dict[str, Any]) -> bool: