logitech_receiver: simplify param labels

This commit is contained in:
Vinícius 2022-01-20 14:55:32 -03:00 committed by Peter F. Patel-Schneider
parent f5831cbda7
commit 13dfac476b
2 changed files with 2 additions and 6 deletions

View File

@ -949,11 +949,7 @@ class Gesture2Params(_LongSettings):
rw_options = {'read_fnid': 0x70, 'write_fnid': 0x80} rw_options = {'read_fnid': 0x70, 'write_fnid': 0x80}
choices_universe = None choices_universe = None
class ParamWrapper: _labels = _GESTURE2_PARAMS_LABELS
def get(self, name, default=None):
return _GESTURE2_PARAMS_LABELS.get(name.param, default)
_labels = ParamWrapper()
_labels_sub = _GESTURE2_PARAMS_LABELS_SUB _labels_sub = _GESTURE2_PARAMS_LABELS_SUB
class validator_class(_MultipleRangeV): class validator_class(_MultipleRangeV):

View File

@ -356,7 +356,7 @@ class MultipleRangeControl(Gtk.ListBox, MultipleControl):
lbl_text = str(item) lbl_text = str(item)
lbl_tooltip = None lbl_tooltip = None
if hasattr(sbox.setting, '_labels'): if hasattr(sbox.setting, '_labels'):
l1, l2 = sbox.setting._labels.get(item, (None, None)) l1, l2 = sbox.setting._labels.get(int(item), (None, None))
lbl_text = l1 if l1 else lbl_text lbl_text = l1 if l1 else lbl_text
lbl_tooltip = l2 if l2 else lbl_tooltip lbl_tooltip = l2 if l2 else lbl_tooltip
item_lbl = Gtk.Label(lbl_text) item_lbl = Gtk.Label(lbl_text)