Resolves #56 by moving kmk.common.* up a level to kmk.*
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -39,7 +39,7 @@ lint: devdeps | |||||||
| 	@$(PIPENV) run flake8 | 	@$(PIPENV) run flake8 | ||||||
|  |  | ||||||
| fix-isort: devdeps | fix-isort: devdeps | ||||||
| 	@find kmk/ user_keymaps/ -name "*.py" | xargs $(PIPENV) run isort | 	@find kmk/ tests/ user_keymaps/ -name "*.py" | xargs $(PIPENV) run isort | ||||||
|  |  | ||||||
| clean: clean-build-log | clean: clean-build-log | ||||||
| 	@echo "===> Cleaning build artifacts" | 	@echo "===> Cleaning build artifacts" | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import sys | |||||||
|  |  | ||||||
| import uos | import uos | ||||||
|  |  | ||||||
| from kmk.common.keycodes import Keycodes, RawKeycodes | from kmk.keycodes import Keycodes, RawKeycodes | ||||||
|  |  | ||||||
| if len(sys.argv) < 2: | if len(sys.argv) < 2: | ||||||
|     print('Must provide a keymap to test as first argument', file=sys.stderr) |     print('Must provide a keymap to test as first argument', file=sys.stderr) | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| import logging | import logging | ||||||
| 
 | 
 | ||||||
| from kmk.common.consts import HIDReportTypes | from kmk.consts import HIDReportTypes | ||||||
| from kmk.common.event_defs import HID_REPORT_EVENT | from kmk.event_defs import HID_REPORT_EVENT | ||||||
| from kmk.common.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, ConsumerKeycode, | from kmk.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, ConsumerKeycode, | ||||||
|                                  ModifierKeycode) |                           ModifierKeycode) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class AbstractHidHelper: | class AbstractHidHelper: | ||||||
| @@ -1,7 +1,6 @@ | |||||||
| import usb_hid | import usb_hid | ||||||
| from kmk.common.abstract.hid import AbstractHidHelper | from kmk.abstract.hid import AbstractHidHelper | ||||||
| from kmk.common.consts import (HID_REPORT_SIZES, HIDReportTypes, HIDUsage, | from kmk.consts import HID_REPORT_SIZES, HIDReportTypes, HIDUsage, HIDUsagePage | ||||||
|                                HIDUsagePage) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class HIDHelper(AbstractHidHelper): | class HIDHelper(AbstractHidHelper): | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| import sys | import sys | ||||||
|  |  | ||||||
| from kmk.circuitpython.hid import HIDHelper | from kmk.circuitpython.hid import HIDHelper | ||||||
| from kmk.common.consts import UnicodeModes | from kmk.consts import UnicodeModes | ||||||
| from kmk.common.matrix import MatrixScanner |  | ||||||
| from kmk.firmware import Firmware | from kmk.firmware import Firmware | ||||||
|  | from kmk.matrix import MatrixScanner | ||||||
|  |  | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| import sys | import sys | ||||||
|  |  | ||||||
| from kmk.circuitpython.hid import HIDHelper | from kmk.circuitpython.hid import HIDHelper | ||||||
| from kmk.common.consts import UnicodeModes | from kmk.consts import UnicodeModes | ||||||
| from kmk.common.matrix import MatrixScanner |  | ||||||
| from kmk.firmware import Firmware | from kmk.firmware import Firmware | ||||||
|  | from kmk.matrix import MatrixScanner | ||||||
|  |  | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
|   | |||||||
| @@ -2,8 +2,8 @@ import sys | |||||||
|  |  | ||||||
| import gc | import gc | ||||||
|  |  | ||||||
| from kmk.common.matrix import MatrixScanner |  | ||||||
| from kmk.firmware import Firmware | from kmk.firmware import Firmware | ||||||
|  | from kmk.matrix import MatrixScanner | ||||||
| from kmk.micropython.pyb_hid import HIDHelper | from kmk.micropython.pyb_hid import HIDHelper | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,8 +3,8 @@ from collections import namedtuple | |||||||
| 
 | 
 | ||||||
| from micropython import const | from micropython import const | ||||||
| 
 | 
 | ||||||
| from kmk.common.keycodes import Keycodes | from kmk.keycodes import Keycodes | ||||||
| from kmk.common.util import reset_bootloader | from kmk.util import reset_bootloader | ||||||
| 
 | 
 | ||||||
