Compare commits

..

No commits in common. "401c8625adbde30e1a9f4a7c45246be83c9854e0" and "45fd180dcb902ec9dcd69270cfd9bf705101a5af" have entirely different histories.

2 changed files with 6 additions and 33 deletions

View File

@ -119,11 +119,10 @@ 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, use_custom: bool = False) -> str: def _hash(uid: str) -> str:
md5 = hashlib.md5() md5 = hashlib.md5()
md5.update(uid.encode("ascii")) md5.update(uid.encode("ascii"))
prefix = "@C" if use_custom else "@" return "@" + md5.hexdigest()[:8]
return prefix + md5.hexdigest()[:8]
def remove_stale_signatures(config: Path, versions: Path) -> None: def remove_stale_signatures(config: Path, versions: Path) -> None:

View File

@ -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=10) super().__init__(spacing=5)
self.set_margin_start(10) self.set_margin_start(10)
self.set_margin_bottom(10) self.set_margin_bottom(10)
@ -87,11 +87,10 @@ 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(5) self.scrolled.set_margin_end(10)
self.scrolled.set_vexpand(True) self.scrolled.set_size_request(600, 400)
self.scrolled.add(self.tree) self.scrolled.add(self.tree)
self.status = Gtk.Label( self.status = Gtk.Label(
@ -101,23 +100,12 @@ 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.pack_end(self.tree_vbox, expand=True, fill=True, padding=3) self.vbox.add(self.tree_vbox)
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:
@ -261,13 +249,10 @@ 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)
@ -301,16 +286,8 @@ 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:
@ -323,8 +300,6 @@ 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
@ -341,6 +316,5 @@ 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