-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modes.py
72 lines (54 loc) · 1.45 KB
/
modes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from leds import Leds
from config_layout import cl
class Modes():
current_mode = 0;
modes = cl["defaults"]["modes"]
layer_count = 0
sequence_leds = False
transport_leds = False
def set_transport_leds(b):
Modes.transport_leds = b
def get_transport_leds():
return Modes.transport_leds
def set_seq_leds(b):
Modes.sequence_leds = b
Leds.sequence_leds = b
def get_sequence_leds():
return Modes.sequence_leds
def set_layer(self, val):
Modes.layer_count = Mode.layer_count + val
if Modes.layer_count < 0:
Modes.layer_count = 2
elif Modes.layer_count > 2:
Modes.layer_count = 0
def set_mode():
Modes.current_mode += 1
if (Modes.current_mode >= len(Modes.modes)):
Modes.current_mode = 0
Leds.set_current_mode(Modes.modes[Modes.current_mode])
def get_layer():
return Modes.layer_count
def set_mode_direct(mode):
Modes.current_mode = mode
def get_mode():
return Modes.modes[Modes.current_mode]
def set_pattern_range(self):
"""rotates between pattern a and pattern b"""
if Modes.get_layer() <= 1:
Modes.seq_status = next(Mode.seq)
ui.setHintMsg(f'Seq Mode: {Mode.seq_status}')
# def get_seq_status():
# return Mode.seq_status
@classmethod
def remove_mode(cls, m):
cls.modes.remove(m)
@classmethod
def mode_active(cls, mode):
if cl["defaults"][mode]:
return True
if mode in cls.modes and Modes.get_mode() == mode:
return True
# elif cl.defaults[mode]:
# return True
else:
return False