mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +02:00
fix: emitter arguments
This commit is contained in:
parent
606df3423c
commit
486da7749a
@ -155,6 +155,6 @@ class Emitter(GObject.GObject):
|
||||
def lan_page_initialized(self) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object, str))
|
||||
def custom_mods_loaded(self, store: "FastInsertListStore", folder: str) -> None:
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object, str, bool))
|
||||
def custom_mods_loaded(self, store: "FastInsertListStore", folder: str, has_duplicates: bool) -> None:
|
||||
pass
|
||||
|
||||
@ -42,7 +42,7 @@ class OfflineManager:
|
||||
row[-1]=True
|
||||
has_duplicates = True
|
||||
|
||||
func = StoredFunc(self.emitter.emit, "custom_mods_loaded", store, folder, has_duplicates)
|
||||
func = StoredFunc(lambda: self.emitter.emit("custom_mods_loaded", store, folder, has_duplicates))
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def setup(
|
||||
|
||||
@ -27,6 +27,7 @@ from gi.repository import Gtk, Gdk # noqa
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
from dzgui.controllers.emitter import Emitter
|
||||
from dzgui.model.model_factory import FastInsertListStore
|
||||
|
||||
|
||||
@ -105,6 +106,10 @@ class ModFrame(HeadingFrame):
|
||||
sel = self.tree.get_selection()
|
||||
sel.connect("changed", self._on_selection_changed)
|
||||
|
||||
def get_mods(self) -> list[str]:
|
||||
model = self.tree.get_model()
|
||||
return [row[1] for row in model]
|
||||
|
||||
def collapse_tree(self) -> None:
|
||||
self.tree_vbox.hide()
|
||||
|
||||
@ -151,7 +156,7 @@ class CustomModFrame(ModFrame):
|
||||
self.emitter.connect("custom_mods_loaded", self._on_custom_mods_loaded)
|
||||
|
||||
|
||||
def _on_custom_mods_loaded(self, store: "FastInsertListStore", folder: str, has_duplicates: bool) -> None:
|
||||
def _on_custom_mods_loaded(self, emitter: "Emitter", store: "FastInsertListStore", folder: str, has_duplicates: bool) -> None:
|
||||
if len(store) == 0:
|
||||
# TODO: pop error dialog area
|
||||
# block button access
|
||||
@ -274,7 +279,7 @@ class OfflineLoader(Gtk.Box):
|
||||
self.add(self.button_box)
|
||||
|
||||
def parse_mods(self) -> None:
|
||||
# TODO:
|
||||
# TODO: check method on custom frame
|
||||
local_mods = self.local_frame.get_mods()
|
||||
folder = self.controller.set_custom_folder()
|
||||
if folder is not None:
|
||||
|
||||
@ -115,10 +115,13 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView): # type: ignore
|
||||
val = model[it][3]
|
||||
formatted = localize.number(val)
|
||||
cell.set_property("text", formatted)
|
||||
# NOTE: reapply color property after float conversion
|
||||
self._format_color(column, cell, model, it, data)
|
||||
|
||||
def set_menu(self, context: ContextMenuGroup) -> None:
|
||||
self.menu = context
|
||||
|
||||
|
||||
class OfflineModTreeView(ModTreeView):
|
||||
def __init__(self, controller: "Controller") -> None:
|
||||
super().__init__(controller)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user