Skip to content

Complete overhaul (Add functionality, typing, etc.) for Python >=3.7 #38

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

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

ReggX
Copy link

@ReggX ReggX commented Apr 21, 2022

Hey there,

I needed to make some changes for a private project of mine.

What began as a small set of changes to conform to mypy --strict ended up in a complete overhaul of the project, implementing more of PyAutoGUI's functions directly into pydirectinput and extending function signatures with optional keyword-only arguments.

Your welcome to take the changes and integrate them upstream, there are some pitfalls though:

The whole package is in-line typed, which means it will need at least Python 3.7 to run.
It's also modifying the README to match my forked pypi package that I use for other stuff, so it can't be merged as is. It is on a seperate branch, so you're free to modify it before merging.

Please let me know if you're interested in merging this.

(Had to redo #36 because I accidentally removed the branch)

ReggX and others added 30 commits December 30, 2021 19:57
* Add scroll()

* Add hotkey()
Be more strict with the 80 column limit

Define Protocols for foreign functions.

Leave only public-facing vars/functions without underscore.
* Fix: SendInput used wrong cbSize calculation (size of single INPUT struct)

* Extend KEYBOARD_MAPPING:
 - Add new buttons (F13-F24, media/browser/etc.)
 - Add shifted versions for alphanumeric digits
 - Use constants outside of c_short range to mark extendend and shifted keys

* Add automatic shifting of supported characters through optional keyword-only argument for all keydown/up/press functions

* Add additional keyword-only arguments to press and typewrite for tighter control on key press timing

* Add Unicode char press function: Works similar to the old keypress functions, but inserts Unicode characters that can't be replicated by a simple keyboard. (Since their primary purpose is text, don't expect them to work in 3D games/applications)

* Minor formating
* Add virtual screen functions/arguments to enable mouse functions on multi-monitor setups

* Add update_MOUSEEVENT_mappings() to allow changing mouse button names

* Add support for extended scancode sequences in KEYBOARD_MAPPING via special bit flag.

* Add more key names from PyAutoGui to KEYBOARD_MAPPING

* Add ParamSpec to decorator to improve type hinting

* Add support for swapped mouse buttons

* Match scroll functions' basic call signature by including obsolete arguments

* Add drag functions

* Add isValidKey function to match PyAutoGui (even though it's unncessary)

* Add scancode_* variants of keyboard functions for direct low-level access, internally used by the normal keyboard functions

* Add hold context manager functions, add PriorInputFailedException

* Rework hotkey functions to better match PyAutoGui's call signature

* Fix: Some values in KEYBOARD_MAPPING used BREAK instead of MAKE codes

* Overhaul doc-strings and Comments
* Sleep calibration

* Automatic disabling of mouse acceleration (careful with that one)

* Reworked calculation of normalized screen coordinates

* Duration support for mouse functions

* Add a test script to check if normalized coordinates map to all pixels
* Rename private function to remove weird language in `with _without_mouse_acceleration():` context.
* Removed expensive call to inspect.getcallargs() where a simple if statement would do

* Fixed not handling _pause as a positional argument
…from the performance improvement in the _genericPyDirectInputChecks decorator
@Someone45
Copy link

This is really awesome! Good stuff :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants