mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 23:22:44 +01:00
fix: update table checkmarks when mods are synched (#370)
This commit is contained in:
1 parent
9225f3bc06
commit
ed20a7cc84
3 files changed
+17
-2
No files matched your search
@@ -172,3 +172,7 @@ class Emitter(GObject.GObject):
|
|||||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||||
def invalid_custom_mods(self) -> None:
|
def invalid_custom_mods(self) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||||
|
def all_mods_synched(self) -> None:
|
||||||
|
pass
|
||||||
@@ -23,6 +23,7 @@ from gi.repository import Gdk, Gtk # noqa E402
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from dzgui.managers.connection import Prerequisites
|
from dzgui.managers.connection import Prerequisites
|
||||||
from dzgui.controllers.mc import Controller
|
from dzgui.controllers.mc import Controller
|
||||||
|
from dzgui.controllers.emitter import Emitter
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -191,9 +192,14 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
self.add(self.scrolled_box)
|
self.add(self.scrolled_box)
|
||||||
self.add(self.button_box)
|
self.add(self.button_box)
|
||||||
|
|
||||||
|
emitter = self.controller.get_emitter()
|
||||||
|
emitter.connect("all_mods_synched", self._on_mods_synched)
|
||||||
self.connect("key-press-event", self._on_keypress)
|
self.connect("key-press-event", self._on_keypress)
|
||||||
self.connect("map", self._on_map)
|
self.connect("map", self._on_map)
|
||||||
|
|
||||||
|
def _on_mods_synched(self, emitter: "Emitter") -> None:
|
||||||
|
self.tree.mark_mods_synched()
|
||||||
|
|
||||||
def _on_map(self, widget: Self) -> None:
|
def _on_map(self, widget: Self) -> None:
|
||||||
widgets = (
|
widgets = (
|
||||||
self.tree_frame,
|
self.tree_frame,
|
||||||
@@ -297,10 +303,10 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
self._hide_mod_area()
|
self._hide_mod_area()
|
||||||
else:
|
else:
|
||||||
self._show_mod_area()
|
self._show_mod_area()
|
||||||
msg = "All mods are up to date."
|
msg = preconnect.up_to_date
|
||||||
self.mod_count.set_text(msg)
|
self.mod_count.set_text(msg)
|
||||||
|
|
||||||
if prereqs.required_space == 0:
|
if prereqs.required_space != 0:
|
||||||
self.ok.set_label(preconnect.connect)
|
self.ok.set_label(preconnect.connect)
|
||||||
|
|
||||||
pretty = number(prereqs.required_space)
|
pretty = number(prereqs.required_space)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from gi.repository import Gtk, GLib, Gdk, Pango # noqa
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from dzgui.controllers.mc import Controller
|
from dzgui.controllers.mc import Controller
|
||||||
|
from dzgui.controllers.emitter import Emitter
|
||||||
|
|
||||||
|
|
||||||
class ServerModTreeView(ContextMixin, TreeView): # type: ignore
|
class ServerModTreeView(ContextMixin, TreeView): # type: ignore
|
||||||
@@ -48,6 +49,10 @@ class ServerModTreeView(ContextMixin, TreeView): # type: ignore
|
|||||||
case _:
|
case _:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def mark_mods_synched(self) -> None:
|
||||||
|
for row in self.mod_store:
|
||||||
|
row[2] = server_mods.checkmark
|
||||||
|
|
||||||
# TODO: could be problematic if user downloads mods out of band
|
# TODO: could be problematic if user downloads mods out of band
|
||||||
def _on_row_activated(
|
def _on_row_activated(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in new issue
Block a user