-
Notifications
You must be signed in to change notification settings - Fork 0
/
effect.py
38 lines (29 loc) · 914 Bytes
/
effect.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
import time
# This is a class template applied to all other defined Effects (including the Menu)
class Effect:
def __init__(self, device:Device, realname):
#super().__init__(device)
self.device = locals()['device']
self.settings = self.device.loadData(realname.lower() + '.json')
#if not self.settings: #set defaults
# self.settings = {'setting':'default'}
#device.clearDisplayGroup(device.effect_group)
self.effectmenu = [
{
'label': 'Save',
'set': self.saveSettings,
'get': lambda: '<Press>'
}
]
#self.menu.extend(self.effectmenu)
self.lastFrame = 0
def play(self):
if (self.device.limitStep(.1, self.lastFrame)):
# do stuff
self.lastFrame = time.monotonic()
def handleRemote(self, key:str):
print(key)
if key == 'Enter':
pass
def saveSettings(self, direction:int=0):
self.device.writeData(self.settings, self.name.lower() + '.json')