196 event(self, id, function) |
196 event(self, id, function) |
197 else: |
197 else: |
198 event(self, function) |
198 event(self, function) |
199 |
199 |
200 def __init__(self, parent, message, caption=_("Please enter text"), defaultValue="", |
200 def __init__(self, parent, message, caption=_("Please enter text"), defaultValue="", |
201 style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): |
201 style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): |
202 wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) |
202 wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) |
203 |
203 |
204 self.Tests = [] |
204 self.Tests = [] |
205 if wx.VERSION >= (2, 8, 0): |
205 if wx.VERSION >= (2, 8, 0): |
206 self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId()) |
206 self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId()) |
310 def OnTaskBarChangeInterface(self, evt): |
310 def OnTaskBarChangeInterface(self, evt): |
311 ip_addr = self.pyroserver.ip_addr |
311 ip_addr = self.pyroserver.ip_addr |
312 ip_addr = '' if ip_addr is None else ip_addr |
312 ip_addr = '' if ip_addr is None else ip_addr |
313 dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) |
313 dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) |
314 dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), |
314 dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), |
315 (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) |
315 (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, |
316 ]) |
316 _("IP is not valid!")) |
|
317 ]) |
317 if dlg.ShowModal() == wx.ID_OK: |
318 if dlg.ShowModal() == wx.ID_OK: |
318 self.pyroserver.ip_addr = dlg.GetValue() |
319 self.pyroserver.ip_addr = dlg.GetValue() |
319 self.pyroserver.Stop() |
320 self.pyroserver.Stop() |
320 |
321 |
321 def OnTaskBarChangePort(self, evt): |
322 def OnTaskBarChangePort(self, evt): |