mirror of
https://github.com/libratbag/piper.git
synced 2026-02-20 15:43:51 -05:00
show key name instead of code in button page
This commit is contained in:
@@ -296,13 +296,14 @@ class ButtonDialog(Gtk.Dialog):
|
||||
|
||||
def _on_macro_set(self, macro):
|
||||
# A macro has been set; update accordingly.
|
||||
if RatbagdButton.ActionType.MACRO in self._button.action_types: # macro is supported
|
||||
self._action_type = RatbagdButton.ActionType.MACRO
|
||||
self._mapping = macro
|
||||
else:
|
||||
if (RatbagdButton.ActionType.KEY in self._button.action_types and
|
||||
len(macro.keys) == 2): # single key (press + release events)
|
||||
self._action_type = RatbagdButton.ActionType.KEY
|
||||
type_, value = macro.keys[0]
|
||||
self._mapping = value
|
||||
else:
|
||||
self._action_type = RatbagdButton.ActionType.MACRO
|
||||
self._mapping = macro
|
||||
self.stack.set_visible_child_name("overview")
|
||||
self._release_grab()
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
from gettext import gettext as _
|
||||
from evdev import ecodes
|
||||
|
||||
from .buttondialog import ButtonDialog
|
||||
from .mousemap import MouseMap
|
||||
from .optionbutton import OptionButton
|
||||
from .ratbagd import RatbagdButton
|
||||
from .ratbagd import RatbagdButton, RatbagdMacro
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
@@ -81,7 +82,7 @@ class ButtonsPage(Gtk.Box):
|
||||
elif action_type == RatbagdButton.ActionType.MACRO:
|
||||
label = _("Macro: {}").format(str(ratbagd_button.macro))
|
||||
elif action_type == RatbagdButton.ActionType.KEY:
|
||||
label = _("Key: {}").format(str(ratbagd_button.key))
|
||||
label = _("Key: {}").format(ecodes.KEY[ratbagd_button.key][RatbagdMacro._PREFIX_LEN:])
|
||||
elif action_type == RatbagdButton.ActionType.NONE:
|
||||
# Translators: the button is turned disabled, e.g. off.
|
||||
label = _("Disabled")
|
||||
|
||||
Reference in New Issue
Block a user