Run black against source tree
This commit is contained in:
@@ -114,7 +114,9 @@ def tt_pressed(key, state, *args, **kwargs):
|
||||
|
||||
|
||||
def tt_released(key, state, *args, **kwargs):
|
||||
tap_timed_out = ticks_diff(ticks_ms(), state.start_time['tt']) >= state.config.tap_time
|
||||
tap_timed_out = (
|
||||
ticks_diff(ticks_ms(), state.start_time['tt']) >= state.config.tap_time
|
||||
)
|
||||
if state.start_time['tt'] is None or tap_timed_out:
|
||||
# On first press, works like MO. On second press, does nothing unless let up within
|
||||
# time window, then acts like TG.
|
||||
|
@@ -14,7 +14,7 @@ def mt_released(key, state, *args, **kwargs):
|
||||
state.keys_pressed.discard(key.meta.mods)
|
||||
timer_name = 'mod_tap'
|
||||
if state.start_time[timer_name] and (
|
||||
ticks_diff(ticks_ms(), state.start_time[timer_name]) < state.config.tap_time
|
||||
ticks_diff(ticks_ms(), state.start_time[timer_name]) < state.config.tap_time
|
||||
):
|
||||
state.hid_pending = True
|
||||
state.tap_key(key.meta.kc)
|
||||
|
@@ -64,10 +64,7 @@ def unicode_string_sequence(unistring):
|
||||
Allows sending things like (╯°□°)╯︵ ┻━┻ directly, without
|
||||
manual conversion to Unicode codepoints.
|
||||
'''
|
||||
return unicode_codepoint_sequence([
|
||||
hex(get_wide_ordinal(s))[2:]
|
||||
for s in unistring
|
||||
])
|
||||
return unicode_codepoint_sequence([hex(get_wide_ordinal(s))[2:] for s in unistring])
|
||||
|
||||
|
||||
def generate_codepoint_keysym_seq(codepoint, expected_length=4):
|
||||
@@ -95,31 +92,22 @@ def generate_leader_dictionary_seq(string):
|
||||
|
||||
|
||||
def unicode_codepoint_sequence(codepoints):
|
||||
kc_seqs = (
|
||||
generate_codepoint_keysym_seq(codepoint)
|
||||
for codepoint in codepoints
|
||||
)
|
||||
kc_seqs = (generate_codepoint_keysym_seq(codepoint) for codepoint in codepoints)
|
||||
|
||||
kc_macros = [
|
||||
simple_key_sequence(kc_seq)
|
||||
for kc_seq in kc_seqs
|
||||
]
|
||||
kc_macros = [simple_key_sequence(kc_seq) for kc_seq in kc_seqs]
|
||||
|
||||
def _unicode_sequence(key, state, *args, **kwargs):
|
||||
if state.config.unicode_mode == UnicodeMode.IBUS:
|
||||
state.process_key(
|
||||
simple_key_sequence(_ibus_unicode_sequence(kc_macros, state)),
|
||||
True,
|
||||
simple_key_sequence(_ibus_unicode_sequence(kc_macros, state)), True
|
||||
)
|
||||
elif state.config.unicode_mode == UnicodeMode.RALT:
|
||||
state.process_key(
|
||||
simple_key_sequence(_ralt_unicode_sequence(kc_macros, state)),
|
||||
True,
|
||||
simple_key_sequence(_ralt_unicode_sequence(kc_macros, state)), True
|
||||
)
|
||||
elif state.config.unicode_mode == UnicodeMode.WINC:
|
||||
state.process_key(
|
||||
simple_key_sequence(_winc_unicode_sequence(kc_macros, state)),
|
||||
True,
|
||||
simple_key_sequence(_winc_unicode_sequence(kc_macros, state)), True
|
||||
)
|
||||
|
||||
return make_key(on_press=_unicode_sequence)
|
||||
|
Reference in New Issue
Block a user