Skip to content

Commit

Permalink
Refactor: Convert Kind to IntEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
MattHag committed Dec 1, 2024
1 parent 2a49ec7 commit af87ccd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 0 additions & 12 deletions lib/logitech_receiver/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,10 @@
from . import hidpp20_constants
from . import settings_validator
from .common import NamedInt
from .common import NamedInts

logger = logging.getLogger(__name__)


SENSITIVITY_IGNORE = "ignore"
KIND = NamedInts(
toggle=0x01,
choice=0x02,
range=0x04,
map_choice=0x0A,
multiple_toggle=0x10,
packed_range=0x20,
multiple_range=0x40,
hetero=0x80,
)


class Kind(IntEnum):
Expand Down
6 changes: 3 additions & 3 deletions lib/solaar/ui/config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def update(self):
def layout(self, sbox, label, change, spinner, failed):
sbox.pack_start(label, False, False, 0)
sbox.pack_end(change, False, False, 0)
fill = sbox.setting.kind == settings.KIND.range or sbox.setting.kind == settings.KIND.hetero
fill = sbox.setting.kind == settings.Kind.RANGE or sbox.setting.kind == settings.Kind.HETERO
sbox.pack_end(self, fill, fill, 0)
sbox.pack_end(spinner, False, False, 0)
sbox.pack_end(failed, False, False, 0)
Expand Down Expand Up @@ -544,13 +544,13 @@ def __init__(self, sbox, delegate=None):
item_lblbox = None

item_box = ComboBoxText()
if item["kind"] == settings.KIND.choice:
if item["kind"] == settings.Kind.CHOICE:
for entry in item["choices"]:
item_box.append(str(int(entry)), str(entry))
item_box.set_active(0)
item_box.connect("changed", self.changed)
self.pack_start(item_box, False, False, 0)
elif item["kind"] == settings.KIND.range:
elif item["kind"] == settings.Kind.RANGE:
item_box = Scale()
item_box.set_range(item["min"], item["max"])
item_box.set_round_digits(0)
Expand Down

0 comments on commit af87ccd

Please sign in to comment.