mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 17:57:06 +02:00
fix: handle zero mods
This commit is contained in:
parent
0fad9155e2
commit
34d8545c94
@ -124,8 +124,14 @@ class Emitter(GObject.GObject):
|
||||
def load_maps(self, store: ListStore) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(str,))
|
||||
def mods_updated(self, msg: str) -> None:
|
||||
@GObject.Signal(
|
||||
flags=GObject.SignalFlags.RUN_LAST,
|
||||
arg_types=(
|
||||
str,
|
||||
int,
|
||||
),
|
||||
)
|
||||
def mods_updated(self, msg: str, mods: int) -> None:
|
||||
pass
|
||||
|
||||
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
|
||||
|
||||
@ -31,6 +31,7 @@ class ModSelectionPanel(Gtk.Box):
|
||||
emitter = controller.get_emitter()
|
||||
emitter.connect("mod_page_toggled", self._on_mod_page_toggled)
|
||||
emitter.connect("mods_highlighted", self._on_mods_highlighted)
|
||||
emitter.connect("mods_updated", self._on_mods_updated)
|
||||
|
||||
header = BoldLabel(mod_panel.header)
|
||||
|
||||
@ -72,6 +73,11 @@ class ModSelectionPanel(Gtk.Box):
|
||||
else:
|
||||
child.set_sensitive(True)
|
||||
|
||||
def _on_mods_updated(self, emitter: "Emitter", msg: str, mods: int) -> None:
|
||||
if mods < 1:
|
||||
self.main_panel.set_sensitive(False)
|
||||
self.stale_panel.set_sensitive(False)
|
||||
|
||||
def _on_mods_highlighted(self, emitter: "Emitter") -> None:
|
||||
self.swap_sensitive(True)
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class Statusbar(Gtk.Grid):
|
||||
# FIXME: fails if button was not previously drawn
|
||||
self.alert_button.hide()
|
||||
|
||||
def _on_mods_updated(self, emitter: "Emitter", msg: str) -> None:
|
||||
def _on_mods_updated(self, emitter: "Emitter", msg: str, mods: int) -> None:
|
||||
self.set_by_context(NotebookPage.MODS, msg)
|
||||
|
||||
def _on_notebook_page_changed(
|
||||
|
||||
@ -61,8 +61,9 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView):
|
||||
def _on_mods_highlighted(self, emitter: "Emitter") -> None:
|
||||
self.get_selection().unselect_all()
|
||||
|
||||
# TODO: test loading with no mods
|
||||
def _on_mods_updated(self, emitter: "Emitter", msg: str) -> None:
|
||||
def _on_mods_updated(self, emitter: "Emitter", msg: str, mods: int) -> None:
|
||||
if mods < 1:
|
||||
return
|
||||
self.set_cursor(0)
|
||||
|
||||
def get_selected_mod(self) -> str:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user