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