1
0
forked from drath/libratbag

tools: put the list of possible button action types into a const

This commit is contained in:
Yaroslav Chvanov
2022-11-18 15:13:41 +03:00
parent 72c1a29f28
commit 0b8f4a25b1

View File

@@ -648,8 +648,18 @@ class RatbagdButton(metaclass=MetaRatbag):
@property
def action_types(self):
"""An array of possible values for ActionType."""
return [t for t in (RatbagdButton.ActionType.BUTTON, RatbagdButton.ActionType.SPECIAL, RatbagdButton.ActionType.KEY, RatbagdButton.ActionType.MACRO)
if libratbag.ratbag_button_has_action_type(self._button, t)]
POSSIBLE_ACTION_TYPES = (
RatbagdButton.ActionType.BUTTON,
RatbagdButton.ActionType.SPECIAL,
RatbagdButton.ActionType.KEY,
RatbagdButton.ActionType.MACRO,
)
return [
t
for t in POSSIBLE_ACTION_TYPES
if libratbag.ratbag_button_has_action_type(self._button, t)
]
def disable(self):
"""Disables this button."""