mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
This commit is contained in:
1 parent
486da7749a
commit
45fd180dcb
2 files changed
+13
-8
No files matched your search
@@ -1,13 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from dzgui.config.query import lookup
|
from dzgui.config.query import lookup
|
||||||
from dzgui.const.constants import APPID_DAYZ, APP_NAME, LIBRARYFOLDERS_PATH
|
from dzgui.const.constants import APPID_DAYZ, APP_NAME, LIBRARYFOLDERS_PATH
|
||||||
from dzgui.const.enum import Preferences
|
from dzgui.const.enum import Preferences
|
||||||
from dzgui.strings.errors import dayz_not_found
|
|
||||||
from dzgui.views.dialogs.early_alert import EarlyAlertDialog
|
|
||||||
|
|
||||||
import dzgui.api.pefile as PeFile
|
import dzgui.api.pefile as PeFile
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import annotations
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Self, Sequence, TYPE_CHECKING
|
from typing import Self, Sequence, TYPE_CHECKING
|
||||||
|
|
||||||
@@ -19,7 +20,6 @@ from dzgui.views.components.scrollable import NoOverlayScrolledWindow
|
|||||||
from dzgui.views.trees.tree_mods import OfflineModTreeView
|
from dzgui.views.trees.tree_mods import OfflineModTreeView
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
@@ -108,6 +108,8 @@ class ModFrame(HeadingFrame):
|
|||||||
|
|
||||||
def get_mods(self) -> list[str]:
|
def get_mods(self) -> list[str]:
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
if model is None:
|
||||||
|
return []
|
||||||
return [row[1] for row in model]
|
return [row[1] for row in model]
|
||||||
|
|
||||||
def collapse_tree(self) -> None:
|
def collapse_tree(self) -> None:
|
||||||
@@ -139,7 +141,9 @@ class ModFrame(HeadingFrame):
|
|||||||
|
|
||||||
|
|
||||||
class CustomModFrame(ModFrame):
|
class CustomModFrame(ModFrame):
|
||||||
def __init__(self, parent: Gtk.Widget, controller: "Controller", heading: str) -> None:
|
def __init__(
|
||||||
|
self, parent: OfflineLoader, controller: "Controller", heading: str
|
||||||
|
) -> None:
|
||||||
super().__init__(controller, heading)
|
super().__init__(controller, heading)
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
@@ -155,8 +159,13 @@ class CustomModFrame(ModFrame):
|
|||||||
|
|
||||||
self.emitter.connect("custom_mods_loaded", self._on_custom_mods_loaded)
|
self.emitter.connect("custom_mods_loaded", self._on_custom_mods_loaded)
|
||||||
|
|
||||||
|
def _on_custom_mods_loaded(
|
||||||
def _on_custom_mods_loaded(self, emitter: "Emitter", store: "FastInsertListStore", folder: str, has_duplicates: bool) -> None:
|
self,
|
||||||
|
emitter: "Emitter",
|
||||||
|
store: "FastInsertListStore",
|
||||||
|
folder: str,
|
||||||
|
has_duplicates: bool,
|
||||||
|
) -> None:
|
||||||
if len(store) == 0:
|
if len(store) == 0:
|
||||||
# TODO: pop error dialog area
|
# TODO: pop error dialog area
|
||||||
# block button access
|
# block button access
|
||||||
@@ -171,7 +180,6 @@ class CustomModFrame(ModFrame):
|
|||||||
# duplicates should block button access
|
# duplicates should block button access
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _on_custom_button_clicked(self, button: Gtk.Button) -> None:
|
def _on_custom_button_clicked(self, button: Gtk.Button) -> None:
|
||||||
self.parent.parse_mods()
|
self.parent.parse_mods()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user