| KEY_UP_EVENT = const(1) | KEY_UP_EVENT = const(1) | ||||||
| KEY_DOWN_EVENT = const(2) | KEY_DOWN_EVENT = const(2) | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| import logging | import logging | ||||||
|  |  | ||||||
| from kmk.common.event_defs import init_firmware | from kmk.event_defs import init_firmware | ||||||
| from kmk.common.internal_state import Store, kmk_reducer | from kmk.internal_state import Store, kmk_reducer | ||||||
| from kmk.common.leader_mode import LeaderHelper | from kmk.leader_mode import LeaderHelper | ||||||
|  |  | ||||||
|  |  | ||||||
| class Firmware: | class Firmware: | ||||||
|   | |||||||
| @@ -1,15 +1,13 @@ | |||||||
| import logging | import logging | ||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
| from kmk.common import kmktime | from kmk import kmktime | ||||||
| from kmk.common.consts import DiodeOrientation, LeaderMode, UnicodeModes | from kmk.consts import DiodeOrientation, LeaderMode, UnicodeModes | ||||||
| from kmk.common.event_defs import (HID_REPORT_EVENT, INIT_FIRMWARE_EVENT, | from kmk.event_defs import (HID_REPORT_EVENT, INIT_FIRMWARE_EVENT, | ||||||
|                                    KEY_DOWN_EVENT, KEY_UP_EVENT, |                             KEY_DOWN_EVENT, KEY_UP_EVENT, KEYCODE_DOWN_EVENT, | ||||||
|                                    KEYCODE_DOWN_EVENT, KEYCODE_UP_EVENT, |                             KEYCODE_UP_EVENT, MACRO_COMPLETE_EVENT, | ||||||
|                                    MACRO_COMPLETE_EVENT, NEW_MATRIX_EVENT, |                             NEW_MATRIX_EVENT, PENDING_KEYCODE_POP_EVENT) | ||||||
|                                    PENDING_KEYCODE_POP_EVENT) | from kmk.keycodes import FIRST_KMK_INTERNAL_KEYCODE, Keycodes, RawKeycodes | ||||||
| from kmk.common.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, Keycodes, |  | ||||||
|                                  RawKeycodes) |  | ||||||
| 
 | 
 | ||||||
| GESC_TRIGGERS = { | GESC_TRIGGERS = { | ||||||
|     Keycodes.Modifiers.KC_LSHIFT, Keycodes.Modifiers.KC_RSHIFT, |     Keycodes.Modifiers.KC_LSHIFT, Keycodes.Modifiers.KC_RSHIFT, | ||||||
| @@ -5,8 +5,8 @@ except ImportError: | |||||||
|     # MicroPython, it doesn't exist |     # MicroPython, it doesn't exist | ||||||
|     from ucollections import namedtuple |     from ucollections import namedtuple | ||||||
| 
 | 
 | ||||||
| from kmk.common.consts import UnicodeModes | from kmk.consts import UnicodeModes | ||||||
| from kmk.common.types import AttrDict | from kmk.types import AttrDict | ||||||
| 
 | 
 | ||||||
| FIRST_KMK_INTERNAL_KEYCODE = 1000 | FIRST_KMK_INTERNAL_KEYCODE = 1000 | ||||||
| 
 | 
 | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| import logging | import logging | ||||||
| 
 | 
 | ||||||
| from kmk.common.keycodes import Keycodes | from kmk.keycodes import Keycodes | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class LeaderHelper: | class LeaderHelper: | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| import math | import math | ||||||
| 
 | 
 | ||||||
| from kmk.common.event_defs import (hid_report_event, keycode_down_event, | from kmk.event_defs import (hid_report_event, keycode_down_event, | ||||||
|                                    keycode_up_event) |                             keycode_up_event) | ||||||
| from kmk.common.keycodes import Media | from kmk.keycodes import Media | ||||||
| from kmk.common.rotary_encoder import RotaryEncoder | from kmk.rotary_encoder import RotaryEncoder | ||||||
| 
 | 
 | ||||||
| VAL_FALSE = False + 1 | VAL_FALSE = False + 1 | ||||||
| VAL_NONE = True + 2 | VAL_NONE = True + 2 | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| import string | import string | ||||||
| 
 | 
 | ||||||
| from kmk.common.event_defs import (hid_report_event, keycode_down_event, | from kmk.event_defs import (hid_report_event, keycode_down_event, | ||||||
|                                    keycode_up_event) |                             keycode_up_event) | ||||||
| from kmk.common.keycodes import Keycodes, Macro, RawKeycodes, char_lookup | from kmk.keycodes import Keycodes, Macro, RawKeycodes, char_lookup | ||||||
| from kmk.common.kmktime import sleep_ms | from kmk.kmktime import sleep_ms | ||||||
| 
 | 
 | ||||||
| kc_lookup_cache = {} | kc_lookup_cache = {} | ||||||
| 
 | 
 | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| from kmk.common.consts import UnicodeModes | from kmk.consts import UnicodeModes | ||||||
| from kmk.common.event_defs import (hid_report_event, keycode_down_event, | from kmk.event_defs import (hid_report_event, keycode_down_event, | ||||||
|                                    keycode_up_event) |                             keycode_up_event) | ||||||
| from kmk.common.keycodes import Common, Macro, Modifiers | from kmk.keycodes import Common, Macro, Modifiers | ||||||
| from kmk.common.macros.simple import lookup_kc_with_cache, simple_key_sequence | from kmk.macros.simple import lookup_kc_with_cache, simple_key_sequence | ||||||
| from kmk.common.util import get_wide_ordinal | from kmk.util import get_wide_ordinal | ||||||
| 
 | 
 | ||||||
| IBUS_KEY_COMBO = Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_U)) | IBUS_KEY_COMBO = Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_U)) | ||||||
| IBUS_KEY_DOWN = keycode_down_event(IBUS_KEY_COMBO) | IBUS_KEY_DOWN = keycode_down_event(IBUS_KEY_COMBO) | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| import digitalio | import digitalio | ||||||
| 
 | 
 | ||||||
