don't crash on trying to change IP interface for Beremiz_service using taskbar icon if IP wasn't previously
By default IP is not set (None) and service listen only on localhost interface.
--- a/Beremiz_service.py Wed Dec 07 18:15:04 2016 +0300
+++ b/Beremiz_service.py Wed Dec 07 18:23:59 2016 +0300
@@ -286,7 +286,9 @@
print _("PLC is not started.")
def OnTaskBarChangeInterface(self, evt):
- dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=self.pyroserver.ip_addr)
+ ip_addr = self.pyroserver.ip_addr
+ ip_addr = '' if ip_addr is None else ip_addr
+ dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr)
dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")),
( lambda x :len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!"))
])