Merge pull request #95 from KMKfw/topic-plural-plurals
kmk.consts: rename UnicodeModes => UnicodeMode
This commit is contained in:
commit
6f5f54390b
@ -63,7 +63,7 @@ You can further define a bunch of other stuff:
|
|||||||
console. This is very rarely needed, but can provide very valuable information
|
console. This is very rarely needed, but can provide very valuable information
|
||||||
if you need to open an issue.
|
if you need to open an issue.
|
||||||
|
|
||||||
- `unicode_mode` from `kmk.consts.UnicodeModes`, which defines the default
|
- `unicode_mode` from `kmk.consts.UnicodeMode`, which defines the default
|
||||||
operating system implementation to use for unicode sequences (see examples
|
operating system implementation to use for unicode sequences (see examples
|
||||||
below, or `unicode.md`. This can be changed after boot with a key (see
|
below, or `unicode.md`. This can be changed after boot with a key (see
|
||||||
`keycodes.md`)
|
`keycodes.md`)
|
||||||
@ -86,7 +86,7 @@ features:
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
from kmk.boards.klarank import Firmware
|
from kmk.boards.klarank import Firmware
|
||||||
from kmk.consts import UnicodeModes
|
from kmk.consts import UnicodeMode
|
||||||
from kmk.keycodes import KC
|
from kmk.keycodes import KC
|
||||||
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
||||||
from kmk.macros.simple import send_string
|
from kmk.macros.simple import send_string
|
||||||
@ -95,7 +95,7 @@ from kmk.macros.unicode import compile_unicode_string_sequences as cuss
|
|||||||
keyboard = Firmware()
|
keyboard = Firmware()
|
||||||
|
|
||||||
keyboard.debug_enabled = True
|
keyboard.debug_enabled = True
|
||||||
keyboard.unicode_mode = UnicodeModes.LINUX
|
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||||
|
|
||||||
_______ = KC.TRNS
|
_______ = KC.TRNS
|
||||||
xxxxxxx = KC.NO
|
xxxxxxx = KC.NO
|
||||||
|
@ -16,16 +16,16 @@ Before using unicode mode, you will need to set your platform. This can be done
|
|||||||
You can use both in cases where you want to use one operating system, but occasionally use another.
|
You can use both in cases where you want to use one operating system, but occasionally use another.
|
||||||
This allows you to change modes on the fly without having to change your keymap.
|
This allows you to change modes on the fly without having to change your keymap.
|
||||||
|
|
||||||
unicode_mode = UnicodeModes.LINUX
|
unicode_mode = UnicodeMode.LINUX
|
||||||
Or
|
Or
|
||||||
keymap = [...KC.UC_MODE_LINUX,...]
|
keymap = [...KC.UC_MODE_LINUX,...]
|
||||||
|
|
||||||
|
|
||||||
### Unicode Modes:
|
### Unicode Modes:
|
||||||
On Linux IBUS is required, and on Windows, requires [WinCompose](https://github.com/samhocevar/wincompose)
|
On Linux IBUS is required, and on Windows, requires [WinCompose](https://github.com/samhocevar/wincompose)
|
||||||
- Linux : UnicodeModes.LINUX or UnicodeModes.IBUS
|
- Linux : UnicodeMode.LINUX or UnicodeMode.IBUS
|
||||||
- Mac: UnicodeModes.MACOS or UnicodeModes.OSX or UnicodeModes.RALT
|
- Mac: UnicodeMode.MACOS or UnicodeMode.OSX or UnicodeMode.RALT
|
||||||
- Windows: UnicodeModes.WINC
|
- Windows: UnicodeMode.WINC
|
||||||
|
|
||||||
A note for IBUS users on Linux. This mode is not enabled by default, and will need to be turned on for this to work.
|
A note for IBUS users on Linux. This mode is not enabled by default, and will need to be turned on for this to work.
|
||||||
This works on X11, though if you are on Wayland, or in some GTK apps, it MAY work, but is not supported.
|
This works on X11, though if you are on Wayland, or in some GTK apps, it MAY work, but is not supported.
|
||||||
|
@ -142,7 +142,7 @@ class DiodeOrientation:
|
|||||||
ROWS = 1
|
ROWS = 1
|
||||||
|
|
||||||
|
|
||||||
class UnicodeModes:
|
class UnicodeMode:
|
||||||
NOOP = 0
|
NOOP = 0
|
||||||
LINUX = IBUS = 1
|
LINUX = IBUS = 1
|
||||||
MACOS = OSX = RALT = 2
|
MACOS = OSX = RALT = 2
|
||||||
|
@ -38,7 +38,7 @@ import busio
|
|||||||
import gc
|
import gc
|
||||||
|
|
||||||
import supervisor
|
import supervisor
|
||||||
from kmk.consts import LeaderMode, UnicodeModes
|
from kmk.consts import LeaderMode, UnicodeMode
|
||||||
from kmk.hid import USB_HID
|
from kmk.hid import USB_HID
|
||||||
from kmk.internal_state import InternalState
|
from kmk.internal_state import InternalState
|
||||||
from kmk.matrix import MatrixScanner
|
from kmk.matrix import MatrixScanner
|
||||||
@ -53,7 +53,7 @@ class Firmware:
|
|||||||
col_pins = None
|
col_pins = None
|
||||||
diode_orientation = None
|
diode_orientation = None
|
||||||
|
|
||||||
unicode_mode = UnicodeModes.NOOP
|
unicode_mode = UnicodeMode.NOOP
|
||||||
tap_time = 300
|
tap_time = 300
|
||||||
leader_mode = LeaderMode.TIMEOUT
|
leader_mode = LeaderMode.TIMEOUT
|
||||||
leader_dictionary = {}
|
leader_dictionary = {}
|
||||||
|
@ -5,7 +5,7 @@ except ImportError:
|
|||||||
# MicroPython, it doesn't exist
|
# MicroPython, it doesn't exist
|
||||||
from ucollections import namedtuple
|
from ucollections import namedtuple
|
||||||
|
|
||||||
from kmk.consts import UnicodeModes
|
from kmk.consts import UnicodeMode
|
||||||
from kmk.types import AttrDict
|
from kmk.types import AttrDict
|
||||||
|
|
||||||
FIRST_KMK_INTERNAL_KEYCODE = 1000
|
FIRST_KMK_INTERNAL_KEYCODE = 1000
|
||||||
@ -548,12 +548,12 @@ class KMK(KeycodeCategory):
|
|||||||
'''
|
'''
|
||||||
return UnicodeModeKeycode.from_mode_const(mode)
|
return UnicodeModeKeycode.from_mode_const(mode)
|
||||||
|
|
||||||
KC_UC_MODE_NOOP = KC_UC_DISABLE = UnicodeModeKeycode.from_mode_const(UnicodeModes.NOOP)
|
KC_UC_MODE_NOOP = KC_UC_DISABLE = UnicodeModeKeycode.from_mode_const(UnicodeMode.NOOP)
|
||||||
KC_UC_MODE_LINUX = KC_UC_MODE_IBUS = UnicodeModeKeycode.from_mode_const(UnicodeModes.IBUS)
|
KC_UC_MODE_LINUX = KC_UC_MODE_IBUS = UnicodeModeKeycode.from_mode_const(UnicodeMode.IBUS)
|
||||||
KC_UC_MODE_MACOS = KC_UC_MODE_OSX = KC_UC_MODE_RALT = UnicodeModeKeycode.from_mode_const(
|
KC_UC_MODE_MACOS = KC_UC_MODE_OSX = KC_UC_MODE_RALT = UnicodeModeKeycode.from_mode_const(
|
||||||
UnicodeModes.RALT,
|
UnicodeMode.RALT,
|
||||||
)
|
)
|
||||||
KC_UC_MODE_WINC = UnicodeModeKeycode.from_mode_const(UnicodeModes.WINC)
|
KC_UC_MODE_WINC = UnicodeModeKeycode.from_mode_const(UnicodeMode.WINC)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def KC_MACRO_SLEEP_MS(ms):
|
def KC_MACRO_SLEEP_MS(ms):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from kmk.consts import UnicodeModes
|
from kmk.consts import UnicodeMode
|
||||||
from kmk.keycodes import (Common, Macro, Modifiers,
|
from kmk.keycodes import (Common, Macro, Modifiers,
|
||||||
generate_codepoint_keysym_seq)
|
generate_codepoint_keysym_seq)
|
||||||
from kmk.macros.simple import simple_key_sequence
|
from kmk.macros.simple import simple_key_sequence
|
||||||
@ -43,11 +43,11 @@ def unicode_codepoint_sequence(codepoints):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _unicode_sequence(state):
|
def _unicode_sequence(state):
|
||||||
if state.unicode_mode == UnicodeModes.IBUS:
|
if state.unicode_mode == UnicodeMode.IBUS:
|
||||||
yield from _ibus_unicode_sequence(kc_macros, state)
|
yield from _ibus_unicode_sequence(kc_macros, state)
|
||||||
elif state.unicode_mode == UnicodeModes.RALT:
|
elif state.unicode_mode == UnicodeMode.RALT:
|
||||||
yield from _ralt_unicode_sequence(kc_macros, state)
|
yield from _ralt_unicode_sequence(kc_macros, state)
|
||||||
elif state.unicode_mode == UnicodeModes.WINC:
|
elif state.unicode_mode == UnicodeMode.WINC:
|
||||||
yield from _winc_unicode_sequence(kc_macros, state)
|
yield from _winc_unicode_sequence(kc_macros, state)
|
||||||
|
|
||||||
return Macro(keydown=_unicode_sequence)
|
return Macro(keydown=_unicode_sequence)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from kmk.consts import DiodeOrientation, UnicodeModes
|
from kmk.consts import DiodeOrientation, UnicodeMode
|
||||||
from kmk.keycodes import KC
|
from kmk.keycodes import KC
|
||||||
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
||||||
from kmk.macros.simple import send_string
|
from kmk.macros.simple import send_string
|
||||||
@ -15,7 +15,7 @@ keyboard.diode_orientation = DiodeOrientation.COLUMNS
|
|||||||
|
|
||||||
|
|
||||||
# ------------------User level config variables ---------------------------------------
|
# ------------------User level config variables ---------------------------------------
|
||||||
keyboard.unicode_mode = UnicodeModes.LINUX
|
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||||
keyboard.tap_time = 350
|
keyboard.tap_time = 350
|
||||||
keyboard.leader_timeout = 2000
|
keyboard.leader_timeout = 2000
|
||||||
keyboard.debug_enabled = False
|
keyboard.debug_enabled = False
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import board
|
import board
|
||||||
import busio
|
import busio
|
||||||
|
|
||||||
from kmk.consts import DiodeOrientation, LeaderMode, UnicodeModes
|
from kmk.consts import DiodeOrientation, LeaderMode, UnicodeMode
|
||||||
from kmk.keycodes import KC
|
from kmk.keycodes import KC
|
||||||
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
||||||
from kmk.macros.simple import send_string
|
from kmk.macros.simple import send_string
|
||||||
@ -24,7 +24,7 @@ keyboard.uart = keyboard.init_uart(tx=board.TX, rx=board.RX)
|
|||||||
|
|
||||||
# ------------------User level config variables ---------------------------------------
|
# ------------------User level config variables ---------------------------------------
|
||||||
keyboard.leader_mode = LeaderMode.TIMEOUT
|
keyboard.leader_mode = LeaderMode.TIMEOUT
|
||||||
keyboard.unicode_mode = UnicodeModes.LINUX
|
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||||
keyboard.tap_time = 150
|
keyboard.tap_time = 150
|
||||||
keyboard.leader_timeout = 2000
|
keyboard.leader_timeout = 2000
|
||||||
keyboard.debug_enabled = True
|
keyboard.debug_enabled = True
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from kmk.boards.klarank import Firmware
|
from kmk.boards.klarank import Firmware
|
||||||
from kmk.consts import LeaderMode, UnicodeModes
|
from kmk.consts import LeaderMode, UnicodeMode
|
||||||
from kmk.keycodes import KC
|
from kmk.keycodes import KC
|
||||||
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
||||||
from kmk.macros.simple import send_string
|
from kmk.macros.simple import send_string
|
||||||
@ -8,7 +8,7 @@ from kmk.macros.unicode import compile_unicode_string_sequences as cuss
|
|||||||
keyboard = Firmware()
|
keyboard = Firmware()
|
||||||
|
|
||||||
keyboard.debug_enabled = True
|
keyboard.debug_enabled = True
|
||||||
keyboard.unicode_mode = UnicodeModes.LINUX
|
keyboard.unicode_mode = UnicodeMode.LINUX
|
||||||
keyboard.tap_time = 750
|
keyboard.tap_time = 750
|
||||||
|
|
||||||
emoticons = cuss({
|
emoticons = cuss({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user