270 icon = wx.IconFromBitmap(img.ConvertToBitmap() ) |
270 icon = wx.IconFromBitmap(img.ConvertToBitmap() ) |
271 return icon |
271 return icon |
272 |
272 |
273 def OnTaskBarStartPLC(self, evt): |
273 def OnTaskBarStartPLC(self, evt): |
274 if self.pyroserver.plcobj is not None: |
274 if self.pyroserver.plcobj is not None: |
275 self.pyroserver.plcobj.StartPLC() |
275 plcstatus = self.pyroserver.plcobj.GetPLCstatus()[0] |
|
276 if plcstatus is "Stopped": |
|
277 self.pyroserver.plcobj.StartPLC() |
|
278 else: |
|
279 print _("PLC is empty or already started.") |
276 |
280 |
277 def OnTaskBarStopPLC(self, evt): |
281 def OnTaskBarStopPLC(self, evt): |
278 if self.pyroserver.plcobj is not None: |
282 if self.pyroserver.plcobj is not None: |
279 Thread(target=self.pyroserver.plcobj.StopPLC).start() |
283 if self.pyroserver.plcobj.GetPLCstatus()[0] == "Started": |
|
284 Thread(target=self.pyroserver.plcobj.StopPLC).start() |
|
285 else: |
|
286 print _("PLC is not started.") |
280 |
287 |
281 def OnTaskBarChangeInterface(self, evt): |
288 def OnTaskBarChangeInterface(self, evt): |
282 dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=self.pyroserver.ip_addr) |
289 dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=self.pyroserver.ip_addr) |
283 dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), |
290 dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), |
284 ( lambda x :len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) |
291 ( lambda x :len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) |