mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 01:37:18 +02:00
chore: clear typehinting errors
This commit is contained in:
parent
bc1118a29f
commit
46fba4eef1
@ -20,7 +20,6 @@ from dzgui.controllers.emitter import Emitter
|
||||
from dzgui.managers.config import ConfigManager
|
||||
from dzgui.managers.connection import ConnectionManager
|
||||
from dzgui.managers.contextmenu import ContextMenuManager
|
||||
from dzgui.managers.mods import ModManager
|
||||
from dzgui.managers.notes import NoteManager
|
||||
from dzgui.model.servers import ServerModelManager
|
||||
from dzgui.util.diag import write_diagnostic
|
||||
@ -236,7 +235,7 @@ class Controller(GObject.GObject):
|
||||
mod_man.toggle_mod_selection(state)
|
||||
|
||||
def delete_mods(
|
||||
self, treeview: Union["ModTreeView", "OfflineModTreeView"] = None
|
||||
self, treeview: Union["ModTreeView", "OfflineModTreeView", None] = None
|
||||
) -> None:
|
||||
if treeview is None:
|
||||
view = self.mediator.modtreeview
|
||||
|
||||
@ -1,43 +1,49 @@
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
from dzgui.api.steam import launch_offline
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.managers.threading import call_on_thread, ThreadingManager
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util.symlinks import clone_symlinks
|
||||
from dzgui.util.symlink import clone_symlinks
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
|
||||
class OfflineManager:
|
||||
def __init__(
|
||||
self,
|
||||
controller: "Controller",
|
||||
appid: int,
|
||||
mission: Union[Path, None] = None,
|
||||
mission: str = "",
|
||||
local_mods: Union[list[str], None] = None,
|
||||
custom_mods: Union[list[str], None] = None,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.thread_man = ThreadingManager()
|
||||
self.controller = controller
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
self.appid = appid
|
||||
self.mission_folder = mission
|
||||
self.local_mods = local_mods
|
||||
self.custom_mods = custom_mods
|
||||
|
||||
@call_on_thread(dialogs.waiting_for_launch)
|
||||
def launch(self) -> None:
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
name = self.controller.query_config(Preferences.NAME)
|
||||
steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||
@call_on_thread(dialogs.waiting_for_launch)
|
||||
def launch(self) -> None:
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
name = self.controller.query_config(Preferences.NAME)
|
||||
steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||
|
||||
new_symlinks: list[str] = []
|
||||
new_symlinks: list[str] = []
|
||||
|
||||
combined_mods: list[str] = []
|
||||
combined_mods: list[str] = []
|
||||
if self.local_mods is not None:
|
||||
combined_mods.extend(self.local_mods)
|
||||
|
||||
if self.custom_mods is not None:
|
||||
clone_symlinks(Path(steam_path))
|
||||
combined_mods.extend(new_symlinks)
|
||||
|
||||
# TODO: cf. rebuild_symlinks
|
||||
|
||||
clone_symlinks(Path(steam_path))
|
||||
launch_offline(client, self.appid, name, combined_mods)
|
||||
launch_offline(client, self.appid, name, combined_mods, self.mission_folder)
|
||||
|
||||
@ -166,5 +166,5 @@ class ModelFactory:
|
||||
def make_server_store(self) -> FastInsertListStore:
|
||||
return self.new_model_from_class(ServerCols)
|
||||
|
||||
def convert_model_to_list(self, model: "FastInsertListStore") -> list:
|
||||
return [[el for el in row] for row in model]
|
||||
# def convert_model_to_list(self, model: "FastInsertListStore") -> list:
|
||||
# return [[el for el in row] for row in model]
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
from typing import Self
|
||||
from dzgui.util import css
|
||||
|
||||
import gi
|
||||
@ -21,7 +22,7 @@ class HeadingFrame(Gtk.Box):
|
||||
self.add(self.frame)
|
||||
|
||||
@classmethod
|
||||
def new_with_widget_and_label(cls, widget: Gtk.Widget, label: str) -> None:
|
||||
def new_with_widget_and_label(cls, widget: Gtk.Widget, label: str) -> Self:
|
||||
n = cls()
|
||||
n.frame.add(widget)
|
||||
n.label.set_label(label)
|
||||
|
||||
@ -45,7 +45,7 @@ class ContextMixin(TreeView):
|
||||
|
||||
for row in group.value:
|
||||
if row is None:
|
||||
return
|
||||
return False
|
||||
item = self._process_dynamic_row(row)
|
||||
self.context_menu.append(item)
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ class ModFrame(HeadingFrame):
|
||||
def get_tree(self) -> OfflineModTreeView:
|
||||
return self.tree
|
||||
|
||||
def pack_start(self, widget: Gtk.Widget) -> None:
|
||||
def pack(self, widget: Gtk.Widget) -> None:
|
||||
self.vbox.pack_start(widget, expand=False, fill=False, padding=5)
|
||||
|
||||
def set_model(self, model: "FastInsertListStore") -> None:
|
||||
@ -136,14 +136,13 @@ class CustomModFrame(ModFrame):
|
||||
self.custom_hbox = FolderHBox(offline.custom_button)
|
||||
self.custom_hbox.get_button().connect("clicked", self._on_custom_button_clicked)
|
||||
|
||||
self.pack_start(self.custom_hbox)
|
||||
self.pack(self.custom_hbox)
|
||||
|
||||
def _on_custom_button_clicked(self, button: Gtk.Button) -> None:
|
||||
# TODO: recycle for mission folder
|
||||
# TODO: propagate results back to parent
|
||||
folder = self.controller.set_custom_folder()
|
||||
if folder is not None:
|
||||
# TODO: CustomModManager
|
||||
self.custom_hbox.set_label(str(folder))
|
||||
|
||||
|
||||
@ -154,7 +153,7 @@ class RadioFrame(HeadingFrame):
|
||||
self.controller = controller
|
||||
|
||||
self.id_map = {APPNAME_DAYZ: APPID_DAYZ, APPNAME_DAYZ_EXP_HUMAN: APPID_DAYZ_EXP}
|
||||
self.appid: APPID_DAYZ
|
||||
self.appid = APPID_DAYZ
|
||||
|
||||
self.dayz = Gtk.RadioButton.new_with_label(None, APPNAME_DAYZ)
|
||||
self.dayz_exp = Gtk.RadioButton.new_with_label_from_widget(
|
||||
@ -259,7 +258,8 @@ class OfflineLoader(Gtk.Box):
|
||||
self.controller.open_page(NotebookPage.MODS)
|
||||
|
||||
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
||||
appid = self.radio_frame.get_appid()
|
||||
# appid = self.radio_frame.get_appid()
|
||||
# TODO; delegate to OfflineManager
|
||||
"""
|
||||
- collect symlinks to selected mods
|
||||
cf. rebuild_symlinks()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user