GUI protocol moved to the application
This commit is contained in:
parent
4a2f461be4
commit
53e4523c14
17
__init__.py
17
__init__.py
@ -27,14 +27,10 @@ class my_server_protocol_tcp(my_base_protocol_tcp):
|
|||||||
return self.STATUS_OKAY, self.envsens.get_env_data()
|
return self.STATUS_OKAY, self.envsens.get_env_data()
|
||||||
|
|
||||||
|
|
||||||
class my_smarthome_gui_client_protocol_tcp(my_base_protocol_tcp):
|
class my_client_protocol_tcp(my_base_protocol_tcp):
|
||||||
START_ROUTINE_DATA_IDS = []
|
START_ROUTINE_DATA_IDS = []
|
||||||
|
|
||||||
def __init__(self, comm_instance, cb_temperature, cb_humidity, cb_pressure, cb_layout, secret=None):
|
def __init__(self, comm_instance, secret=None):
|
||||||
self.cb_temperature = cb_temperature
|
|
||||||
self.cb_humidity = cb_humidity
|
|
||||||
self.cb_pressure = cb_pressure
|
|
||||||
self.cb_layout = cb_layout
|
|
||||||
socket_protocol.pure_json_protocol.__init__(self, comm_instance, secret)
|
socket_protocol.pure_json_protocol.__init__(self, comm_instance, secret)
|
||||||
self.register_callback(self.SID_READ_RESPONSE, self.CURRENT_ENVDATA, self.read_current_envdata)
|
self.register_callback(self.SID_READ_RESPONSE, self.CURRENT_ENVDATA, self.read_current_envdata)
|
||||||
|
|
||||||
@ -46,14 +42,11 @@ class my_smarthome_gui_client_protocol_tcp(my_base_protocol_tcp):
|
|||||||
return my_base_protocol_tcp.__authentificate_process_feedback__(self, msg)
|
return my_base_protocol_tcp.__authentificate_process_feedback__(self, msg)
|
||||||
|
|
||||||
def read_current_envdata(self, msg):
|
def read_current_envdata(self, msg):
|
||||||
import wx
|
|
||||||
|
|
||||||
if msg.get_status() == self.STATUS_OKAY:
|
if msg.get_status() == self.STATUS_OKAY:
|
||||||
env_data = msg.get_data()
|
env_data = msg.get_data()
|
||||||
wx.CallAfter(self.cb_temperature.SetLabel, "%.1f °C" % env_data[envsens.KEY_TEMPERATURE])
|
print("Temperature: %6.1f °C" % env_data[envsens.KEY_TEMPERATURE])
|
||||||
wx.CallAfter(self.cb_humidity.SetLabel, "%.1f %%" % env_data[envsens.KEY_HUMIDITY])
|
print("Humidity: %6.1f %%" % env_data[envsens.KEY_HUMIDITY])
|
||||||
wx.CallAfter(self.cb_pressure.SetLabel, "%.0f mbar" % env_data[envsens.KEY_PRESSURE])
|
print("Pressure: %6.1f mbar" % env_data[envsens.KEY_PRESSURE])
|
||||||
wx.CallAfter(self.cb_layout)
|
|
||||||
return self.STATUS_OKAY, None
|
return self.STATUS_OKAY, None
|
||||||
else:
|
else:
|
||||||
print('No environmental data received!')
|
print('No environmental data received!')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user