Exemple #1
0
 def __init__(self):
     wx.Frame.__init__(self,
                       parent=None,
                       title=TITLE + " - " + VERSION,
                       size=(250, 320))
     # Load config
     self.config = load_json("config.json")
     # Create panel elements
     self.panel = wx.Panel(self)
     wx.StaticText(self.panel, label="Name", pos=(5, 5))
     wx.StaticText(self.panel, label="IP Addr", pos=(5, 88))
     self.ctrl_name = wx.TextCtrl(self.panel, pos=(5, 25), size=(230, -1))
     self.ctrl_ipaddr = wx.TextCtrl(self.panel,
                                    pos=(55, 85),
                                    size=(180, -1),
                                    style=wx.TE_READONLY)
     self.ctrl_register = wx.Button(self.panel,
                                    pos=(5, 55),
                                    label="Register")
     self.ctrl_pair = wx.Button(self.panel, pos=(5, 245), label="Pair")
     self.ctrl_list = wx.ListBox(self.panel,
                                 pos=(5, 115),
                                 size=(230, 120),
                                 style=wx.LB_SINGLE)
     self.SetStatusBar(wx.StatusBar(self))
     # Set gui initial state
     self.ctrl_pair.Disable()
     self.SetStatusText("closed")
     # Bind element event handlers
     self.Bind(wx.EVT_BUTTON, lambda _: self.DoRegister(),
               self.ctrl_register)
     self.Bind(wx.EVT_BUTTON, lambda _: self.DoPair(), self.ctrl_pair)
     # Create client
     self.client = BrokerClient(self.config["server"]["address"],
                                self.config["server"]["port"])
     self.client.subscribe(self.MessageHandler)
     self.client_timer = wx.Timer(self)
     self.Bind(wx.EVT_TIMER, lambda _: asyncore.poll(), self.client_timer)
     self.client_timer.Start(100)
     self.client.Connect()
Exemple #2
0
 def __init__(self, *args, **kwargs):
     self.client = BrokerClient(self.host, get_certificate())
Exemple #3
0
 def __init__(self, *args, **kwargs):
     self.client = BrokerClient(self.host, CREDENTIALS)