1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- |
2 # -*- coding: utf-8 -*- |
3 |
3 |
4 #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
4 # This file is part of Beremiz, a Integrated Development Environment for |
5 #based on the plcopen standard. |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
6 # |
6 # |
7 #Copyright (C) 2012: Edouard TISSERANT and Laurent BESSARD |
7 # Copyright (C) 2012: Edouard TISSERANT and Laurent BESSARD |
8 # |
8 # |
9 #See COPYING file for copyrights details. |
9 # See COPYING file for copyrights details. |
10 # |
10 # |
11 #This library is free software; you can redistribute it and/or |
11 # This program is free software; you can redistribute it and/or |
12 #modify it under the terms of the GNU General Public |
12 # modify it under the terms of the GNU General Public License |
13 #License as published by the Free Software Foundation; either |
13 # as published by the Free Software Foundation; either version 2 |
14 #version 2.1 of the License, or (at your option) any later version. |
14 # of the License, or (at your option) any later version. |
15 # |
15 # |
16 #This library is distributed in the hope that it will be useful, |
16 # This program is distributed in the hope that it will be useful, |
17 #but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 #General Public License for more details. |
19 # GNU General Public License for more details. |
20 # |
20 # |
21 #You should have received a copy of the GNU General Public |
21 # You should have received a copy of the GNU General Public License |
22 #License along with this library; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 import wx |
25 import wx |
26 |
26 |
27 from controls.ProjectPropertiesPanel import ProjectPropertiesPanel |
27 from controls.ProjectPropertiesPanel import ProjectPropertiesPanel |
28 |
28 |
49 self.SetSizer(main_sizer) |
49 self.SetSizer(main_sizer) |
50 |
50 |
51 def OnOK(self, event): |
51 def OnOK(self, event): |
52 values = self.ProjectProperties.GetValues() |
52 values = self.ProjectProperties.GetValues() |
53 error = [] |
53 error = [] |
54 for param, name in [("projectName", "Project Name"), |
54 for param, name in [("projectName", _("Project Name")), |
55 ("productName", "Product Name"), |
55 ("productName", _("Product Name")), |
56 ("productVersion", "Product Version"), |
56 ("productVersion", _("Product Version")), |
57 ("companyName", "Company Name")]: |
57 ("companyName", _("Company Name"))]: |
58 if values[param] == "": |
58 if values[param] == "": |
59 error.append(name) |
59 error.append(name) |
60 if len(error) > 0: |
60 if len(error) > 0: |
61 text = "" |
61 text = "" |
62 for i, item in enumerate(error): |
62 for i, item in enumerate(error): |
63 if i == 0: |
63 if i == 0: |
64 text += item |
64 text += item |
65 elif i == len(error) - 1: |
65 elif i == len(error) - 1: |
66 text += " and %s"%item |
66 text += _(" and %s")%item |
67 else: |
67 else: |
68 text += ", %s"%item |
68 text += ", %s"%item |
69 dialog = wx.MessageDialog(self, |
69 dialog = wx.MessageDialog(self, |
70 _("Form isn't complete. %s must be filled!") % text, |
70 _("Form isn't complete. %s must be filled!") % text, |
71 _("Error"), wx.OK|wx.ICON_ERROR) |
71 _("Error"), wx.OK|wx.ICON_ERROR) |