From 75868b32d07aafe46b69649d2da0dc2c833f112d Mon Sep 17 00:00:00 2001 From: Warry Date: Thu, 4 Dec 2025 12:03:31 +0100 Subject: refactor: Restructure GUI components into separate modules for improved maintainability --- tidal_dl_ng/gui/updates.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tidal_dl_ng/gui/updates.py (limited to 'tidal_dl_ng/gui/updates.py') diff --git a/tidal_dl_ng/gui/updates.py b/tidal_dl_ng/gui/updates.py new file mode 100644 index 0000000..099210c --- /dev/null +++ b/tidal_dl_ng/gui/updates.py @@ -0,0 +1,25 @@ +"""Updates mixin for MainWindow. + +Handles application update checking. +""" + +from tidal_dl_ng import update_available +from tidal_dl_ng.dialog import DialogVersion +from tidal_dl_ng.model.meta import ReleaseLatest + + +class UpdatesMixin: + """Mixin containing update checking methods.""" + + def on_update_check(self, on_startup: bool = True) -> None: + """Check for application updates and emit update signals.""" + is_available, info = update_available() + + if (on_startup and is_available) or not on_startup: + self.s_update_show.emit(True, is_available, info) + + def on_version( + self, update_check: bool = False, update_available: bool = False, update_info: ReleaseLatest | None = None + ) -> None: + """Show the version information dialog.""" + DialogVersion(self, update_check, update_available, update_info) -- cgit v1.3.1