-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlcdmanager.py
More file actions
36 lines (29 loc) · 1.18 KB
/
Copy pathlcdmanager.py
File metadata and controls
36 lines (29 loc) · 1.18 KB
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
from threading import Thread
import g15daemon
from apps.g15app import G15App
from apps import *
class LCDKeyWatcher(Thread):
def __init__(self, g15):
super(LCDKeyWatcher, self).__init__()
self._keys = 0
self.g15 = g15
self.stop_thread = False
def run(self):
while not self.stop_thread:
key = self.g15.get_key()
if key is not None:
changed = self._keys ^ key
pressed = self._keys
self._keys = key
if pressed:
if not key & g15daemon.G15_KEY_LIGHT:
if changed & g15daemon.G15_KEY_L2:
G15App.previousPlugin()
elif changed & g15daemon.G15_KEY_L3:
G15App.nextPlugin()
elif changed & g15daemon.G15_KEY_L4 and G15App.activePlugin().has_l3action():
G15App.activePlugin().l3action()
elif changed & g15daemon.G15_KEY_L5 and G15App.activePlugin().has_l4action():
G15App.activePlugin().l4action()
def stop(self):
self.stop_thread = True