controls/ProjectPropertiesPanel.py
changeset 1970 b524b356aa58
parent 1881 091005ec69c4
child 1972 38e912c8bd31
equal deleted inserted replaced
1969:0607c382d73f 1970:b524b356aa58
    23 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    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 
       
    29 from xmlclass.xmlclass import URI_model
    28 
    30 
    29 # -------------------------------------------------------------------------------
    31 # -------------------------------------------------------------------------------
    30 #                                 Helpers
    32 #                                 Helpers
    31 # -------------------------------------------------------------------------------
    33 # -------------------------------------------------------------------------------
    32 
    34 
   283             if self.Controller is not None and self.Values is not None:
   285             if self.Controller is not None and self.Values is not None:
   284                 old_value = self.Values.get(name)
   286                 old_value = self.Values.get(name)
   285                 new_value = textctrl.GetValue()
   287                 new_value = textctrl.GetValue()
   286                 if name not in REQUIRED_PARAMS and new_value == "":
   288                 if name not in REQUIRED_PARAMS and new_value == "":
   287                     new_value = None
   289                     new_value = None
       
   290                 if name == 'companyURL':
       
   291                     if not URI_model.match(new_value):
       
   292                         new_value = None
       
   293                         dialog = wx.MessageDialog(self, _('Invalid URL!\n'
       
   294                                                           'Please enter correct URL address.'),
       
   295                                                   _("Error"), wx.OK | wx.ICON_ERROR)
       
   296                         dialog.ShowModal()
       
   297                         dialog.Destroy()
   288                 if old_value != new_value:
   298                 if old_value != new_value:
   289                     self.Controller.SetProjectProperties(properties={name: new_value})
   299                     self.Controller.SetProjectProperties(properties={name: new_value})
   290                     self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,
   300                     self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU,
   291                                                PROJECTTREE, PAGETITLES)
   301                                                PROJECTTREE, PAGETITLES)
   292                     wx.CallAfter(self.RefreshView)
   302                     wx.CallAfter(self.RefreshView)