24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
25 |
25 |
26 from __future__ import absolute_import |
26 from __future__ import absolute_import |
27 import wx |
27 import wx |
28 from wx.lib.scrolledpanel import ScrolledPanel |
28 from wx.lib.scrolledpanel import ScrolledPanel |
|
29 |
|
30 from xmlclass.xmlclass import URI_model |
29 |
31 |
30 # ------------------------------------------------------------------------------- |
32 # ------------------------------------------------------------------------------- |
31 # Helpers |
33 # Helpers |
32 # ------------------------------------------------------------------------------- |
34 # ------------------------------------------------------------------------------- |
33 |
35 |
292 def GetTextCtrlChangedFunction(self, textctrl, name): |
294 def GetTextCtrlChangedFunction(self, textctrl, name): |
293 def TextCtrlChangedFunction(event): |
295 def TextCtrlChangedFunction(event): |
294 if self.Controller is not None and self.Values is not None: |
296 if self.Controller is not None and self.Values is not None: |
295 old_value = self.Values.get(name) |
297 old_value = self.Values.get(name) |
296 new_value = textctrl.GetValue() |
298 new_value = textctrl.GetValue() |
297 if name not in REQUIRED_PARAMS and new_value == "": |
299 if name in REQUIRED_PARAMS and new_value == "": |
298 new_value = None |
300 new_value = None |
|
301 if name == 'companyURL': |
|
302 if not URI_model.match(new_value): |
|
303 new_value = None |
|
304 dialog = wx.MessageDialog(self, _('Invalid URL!\n' |
|
305 'Please enter correct URL address.'), |
|
306 _("Error"), wx.OK | wx.ICON_ERROR) |
|
307 dialog.ShowModal() |
|
308 dialog.Destroy() |
299 if old_value != new_value: |
309 if old_value != new_value: |
300 self.Controller.SetProjectProperties(properties={name: new_value}) |
310 self.Controller.SetProjectProperties(properties={name: new_value}) |
301 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, |
311 self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, |
302 PROJECTTREE, PAGETITLES) |
312 PROJECTTREE, PAGETITLES) |
303 wx.CallAfter(self.RefreshView) |
313 wx.CallAfter(self.RefreshView) |