Resolves #56 by moving kmk.common.* up a level to kmk.*

This commit is contained in:
Josh Klar 2018-10-11 18:02:13 -07:00
parent 30cd5da3f1
commit 00899d1b0f
No known key found for this signature in database
GPG Key ID: 220F99BD7DB7A99E
35 changed files with 85 additions and 88 deletions

View File

@ -39,7 +39,7 @@ lint: devdeps
@$(PIPENV) run flake8
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
@echo "===> Cleaning build artifacts"

View File

@ -4,7 +4,7 @@ import sys
import uos
from kmk.common.keycodes import Keycodes, RawKeycodes
from kmk.keycodes import Keycodes, RawKeycodes
if len(sys.argv) < 2:
print('Must provide a keymap to test as first argument', file=sys.stderr)

View File

@ -1,9 +1,9 @@
import logging
from kmk.common.consts import HIDReportTypes
from kmk.common.event_defs import HID_REPORT_EVENT
from kmk.common.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, ConsumerKeycode,
ModifierKeycode)
from kmk.consts import HIDReportTypes
from kmk.event_defs import HID_REPORT_EVENT
from kmk.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, ConsumerKeycode,
ModifierKeycode)
class AbstractHidHelper:

View File

@ -1,7 +1,6 @@
import usb_hid
from kmk.common.abstract.hid import AbstractHidHelper
from kmk.common.consts import (HID_REPORT_SIZES, HIDReportTypes, HIDUsage,
HIDUsagePage)
from kmk.abstract.hid import AbstractHidHelper
from kmk.consts import HID_REPORT_SIZES, HIDReportTypes, HIDUsage, HIDUsagePage
class HIDHelper(AbstractHidHelper):

View File

@ -1,9 +1,9 @@
import sys
from kmk.circuitpython.hid import HIDHelper
from kmk.common.consts import UnicodeModes
from kmk.common.matrix import MatrixScanner
from kmk.consts import UnicodeModes
from kmk.firmware import Firmware
from kmk.matrix import MatrixScanner
def main():

View File

@ -1,9 +1,9 @@
import sys
from kmk.circuitpython.hid import HIDHelper
from kmk.common.consts import UnicodeModes
from kmk.common.matrix import MatrixScanner
from kmk.consts import UnicodeModes
from kmk.firmware import Firmware
from kmk.matrix import MatrixScanner
def main():

View File

@ -2,8 +2,8 @@ import sys
import gc
from kmk.common.matrix import MatrixScanner
from kmk.firmware import Firmware
from kmk.matrix import MatrixScanner
from kmk.micropython.pyb_hid import HIDHelper

View File

@ -3,8 +3,8 @@ from collections import namedtuple
from micropython import const
from kmk.common.keycodes import Keycodes
from kmk.common.util import reset_bootloader
from kmk.keycodes import Keycodes
from kmk.util import reset_bootloader
KEY_UP_EVENT = const(1)
KEY_DOWN_EVENT = const(2)

View File

@ -1,8 +1,8 @@
import logging
from kmk.common.event_defs import init_firmware
from kmk.common.internal_state import Store, kmk_reducer
from kmk.common.leader_mode import LeaderHelper
from kmk.event_defs import init_firmware
from kmk.internal_state import Store, kmk_reducer
from kmk.leader_mode import LeaderHelper
class Firmware:

View File

