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