-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhandler.py
More file actions
38 lines (33 loc) · 1.23 KB
/
handler.py
File metadata and controls
38 lines (33 loc) · 1.23 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
37
38
import threading
import globals
def funcion_handler(node, val):
key = node.get_parent().get_display_name().Text
variable = node.get_display_name().Text
if 'Tanque' in key:
pos = int(key[-1]) - 1
if variable == 'T':
globals.interfaz.temp[pos] = val
elif variable == 'h':
globals.interfaz.alturas[pos] = val
globals.control.alturas[pos] = val
else:
print("No se entiende variable")
elif 'Razon' in key:
pos = int(key[-1]) - 1
globals.interfaz.razones[pos] = val
elif 'Valvula' in key:
pos = int(key[-1]) - 1
globals.interfaz.voltajes[pos] = val
class SubHandler(object):
"""
Subscription Handler. To receive events from server for a subscription
data_change and event methods are called directly from receiving thread.
Do not do expensive, slow or network operation there. Create another
thread if you need to do such a thing
"""
def datachange_notification(self, node, val, data):
thread_handler = threading.Thread(target=funcion_handler, args=(node, val))
thread_handler.start()
# Eventos!!
def event_notification(self, event):
globals.info_evento = (True, event)