Add arguments to setup layout on init #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds parameters to the init of the
Macropad
class to allow defining a keyboard layout that is not the default US.The parameters are classes, the layout class from which the layout is instanciated, and the keycode class, from which the class constants are taken. It is assigend to the class property Macropad.Keycode, for use in the code.
The added example shows how it is used.
I've also added a reference variable to the Keycode class at the module level. This is to help with the hotkeys code for example. It allows doing this in the macros files, and have it use the Keycode set in code.py.
I don't know if that's really a good thing in general, it could simply be done by having the Keycode setting in a separate file for example. And it won't work in general if you want to instantiate 2 Macropad instances with different languages at the same time.