equal
deleted
inserted
replaced
2 |
2 |
3 from __future__ import absolute_import |
3 from __future__ import absolute_import |
4 |
4 |
5 import os |
5 import os |
6 import re |
6 import re |
|
7 import wx |
7 |
8 |
8 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor |
9 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor |
9 from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT |
10 from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT |
10 from .mqtt_client_gen import MQTTClientPanel, MQTTClientModel, MQTT_IEC_types, authParams |
11 from .mqtt_client_gen import MQTTClientPanel, MQTTClientModel, MQTT_IEC_types, authParams |
11 |
12 |
24 frozen_path |
25 frozen_path |
25 ] |
26 ] |
26 |
27 |
27 class MQTTClientEditor(ConfTreeNodeEditor): |
28 class MQTTClientEditor(ConfTreeNodeEditor): |
28 CONFNODEEDITOR_TABS = [ |
29 CONFNODEEDITOR_TABS = [ |
29 (_("MQTT Client"), "CreateMQTTClient_UI")] |
30 (_("MQTT Client"), "CreateMQTTClient_UI"), |
|
31 (_("Info"), "CreateInfo_UI")] |
30 |
32 |
31 MQTTClient_UI = None |
33 MQTTClient_UI = None |
|
34 Info_UI = None |
32 |
35 |
33 def Log(self, msg): |
36 def Log(self, msg): |
34 self.Controler.GetCTRoot().logger.write(msg) |
37 self.Controler.GetCTRoot().logger.write(msg) |
35 |
38 |
36 def CreateMQTTClient_UI(self, parent): |
39 def CreateMQTTClient_UI(self, parent): |
38 parent, |
41 parent, |
39 self.Controler.GetModelData(), |
42 self.Controler.GetModelData(), |
40 self.Log, |
43 self.Log, |
41 self.Controler.GetTypes) |
44 self.Controler.GetTypes) |
42 return self.MQTTClient_UI |
45 return self.MQTTClient_UI |
|
46 |
|
47 def CreateInfo_UI(self, parent): |
|
48 location_str = "_".join(map(str, self.Controler.GetCurrentLocation())) |
|
49 information=("Connection status GLOBAL VAR is:\n\n\tMQTT_STATUS_"+location_str |
|
50 +", of type INT.\n\t" |
|
51 +"0 is disconnected\n\t" |
|
52 +"1 is connected\n") |
|
53 self.Info_UI = wx.StaticText(parent, label = information) |
|
54 return self.Info_UI |
43 |
55 |
44 def RefreshView(self): |
56 def RefreshView(self): |
45 if(self.MQTTClient_UI): |
57 if(self.MQTTClient_UI): |
46 self.MQTTClient_UI.RefreshView() |
58 self.MQTTClient_UI.RefreshView() |
47 return ConfTreeNodeEditor.RefreshView(self) |
59 return ConfTreeNodeEditor.RefreshView(self) |
222 "children": children} |
234 "children": children} |
223 |
235 |
224 |
236 |
225 def CTNGlobalInstances(self): |
237 def CTNGlobalInstances(self): |
226 location_str = "_".join(map(str, self.GetCurrentLocation())) |
238 location_str = "_".join(map(str, self.GetCurrentLocation())) |
227 return [("MQTT_HAPPY_"+location_str, "DINT", "")] |
239 return [("MQTT_STATUS_"+location_str, "INT", ""), |
228 |
240 ] |
229 |
241 |
|
242 |