From 59959ae3a1922d020d2b9bf3790928895ae66990 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 24 May 2026 01:49:08 +0900 Subject: [PATCH] chore: clear typehinting errors --- dzgui/managers/update.py | 17 ++++++++++++----- dzgui/views/components/right_panel.py | 12 +----------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/dzgui/managers/update.py b/dzgui/managers/update.py index 62b543b..abe6818 100644 --- a/dzgui/managers/update.py +++ b/dzgui/managers/update.py @@ -1,14 +1,19 @@ import logging import requests import shutil +import subprocess +import tarfile +from typing import TYPE_CHECKING from dzgui.const.constants import ( + APP_NAME, TMP_EXE, TMP_PATH, TMP_TARBALL, - ) +) from dzgui.strings import dialogs from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager +from dzgui.views.dialogs.generic import ExceptionDialog, QuitDialog import gi @@ -20,13 +25,15 @@ if TYPE_CHECKING: logger = logging.getLogger(APP_NAME) -class UpdateManager: - def __init__(self) -> None: - self.thread_man = ThreadingManager() +class UpdateManager: + def __init__(self, controller: "Controller") -> None: + + self.thread_man = ThreadingManager(controller) + self.controller = controller @call_on_thread(dialogs.fetching_update) - def _update_version(self, exe_path: str, url: str) -> None: + def update_version(self, exe_path: str, url: str) -> None: try: res = requests.get(url) if res.status_code == 200: diff --git a/dzgui/views/components/right_panel.py b/dzgui/views/components/right_panel.py index 244eee8..48b385b 100644 --- a/dzgui/views/components/right_panel.py +++ b/dzgui/views/components/right_panel.py @@ -1,9 +1,5 @@ import logging import os -import requests -import shutil -import subprocess -import tarfile from typing import Literal, TYPE_CHECKING @@ -13,20 +9,14 @@ from dzgui.const.constants import ( NO_FILL, FILL, NO_PADDING, - TMP_EXE, - TMP_PATH, - TMP_TARBALL, ) -from dzgui.const.update import ALLOW_UPDATES from dzgui.const.enum import ServerTab from dzgui.managers.update import UpdateManager -from dzgui.strings import dialogs from dzgui.util.clip import copy_clipboard from dzgui.views.components.buttonbox import ButtonBox from dzgui.views.components.filter_panel import FilterPanel from dzgui.views.components.mod_panel import ModSelectionPanel from dzgui.views.components.buttons import IconTextButton, RefreshButton, KeysButton -from dzgui.views.dialogs.generic import ExceptionDialog, QuitDialog import gi @@ -106,7 +96,7 @@ class RightPanel(Gtk.Box): self.pack_start(self.gutter_box, NO_EXPAND, FILL, NO_PADDING) def _on_update_button_clicked(self, button: Gtk.Button, exe_path: str, url: str) -> None: - UpdateManager().update_version() + UpdateManager(self.controller).update_version() def _on_server_page_changed( self, emitter: "Emitter", page: "ServerTreeView"