From 53e4523c140b5f51dedb3b128048eb59c1a5da4c Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Mon, 7 Sep 2020 12:32:08 +0200 Subject: [PATCH] GUI protocol moved to the application --- __init__.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/__init__.py b/__init__.py index 2f9898b..33de7a1 100644 --- a/__init__.py +++ b/__init__.py @@ -27,14 +27,10 @@ class my_server_protocol_tcp(my_base_protocol_tcp): 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 = [] - def __init__(self, comm_instance, cb_temperature, cb_humidity, cb_pressure, cb_layout, secret=None): - self.cb_temperature = cb_temperature - self.cb_humidity = cb_humidity - self.cb_pressure = cb_pressure - self.cb_layout = cb_layout + def __init__(self, comm_instance, secret=None): socket_protocol.pure_json_protocol.__init__(self, comm_instance, secret) 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) def read_current_envdata(self, msg): - import wx - if msg.get_status() == self.STATUS_OKAY: env_data = msg.get_data() - wx.CallAfter(self.cb_temperature.SetLabel, "%.1f °C" % env_data[envsens.KEY_TEMPERATURE]) - wx.CallAfter(self.cb_humidity.SetLabel, "%.1f %%" % env_data[envsens.KEY_HUMIDITY]) - wx.CallAfter(self.cb_pressure.SetLabel, "%.0f mbar" % env_data[envsens.KEY_PRESSURE]) - wx.CallAfter(self.cb_layout) + print("Temperature: %6.1f °C" % env_data[envsens.KEY_TEMPERATURE]) + print("Humidity: %6.1f %%" % env_data[envsens.KEY_HUMIDITY]) + print("Pressure: %6.1f mbar" % env_data[envsens.KEY_PRESSURE]) return self.STATUS_OKAY, None else: print('No environmental data received!')