Dialogs.py
changeset 391 07447ee3538e
parent 355 a9046671e0ce
child 427 22d16c457d87
equal deleted inserted replaced
390:020420ad8914 391:07447ee3538e
    75     def _init_coll_RightGridSizer_Growables(self, parent):
    75     def _init_coll_RightGridSizer_Growables(self, parent):
    76         parent.AddGrowableCol(0)
    76         parent.AddGrowableCol(0)
    77         parent.AddGrowableRow(2)
    77         parent.AddGrowableRow(2)
    78 
    78 
    79     def _init_coll_RightUpGridSizer_Items(self, parent):
    79     def _init_coll_RightUpGridSizer_Items(self, parent):
    80         parent.AddWindow(self.staticText2, 0, border=4, flag=wx.GROW|wx.TOP)
    80         parent.AddWindow(self.staticText2, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
    81         parent.AddWindow(self.BlockName, 0, border=0, flag=wx.GROW)
    81         parent.AddWindow(self.BlockName, 0, border=0, flag=wx.GROW)
    82         parent.AddWindow(self.staticText3, 0, border=4, flag=wx.GROW|wx.TOP)
    82         parent.AddWindow(self.staticText3, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
    83         parent.AddWindow(self.Inputs, 0, border=0, flag=wx.GROW)
    83         parent.AddWindow(self.Inputs, 0, border=0, flag=wx.GROW)
    84         parent.AddWindow(self.staticText4, 0, border=4, flag=wx.GROW|wx.TOP)
    84         parent.AddWindow(self.staticText4, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
    85         parent.AddWindow(self.ExecutionOrder, 0, border=0, flag=wx.GROW)
    85         parent.AddWindow(self.ExecutionOrder, 0, border=0, flag=wx.GROW)
    86         parent.AddWindow(self.staticText5, 0, border=4, flag=wx.GROW|wx.TOP)
    86         parent.AddWindow(self.staticText5, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP)
    87         parent.AddWindow(self.ExecutionControl, 0, border=0, flag=wx.GROW)
    87         parent.AddWindow(self.ExecutionControl, 0, border=0, flag=wx.GROW)
    88         
    88     
       
    89     def _init_coll_RightUpGridSizer_Growables(self, parent):
       
    90         parent.AddGrowableCol(1)
       
    91     
    89     def _init_sizers(self):
    92     def _init_sizers(self):
    90         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
    93         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
    91         self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
    94         self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
    92         self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wx.VERTICAL)
    95         self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wx.VERTICAL)
    93         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
    96         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
    94         self.RightUpGridSizer = wx.GridSizer(cols=2, hgap=5, rows=4, vgap=5)
    97         self.RightUpGridSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=5)
    95         
    98         
    96         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
    99         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
    97         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
   100         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
    98         self._init_coll_MainSizer_Items(self.MainSizer)
   101         self._init_coll_MainSizer_Items(self.MainSizer)
    99         self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer)
   102         self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer)
   100         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   103         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
   101         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   104         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
   102         self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer)
   105         self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer)
       
   106         self._init_coll_RightUpGridSizer_Growables(self.RightUpGridSizer)
   103         
   107         
   104         self.SetSizer(self.flexGridSizer1)
   108         self.SetSizer(self.flexGridSizer1)
   105 
   109 
   106     def _init_ctrls(self, prnt):
   110     def _init_ctrls(self, prnt):
   107         wx.Dialog.__init__(self, id=ID_BLOCKPROPERTIESDIALOG,
   111         wx.Dialog.__init__(self, id=ID_BLOCKPROPERTIESDIALOG,
   108               name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   112               name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   109               size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
   113               size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
   110               title='Block Properties')
   114               title=_('Block Properties'))
   111         self.SetClientSize(wx.Size(600, 400))
   115         self.SetClientSize(wx.Size(600, 400))
   112 
   116 
   113         self.staticbox1 = wx.StaticBox(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
   117         self.staticbox1 = wx.StaticBox(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT1,
   114               label='Type:', name='staticBox1', parent=self,
   118               label=_('Type:'), name='staticBox1', parent=self,
   115               pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
   119               pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
   116 
   120 
   117         self.staticText2 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
   121         self.staticText2 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
   118               label='Name:', name='staticText2', parent=self,
   122               label=_('Name:'), name='staticText2', parent=self,
   119               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   123               pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
   120 
   124 
   121         self.staticText3 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
   125         self.staticText3 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2,
   122               label='Inputs:', name='staticText4', parent=self,
   126               label=_('Inputs:'), name='staticText4', parent=self,
   123               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   127               pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
   124 
   128 
   125         self.staticText4 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
   129         self.staticText4 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT4,
   126               label='Execution Order:', name='staticText4', parent=self,
   130               label=_('Execution Order:'), name='staticText4', parent=self,
   127               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   131               pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
   128 
   132 
   129         self.staticText5 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT5,
   133         self.staticText5 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT5,
   130               label='Execution Control:', name='staticText5', parent=self,
   134               label=_('Execution Control:'), name='staticText5', parent=self,
   131               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   135               pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
   132 
   136 
   133         self.staticText6 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT6,
   137         self.staticText6 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT6,
   134               label='Preview:', name='staticText6', parent=self,
   138               label=_('Preview:'), name='staticText6', parent=self,
   135               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   139               pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
   136 
   140 
   137         if wx.Platform == '__WXMSW__':
   141         if wx.Platform == '__WXMSW__':
   138             treestyle = wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.SUNKEN_BORDER
   142             treestyle = wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.SUNKEN_BORDER
   139         else:
   143         else:
   140             treestyle = wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER
   144             treestyle = wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_SINGLE|wx.SUNKEN_BORDER
   232     def OnOK(self, event):
   236     def OnOK(self, event):
   233         selected = self.TypeTree.GetSelection()
   237         selected = self.TypeTree.GetSelection()
   234         block_name = self.BlockName.GetValue()
   238         block_name = self.BlockName.GetValue()
   235         name_enabled = self.BlockName.IsEnabled()
   239         name_enabled = self.BlockName.IsEnabled()
   236         if not selected.IsOk() or self.TypeTree.GetItemParent(selected) == self.TypeTree.GetRootItem() or selected == self.TypeTree.GetRootItem():
   240         if not selected.IsOk() or self.TypeTree.GetItemParent(selected) == self.TypeTree.GetRootItem() or selected == self.TypeTree.GetRootItem():
   237             message = wx.MessageDialog(self, "Form isn't complete. Valid block type must be selected!", "Error", wx.OK|wx.ICON_ERROR)
   241             message = wx.MessageDialog(self, _("Form isn't complete. Valid block type must be selected!"), _("Error"), wx.OK|wx.ICON_ERROR)
   238             message.ShowModal()
   242             message.ShowModal()
   239             message.Destroy()
   243             message.Destroy()
   240         elif name_enabled and block_name == "":
   244         elif name_enabled and block_name == "":
   241             message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR)
   245             message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR)
   242             message.ShowModal()
   246             message.ShowModal()
   243             message.Destroy()
   247             message.Destroy()
   244         elif name_enabled and not TestIdentifier(block_name):
   248         elif name_enabled and not TestIdentifier(block_name):
   245             message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
   249             message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR)
   246             message.ShowModal()
   250             message.ShowModal()
   247             message.Destroy()
   251             message.Destroy()
   248         elif name_enabled and block_name.upper() in IEC_KEYWORDS:
   252         elif name_enabled and block_name.upper() in IEC_KEYWORDS:
   249             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
   253             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR)
   250             message.ShowModal()
   254             message.ShowModal()
   251             message.Destroy()
   255             message.Destroy()
   252         elif name_enabled and block_name.upper() in self.PouNames:
   256         elif name_enabled and block_name.upper() in self.PouNames:
   253             message = wx.MessageDialog(self, "\"%s\" pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
   257             message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR)
   254             message.ShowModal()
   258             message.ShowModal()
   255             message.Destroy()
   259             message.Destroy()
   256         elif name_enabled and block_name.upper() in self.PouElementNames:
   260         elif name_enabled and block_name.upper() in self.PouElementNames:
   257             message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
   261             message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR)
   258             message.ShowModal()
   262             message.ShowModal()
   259             message.Destroy()
   263             message.Destroy()
   260         else:
   264         else:
   261             self.EndModal(wx.ID_OK)
   265             self.EndModal(wx.ID_OK)
   262 
   266 
   263     def SetBlockList(self, blocktypes):
   267     def SetBlockList(self, blocktypes):
   264         if wx.Platform == '__WXMSW__':
   268         if wx.Platform == '__WXMSW__':
   265             root = self.TypeTree.AddRoot("Block Types")
   269             root = self.TypeTree.AddRoot(_("Block Types"))
   266         else:
   270         else:
   267             root = self.TypeTree.AddRoot("")
   271             root = self.TypeTree.AddRoot("")
   268         self.TypeTree.SetPyData(root, {"type" : CATEGORY})
   272         self.TypeTree.SetPyData(root, {"type" : CATEGORY})
   269         for category in blocktypes:
   273         for category in blocktypes:
   270             category_item = self.TypeTree.AppendItem(root, category["name"])
   274             category_name = category["name"]
       
   275             category_item = self.TypeTree.AppendItem(root, _(category_name))
   271             self.TypeTree.SetPyData(category_item, {"type" : CATEGORY})
   276             self.TypeTree.SetPyData(category_item, {"type" : CATEGORY})
   272             for blocktype in category["list"]:
   277             for blocktype in category["list"]:
   273                 blocktype_item = self.TypeTree.AppendItem(category_item, blocktype["name"])
   278                 blocktype_item = self.TypeTree.AppendItem(category_item, blocktype["name"])
   274                 block_data = {"type" : BLOCK, 
   279                 block_data = {"type" : BLOCK, 
   275                               "inputs" : tuple([type for name, type, modifier in blocktype["inputs"]]),
   280                               "inputs" : tuple([type for name, type, modifier in blocktype["inputs"]]),
   328             blocktype = self.Controler.GetBlockType(self.TypeTree.GetItemText(selected), pydata["inputs"])
   333             blocktype = self.Controler.GetBlockType(self.TypeTree.GetItemText(selected), pydata["inputs"])
   329             if blocktype:
   334             if blocktype:
   330                 self.Inputs.SetValue(len(blocktype["inputs"]))
   335                 self.Inputs.SetValue(len(blocktype["inputs"]))
   331                 self.Inputs.Enable(blocktype["extensible"])
   336                 self.Inputs.Enable(blocktype["extensible"])
   332                 self.BlockName.Enable(blocktype["type"] != "function")
   337                 self.BlockName.Enable(blocktype["type"] != "function")
   333                 self.TypeDesc.SetValue(blocktype["comment"])
   338                 comment = blocktype["comment"]
       
   339                 self.TypeDesc.SetValue(_(comment) + blocktype.get("usage", ""))
   334                 wx.CallAfter(self.RefreshPreview)
   340                 wx.CallAfter(self.RefreshPreview)
   335             else:
   341             else:
   336                 self.BlockName.Enable(False)
   342                 self.BlockName.Enable(False)
   337                 self.Inputs.Enable(False)
   343                 self.Inputs.Enable(False)
   338                 self.Inputs.SetValue(2)
   344                 self.Inputs.SetValue(2)
   414  ID_VARIABLEPROPERTIESDIALOGEXECUTIONORDER, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, 
   420  ID_VARIABLEPROPERTIESDIALOGEXECUTIONORDER, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, 
   415  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, 
   421  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, 
   416  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5
   422  ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5
   417 ] = [wx.NewId() for _init_ctrls in range(12)]
   423 ] = [wx.NewId() for _init_ctrls in range(12)]
   418 
   424 
       
   425 VARIABLE_CLASSES_DICT = {INPUT : _("Input"),
       
   426                          INOUT : _("InOut"),
       
   427                          OUTPUT : _("Output")}
       
   428 VARIABLE_CLASSES_DICT_REVERSE = dict([(value, key) for key, value in VARIABLE_CLASSES_DICT.iteritems()])
       
   429 
   419 class VariablePropertiesDialog(wx.Dialog):
   430 class VariablePropertiesDialog(wx.Dialog):
   420     
   431     
   421     if wx.VERSION < (2, 6, 0):
   432     if wx.VERSION < (2, 6, 0):
   422         def Bind(self, event, function, id = None):
   433         def Bind(self, event, function, id = None):
   423             if id is not None:
   434             if id is not None:
   488 
   499 
   489     def _init_ctrls(self, prnt, ctrler):
   500     def _init_ctrls(self, prnt, ctrler):
   490         wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG,
   501         wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG,
   491               name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   502               name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   492               size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE,
   503               size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE,
   493               title='Variable Properties')
   504               title=_('Variable Properties'))
   494         self.SetClientSize(wx.Size(400, 380))
   505         self.SetClientSize(wx.Size(400, 380))
   495 
   506 
   496         self.staticText1 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
   507         self.staticText1 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1,
   497               label='Class:', name='staticText1', parent=self,
   508               label=_('Class:'), name='staticText1', parent=self,
   498               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   509               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   499 
   510 
   500         self.staticText2 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
   511         self.staticText2 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2,
   501               label='Expression:', name='staticText2', parent=self,
   512               label=_('Expression:'), name='staticText2', parent=self,
   502               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   513               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   503 
   514 
   504         self.staticText3 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3,
   515         self.staticText3 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3,
   505               label='Execution Order:', name='staticText3', parent=self,
   516               label=_('Execution Order:'), name='staticText3', parent=self,
   506               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   517               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   507 
   518 
   508         self.staticText4 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
   519         self.staticText4 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4,
   509               label='Name:', name='staticText4', parent=self,
   520               label=_('Name:'), name='staticText4', parent=self,
   510               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   521               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   511 
   522 
   512         self.staticText5 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5,
   523         self.staticText5 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5,
   513               label='Preview:', name='staticText5', parent=self,
   524               label=_('Preview:'), name='staticText5', parent=self,
   514               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   525               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   515 
   526 
   516         self.Class = wx.ComboBox(id=ID_VARIABLEPROPERTIESDIALOGCLASS,
   527         self.Class = wx.ComboBox(id=ID_VARIABLEPROPERTIESDIALOGCLASS,
   517               name='Class', parent=self, pos=wx.Point(0, 0),
   528               name='Class', parent=self, pos=wx.Point(0, 0),
   518               size=wx.Size(0, 28), style=wx.CB_READONLY)
   529               size=wx.Size(0, 28), style=wx.CB_READONLY)
   559         self._init_ctrls(parent, controler)
   570         self._init_ctrls(parent, controler)
   560         self.Transition = transition
   571         self.Transition = transition
   561         self.Variable = None
   572         self.Variable = None
   562         self.VarList = []
   573         self.VarList = []
   563         self.MinVariableSize = None
   574         self.MinVariableSize = None
       
   575         
       
   576         for choice in VARIABLE_CLASSES_DICT.itervalues():
       
   577             self.Class.Append(choice)
       
   578         self.Class.SetStringSelection(VARIABLE_CLASSES_DICT[INPUT])
       
   579 
   564         self.RefreshNameList()
   580         self.RefreshNameList()
   565         
       
   566         for choice in ["Input", "Output", "InOut"]:
       
   567             self.Class.Append(choice)
       
   568         self.Class.SetStringSelection("Input")
       
   569 
   581 
   570     def SetPreviewFont(self, font):
   582     def SetPreviewFont(self, font):
   571         self.Preview.SetFont(font)
   583         self.Preview.SetFont(font)
   572 
   584 
   573     def RefreshNameList(self):
   585     def RefreshNameList(self):
   574         selected = self.VariableName.GetStringSelection()
   586         selected = self.VariableName.GetStringSelection()
       
   587         var_class = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()]
   575         self.VariableName.Clear()
   588         self.VariableName.Clear()
   576         self.VariableName.Append("")
   589         self.VariableName.Append("")
   577         for name, var_type, value_type in self.VarList:
   590         for name, var_type, value_type in self.VarList:
   578             if var_type != "Input" or self.Class.GetStringSelection() == "Input":
   591             if var_type != "Input" or var_class == INPUT:
   579                 self.VariableName.Append(name)
   592                 self.VariableName.Append(name)
   580         if selected != "" and self.VariableName.FindString(selected) != wx.NOT_FOUND:
   593         if selected != "" and self.VariableName.FindString(selected) != wx.NOT_FOUND:
   581             self.VariableName.SetStringSelection(selected)
   594             self.VariableName.SetStringSelection(selected)
   582             self.Expression.Enable(False)
   595             self.Expression.Enable(False)
   583         else:
   596         else:
   584             self.VariableName.SetStringSelection("")
   597             self.VariableName.SetStringSelection("")
   585             self.Expression.Enable(self.Class.GetStringSelection() == "Input")
   598             self.Expression.Enable(var_class == INPUT)
   586         self.VariableName.Enable(self.VariableName.GetCount() > 0)
   599         self.VariableName.Enable(self.VariableName.GetCount() > 0)
   587             
   600             
   588     def SetMinVariableSize(self, size):
   601     def SetMinVariableSize(self, size):
   589         self.MinVariableSize = size
   602         self.MinVariableSize = size
   590 
   603 
   594 
   607 
   595     def SetValues(self, values):
   608     def SetValues(self, values):
   596         value_type = values.get("type", None)
   609         value_type = values.get("type", None)
   597         value_name = values.get("name", None)
   610         value_name = values.get("name", None)
   598         if value_type:
   611         if value_type:
   599             if value_type == INPUT:
   612             self.Class.SetStringSelection(VARIABLE_CLASSES_DICT[value_type])
   600                 self.Class.SetStringSelection("Input")
       
   601             if value_type == OUTPUT:
       
   602                 self.Class.SetStringSelection("Output")
       
   603             if value_type == INOUT:
       
   604                 self.Class.SetStringSelection("InOut")
       
   605             self.RefreshNameList()
   613             self.RefreshNameList()
   606         if value_name:
   614         if value_name:
   607             if self.VariableName.FindString(value_name) != wx.NOT_FOUND:
   615             if self.VariableName.FindString(value_name) != wx.NOT_FOUND:
   608                 self.VariableName.SetStringSelection(value_name)
   616                 self.VariableName.SetStringSelection(value_name)
   609                 self.Expression.Enable(False)
   617                 self.Expression.Enable(False)
   614             self.ExecutionOrder.SetValue(values["executionOrder"])
   622             self.ExecutionOrder.SetValue(values["executionOrder"])
   615         self.RefreshPreview()
   623         self.RefreshPreview()
   616         
   624         
   617     def GetValues(self):
   625     def GetValues(self):
   618         values = {}
   626         values = {}
   619         classtype = self.Class.GetStringSelection()
   627         values["type"] = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()]
   620         if classtype == "Input":
       
   621             values["type"] = INPUT
       
   622         elif classtype == "Output":
       
   623             values["type"] = OUTPUT
       
   624         elif classtype == "InOut":
       
   625             values["type"] = INOUT
       
   626         expression = self.Expression.GetValue()
   628         expression = self.Expression.GetValue()
   627         if self.Expression.IsEnabled() and expression != "":
   629         if self.Expression.IsEnabled() and expression != "":
   628             values["name"] = expression
   630             values["name"] = expression
   629         else:
   631         else:
   630             values["name"] = self.VariableName.GetStringSelection()
   632             values["name"] = self.VariableName.GetStringSelection()
   641         if self.Expression.IsEnabled():
   643         if self.Expression.IsEnabled():
   642             value = expression
   644             value = expression
   643         else:
   645         else:
   644             value = self.VariableName.GetStringSelection()
   646             value = self.VariableName.GetStringSelection()
   645         if value == "":
   647         if value == "":
   646             message = wx.MessageDialog(self, "At least a variable or an expression must be selected!", "Error", wx.OK|wx.ICON_ERROR)
   648             message = wx.MessageDialog(self, _("At least a variable or an expression must be selected!"), _("Error"), wx.OK|wx.ICON_ERROR)
   647             message.ShowModal()
   649             message.ShowModal()
   648             message.Destroy()
   650             message.Destroy()
   649         elif value.upper() in IEC_KEYWORDS:
   651         elif value.upper() in IEC_KEYWORDS:
   650             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wx.OK|wx.ICON_ERROR)
   652             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%value, _("Error"), wx.OK|wx.ICON_ERROR)
   651             message.ShowModal()
   653             message.ShowModal()
   652             message.Destroy()
   654             message.Destroy()
   653         else:
   655         else:
   654             self.EndModal(wx.ID_OK)
   656             self.EndModal(wx.ID_OK)
   655 
   657 
   659         event.Skip()
   661         event.Skip()
   660 
   662 
   661     def OnNameChanged(self, event):
   663     def OnNameChanged(self, event):
   662         if self.VariableName.GetStringSelection() != "":
   664         if self.VariableName.GetStringSelection() != "":
   663             self.Expression.Enable(False)
   665             self.Expression.Enable(False)
   664         elif self.Class.GetStringSelection() == "Input":
   666         elif VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()] == INPUT:
   665             self.Expression.Enable(True)
   667             self.Expression.Enable(True)
   666         self.RefreshPreview()
   668         self.RefreshPreview()
   667         event.Skip()
   669         event.Skip()
   668     
   670     
   669     def OnExpressionChanged(self, event):
   671     def OnExpressionChanged(self, event):
   689             name = self.VariableName.GetStringSelection()
   691             name = self.VariableName.GetStringSelection()
   690         type = ""
   692         type = ""
   691         for var_name, var_type, value_type in self.VarList:
   693         for var_name, var_type, value_type in self.VarList:
   692             if var_name == name:
   694             if var_name == name:
   693                 type = value_type
   695                 type = value_type
   694         classtype = self.Class.GetStringSelection()
   696         classtype = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()]
   695         if classtype == "Input":
   697         self.Variable = FBD_Variable(self.Preview, classtype, name, type, executionOrder = self.ExecutionOrder.GetValue())
   696             self.Variable = FBD_Variable(self.Preview, INPUT, name, type, executionOrder = self.ExecutionOrder.GetValue())
       
   697         elif classtype == "Output":
       
   698             self.Variable = FBD_Variable(self.Preview, OUTPUT, name, type, executionOrder = self.ExecutionOrder.GetValue())
       
   699         elif classtype == "InOut":
       
   700             self.Variable = FBD_Variable(self.Preview, INOUT, name, type, executionOrder = self.ExecutionOrder.GetValue())
       
   701         width, height = self.MinVariableSize
   698         width, height = self.MinVariableSize
   702         min_width, min_height = self.Variable.GetMinSize()
   699         min_width, min_height = self.Variable.GetMinSize()
   703         width, height = max(min_width, width), max(min_height, height)
   700         width, height = max(min_width, width), max(min_height, height)
   704         self.Variable.SetSize(width, height)
   701         self.Variable.SetSize(width, height)
   705         clientsize = self.Preview.GetClientSize()
   702         clientsize = self.Preview.GetClientSize()
   782 
   779 
   783     def _init_ctrls(self, prnt, ctrler):
   780     def _init_ctrls(self, prnt, ctrler):
   784         wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG,
   781         wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG,
   785               name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   782               name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
   786               size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE,
   783               size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE,
   787               title='Connection Properties')
   784               title=_('Connection Properties'))
   788         self.SetClientSize(wx.Size(350, 220))
   785         self.SetClientSize(wx.Size(350, 220))
   789 
   786 
   790         self.staticText1 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1,
   787         self.staticText1 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1,
   791               label='Type:', name='staticText1', parent=self,
   788               label=_('Type:'), name='staticText1', parent=self,
   792               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   789               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   793 
   790 
   794         self.staticText2 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
   791         self.staticText2 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2,
   795               label='Name:', name='staticText2', parent=self,
   792               label=_('Name:'), name='staticText2', parent=self,
   796               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   793               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   797 
   794 
   798         self.staticText3 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
   795         self.staticText3 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3,
   799               label='Preview:', name='staticText3', parent=self,
   796               label=_('Preview:'), name='staticText3', parent=self,
   800               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   797               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   801 
   798 
   802         self.radioButton1 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
   799         self.radioButton1 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1,
   803               label='Connector', name='radioButton1', parent=self,
   800               label=_('Connector'), name='radioButton1', parent=self,
   804               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
   801               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
   805         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1)
   802         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1)
   806         self.radioButton1.SetValue(True)
   803         self.radioButton1.SetValue(True)
   807 
   804 
   808         self.radioButton2 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2,
   805         self.radioButton2 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2,
   809               label='Continuation', name='radioButton2', parent=self, 
   806               label=_('Continuation'), name='radioButton2', parent=self, 
   810               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   807               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   811         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2)
   808         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2)
   812         self.radioButton2.SetValue(False)
   809         self.radioButton2.SetValue(False)
   813         
   810         
   814         self.ConnectionName = wx.TextCtrl(id=ID_CONNECTIONPROPERTIESDIALOGNAME,
   811         self.ConnectionName = wx.TextCtrl(id=ID_CONNECTIONPROPERTIESDIALOGNAME,
   880         self.PouElementNames = [element_name.upper() for element_name in element_names]
   877         self.PouElementNames = [element_name.upper() for element_name in element_names]
   881 
   878 
   882     def OnOK(self, event):
   879     def OnOK(self, event):
   883         connection_name = self.ConnectionName.GetValue()
   880         connection_name = self.ConnectionName.GetValue()
   884         if connection_name == "":
   881         if connection_name == "":
   885             message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR)
   882             message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR)
   886             message.ShowModal()
   883             message.ShowModal()
   887             message.Destroy()
   884             message.Destroy()
   888         elif not TestIdentifier(connection_name):
   885         elif not TestIdentifier(connection_name):
   889             message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%connection_name, "Error", wx.OK|wx.ICON_ERROR)
   886             message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR)
   890             message.ShowModal()
   887             message.ShowModal()
   891             message.Destroy()
   888             message.Destroy()
   892         elif connection_name.upper() in IEC_KEYWORDS:
   889         elif connection_name.upper() in IEC_KEYWORDS:
   893             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%connection_name, "Error", wx.OK|wx.ICON_ERROR)
   890             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR)
   894             message.ShowModal()
   891             message.ShowModal()
   895             message.Destroy()
   892             message.Destroy()
   896         elif connection_name.upper() in self.PouNames:
   893         elif connection_name.upper() in self.PouNames:
   897             message = wx.MessageDialog(self, "\"%s\" pou already exists!"%connection_name, "Error", wx.OK|wx.ICON_ERROR)
   894             message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR)
   898             message.ShowModal()
   895             message.ShowModal()
   899             message.Destroy()
   896             message.Destroy()
   900         elif connection_name.upper() in self.PouElementNames:
   897         elif connection_name.upper() in self.PouElementNames:
   901             message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%connection_name, "Error", wx.OK|wx.ICON_ERROR)
   898             message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR)
   902             message.ShowModal()
   899             message.ShowModal()
   903             message.Destroy()
   900             message.Destroy()
   904         else:
   901         else:
   905             self.EndModal(wx.ID_OK)
   902             self.EndModal(wx.ID_OK)
   906 
   903 
  1020               size=wx.Size(350, 260 + extra_size), style=wx.DEFAULT_DIALOG_STYLE,
  1017               size=wx.Size(350, 260 + extra_size), style=wx.DEFAULT_DIALOG_STYLE,
  1021               title=title)
  1018               title=title)
  1022         self.SetClientSize(wx.Size(350, 260 + extra_size))
  1019         self.SetClientSize(wx.Size(350, 260 + extra_size))
  1023 
  1020 
  1024         self.staticText1 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT1,
  1021         self.staticText1 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT1,
  1025               label='Modifier:', name='staticText1', parent=self,
  1022               label=_('Modifier:'), name='staticText1', parent=self,
  1026               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1023               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1027 
  1024 
  1028         self.staticText2 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT2,
  1025         self.staticText2 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT2,
  1029               label='Name:', name='staticText2', parent=self,
  1026               label=_('Name:'), name='staticText2', parent=self,
  1030               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1027               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1031 
  1028 
  1032         self.staticText3 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT3,
  1029         self.staticText3 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT3,
  1033               label='Preview:', name='staticText3', parent=self,
  1030               label=_('Preview:'), name='staticText3', parent=self,
  1034               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1031               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1035 
  1032 
  1036         self.radioButton1 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON1,
  1033         self.radioButton1 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON1,
  1037               label="Normal", name='radioButton1', parent=self,
  1034               label=_("Normal"), name='radioButton1', parent=self,
  1038               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1035               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1039         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON1)
  1036         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON1)
  1040         self.radioButton1.SetValue(True)
  1037         self.radioButton1.SetValue(True)
  1041 
  1038 
  1042         self.radioButton2 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON2,
  1039         self.radioButton2 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON2,
  1043               label="Negated", name='radioButton2', parent=self, 
  1040               label=_("Negated"), name='radioButton2', parent=self, 
  1044               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1041               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1045         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON2)
  1042         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON2)
  1046 
  1043 
  1047         self.radioButton3 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON3,
  1044         self.radioButton3 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON3,
  1048               label="Set", name='radioButton3', parent=self,
  1045               label=_("Set"), name='radioButton3', parent=self,
  1049               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1046               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1050         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON3)
  1047         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON3)
  1051 
  1048 
  1052         self.radioButton4 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON4,
  1049         self.radioButton4 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON4,
  1053               label="Reset", name='radioButton4', parent=self, 
  1050               label=_("Reset"), name='radioButton4', parent=self, 
  1054               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1051               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1055         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON4)
  1052         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON4)
  1056 
  1053 
  1057         self.radioButton5 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON5,
  1054         self.radioButton5 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON5,
  1058               label="Rising Edge", name='radioButton5', parent=self, 
  1055               label=_("Rising Edge"), name='radioButton5', parent=self, 
  1059               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1056               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1060         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON5)
  1057         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON5)
  1061 
  1058 
  1062         self.radioButton6 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON6,
  1059         self.radioButton6 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON6,
  1063               label="Falling Edge", name='radioButton6', parent=self, 
  1060               label=_("Falling Edge"), name='radioButton6', parent=self, 
  1064               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1061               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1065         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON6)
  1062         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON6)
  1066 
  1063 
  1067         self.ElementName = wx.ComboBox(id=ID_LDELEMENTDIALOGNAME,
  1064         self.ElementName = wx.ComboBox(id=ID_LDELEMENTDIALOGNAME,
  1068               name='Name', parent=self, pos=wx.Point(0, 0),
  1065               name='Name', parent=self, pos=wx.Point(0, 0),
  1091         self._init_sizers()
  1088         self._init_sizers()
  1092 
  1089 
  1093     def __init__(self, parent, controler, type):
  1090     def __init__(self, parent, controler, type):
  1094         self.Type = type
  1091         self.Type = type
  1095         if type == "contact":
  1092         if type == "contact":
  1096             self._init_ctrls(parent, controler, "Edit Contact Values")
  1093             self._init_ctrls(parent, controler, _("Edit Contact Values"))
  1097             self.Element = LD_Contact(self.Preview, CONTACT_NORMAL, "")
  1094             self.Element = LD_Contact(self.Preview, CONTACT_NORMAL, "")
  1098             self.radioButton3.Hide()
  1095             self.radioButton3.Hide()
  1099             self.radioButton4.Hide()
  1096             self.radioButton4.Hide()
  1100         elif type == "coil":
  1097         elif type == "coil":
  1101             self._init_ctrls(parent, controler, "Edit Coil Values", 50)
  1098             self._init_ctrls(parent, controler, _("Edit Coil Values"), 50)
  1102             self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
  1099             self.Element = LD_Coil(self.Preview, COIL_NORMAL, "")
  1103             
  1100             
  1104     
  1101     
  1105     def SetPreviewFont(self, font):
  1102     def SetPreviewFont(self, font):
  1106         self.Preview.SetFont(font)
  1103         self.Preview.SetFont(font)
  1269 
  1266 
  1270     def _init_ctrls(self, prnt, ctrler):
  1267     def _init_ctrls(self, prnt, ctrler):
  1271         wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG,
  1268         wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG,
  1272               name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223),
  1269               name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223),
  1273               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
  1270               size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE,
  1274               title='Power Rail Properties')
  1271               title=_('Power Rail Properties'))
  1275         self.SetClientSize(wx.Size(350, 260))
  1272         self.SetClientSize(wx.Size(350, 260))
  1276 
  1273 
  1277         self.staticText1 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT1,
  1274         self.staticText1 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT1,
  1278               label='Type:', name='staticText1', parent=self,
  1275               label=_('Type:'), name='staticText1', parent=self,
  1279               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1276               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1280 
  1277 
  1281         self.staticText2 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT2,
  1278         self.staticText2 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT2,
  1282               label='Pin number:', name='staticText2', parent=self,
  1279               label=_('Pin number:'), name='staticText2', parent=self,
  1283               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1280               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1284 
  1281 
  1285         self.staticText3 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT3,
  1282         self.staticText3 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT3,
  1286               label='Preview:', name='staticText3', parent=self,
  1283               label=_('Preview:'), name='staticText3', parent=self,
  1287               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1284               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1288 
  1285 
  1289         self.radioButton1 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON1,
  1286         self.radioButton1 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON1,
  1290               label='Left PowerRail', name='radioButton1', parent=self,
  1287               label=_('Left PowerRail'), name='radioButton1', parent=self,
  1291               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1288               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1292         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON1)
  1289         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON1)
  1293         self.radioButton1.SetValue(True)
  1290         self.radioButton1.SetValue(True)
  1294 
  1291 
  1295         self.radioButton2 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON2,
  1292         self.radioButton2 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON2,
  1296               label='Right PowerRail', name='radioButton2', parent=self, 
  1293               label=_('Right PowerRail'), name='radioButton2', parent=self, 
  1297               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1294               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1298         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON2)
  1295         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON2)
  1299 
  1296 
  1300         self.PinNumber = wx.SpinCtrl(id=ID_LDPOWERRAILDIALOGPINNUMBER,
  1297         self.PinNumber = wx.SpinCtrl(id=ID_LDPOWERRAILDIALOGPINNUMBER,
  1301               name='PinNumber', parent=self, pos=wx.Point(0, 0),
  1298               name='PinNumber', parent=self, pos=wx.Point(0, 0),
  1449 
  1446 
  1450     def _init_ctrls(self, prnt, ctrler):
  1447     def _init_ctrls(self, prnt, ctrler):
  1451         wx.Dialog.__init__(self, id=ID_STEPCONTENTDIALOG,
  1448         wx.Dialog.__init__(self, id=ID_STEPCONTENTDIALOG,
  1452               name='StepContentDialog', parent=prnt, pos=wx.Point(376, 223),
  1449               name='StepContentDialog', parent=prnt, pos=wx.Point(376, 223),
  1453               size=wx.Size(400, 250), style=wx.DEFAULT_DIALOG_STYLE,
  1450               size=wx.Size(400, 250), style=wx.DEFAULT_DIALOG_STYLE,
  1454               title='Edit Step')
  1451               title=_('Edit Step'))
  1455         self.SetClientSize(wx.Size(400, 250))
  1452         self.SetClientSize(wx.Size(400, 250))
  1456 
  1453 
  1457         self.staticText1 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT1,
  1454         self.staticText1 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT1,
  1458               label='Name:', name='staticText1', parent=self,
  1455               label=_('Name:'), name='staticText1', parent=self,
  1459               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1456               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1460 
  1457 
  1461         self.staticText2 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT2,
  1458         self.staticText2 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT2,
  1462               label='Connectors:', name='staticText2', parent=self,
  1459               label=_('Connectors:'), name='staticText2', parent=self,
  1463               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1460               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1464 
  1461 
  1465         self.staticText3 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT3,
  1462         self.staticText3 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT3,
  1466               label='Preview:', name='staticText4', parent=self,
  1463               label=_('Preview:'), name='staticText4', parent=self,
  1467               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1464               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1468 
  1465 
  1469         self.StepName = wx.TextCtrl(id=ID_STEPCONTENTDIALOGNAME,
  1466         self.StepName = wx.TextCtrl(id=ID_STEPCONTENTDIALOGNAME,
  1470               name='Name', parent=self, pos=wx.Point(0, 0),
  1467               name='Name', parent=self, pos=wx.Point(0, 0),
  1471               size=wx.Size(0, 24), style=0)
  1468               size=wx.Size(0, 24), style=0)
  1472         self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_STEPCONTENTDIALOGNAME)
  1469         self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_STEPCONTENTDIALOGNAME)
  1473 
  1470 
  1474         self.checkBox1 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX1,
  1471         self.checkBox1 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX1,
  1475               label="Input", name='checkBox1', parent=self,
  1472               label=_("Input"), name='checkBox1', parent=self,
  1476               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1473               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1477         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX1)
  1474         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX1)
  1478         
  1475         
  1479         self.checkBox2 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX2,
  1476         self.checkBox2 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX2,
  1480               label="Output", name='checkBox2', parent=self,
  1477               label=_("Output"), name='checkBox2', parent=self,
  1481               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1478               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1482         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX2)
  1479         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX2)
  1483         
  1480         
  1484         self.checkBox3 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX3,
  1481         self.checkBox3 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX3,
  1485               label="Action", name='checkBox3', parent=self,
  1482               label=_("Action"), name='checkBox3', parent=self,
  1486               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1483               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1487         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX3)
  1484         self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX3)
  1488         
  1485         
  1489         self.Spacer = wx.Panel(id=ID_STEPCONTENTDIALOGSPACER,
  1486         self.Spacer = wx.Panel(id=ID_STEPCONTENTDIALOGSPACER,
  1490               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1487               name='Spacer', parent=self, pos=wx.Point(0, 0),
  1523         self.Preview.SetFont(font)
  1520         self.Preview.SetFont(font)
  1524     
  1521     
  1525     def OnOK(self, event):
  1522     def OnOK(self, event):
  1526         step_name = self.StepName.GetValue()
  1523         step_name = self.StepName.GetValue()
  1527         if step_name == "":
  1524         if step_name == "":
  1528             message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
  1525             message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR)
  1529             message.ShowModal()
  1526             message.ShowModal()
  1530             message.Destroy()
  1527             message.Destroy()
  1531         elif not TestIdentifier(step_name):
  1528         elif not TestIdentifier(step_name):
  1532             message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  1529             message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  1533             message.ShowModal()
  1530             message.ShowModal()
  1534             message.Destroy()
  1531             message.Destroy()
  1535         elif step_name.upper() in IEC_KEYWORDS:
  1532         elif step_name.upper() in IEC_KEYWORDS:
  1536             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  1533             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  1537             message.ShowModal()
  1534             message.ShowModal()
  1538             message.Destroy()
  1535             message.Destroy()
  1539         elif step_name.upper() in self.PouNames:
  1536         elif step_name.upper() in self.PouNames:
  1540             message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  1537             message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  1541             message.ShowModal()
  1538             message.ShowModal()
  1542             message.Destroy()
  1539             message.Destroy()
  1543         elif step_name.upper() in self.Variables:
  1540         elif step_name.upper() in self.Variables:
  1544             message = wx.MessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  1541             message = wx.MessageDialog(self, _("A variable with \"%s\" as name already exists in this pou!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  1545             message.ShowModal()
  1542             message.ShowModal()
  1546             message.Destroy()
  1543             message.Destroy()
  1547         elif step_name.upper() in self.StepNames:
  1544         elif step_name.upper() in self.StepNames:
  1548             message = wx.MessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  1545             message = wx.MessageDialog(self, _("\"%s\" step already exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  1549             message.ShowModal()
  1546             message.ShowModal()
  1550             message.Destroy()
  1547             message.Destroy()
  1551         else:
  1548         else:
  1552             self.EndModal(wx.ID_OK)
  1549             self.EndModal(wx.ID_OK)
  1553     
  1550     
  1696 
  1693 
  1697     def _init_ctrls(self, prnt, ctrler):
  1694     def _init_ctrls(self, prnt, ctrler):
  1698         wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG,
  1695         wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG,
  1699               name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
  1696               name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223),
  1700               size=wx.Size(350, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1697               size=wx.Size(350, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1701               title='Edit transition')
  1698               title=_('Edit transition'))
  1702         self.SetClientSize(wx.Size(350, 300))
  1699         self.SetClientSize(wx.Size(350, 300))
  1703 
  1700 
  1704         self.staticText1 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT1,
  1701         self.staticText1 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT1,
  1705               label='Type:', name='staticText1', parent=self,
  1702               label=_('Type:'), name='staticText1', parent=self,
  1706               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1703               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1707 
  1704 
  1708         self.staticText2 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT2,
  1705         self.staticText2 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT2,
  1709               label='Preview:', name='staticText2', parent=self,
  1706               label=_('Preview:'), name='staticText2', parent=self,
  1710               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1707               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1711 
  1708 
  1712         self.staticText3 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT3,
  1709         self.staticText3 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT3,
  1713               label='Priority:', name='staticText3', parent=self,
  1710               label=_('Priority:'), name='staticText3', parent=self,
  1714               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1711               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1715         
  1712         
  1716         self.radioButton1 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1,
  1713         self.radioButton1 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1,
  1717               label='Reference', name='radioButton1', parent=self,
  1714               label=_('Reference'), name='radioButton1', parent=self,
  1718               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1715               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1719         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1)
  1716         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1)
  1720         self.radioButton1.SetValue(True)
  1717         self.radioButton1.SetValue(True)
  1721 
  1718 
  1722         self.Reference = wx.ComboBox(id=ID_TRANSITIONCONTENTDIALOGREFERENCE,
  1719         self.Reference = wx.ComboBox(id=ID_TRANSITIONCONTENTDIALOGREFERENCE,
  1723               name='Reference', parent=self, pos=wx.Point(0, 0), 
  1720               name='Reference', parent=self, pos=wx.Point(0, 0), 
  1724               size=wx.Size(0, 28), style=wx.CB_READONLY)
  1721               size=wx.Size(0, 28), style=wx.CB_READONLY)
  1725         self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, id=ID_TRANSITIONCONTENTDIALOGREFERENCE)
  1722         self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, id=ID_TRANSITIONCONTENTDIALOGREFERENCE)
  1726 
  1723 
  1727         self.radioButton2 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2,
  1724         self.radioButton2 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2,
  1728               label='Inline', name='radioButton2', parent=self,
  1725               label=_('Inline'), name='radioButton2', parent=self,
  1729               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1726               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1730         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2)
  1727         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2)
  1731         self.radioButton2.SetValue(False)
  1728         self.radioButton2.SetValue(False)
  1732 
  1729 
  1733         self.Inline = wx.TextCtrl(id=ID_TRANSITIONCONTENTDIALOGINLINE,
  1730         self.Inline = wx.TextCtrl(id=ID_TRANSITIONCONTENTDIALOGINLINE,
  1735               size=wx.Size(0, 24), style=0)
  1732               size=wx.Size(0, 24), style=0)
  1736         self.Bind(wx.EVT_TEXT, self.OnInlineChanged, id=ID_TRANSITIONCONTENTDIALOGINLINE)
  1733         self.Bind(wx.EVT_TEXT, self.OnInlineChanged, id=ID_TRANSITIONCONTENTDIALOGINLINE)
  1737         self.Inline.Enable(False)
  1734         self.Inline.Enable(False)
  1738         
  1735         
  1739         self.radioButton3 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3,
  1736         self.radioButton3 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3,
  1740               label='Connection', name='radioButton3', parent=self,
  1737               label=_('Connection'), name='radioButton3', parent=self,
  1741               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1738               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1742         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3)
  1739         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3)
  1743         self.radioButton3.SetValue(False)
  1740         self.radioButton3.SetValue(False)
  1744         if not self.Connection:
  1741         if not self.Connection:
  1745             self.radioButton3.Hide()
  1742             self.radioButton3.Hide()
  1789         self.Element.SetSize(width, height)
  1786         self.Element.SetSize(width, height)
  1790     
  1787     
  1791     def OnOK(self, event):
  1788     def OnOK(self, event):
  1792         error = []
  1789         error = []
  1793         if self.radioButton1.GetValue() and self.Reference.GetStringSelection() == "":
  1790         if self.radioButton1.GetValue() and self.Reference.GetStringSelection() == "":
  1794             error.append("Reference")
  1791             error.append(_("Reference"))
  1795         if self.radioButton2.GetValue() and self.Inline.GetValue() == "":
  1792         if self.radioButton2.GetValue() and self.Inline.GetValue() == "":
  1796             error.append("Inline")
  1793             error.append(_("Inline"))
  1797         if len(error) > 0:
  1794         if len(error) > 0:
  1798             text = ""
  1795             text = ""
  1799             for i, item in enumerate(error):
  1796             for i, item in enumerate(error):
  1800                 if i == 0:
  1797                 if i == 0:
  1801                     text += item
  1798                     text += item
  1802                 elif i == len(error) - 1:
  1799                 elif i == len(error) - 1:
  1803                     text += " and %s"%item
  1800                     text += _(" and %s")%item
  1804                 else:
  1801                 else:
  1805                     text += ", %s"%item 
  1802                     text += _(", %s")%item 
  1806             message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
  1803             message = wx.MessageDialog(self, _("Form isn't complete. %s must be filled!")%text, _("Error"), wx.OK|wx.ICON_ERROR)
  1807             message.ShowModal()
  1804             message.ShowModal()
  1808             message.Destroy()
  1805             message.Destroy()
  1809         else:
  1806         else:
  1810             self.EndModal(wx.ID_OK)
  1807             self.EndModal(wx.ID_OK)
  1811 
  1808 
  1974     
  1971     
  1975     def _init_ctrls(self, prnt, ctrler):
  1972     def _init_ctrls(self, prnt, ctrler):
  1976         wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG,
  1973         wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG,
  1977               name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
  1974               name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223),
  1978               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1975               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE,
  1979               title='Create a new divergence or convergence')
  1976               title=_('Create a new divergence or convergence'))
  1980         self.SetClientSize(wx.Size(500, 300))
  1977         self.SetClientSize(wx.Size(500, 300))
  1981 
  1978 
  1982         self.staticText1 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT1,
  1979         self.staticText1 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT1,
  1983               label='Type:', name='staticText1', parent=self,
  1980               label=_('Type:'), name='staticText1', parent=self,
  1984               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1981               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  1985 
  1982 
  1986         self.radioButton1 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1,
  1983         self.radioButton1 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1,
  1987               label='Selection Divergence', name='radioButton1', parent=self,
  1984               label=_('Selection Divergence'), name='radioButton1', parent=self,
  1988               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1985               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP)
  1989         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1)
  1986         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1)
  1990         self.radioButton1.SetValue(True)
  1987         self.radioButton1.SetValue(True)
  1991 
  1988 
  1992         self.radioButton2 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
  1989         self.radioButton2 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2,
  1993               label='Selection Convergence', name='radioButton2', parent=self, 
  1990               label=_('Selection Convergence'), name='radioButton2', parent=self, 
  1994               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1991               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1995         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2)
  1992         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2)
  1996         self.radioButton2.SetValue(False)
  1993         self.radioButton2.SetValue(False)
  1997 
  1994 
  1998         self.radioButton3 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3,
  1995         self.radioButton3 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3,
  1999               label='Simultaneous Divergence', name='radioButton3', parent=self,
  1996               label=_('Simultaneous Divergence'), name='radioButton3', parent=self,
  2000               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  1997               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  2001         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3)
  1998         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3)
  2002         self.radioButton3.SetValue(False)
  1999         self.radioButton3.SetValue(False)
  2003 
  2000 
  2004         self.radioButton4 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
  2001         self.radioButton4 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4,
  2005               label='Simultaneous Convergence', name='radioButton4', parent=self, 
  2002               label=_('Simultaneous Convergence'), name='radioButton4', parent=self, 
  2006               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  2003               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
  2007         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4)
  2004         self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4)
  2008         self.radioButton4.SetValue(False)
  2005         self.radioButton4.SetValue(False)
  2009 
  2006 
  2010         self.staticText2 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT2,
  2007         self.staticText2 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT2,
  2011               label='Number of sequences:', name='staticText2', parent=self,
  2008               label=_('Number of sequences:'), name='staticText2', parent=self,
  2012               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2009               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2013 
  2010 
  2014         self.Sequences = wx.SpinCtrl(id=ID_DIVERGENCECREATEDIALOGSEQUENCES,
  2011         self.Sequences = wx.SpinCtrl(id=ID_DIVERGENCECREATEDIALOGSEQUENCES,
  2015               name='Sequences', parent=self, pos=wx.Point(0, 0),
  2012               name='Sequences', parent=self, pos=wx.Point(0, 0),
  2016               size=wx.Size(0, 24), style=0, min=2, max=20)
  2013               size=wx.Size(0, 24), style=0, min=2, max=20)
  2017         self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, id=ID_DIVERGENCECREATEDIALOGSEQUENCES)
  2014         self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, id=ID_DIVERGENCECREATEDIALOGSEQUENCES)
  2018 
  2015 
  2019         self.staticText3 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT3,
  2016         self.staticText3 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT3,
  2020               label='Preview:', name='staticText3', parent=self,
  2017               label=_('Preview:'), name='staticText3', parent=self,
  2021               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2018               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2022 
  2019 
  2023         self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW,
  2020         self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW,
  2024               name='Preview', parent=self, pos=wx.Point(0, 0),
  2021               name='Preview', parent=self, pos=wx.Point(0, 0),
  2025               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  2022               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL|wx.SIMPLE_BORDER)
  2100 
  2097 
  2101 
  2098 
  2102 #-------------------------------------------------------------------------------
  2099 #-------------------------------------------------------------------------------
  2103 #                            Action Block Dialog
  2100 #                            Action Block Dialog
  2104 #-------------------------------------------------------------------------------
  2101 #-------------------------------------------------------------------------------
       
  2102 
       
  2103 def GetActionTableColnames():
       
  2104     _ = lambda x: x
       
  2105     return [_("Qualifier"), _("Duration"), _("Type"), _("Value"), _("Indicator")]
       
  2106 
       
  2107 def GetTypeList():
       
  2108     _ = lambda x: x
       
  2109     return [_("Action"), _("Variable"), _("Inline")]
  2105 
  2110 
  2106 class ActionTable(wx.grid.PyGridTableBase):
  2111 class ActionTable(wx.grid.PyGridTableBase):
  2107     
  2112     
  2108     """
  2113     """
  2109     A custom wx.Grid Table using user supplied data
  2114     A custom wx.Grid Table using user supplied data
  2124         return len(self.colnames)
  2129         return len(self.colnames)
  2125         
  2130         
  2126     def GetNumberRows(self):
  2131     def GetNumberRows(self):
  2127         return len(self.data)
  2132         return len(self.data)
  2128 
  2133 
  2129     def GetColLabelValue(self, col):
  2134     def GetColLabelValue(self, col, translate=True):
  2130         if col < len(self.colnames):
  2135         if col < len(self.colnames):
  2131             return self.colnames[col]
  2136             colname = self.colnames[col]
  2132 
  2137             if translate:
  2133     def GetRowLabelValues(self, row):
  2138 		return _(colname)
       
  2139 	    return colname
       
  2140 
       
  2141     def GetRowLabelValues(self, row, translate=True):
  2134         return row
  2142         return row
  2135 
  2143 
  2136     def GetValue(self, row, col):
  2144     def GetValue(self, row, col):
  2137         if row < self.GetNumberRows():
  2145         if row < self.GetNumberRows():
  2138             name = str(self.data[row].get(self.GetColLabelValue(col), ""))
  2146             colname = self.GetColLabelValue(col, False)
       
  2147             name = str(self.data[row].get(colname, ""))
       
  2148             if colname == "Type":
       
  2149                 return _(name)
  2139             return name
  2150             return name
  2140     
  2151     
  2141     def GetValueByName(self, row, colname):
  2152     def GetValueByName(self, row, colname):
  2142         return self.data[row].get(colname)
  2153         return self.data[row].get(colname)
  2143 
  2154 
  2144     def SetValue(self, row, col, value):
  2155     def SetValue(self, row, col, value):
  2145         if col < len(self.colnames):
  2156         if col < len(self.colnames):
  2146             self.data[row][self.GetColLabelValue(col)] = value
  2157             colname = self.GetColLabelValue(col, False)
       
  2158             if colname == "Type":
       
  2159                 value = self.Parent.TranslateType[value]
       
  2160             self.data[row][colname] = value
  2147         
  2161         
  2148     def ResetView(self, grid):
  2162     def ResetView(self, grid):
  2149         """
  2163         """
  2150         (wx.Grid) -> Reset the grid view.   Call this to
  2164         (wx.Grid) -> Reset the grid view.   Call this to
  2151         update the grid if rows and columns have been added or deleted
  2165         update the grid if rows and columns have been added or deleted
  2185         appropriate renderer given the column name.
  2199         appropriate renderer given the column name.
  2186 
  2200 
  2187         Otherwise default to the default renderer.
  2201         Otherwise default to the default renderer.
  2188         """
  2202         """
  2189         
  2203         
  2190         for col in range(self.GetNumberCols()):
       
  2191             attr = wx.grid.GridCellAttr()
       
  2192             attr.SetAlignment(self.Parent.ColAlignements[col], wx.ALIGN_CENTRE)
       
  2193             grid.SetColAttr(col, attr)
       
  2194             grid.SetColSize(col, self.Parent.ColSizes[col])
       
  2195         
       
  2196         typelist = None
       
  2197         accesslist = None
       
  2198         for row in range(self.GetNumberRows()):
  2204         for row in range(self.GetNumberRows()):
  2199             for col in range(self.GetNumberCols()):
  2205             for col in range(self.GetNumberCols()):
  2200                 editor = None
  2206                 editor = None
  2201                 renderer = None
  2207                 renderer = None
  2202                 readonly = False
  2208                 readonly = False
  2203                 colname = self.GetColLabelValue(col)
  2209                 colname = self.GetColLabelValue(col, False)
  2204                 if colname == "Qualifier":
  2210                 if colname == "Qualifier":
  2205                     editor = wx.grid.GridCellChoiceEditor()
  2211                     editor = wx.grid.GridCellChoiceEditor()
  2206                     editor.SetParameters(self.Parent.QualifierList)
  2212                     editor.SetParameters(self.Parent.QualifierList)
  2207                 if colname == "Duration":
  2213                 if colname == "Duration":
  2208                     editor = wx.grid.GridCellTextEditor()
  2214                     editor = wx.grid.GridCellTextEditor()
  2317     
  2323     
  2318     def _init_ctrls(self, prnt):
  2324     def _init_ctrls(self, prnt):
  2319         wx.Dialog.__init__(self, id=ID_ACTIONBLOCKDIALOG,
  2325         wx.Dialog.__init__(self, id=ID_ACTIONBLOCKDIALOG,
  2320               name='ActionBlockDialog', parent=prnt, pos=wx.Point(376, 223),
  2326               name='ActionBlockDialog', parent=prnt, pos=wx.Point(376, 223),
  2321               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
  2327               size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
  2322               title='Edit action block properties')
  2328               title=_('Edit action block properties'))
  2323         self.SetClientSize(wx.Size(500, 300))
  2329         self.SetClientSize(wx.Size(500, 300))
  2324 
  2330 
  2325         self.staticText1 = wx.StaticText(id=ID_ACTIONBLOCKDIALOGSTATICTEXT1,
  2331         self.staticText1 = wx.StaticText(id=ID_ACTIONBLOCKDIALOGSTATICTEXT1,
  2326               label='Actions:', name='staticText1', parent=self,
  2332               label=_('Actions:'), name='staticText1', parent=self,
  2327               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2333               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
  2328 
  2334 
  2329         self.ActionsGrid = wx.grid.Grid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID,
  2335         self.ActionsGrid = wx.grid.Grid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID,
  2330               name='ActionsGrid', parent=self, pos=wx.Point(0, 0), 
  2336               name='ActionsGrid', parent=self, pos=wx.Point(0, 0), 
  2331               size=wx.Size(0, 0), style=wx.VSCROLL)
  2337               size=wx.Size(0, 0), style=wx.VSCROLL)
  2335               False, 'Sans'))
  2341               False, 'Sans'))
  2336         self.ActionsGrid.DisableDragGridSize()
  2342         self.ActionsGrid.DisableDragGridSize()
  2337         self.ActionsGrid.EnableScrolling(False, True)
  2343         self.ActionsGrid.EnableScrolling(False, True)
  2338         self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnActionsGridCellChange)
  2344         self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnActionsGridCellChange)
  2339 
  2345 
  2340         self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label='Add',
  2346         self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label=_('Add'),
  2341               name='AddButton', parent=self, pos=wx.Point(0, 0),
  2347               name='AddButton', parent=self, pos=wx.Point(0, 0),
  2342               size=wx.Size(72, 32), style=0)
  2348               size=wx.DefaultSize, style=0)
  2343         self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_ACTIONBLOCKDIALOGADDBUTTON)
  2349         self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_ACTIONBLOCKDIALOGADDBUTTON)
  2344 
  2350 
  2345         self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label='Delete',
  2351         self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label=_('Delete'),
  2346               name='DeleteButton', parent=self, pos=wx.Point(0, 0),
  2352               name='DeleteButton', parent=self, pos=wx.Point(0, 0),
  2347               size=wx.Size(72, 32), style=0)
  2353               size=wx.DefaultSize, style=0)
  2348         self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_ACTIONBLOCKDIALOGDELETEBUTTON)
  2354         self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_ACTIONBLOCKDIALOGDELETEBUTTON)
  2349 
  2355 
  2350         self.UpButton = wx.Button(id=ID_ACTIONBLOCKDIALOGUPBUTTON, label='^',
  2356         self.UpButton = wx.Button(id=ID_ACTIONBLOCKDIALOGUPBUTTON, label='^',
  2351               name='UpButton', parent=self, pos=wx.Point(0, 0),
  2357               name='UpButton', parent=self, pos=wx.Point(0, 0),
  2352               size=wx.Size(32, 32), style=0)
  2358               size=wx.Size(32, 32), style=0)
  2367 
  2373 
  2368     def __init__(self, parent):
  2374     def __init__(self, parent):
  2369         self._init_ctrls(parent)
  2375         self._init_ctrls(parent)
  2370         
  2376         
  2371         self.DefaultValue = {"Qualifier" : "N", "Duration" : "", "Type" : "Action", "Value" : "", "Indicator" : ""}
  2377         self.DefaultValue = {"Qualifier" : "N", "Duration" : "", "Type" : "Action", "Value" : "", "Indicator" : ""}
  2372         self.Table = ActionTable(self, [], ["Qualifier","Duration","Type","Value","Indicator"])
  2378         self.Table = ActionTable(self, [], GetActionTableColnames())
  2373         self.TypeList = "Action,Variable,Inline"
  2379         typelist = GetTypeList()       
       
  2380         self.TypeList = ",".join(map(_,typelist))
       
  2381         self.TranslateType = dict([(_(value), value) for value in typelist])
  2374         self.ColSizes = [60, 90, 80, 110, 80]
  2382         self.ColSizes = [60, 90, 80, 110, 80]
  2375         self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
  2383         self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
  2376         
  2384         
  2377         self.ActionsGrid.SetTable(self.Table)
  2385         self.ActionsGrid.SetTable(self.Table)
  2378         self.ActionsGrid.SetRowLabelSize(0)
  2386         self.ActionsGrid.SetRowLabelSize(0)
       
  2387         
       
  2388         for col in range(self.Table.GetNumberCols()):
       
  2389             attr = wx.grid.GridCellAttr()
       
  2390             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
       
  2391             self.ActionsGrid.SetColAttr(col, attr)
       
  2392             self.ActionsGrid.SetColMinimalWidth(col, self.ColSizes[col])
       
  2393             self.ActionsGrid.AutoSizeColumn(col, False)
  2379         
  2394         
  2380         self.Table.ResetView(self.ActionsGrid)
  2395         self.Table.ResetView(self.ActionsGrid)
  2381 
  2396 
  2382     def OnOK(self, event):
  2397     def OnOK(self, event):
  2383         self.ActionsGrid.SetGridCursor(0, 0)
  2398         self.ActionsGrid.SetGridCursor(0, 0)
  2488             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  2503             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  2489     
  2504     
  2490     def OnOK(self, event):
  2505     def OnOK(self, event):
  2491         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2506         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2492         if step_name == "":
  2507         if step_name == "":
  2493             message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
  2508             message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR)
  2494             message.ShowModal()
  2509             message.ShowModal()
  2495             message.Destroy()
  2510             message.Destroy()
  2496         elif not TestIdentifier(step_name):
  2511         elif not TestIdentifier(step_name):
  2497             message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2512             message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2498             message.ShowModal()
  2513             message.ShowModal()
  2499             message.Destroy()
  2514             message.Destroy()
  2500         elif step_name.upper() in IEC_KEYWORDS:
  2515         elif step_name.upper() in IEC_KEYWORDS:
  2501             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2516             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2502             message.ShowModal()
  2517             message.ShowModal()
  2503             message.Destroy()
  2518             message.Destroy()
  2504         elif step_name.upper() in self.PouNames:
  2519         elif step_name.upper() in self.PouNames:
  2505             message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2520             message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2506             message.ShowModal()
  2521             message.ShowModal()
  2507             message.Destroy()
  2522             message.Destroy()
  2508         elif step_name.upper() in self.Variables:
  2523         elif step_name.upper() in self.Variables:
  2509             message = wx.MessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2524             message = wx.MessageDialog(self, _("A variable with \"%s\" as name already exists in this pou!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2510             message.ShowModal()
  2525             message.ShowModal()
  2511             message.Destroy()
  2526             message.Destroy()
  2512         elif step_name.upper() in self.StepNames:
  2527         elif step_name.upper() in self.StepNames:
  2513             message = wx.MessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2528             message = wx.MessageDialog(self, _("\"%s\" step already exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2514             message.ShowModal()
  2529             message.ShowModal()
  2515             message.Destroy()
  2530             message.Destroy()
  2516         else:
  2531         else:
  2517             self.EndModal(wx.ID_OK)
  2532             self.EndModal(wx.ID_OK)
  2518 
  2533 
  2555             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  2570             self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
  2556     
  2571     
  2557     def OnOK(self, event):
  2572     def OnOK(self, event):
  2558         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2573         step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
  2559         if step_name == "":
  2574         if step_name == "":
  2560             message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR)
  2575             message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR)
  2561             message.ShowModal()
  2576             message.ShowModal()
  2562             message.Destroy()
  2577             message.Destroy()
  2563         elif not TestIdentifier(step_name):
  2578         elif not TestIdentifier(step_name):
  2564             message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2579             message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2565             message.ShowModal()
  2580             message.ShowModal()
  2566             message.Destroy()
  2581             message.Destroy()
  2567         elif step_name.upper() in IEC_KEYWORDS:
  2582         elif step_name.upper() in IEC_KEYWORDS:
  2568             message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2583             message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2569             message.ShowModal()
  2584             message.ShowModal()
  2570             message.Destroy()
  2585             message.Destroy()
  2571         elif step_name.upper() in self.PouNames:
  2586         elif step_name.upper() in self.PouNames:
  2572             message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR)
  2587             message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR)
  2573             message.ShowModal()
  2588             message.ShowModal()
  2574             message.Destroy()
  2589             message.Destroy()
  2575         else:
  2590         else:
  2576             self.EndModal(wx.ID_OK)
  2591             self.EndModal(wx.ID_OK)
  2577 
  2592