mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 15:12:48 +01:00
feat: prepare mods in manager (WIP)
This commit is contained in:
1 parent
46fba4eef1
commit
d4a99f8229
3 files changed
+54
-17
No files matched your search
@@ -1,9 +1,11 @@
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Union
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.api.mods import get_custom_mods
|
||||
from dzgui.api.steam import launch_offline
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.managers.threading import call_on_thread, ThreadingManager
|
||||
from dzgui.model.model_factory import FastInsertListStore, ModelFactory
|
||||
from dzgui.strings import dialogs
|
||||
from dzgui.util.symlink import clone_symlinks
|
||||
|
||||
@@ -15,21 +17,41 @@ class OfflineManager:
|
||||
def __init__(
|
||||
self,
|
||||
controller: "Controller",
|
||||
appid: int,
|
||||
mission: str = "",
|
||||
local_mods: Union[list[str], None] = None,
|
||||
custom_mods: Union[list[str], None] = None,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.controller = controller
|
||||
self.thread_man = ThreadingManager(controller)
|
||||
|
||||
self.appid: int
|
||||
self.mission_folder: str
|
||||
self.local_mods: list[str] | None
|
||||
self.custom_mods: list[str] | None
|
||||
|
||||
# TODO: strings
|
||||
@call_on_thread("parsing")
|
||||
def parse_custom_mods(self, folder: str) -> "FastInsertListStore":
|
||||
mods = get_custom_mods(Path(folder))
|
||||
store = ModelFactory().make_mod_store()
|
||||
store.extend(mods)
|
||||
# TODO: manipulate tree columns to only show name and size
|
||||
return store
|
||||
|
||||
def setup(
|
||||
self,
|
||||
appid: int,
|
||||
mission: str = "",
|
||||
local_mods: list[str] | None = None,
|
||||
custom_mods: list[str] | None = None,
|
||||
) -> None:
|
||||
|
||||
self.appid = appid
|
||||
self.mission_folder = mission
|
||||
self.local_mods = local_mods
|
||||
self.custom_mods = custom_mods
|
||||
|
||||
self.launch()
|
||||
|
||||
@call_on_thread(dialogs.waiting_for_launch)
|
||||
def launch(self) -> None:
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
@@ -43,6 +65,8 @@ class OfflineManager:
|
||||
combined_mods.extend(self.local_mods)
|
||||
|
||||
if self.custom_mods is not None:
|
||||
# TODO: new function that creates symlinks in game path
|
||||
# based on selected mods
|
||||
clone_symlinks(Path(steam_path))
|
||||
combined_mods.extend(new_symlinks)
|
||||
|
||||
|
||||
Reference in new issue
Block a user