mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 11:47:17 +02:00
Compare commits
3 Commits
45fd180dcb
...
401c8625ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
401c8625ad | ||
|
|
8503d7e698 | ||
|
|
b35b6148bc |
@ -119,10 +119,11 @@ def get_missing_mods(local: list, remote: list) -> list:
|
|||||||
return [mod for mod in remote if mod not in local]
|
return [mod for mod in remote if mod not in local]
|
||||||
|
|
||||||
|
|
||||||
def _hash(uid: str) -> str:
|
def _hash(uid: str, use_custom: bool = False) -> str:
|
||||||
md5 = hashlib.md5()
|
md5 = hashlib.md5()
|
||||||
md5.update(uid.encode("ascii"))
|
md5.update(uid.encode("ascii"))
|
||||||
return "@" + md5.hexdigest()[:8]
|
prefix = "@C" if use_custom else "@"
|
||||||
|
return prefix + md5.hexdigest()[:8]
|
||||||
|
|
||||||
|
|
||||||
def remove_stale_signatures(config: Path, versions: Path) -> None:
|
def remove_stale_signatures(config: Path, versions: Path) -> None:
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class PageHeading(Gtk.Label):
|
|||||||
|
|
||||||
class FolderHBox(HBox):
|
class FolderHBox(HBox):
|
||||||
def __init__(self, btn_label: str) -> None:
|
def __init__(self, btn_label: str) -> None:
|
||||||
super().__init__(spacing=5)
|
super().__init__(spacing=10)
|
||||||
|
|
||||||
self.set_margin_start(10)
|
self.set_margin_start(10)
|
||||||
self.set_margin_bottom(10)
|
self.set_margin_bottom(10)
|
||||||
@ -87,10 +87,11 @@ class ModFrame(HeadingFrame):
|
|||||||
|
|
||||||
self.tree = OfflineModTreeView(controller)
|
self.tree = OfflineModTreeView(controller)
|
||||||
self.tree.set_model(None)
|
self.tree.set_model(None)
|
||||||
|
self.tree.set_valign(Gtk.Align.FILL)
|
||||||
|
|
||||||
self.scrolled = NoOverlayScrolledWindow()
|
self.scrolled = NoOverlayScrolledWindow()
|
||||||
self.scrolled.set_margin_end(10)
|
self.scrolled.set_margin_end(5)
|
||||||
self.scrolled.set_size_request(600, 400)
|
self.scrolled.set_vexpand(True)
|
||||||
self.scrolled.add(self.tree)
|
self.scrolled.add(self.tree)
|
||||||
|
|
||||||
self.status = Gtk.Label(
|
self.status = Gtk.Label(
|
||||||
@ -100,12 +101,23 @@ class ModFrame(HeadingFrame):
|
|||||||
self.tree_vbox = VBox()
|
self.tree_vbox = VBox()
|
||||||
self.tree_vbox.extend([self.scrolled, self.status])
|
self.tree_vbox.extend([self.scrolled, self.status])
|
||||||
|
|
||||||
self.vbox.add(self.tree_vbox)
|
self.vbox.pack_end(self.tree_vbox, expand=True, fill=True, padding=3)
|
||||||
self.frame.add(self.vbox)
|
self.frame.add(self.vbox)
|
||||||
|
# self.vbox.add(self.tree_vbox)
|
||||||
|
# self.none_label = Gtk.Label(label="No mods found", halign=Gtk.Align.START)
|
||||||
|
# self.vbox.pack_end(self.none_label, expand=True, fill=True, padding=3)
|
||||||
|
# self.none_label.hide()
|
||||||
|
|
||||||
sel = self.tree.get_selection()
|
sel = self.tree.get_selection()
|
||||||
sel.connect("changed", self._on_selection_changed)
|
sel.connect("changed", self._on_selection_changed)
|
||||||
|
|
||||||
|
# TODO: warnings area
|
||||||
|
# valid warnings (one at a time):
|
||||||
|
# - name collision within custom mods
|
||||||
|
# - name collision b/w custom and local (permissible)
|
||||||
|
# - no mods
|
||||||
|
# - not a valid mission
|
||||||
|
|
||||||
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:
|
if model is None:
|
||||||
@ -249,10 +261,13 @@ class OfflineLoader(Gtk.Box):
|
|||||||
# TODO: suppress symlink column
|
# TODO: suppress symlink column
|
||||||
self.custom_tree = OfflineModTreeView(controller)
|
self.custom_tree = OfflineModTreeView(controller)
|
||||||
|
|
||||||
|
# TODO: custom class
|
||||||
self.mission_hbox = FolderHBox(offline.mission_button)
|
self.mission_hbox = FolderHBox(offline.mission_button)
|
||||||
self.mission_frame = HeadingFrame.new_with_widget_and_label(
|
self.mission_frame = HeadingFrame.new_with_widget_and_label(
|
||||||
self.mission_hbox, offline.mission_frame
|
self.mission_hbox, offline.mission_frame
|
||||||
)
|
)
|
||||||
|
self.mission_button = self.mission_hbox.get_button()
|
||||||
|
self.mission_button.connect("clicked", self._on_mission_clicked)
|
||||||
|
|
||||||
self.radio_frame = RadioFrame(controller)
|
self.radio_frame = RadioFrame(controller)
|
||||||
|
|
||||||
@ -286,8 +301,16 @@ class OfflineLoader(Gtk.Box):
|
|||||||
self.add(self.scrollable)
|
self.add(self.scrollable)
|
||||||
self.add(self.button_box)
|
self.add(self.button_box)
|
||||||
|
|
||||||
|
def _on_mission_clicked(self, button: Gtk.Button) -> None:
|
||||||
|
# process path, cf. set_custom_folder()
|
||||||
|
# file = path / "init.c"
|
||||||
|
# if not file.exists():
|
||||||
|
# pop warning
|
||||||
|
pass
|
||||||
|
|
||||||
def parse_mods(self) -> None:
|
def parse_mods(self) -> None:
|
||||||
# TODO: check method on custom frame
|
# TODO: check method on custom frame
|
||||||
|
# TODO: delegate folderpicker to offline manager
|
||||||
local_mods = self.local_frame.get_mods()
|
local_mods = self.local_frame.get_mods()
|
||||||
folder = self.controller.set_custom_folder()
|
folder = self.controller.set_custom_folder()
|
||||||
if folder is not None:
|
if folder is not None:
|
||||||
@ -300,6 +323,8 @@ class OfflineLoader(Gtk.Box):
|
|||||||
|
|
||||||
def populate(self, store: "FastInsertListStore") -> None:
|
def populate(self, store: "FastInsertListStore") -> None:
|
||||||
self.local_frame.set_model(store)
|
self.local_frame.set_model(store)
|
||||||
|
if store is None:
|
||||||
|
self.local_frame.collapse_tree()
|
||||||
# TODO: toggle if empty model, show warning label
|
# TODO: toggle if empty model, show warning label
|
||||||
# NOTE: there may be no local mods
|
# NOTE: there may be no local mods
|
||||||
# TODO: suppress trees if there are no mods
|
# TODO: suppress trees if there are no mods
|
||||||
@ -316,5 +341,6 @@ class OfflineLoader(Gtk.Box):
|
|||||||
# mission = self.mission_frame.get_mission()
|
# mission = self.mission_frame.get_mission()
|
||||||
# local_mods = self.local_frame.get_mods()
|
# local_mods = self.local_frame.get_mods()
|
||||||
# custom_mods = self.custom_frame.get_mods()
|
# custom_mods = self.custom_frame.get_mods()
|
||||||
|
# cf. api.mods._hash(uid, use_custom=True)
|
||||||
# self.offline_man.setup(appid, mission, local_mods, custom_mods)
|
# self.offline_man.setup(appid, mission, local_mods, custom_mods)
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user