dialogs/ForceVariableDialog.py
changeset 1649 3291024e00da
parent 1581 2295fdc5c271
child 1701 8337f6c169d0
equal deleted inserted replaced
1648:6431f26aa501 1649:3291024e00da
     1 # -*- coding: utf-8 -*-
     1 # -*- coding: utf-8 -*-
     2 
     2 
     3 #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
     3 # This file is part of Beremiz, a Integrated Development Environment for
     4 #based on the plcopen standard. 
     4 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
     5 #
     5 #
     6 #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
     6 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
     7 #
     7 #
     8 #See COPYING file for copyrights details.
     8 # See COPYING file for copyrights details.
     9 #
     9 #
    10 #This library is free software; you can redistribute it and/or
    10 # This program is free software; you can redistribute it and/or
    11 #modify it under the terms of the GNU General Public
    11 # modify it under the terms of the GNU General Public License
    12 #License as published by the Free Software Foundation; either
    12 # as published by the Free Software Foundation; either version 2
    13 #version 2.1 of the License, or (at your option) any later version.
    13 # of the License, or (at your option) any later version.
    14 #
    14 #
    15 #This library is distributed in the hope that it will be useful,
    15 # This program is distributed in the hope that it will be useful,
    16 #but WITHOUT ANY WARRANTY; without even the implied warranty of
    16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    18 #General Public License for more details.
    18 # GNU General Public License for more details.
    19 #
    19 #
    20 #You should have received a copy of the GNU General Public
    20 # You should have received a copy of the GNU General Public License
    21 #License along with this library; if not, write to the Free Software
    21 # along with this program; if not, write to the Free Software
    22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 
    23 
    24 import re
    24 import re
    25 import datetime
    25 import datetime
    26 
    26 
    27 import wx
    27 import wx
   172         message = None
   172         message = None
   173         value = self.GetSizer().GetItem(1).GetWindow().GetValue()
   173         value = self.GetSizer().GetItem(1).GetWindow().GetValue()
   174         if value == "":
   174         if value == "":
   175             message = _("You must type a value!")
   175             message = _("You must type a value!")
   176         elif GetTypeValue[self.IEC_Type](value) is None:
   176         elif GetTypeValue[self.IEC_Type](value) is None:
   177             message = _("Invalid value \"%s\" for \"%s\" variable!") % (value, self.IEC_Type)
   177             message = _("Invalid value \"{a1}\" for \"{a2}\" variable!").format(a1 = value, a2 = self.IEC_Type)
   178         if message is not None:
   178         if message is not None:
   179             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
   179             dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
   180             dialog.ShowModal()
   180             dialog.ShowModal()
   181             dialog.Destroy()
   181             dialog.Destroy()
   182         else:
   182         else: