From 0b8f4a25b1c5a2ac00d52d856d1b6bb166766eff Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Fri, 18 Nov 2022 15:13:41 +0300 Subject: [PATCH] tools: put the list of possible button action types into a const --- tools/ratbagc.py.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/ratbagc.py.in b/tools/ratbagc.py.in index aad42a11..12d913d2 100644 --- a/tools/ratbagc.py.in +++ b/tools/ratbagc.py.in @@ -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."""