@ -1,15 +1,13 @@
import logging
import sys
from kmk.common import kmktime
from kmk.common.consts import DiodeOrientation, LeaderMode, UnicodeModes
from kmk.common.event_defs import (HID_REPORT_EVENT, INIT_FIRMWARE_EVENT,
KEY_DOWN_EVENT, KEY_UP_EVENT,
KEYCODE_DOWN_EVENT, KEYCODE_UP_EVENT,
MACRO_COMPLETE_EVENT, NEW_MATRIX_EVENT,
PENDING_KEYCODE_POP_EVENT)
from kmk.common.keycodes import (FIRST_KMK_INTERNAL_KEYCODE, Keycodes,
RawKeycodes)
from kmk import kmktime
from kmk.consts import DiodeOrientation, LeaderMode, UnicodeModes
from kmk.event_defs import (HID_REPORT_EVENT, INIT_FIRMWARE_EVENT,
KEY_DOWN_EVENT, KEY_UP_EVENT, KEYCODE_DOWN_EVENT,
KEYCODE_UP_EVENT, MACRO_COMPLETE_EVENT,
NEW_MATRIX_EVENT, PENDING_KEYCODE_POP_EVENT)
from kmk.keycodes import FIRST_KMK_INTERNAL_KEYCODE, Keycodes, RawKeycodes
GESC_TRIGGERS = {
Keycodes.Modifiers.KC_LSHIFT, Keycodes.Modifiers.KC_RSHIFT,

View File

@ -5,8 +5,8 @@ except ImportError:
# MicroPython, it doesn't exist
from ucollections import namedtuple
from kmk.common.consts import UnicodeModes
from kmk.common.types import AttrDict
from kmk.consts import UnicodeModes
from kmk.types import AttrDict
FIRST_KMK_INTERNAL_KEYCODE = 1000

View File

@ -1,6 +1,6 @@
import logging
from kmk.common.keycodes import Keycodes
from kmk.keycodes import Keycodes
class LeaderHelper:

View File

@ -1,9 +1,9 @@
import math
from kmk.common.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.common.keycodes import Media
from kmk.common.rotary_encoder import RotaryEncoder
from kmk.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.keycodes import Media
from kmk.rotary_encoder import RotaryEncoder
VAL_FALSE = False + 1
VAL_NONE = True + 2

View File

@ -1,9 +1,9 @@
import string
from kmk.common.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.common.keycodes import Keycodes, Macro, RawKeycodes, char_lookup
from kmk.common.kmktime import sleep_ms
from kmk.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.keycodes import Keycodes, Macro, RawKeycodes, char_lookup
from kmk.kmktime import sleep_ms
kc_lookup_cache = {}

View File

@ -1,9 +1,9 @@
from kmk.common.consts import UnicodeModes
from kmk.common.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.common.keycodes import Common, Macro, Modifiers
from kmk.common.macros.simple import lookup_kc_with_cache, simple_key_sequence
from kmk.common.util import get_wide_ordinal
from kmk.consts import UnicodeModes
from kmk.event_defs import (hid_report_event, keycode_down_event,
keycode_up_event)
from kmk.keycodes import Common, Macro, Modifiers
from kmk.macros.simple import lookup_kc_with_cache, simple_key_sequence
from kmk.util import get_wide_ordinal
IBUS_KEY_COMBO = Modifiers.KC_LCTRL(Modifiers.KC_LSHIFT(Common.KC_U))
IBUS_KEY_DOWN = keycode_down_event(IBUS_KEY_COMBO)

View File

@ -1,7 +1,7 @@
import digitalio
from kmk.common.consts import DiodeOrientation
from kmk.common.event_defs import matrix_changed
from kmk.consts import DiodeOrientation
from kmk.event_defs import matrix_changed
class MatrixScanner:

View File

@ -1,7 +1,7 @@
from pyb import USB_HID, delay, hid_keyboard
from kmk.common.abstract.hid import AbstractHidHelper
from kmk.common.consts import HID_REPORT_STRUCTURE
from kmk.abstract.hid import AbstractHidHelper
from kmk.consts import HID_REPORT_STRUCTURE
def generate_pyb_hid_descriptor():

View File

@ -1,6 +1,6 @@
from micropython import const
from kmk.common.consts import CIRCUITPYTHON, MICROPYTHON
from kmk.consts import CIRCUITPYTHON, MICROPYTHON
PULL_UP = const(1)
PULL_DOWN = const(2)

View File

@ -1,4 +1,4 @@
from kmk.common.pins import PULL_UP
from kmk.pins import PULL_UP
class RotaryEncoder:

View File

@ -1,8 +1,8 @@
import machine
from kmk.common.consts import DiodeOrientation
from kmk.common.keycodes import KC
from kmk.consts import DiodeOrientation
from kmk.entrypoints.handwire.pyboard import main
from kmk.keycodes import KC
p = machine.Pin.board
cols = (p.X10, p.X10, p.X12)

View File

@ -1,8 +1,8 @@
import machine
from kmk.common.consts import DiodeOrientation
from kmk.common.keycodes import KC
from kmk.consts import DiodeOrientation
from kmk.entrypoints.handwire.pyboard import main
from kmk.keycodes import KC
p = machine.Pin.board
cols = (p.X10, p.X11, p.X12)

View File

@ -1,8 +1,8 @@
import machine
from kmk.common.consts import DiodeOrientation
from kmk.common.keycodes import KC
from kmk.consts import DiodeOrientation
from kmk.entrypoints.handwire.pyboard import main
from kmk.keycodes import KC
p = machine.Pin.board
cols = (p.X10, p.X11, p.X12)

View File

@ -1,8 +1,8 @@
import machine
from kmk.common.consts import DiodeOrientation
from kmk.common.keycodes import KC
from kmk.consts import DiodeOrientation
from kmk.entrypoints.handwire.pyboard import main
from kmk.keycodes import KC
p = machine.Pin.board
cols = (p.X10, p.X11, p.X12)

View File

@ -1,10 +1,10 @@
from kmk.common.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.consts import DiodeOrientation, UnicodeModes
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)
rows = (P.D10, P.D11, P.D12, P.D13)

View File

@ -1,12 +1,12 @@
import gc
from kmk.common.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.consts import DiodeOrientation, UnicodeModes
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)
rows = (P.Y1, P.Y2, P.Y3, P.Y4)

View File

@ -1,10 +1,10 @@
from kmk.common.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.consts import DiodeOrientation, UnicodeModes
from kmk.entrypoints.handwire.feather_m4_express import main
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)
rows = (P.A2, P.A3, P.A4, P.A5)

View File

@ -1,12 +1,12 @@
from kmk.common.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.consts import DiodeOrientation, UnicodeModes
from kmk.entrypoints.handwire.itsybitsy_m4_express import main
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

View File

@ -1,9 +1,9 @@
from kmk.common.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.consts import DiodeOrientation, UnicodeModes
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)
rows = (P.X1, P.X2, P.X3)