Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

Exception raised when button event contains unknown button #5

@minus7

Description

@minus7

Pressing one of the buttons on the mouse triggers an event with a button id that is not present in the Button enum, raising a ValueError. I'm not sure how this could be handled properly with Python's Enum; maybe a UNKNOWN enum constant with its value set to the actual id, if that's possible, but that doesn't really sound like a clean solution.

Traceback (most recent call last):
  File "test.py", line 13, in <module>
    button = pointer_event.get_button()
  File "/home/minus/dev/mousebuttond/venv3/lib/python3.6/site-packages/libinput/event.py", line 512, in get_button
    return self._libinput.libinput_event_pointer_get_button(self._handle)
  File "/usr/lib/python3.6/enum.py", line 291, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.6/enum.py", line 533, in __new__
    return cls._missing_(value)
  File "/usr/lib/python3.6/enum.py", line 546, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 280 is not a valid Button

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions