Procházet zdrojové kódy

GUI protocol moved to the application

master
Dirk Alders před 4 roky
rodič
revize
53e4523c14
1 změnil soubory, kde provedl 5 přidání a 12 odebrání
  1. 5
    12
      __init__.py

+ 5
- 12
__init__.py Zobrazit soubor

@@ -27,14 +27,10 @@ class my_server_protocol_tcp(my_base_protocol_tcp):
27 27
         return self.STATUS_OKAY, self.envsens.get_env_data()
28 28
 
29 29
 
30
-class my_smarthome_gui_client_protocol_tcp(my_base_protocol_tcp):
30
+class my_client_protocol_tcp(my_base_protocol_tcp):
31 31
     START_ROUTINE_DATA_IDS = []
32 32
 
33
-    def __init__(self, comm_instance, cb_temperature, cb_humidity, cb_pressure, cb_layout, secret=None):
34
-        self.cb_temperature = cb_temperature
35
-        self.cb_humidity = cb_humidity
36
-        self.cb_pressure = cb_pressure
37
-        self.cb_layout = cb_layout
33
+    def __init__(self, comm_instance, secret=None):
38 34
         socket_protocol.pure_json_protocol.__init__(self, comm_instance, secret)
39 35
         self.register_callback(self.SID_READ_RESPONSE, self.CURRENT_ENVDATA, self.read_current_envdata)
40 36
 
@@ -46,14 +42,11 @@ class my_smarthome_gui_client_protocol_tcp(my_base_protocol_tcp):
46 42
         return my_base_protocol_tcp.__authentificate_process_feedback__(self, msg)
47 43
 
48 44
     def read_current_envdata(self, msg):
49
-        import wx
50
-
51 45
         if msg.get_status() == self.STATUS_OKAY:
52 46
             env_data = msg.get_data()
53
-            wx.CallAfter(self.cb_temperature.SetLabel, "%.1f °C" % env_data[envsens.KEY_TEMPERATURE])
54
-            wx.CallAfter(self.cb_humidity.SetLabel, "%.1f %%" % env_data[envsens.KEY_HUMIDITY])
55
-            wx.CallAfter(self.cb_pressure.SetLabel, "%.0f mbar" % env_data[envsens.KEY_PRESSURE])
56
-            wx.CallAfter(self.cb_layout)
47
+            print("Temperature: %6.1f °C" % env_data[envsens.KEY_TEMPERATURE])
48
+            print("Humidity:    %6.1f %%" % env_data[envsens.KEY_HUMIDITY])
49
+            print("Pressure:    %6.1f mbar" % env_data[envsens.KEY_PRESSURE])
57 50
             return self.STATUS_OKAY, None
58 51
         else:
59 52
             print('No environmental data received!')

Načítá se…
Zrušit
Uložit