🏗️ Kod içi Yapılar

📅 Tablo Oluşturma

1
transition_table = {
2
# Current state of the modifier, per `modifier_states`.
3
# |
4
# | Type of event that triggered this modifier update.
5
# | |
6
# | | Type of key that triggered this modiier update.
7
# | | |
8
# | | | Should we send a fake key press?
9
# | | | |
10
# | | | => | Accept the event?
11
# | | | | |
12
# | | | | | Next state.
13
# v v v v v v
14
('free', KEY_UP, 'modifier'): (False, True, 'free'),
15
('free', KEY_DOWN, 'modifier'): (False, False, 'pending'),
16
('pending', KEY_UP, 'modifier'): (True, True, 'free'),
17
('pending', KEY_DOWN, 'modifier'): (False, True, 'allowed'),
18
('suppressed', KEY_UP, 'modifier'): (False, False, 'free'),
19
('suppressed', KEY_DOWN, 'modifier'): (False, False, 'suppressed'),
20
('allowed', KEY_UP, 'modifier'): (False, True, 'free'),
21
('allowed', KEY_DOWN, 'modifier'): (False, True, 'allowed'),
22
23
('free', KEY_UP, 'hotkey'): (False, None, 'free'),
24
('free', KEY_DOWN, 'hotkey'): (False, None, 'free'),
25
('pending', KEY_UP, 'hotkey'): (False, None, 'suppressed'),
26
('pending', KEY_DOWN, 'hotkey'): (False, None, 'suppressed'),
27
('suppressed', KEY_UP, 'hotkey'): (False, None, 'suppressed'),
28
('suppressed', KEY_DOWN, 'hotkey'): (False, None, 'suppressed'),
29
('allowed', KEY_UP, 'hotkey'): (False, None, 'allowed'),
30
('allowed', KEY_DOWN, 'hotkey'): (False, None, 'allowed'),
31
32
('free', KEY_UP, 'other'): (False, True, 'free'),
33
('free', KEY_DOWN, 'other'): (False, True, 'free'),
34
('pending', KEY_UP, 'other'): (True, True, 'allowed'),
35
('pending', KEY_DOWN, 'other'): (True, True, 'allowed'),
36
# Necessary when hotkeys are removed after beign triggered, such as
37
# TestKeyboard.test_add_hotkey_multistep_suppress_modifier.
38
('suppressed', KEY_UP, 'other'): (False, False, 'allowed'),
39
('suppressed', KEY_DOWN, 'other'): (True, True, 'allowed'),
40
('allowed', KEY_UP, 'other'): (False, True, 'allowed'),
41
('allowed', KEY_DOWN, 'other'): (False, True, 'allowed'),
42
}
Copied!
Last modified 1yr ago
Copy link