Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10.4 collections fix + added grave (`) key code #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ Currently no mac or python2 support :(
Installation
------------

the old

.. code-block:: bash

pip3 install system_hotkey
pip install . --user

should do the trick
in the root folder

Windows
^^^^^^^
Expand Down
7 changes: 4 additions & 3 deletions system_hotkey/system_hotkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import _thread as thread
import queue
import time
import collections
import collections.abc
from pprint import pprint
import struct

Expand Down Expand Up @@ -61,6 +61,8 @@ class InvalidKeyError(SystemHotkeyError):pass
'7':0x37,
'8':0x38,
'9':0x39,
"grave": 0xC0,
"`": 0xC0,
"up": win32con.VK_UP
, "kp_up": win32con.VK_UP
, "down": win32con.VK_DOWN
Expand Down Expand Up @@ -125,7 +127,6 @@ class InvalidKeyError(SystemHotkeyError):pass
, "f23": win32con.VK_F23
, "f24": win32con.VK_F24
, "media_play_pause": win32con.VK_MEDIA_PLAY_PAUSE
, "media_stop": win32con.VK_MEDIA_STOP
, "media_next": win32con.VK_MEDIA_NEXT_TRACK
, "media_previous": win32con.VK_MEDIA_PREV_TRACK
}
Expand Down Expand Up @@ -285,7 +286,7 @@ def register(self, hotkey, *args, callback=None, overwrite=False):

thread safe
'''
assert isinstance(hotkey, collections.Iterable) and type(hotkey) not in (str, bytes)
assert isinstance(hotkey, collections.abc.Iterable) and type(hotkey) not in (str, bytes)
if self.consumer == 'callback' and not callback:
raise TypeError('Function register requires callback argument in non sonsumer mode')

Expand Down