| from kmk.common.consts import DiodeOrientation | from kmk.consts import DiodeOrientation | ||||||
| from kmk.common.event_defs import matrix_changed | from kmk.event_defs import matrix_changed | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class MatrixScanner: | class MatrixScanner: | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| from pyb import USB_HID, delay, hid_keyboard | from pyb import USB_HID, delay, hid_keyboard | ||||||
|  |  | ||||||
| from kmk.common.abstract.hid import AbstractHidHelper | from kmk.abstract.hid import AbstractHidHelper | ||||||
| from kmk.common.consts import HID_REPORT_STRUCTURE | from kmk.consts import HID_REPORT_STRUCTURE | ||||||
|  |  | ||||||
|  |  | ||||||
| def generate_pyb_hid_descriptor(): | def generate_pyb_hid_descriptor(): | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| from micropython import const | from micropython import const | ||||||
| 
 | 
 | ||||||
| from kmk.common.consts import CIRCUITPYTHON, MICROPYTHON | from kmk.consts import CIRCUITPYTHON, MICROPYTHON | ||||||
| 
 | 
 | ||||||
| PULL_UP = const(1) | PULL_UP = const(1) | ||||||
| PULL_DOWN = const(2) | PULL_DOWN = const(2) | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| from kmk.common.pins import PULL_UP | from kmk.pins import PULL_UP | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class RotaryEncoder: | class RotaryEncoder: | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| import machine | import machine | ||||||
|  |  | ||||||
| from kmk.common.consts import DiodeOrientation | from kmk.consts import DiodeOrientation | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  |  | ||||||
| p = machine.Pin.board | p = machine.Pin.board | ||||||
| cols = (p.X10, p.X10, p.X12) | cols = (p.X10, p.X10, p.X12) | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| import machine | import machine | ||||||
|  |  | ||||||
| from kmk.common.consts import DiodeOrientation | from kmk.consts import DiodeOrientation | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  |  | ||||||
| p = machine.Pin.board | p = machine.Pin.board | ||||||
| cols = (p.X10, p.X11, p.X12) | cols = (p.X10, p.X11, p.X12) | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| import machine | import machine | ||||||
|  |  | ||||||
| from kmk.common.consts import DiodeOrientation | from kmk.consts import DiodeOrientation | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  |  | ||||||
| p = machine.Pin.board | p = machine.Pin.board | ||||||
| cols = (p.X10, p.X11, p.X12) | cols = (p.X10, p.X11, p.X12) | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| import machine | import machine | ||||||
|  |  | ||||||
| from kmk.common.consts import DiodeOrientation | from kmk.consts import DiodeOrientation | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  |  | ||||||
| p = machine.Pin.board | p = machine.Pin.board | ||||||
| cols = (p.X10, p.X11, p.X12) | cols = (p.X10, p.X11, p.X12) | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| from kmk.common.consts import DiodeOrientation, UnicodeModes | from kmk.consts import DiodeOrientation, UnicodeModes | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.common.macros.simple import send_string |  | ||||||
| from kmk.common.macros.unicode import unicode_string_sequence |  | ||||||
| from kmk.common.pins import Pin as P |  | ||||||
| from kmk.common.types import AttrDict |  | ||||||
| from kmk.entrypoints.handwire.feather_m4_express import main | from kmk.entrypoints.handwire.feather_m4_express import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  | from kmk.macros.simple import send_string | ||||||
|  | from kmk.macros.unicode import unicode_string_sequence | ||||||
|  | from kmk.pins import Pin as P | ||||||
|  | from kmk.types import AttrDict | ||||||
|  |  | ||||||
| cols = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI, P.MISO, P.RX, P.TX, P.D4) | cols = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI, P.MISO, P.RX, P.TX, P.D4) | ||||||
| rows = (P.D10, P.D11, P.D12, P.D13) | rows = (P.D10, P.D11, P.D12, P.D13) | ||||||
|   | |||||||
| @@ -1,12 +1,12 @@ | |||||||
| import gc | import gc | ||||||
|  |  | ||||||
| from kmk.common.consts import DiodeOrientation, UnicodeModes | from kmk.consts import DiodeOrientation, UnicodeModes | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.common.macros.simple import send_string |  | ||||||
| from kmk.common.macros.unicode import unicode_string_sequence |  | ||||||
| from kmk.common.pins import Pin as P |  | ||||||
| from kmk.common.types import AttrDict |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  | from kmk.macros.simple import send_string | ||||||
|  | from kmk.macros.unicode import unicode_string_sequence | ||||||
|  | from kmk.pins import Pin as P | ||||||
|  | from kmk.types import AttrDict | ||||||
|  |  | ||||||
| cols = (P.Y12, P.Y11, P.Y10, P.Y9, P.X8, P.X7, P.X6, P.X5, P.X4, P.X3, P.X2, P.X1) | cols = (P.Y12, P.Y11, P.Y10, P.Y9, P.X8, P.X7, P.X6, P.X5, P.X4, P.X3, P.X2, P.X1) | ||||||
| rows = (P.Y1, P.Y2, P.Y3, P.Y4) | rows = (P.Y1, P.Y2, P.Y3, P.Y4) | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| from kmk.common.consts import DiodeOrientation, UnicodeModes | from kmk.consts import DiodeOrientation, UnicodeModes | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.common.macros.simple import send_string, simple_key_sequence |  | ||||||
| from kmk.common.macros.unicode import unicode_codepoint_sequence |  | ||||||
| from kmk.common.pins import Pin as P |  | ||||||
| from kmk.entrypoints.handwire.feather_m4_express import main | from kmk.entrypoints.handwire.feather_m4_express import main | ||||||
| from kmk.firmware import Firmware | from kmk.firmware import Firmware | ||||||
|  | from kmk.keycodes import KC | ||||||
|  | from kmk.macros.simple import send_string, simple_key_sequence | ||||||
|  | from kmk.macros.unicode import unicode_codepoint_sequence | ||||||
|  | from kmk.pins import Pin as P | ||||||
|  |  | ||||||
| cols = (P.D11, P.D10, P.D9) | cols = (P.D11, P.D10, P.D9) | ||||||
| rows = (P.A2, P.A3, P.A4, P.A5) | rows = (P.A2, P.A3, P.A4, P.A5) | ||||||
|   | |||||||
| @@ -1,12 +1,12 @@ | |||||||
| from kmk.common.consts import DiodeOrientation, UnicodeModes | from kmk.consts import DiodeOrientation, UnicodeModes | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.common.macros.rotary_encoder import VolumeRotaryEncoder |  | ||||||
| from kmk.common.macros.simple import send_string, simple_key_sequence |  | ||||||
| from kmk.common.macros.unicode import unicode_string_sequence |  | ||||||
| from kmk.common.pins import Pin as P |  | ||||||
| from kmk.common.types import AttrDict |  | ||||||
| from kmk.entrypoints.handwire.itsybitsy_m4_express import main | from kmk.entrypoints.handwire.itsybitsy_m4_express import main | ||||||
| from kmk.firmware import Firmware | from kmk.firmware import Firmware | ||||||
|  | from kmk.keycodes import KC | ||||||
|  | from kmk.macros.rotary_encoder import VolumeRotaryEncoder | ||||||
|  | from kmk.macros.simple import send_string, simple_key_sequence | ||||||
|  | from kmk.macros.unicode import unicode_string_sequence | ||||||
|  | from kmk.pins import Pin as P | ||||||
|  | from kmk.types import AttrDict | ||||||
|  |  | ||||||
| DEBUG_ENABLE = True | DEBUG_ENABLE = True | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| from kmk.common.consts import DiodeOrientation, UnicodeModes | from kmk.consts import DiodeOrientation, UnicodeModes | ||||||
| from kmk.common.keycodes import KC |  | ||||||
| from kmk.common.macros.simple import send_string, simple_key_sequence |  | ||||||
| from kmk.common.macros.unicode import unicode_codepoint_sequence |  | ||||||
| from kmk.common.pins import Pin as P |  | ||||||
| from kmk.entrypoints.handwire.pyboard import main | from kmk.entrypoints.handwire.pyboard import main | ||||||
|  | from kmk.keycodes import KC | ||||||
|  | from kmk.macros.simple import send_string, simple_key_sequence | ||||||
|  | from kmk.macros.unicode import unicode_codepoint_sequence | ||||||
|  | from kmk.pins import Pin as P | ||||||
|  |  | ||||||
| cols = (P.X10, P.X11, P.X12) | cols = (P.X10, P.X11, P.X12) | ||||||
| rows = (P.X1, P.X2, P.X3) | rows = (P.X1, P.X2, P.X3) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user