diff -r 020420ad8914 -r 07447ee3538e Dialogs.py --- a/Dialogs.py Fri Jul 24 12:49:57 2009 +0200 +++ b/Dialogs.py Fri Jul 24 17:12:59 2009 +0200 @@ -77,21 +77,24 @@ parent.AddGrowableRow(2) def _init_coll_RightUpGridSizer_Items(self, parent): - parent.AddWindow(self.staticText2, 0, border=4, flag=wx.GROW|wx.TOP) + parent.AddWindow(self.staticText2, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) parent.AddWindow(self.BlockName, 0, border=0, flag=wx.GROW) - parent.AddWindow(self.staticText3, 0, border=4, flag=wx.GROW|wx.TOP) + parent.AddWindow(self.staticText3, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) parent.AddWindow(self.Inputs, 0, border=0, flag=wx.GROW) - parent.AddWindow(self.staticText4, 0, border=4, flag=wx.GROW|wx.TOP) + parent.AddWindow(self.staticText4, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) parent.AddWindow(self.ExecutionOrder, 0, border=0, flag=wx.GROW) - parent.AddWindow(self.staticText5, 0, border=4, flag=wx.GROW|wx.TOP) + parent.AddWindow(self.staticText5, 0, border=4, flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP) parent.AddWindow(self.ExecutionControl, 0, border=0, flag=wx.GROW) - + + def _init_coll_RightUpGridSizer_Growables(self, parent): + parent.AddGrowableCol(1) + def _init_sizers(self): self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10) self.MainSizer = wx.BoxSizer(wx.HORIZONTAL) self.LeftBoxSizer = wx.StaticBoxSizer(self.staticbox1, wx.VERTICAL) self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5) - self.RightUpGridSizer = wx.GridSizer(cols=2, hgap=5, rows=4, vgap=5) + self.RightUpGridSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=5) self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) @@ -100,6 +103,7 @@ self._init_coll_RightGridSizer_Items(self.RightGridSizer) self._init_coll_RightGridSizer_Growables(self.RightGridSizer) self._init_coll_RightUpGridSizer_Items(self.RightUpGridSizer) + self._init_coll_RightUpGridSizer_Growables(self.RightUpGridSizer) self.SetSizer(self.flexGridSizer1) @@ -107,32 +111,32 @@ wx.Dialog.__init__(self, id=ID_BLOCKPROPERTIESDIALOG, name='BlockPropertiesDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, - title='Block Properties') + title=_('Block Properties')) self.SetClientSize(wx.Size(600, 400)) self.staticbox1 = wx.StaticBox(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT1, - label='Type:', name='staticBox1', parent=self, + label=_('Type:'), name='staticBox1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0) self.staticText2 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2, - label='Name:', name='staticText2', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) + label=_('Name:'), name='staticText2', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.staticText3 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT2, - label='Inputs:', name='staticText4', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) + label=_('Inputs:'), name='staticText4', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.staticText4 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT4, - label='Execution Order:', name='staticText4', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) + label=_('Execution Order:'), name='staticText4', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.staticText5 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT5, - label='Execution Control:', name='staticText5', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) + label=_('Execution Control:'), name='staticText5', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.staticText6 = wx.StaticText(id=ID_BLOCKPROPERTIESDIALOGSTATICTEXT6, - label='Preview:', name='staticText6', parent=self, - pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) + label=_('Preview:'), name='staticText6', parent=self, + pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) if wx.Platform == '__WXMSW__': treestyle = wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.SUNKEN_BORDER @@ -234,27 +238,27 @@ block_name = self.BlockName.GetValue() name_enabled = self.BlockName.IsEnabled() if not selected.IsOk() or self.TypeTree.GetItemParent(selected) == self.TypeTree.GetRootItem() or selected == self.TypeTree.GetRootItem(): - message = wx.MessageDialog(self, "Form isn't complete. Valid block type must be selected!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("Form isn't complete. Valid block type must be selected!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif name_enabled and block_name == "": - message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif name_enabled and not TestIdentifier(block_name): - message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%block_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif name_enabled and block_name.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%block_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif name_enabled and block_name.upper() in self.PouNames: - message = wx.MessageDialog(self, "\"%s\" pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif name_enabled and block_name.upper() in self.PouElementNames: - message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%block_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -262,12 +266,13 @@ def SetBlockList(self, blocktypes): if wx.Platform == '__WXMSW__': - root = self.TypeTree.AddRoot("Block Types") + root = self.TypeTree.AddRoot(_("Block Types")) else: root = self.TypeTree.AddRoot("") self.TypeTree.SetPyData(root, {"type" : CATEGORY}) for category in blocktypes: - category_item = self.TypeTree.AppendItem(root, category["name"]) + category_name = category["name"] + category_item = self.TypeTree.AppendItem(root, _(category_name)) self.TypeTree.SetPyData(category_item, {"type" : CATEGORY}) for blocktype in category["list"]: blocktype_item = self.TypeTree.AppendItem(category_item, blocktype["name"]) @@ -330,7 +335,8 @@ self.Inputs.SetValue(len(blocktype["inputs"])) self.Inputs.Enable(blocktype["extensible"]) self.BlockName.Enable(blocktype["type"] != "function") - self.TypeDesc.SetValue(blocktype["comment"]) + comment = blocktype["comment"] + self.TypeDesc.SetValue(_(comment) + blocktype.get("usage", "")) wx.CallAfter(self.RefreshPreview) else: self.BlockName.Enable(False) @@ -416,6 +422,11 @@ ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4, ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5 ] = [wx.NewId() for _init_ctrls in range(12)] +VARIABLE_CLASSES_DICT = {INPUT : _("Input"), + INOUT : _("InOut"), + OUTPUT : _("Output")} +VARIABLE_CLASSES_DICT_REVERSE = dict([(value, key) for key, value in VARIABLE_CLASSES_DICT.iteritems()]) + class VariablePropertiesDialog(wx.Dialog): if wx.VERSION < (2, 6, 0): @@ -490,27 +501,27 @@ wx.Dialog.__init__(self, id=ID_VARIABLEPROPERTIESDIALOG, name='VariablePropertiesDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(400, 380), style=wx.DEFAULT_DIALOG_STYLE, - title='Variable Properties') + title=_('Variable Properties')) self.SetClientSize(wx.Size(400, 380)) self.staticText1 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT1, - label='Class:', name='staticText1', parent=self, + label=_('Class:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT2, - label='Expression:', name='staticText2', parent=self, + label=_('Expression:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT3, - label='Execution Order:', name='staticText3', parent=self, + label=_('Execution Order:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText4 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT4, - label='Name:', name='staticText4', parent=self, + label=_('Name:'), name='staticText4', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText5 = wx.StaticText(id=ID_VARIABLEPROPERTIESDIALOGSTATICTEXT5, - label='Preview:', name='staticText5', parent=self, + label=_('Preview:'), name='staticText5', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.Class = wx.ComboBox(id=ID_VARIABLEPROPERTIESDIALOGCLASS, @@ -561,28 +572,30 @@ self.Variable = None self.VarList = [] self.MinVariableSize = None + + for choice in VARIABLE_CLASSES_DICT.itervalues(): + self.Class.Append(choice) + self.Class.SetStringSelection(VARIABLE_CLASSES_DICT[INPUT]) + self.RefreshNameList() - - for choice in ["Input", "Output", "InOut"]: - self.Class.Append(choice) - self.Class.SetStringSelection("Input") def SetPreviewFont(self, font): self.Preview.SetFont(font) def RefreshNameList(self): selected = self.VariableName.GetStringSelection() + var_class = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()] self.VariableName.Clear() self.VariableName.Append("") for name, var_type, value_type in self.VarList: - if var_type != "Input" or self.Class.GetStringSelection() == "Input": + if var_type != "Input" or var_class == INPUT: self.VariableName.Append(name) if selected != "" and self.VariableName.FindString(selected) != wx.NOT_FOUND: self.VariableName.SetStringSelection(selected) self.Expression.Enable(False) else: self.VariableName.SetStringSelection("") - self.Expression.Enable(self.Class.GetStringSelection() == "Input") + self.Expression.Enable(var_class == INPUT) self.VariableName.Enable(self.VariableName.GetCount() > 0) def SetMinVariableSize(self, size): @@ -596,12 +609,7 @@ value_type = values.get("type", None) value_name = values.get("name", None) if value_type: - if value_type == INPUT: - self.Class.SetStringSelection("Input") - if value_type == OUTPUT: - self.Class.SetStringSelection("Output") - if value_type == INOUT: - self.Class.SetStringSelection("InOut") + self.Class.SetStringSelection(VARIABLE_CLASSES_DICT[value_type]) self.RefreshNameList() if value_name: if self.VariableName.FindString(value_name) != wx.NOT_FOUND: @@ -616,13 +624,7 @@ def GetValues(self): values = {} - classtype = self.Class.GetStringSelection() - if classtype == "Input": - values["type"] = INPUT - elif classtype == "Output": - values["type"] = OUTPUT - elif classtype == "InOut": - values["type"] = INOUT + values["type"] = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()] expression = self.Expression.GetValue() if self.Expression.IsEnabled() and expression != "": values["name"] = expression @@ -643,11 +645,11 @@ else: value = self.VariableName.GetStringSelection() if value == "": - message = wx.MessageDialog(self, "At least a variable or an expression must be selected!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("At least a variable or an expression must be selected!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif value.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%value, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%value, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -661,7 +663,7 @@ def OnNameChanged(self, event): if self.VariableName.GetStringSelection() != "": self.Expression.Enable(False) - elif self.Class.GetStringSelection() == "Input": + elif VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()] == INPUT: self.Expression.Enable(True) self.RefreshPreview() event.Skip() @@ -691,13 +693,8 @@ for var_name, var_type, value_type in self.VarList: if var_name == name: type = value_type - classtype = self.Class.GetStringSelection() - if classtype == "Input": - self.Variable = FBD_Variable(self.Preview, INPUT, name, type, executionOrder = self.ExecutionOrder.GetValue()) - elif classtype == "Output": - self.Variable = FBD_Variable(self.Preview, OUTPUT, name, type, executionOrder = self.ExecutionOrder.GetValue()) - elif classtype == "InOut": - self.Variable = FBD_Variable(self.Preview, INOUT, name, type, executionOrder = self.ExecutionOrder.GetValue()) + classtype = VARIABLE_CLASSES_DICT_REVERSE[self.Class.GetStringSelection()] + self.Variable = FBD_Variable(self.Preview, classtype, name, type, executionOrder = self.ExecutionOrder.GetValue()) width, height = self.MinVariableSize min_width, min_height = self.Variable.GetMinSize() width, height = max(min_width, width), max(min_height, height) @@ -784,29 +781,29 @@ wx.Dialog.__init__(self, id=ID_CONNECTIONPROPERTIESDIALOG, name='ConnectionPropertiesDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(350, 220), style=wx.DEFAULT_DIALOG_STYLE, - title='Connection Properties') + title=_('Connection Properties')) self.SetClientSize(wx.Size(350, 220)) self.staticText1 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT1, - label='Type:', name='staticText1', parent=self, + label=_('Type:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT2, - label='Name:', name='staticText2', parent=self, + label=_('Name:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_CONNECTIONPROPERTIESDIALOGSTATICTEXT3, - label='Preview:', name='staticText3', parent=self, + label=_('Preview:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.radioButton1 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1, - label='Connector', name='radioButton1', parent=self, + label=_('Connector'), name='radioButton1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON1) self.radioButton1.SetValue(True) self.radioButton2 = wx.RadioButton(id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2, - label='Continuation', name='radioButton2', parent=self, + label=_('Continuation'), name='radioButton2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_CONNECTIONPROPERTIESDIALOGRADIOBUTTON2) self.radioButton2.SetValue(False) @@ -882,23 +879,23 @@ def OnOK(self, event): connection_name = self.ConnectionName.GetValue() if connection_name == "": - message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("Form isn't complete. Name must be filled!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif not TestIdentifier(connection_name): - message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%connection_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif connection_name.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%connection_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif connection_name.upper() in self.PouNames: - message = wx.MessageDialog(self, "\"%s\" pou already exists!"%connection_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif connection_name.upper() in self.PouElementNames: - message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%connection_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" element for this pou already exists!")%connection_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -1022,45 +1019,45 @@ self.SetClientSize(wx.Size(350, 260 + extra_size)) self.staticText1 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT1, - label='Modifier:', name='staticText1', parent=self, + label=_('Modifier:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT2, - label='Name:', name='staticText2', parent=self, + label=_('Name:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_LDELEMENTDIALOGSTATICTEXT3, - label='Preview:', name='staticText3', parent=self, + label=_('Preview:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.radioButton1 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON1, - label="Normal", name='radioButton1', parent=self, + label=_("Normal"), name='radioButton1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON1) self.radioButton1.SetValue(True) self.radioButton2 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON2, - label="Negated", name='radioButton2', parent=self, + label=_("Negated"), name='radioButton2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON2) self.radioButton3 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON3, - label="Set", name='radioButton3', parent=self, + label=_("Set"), name='radioButton3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON3) self.radioButton4 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON4, - label="Reset", name='radioButton4', parent=self, + label=_("Reset"), name='radioButton4', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON4) self.radioButton5 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON5, - label="Rising Edge", name='radioButton5', parent=self, + label=_("Rising Edge"), name='radioButton5', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON5) self.radioButton6 = wx.RadioButton(id=ID_LDELEMENTDIALOGRADIOBUTTON6, - label="Falling Edge", name='radioButton6', parent=self, + label=_("Falling Edge"), name='radioButton6', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDELEMENTDIALOGRADIOBUTTON6) @@ -1093,12 +1090,12 @@ def __init__(self, parent, controler, type): self.Type = type if type == "contact": - self._init_ctrls(parent, controler, "Edit Contact Values") + self._init_ctrls(parent, controler, _("Edit Contact Values")) self.Element = LD_Contact(self.Preview, CONTACT_NORMAL, "") self.radioButton3.Hide() self.radioButton4.Hide() elif type == "coil": - self._init_ctrls(parent, controler, "Edit Coil Values", 50) + self._init_ctrls(parent, controler, _("Edit Coil Values"), 50) self.Element = LD_Coil(self.Preview, COIL_NORMAL, "") @@ -1271,29 +1268,29 @@ wx.Dialog.__init__(self, id=ID_LDPOWERRAILDIALOG, name='PowerRailDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(350, 260), style=wx.DEFAULT_DIALOG_STYLE, - title='Power Rail Properties') + title=_('Power Rail Properties')) self.SetClientSize(wx.Size(350, 260)) self.staticText1 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT1, - label='Type:', name='staticText1', parent=self, + label=_('Type:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT2, - label='Pin number:', name='staticText2', parent=self, + label=_('Pin number:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_LDPOWERRAILDIALOGSTATICTEXT3, - label='Preview:', name='staticText3', parent=self, + label=_('Preview:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.radioButton1 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON1, - label='Left PowerRail', name='radioButton1', parent=self, + label=_('Left PowerRail'), name='radioButton1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON1) self.radioButton1.SetValue(True) self.radioButton2 = wx.RadioButton(id=ID_LDPOWERRAILDIALOGRADIOBUTTON2, - label='Right PowerRail', name='radioButton2', parent=self, + label=_('Right PowerRail'), name='radioButton2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_LDPOWERRAILDIALOGRADIOBUTTON2) @@ -1451,19 +1448,19 @@ wx.Dialog.__init__(self, id=ID_STEPCONTENTDIALOG, name='StepContentDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(400, 250), style=wx.DEFAULT_DIALOG_STYLE, - title='Edit Step') + title=_('Edit Step')) self.SetClientSize(wx.Size(400, 250)) self.staticText1 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT1, - label='Name:', name='staticText1', parent=self, + label=_('Name:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT2, - label='Connectors:', name='staticText2', parent=self, + label=_('Connectors:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_STEPCONTENTDIALOGSTATICTEXT3, - label='Preview:', name='staticText4', parent=self, + label=_('Preview:'), name='staticText4', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.StepName = wx.TextCtrl(id=ID_STEPCONTENTDIALOGNAME, @@ -1472,17 +1469,17 @@ self.Bind(wx.EVT_TEXT, self.OnNameChanged, id=ID_STEPCONTENTDIALOGNAME) self.checkBox1 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX1, - label="Input", name='checkBox1', parent=self, + label=_("Input"), name='checkBox1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX1) self.checkBox2 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX2, - label="Output", name='checkBox2', parent=self, + label=_("Output"), name='checkBox2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX2) self.checkBox3 = wx.CheckBox(id=ID_STEPCONTENTDIALOGCHECKBOX3, - label="Action", name='checkBox3', parent=self, + label=_("Action"), name='checkBox3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, id=ID_STEPCONTENTDIALOGCHECKBOX3) @@ -1525,27 +1522,27 @@ def OnOK(self, event): step_name = self.StepName.GetValue() if step_name == "": - message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif not TestIdentifier(step_name): - message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.PouNames: - message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.Variables: - message = wx.MessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("A variable with \"%s\" as name already exists in this pou!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.StepNames: - message = wx.MessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" step already exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -1698,23 +1695,23 @@ wx.Dialog.__init__(self, id=ID_TRANSITIONCONTENTDIALOG, name='ProjectDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(350, 300), style=wx.DEFAULT_DIALOG_STYLE, - title='Edit transition') + title=_('Edit transition')) self.SetClientSize(wx.Size(350, 300)) self.staticText1 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT1, - label='Type:', name='staticText1', parent=self, + label=_('Type:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText2 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT2, - label='Preview:', name='staticText2', parent=self, + label=_('Preview:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.staticText3 = wx.StaticText(id=ID_TRANSITIONCONTENTDIALOGSTATICTEXT3, - label='Priority:', name='staticText3', parent=self, + label=_('Priority:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.radioButton1 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1, - label='Reference', name='radioButton1', parent=self, + label=_('Reference'), name='radioButton1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON1) self.radioButton1.SetValue(True) @@ -1725,7 +1722,7 @@ self.Bind(wx.EVT_COMBOBOX, self.OnReferenceChanged, id=ID_TRANSITIONCONTENTDIALOGREFERENCE) self.radioButton2 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2, - label='Inline', name='radioButton2', parent=self, + label=_('Inline'), name='radioButton2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON2) self.radioButton2.SetValue(False) @@ -1737,7 +1734,7 @@ self.Inline.Enable(False) self.radioButton3 = wx.RadioButton(id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3, - label='Connection', name='radioButton3', parent=self, + label=_('Connection'), name='radioButton3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_TRANSITIONCONTENTDIALOGRADIOBUTTON3) self.radioButton3.SetValue(False) @@ -1791,19 +1788,19 @@ def OnOK(self, event): error = [] if self.radioButton1.GetValue() and self.Reference.GetStringSelection() == "": - error.append("Reference") + error.append(_("Reference")) if self.radioButton2.GetValue() and self.Inline.GetValue() == "": - error.append("Inline") + error.append(_("Inline")) if len(error) > 0: text = "" for i, item in enumerate(error): if i == 0: text += item elif i == len(error) - 1: - text += " and %s"%item + text += _(" and %s")%item else: - text += ", %s"%item - message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR) + text += _(", %s")%item + message = wx.MessageDialog(self, _("Form isn't complete. %s must be filled!")%text, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -1976,39 +1973,39 @@ wx.Dialog.__init__(self, id=ID_DIVERGENCECREATEDIALOG, name='DivergencePropertiesDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE, - title='Create a new divergence or convergence') + title=_('Create a new divergence or convergence')) self.SetClientSize(wx.Size(500, 300)) self.staticText1 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT1, - label='Type:', name='staticText1', parent=self, + label=_('Type:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.radioButton1 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1, - label='Selection Divergence', name='radioButton1', parent=self, + label=_('Selection Divergence'), name='radioButton1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=wx.RB_GROUP) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON1) self.radioButton1.SetValue(True) self.radioButton2 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2, - label='Selection Convergence', name='radioButton2', parent=self, + label=_('Selection Convergence'), name='radioButton2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON2) self.radioButton2.SetValue(False) self.radioButton3 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3, - label='Simultaneous Divergence', name='radioButton3', parent=self, + label=_('Simultaneous Divergence'), name='radioButton3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON3) self.radioButton3.SetValue(False) self.radioButton4 = wx.RadioButton(id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4, - label='Simultaneous Convergence', name='radioButton4', parent=self, + label=_('Simultaneous Convergence'), name='radioButton4', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0) self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, id=ID_DIVERGENCECREATEDIALOGRADIOBUTTON4) self.radioButton4.SetValue(False) self.staticText2 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT2, - label='Number of sequences:', name='staticText2', parent=self, + label=_('Number of sequences:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.Sequences = wx.SpinCtrl(id=ID_DIVERGENCECREATEDIALOGSEQUENCES, @@ -2017,7 +2014,7 @@ self.Bind(wx.EVT_SPINCTRL, self.OnSequencesChanged, id=ID_DIVERGENCECREATEDIALOGSEQUENCES) self.staticText3 = wx.StaticText(id=ID_DIVERGENCECREATEDIALOGSTATICTEXT3, - label='Preview:', name='staticText3', parent=self, + label=_('Preview:'), name='staticText3', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.Preview = wx.Panel(id=ID_DIVERGENCECREATEDIALOGPREVIEW, @@ -2103,6 +2100,14 @@ # Action Block Dialog #------------------------------------------------------------------------------- +def GetActionTableColnames(): + _ = lambda x: x + return [_("Qualifier"), _("Duration"), _("Type"), _("Value"), _("Indicator")] + +def GetTypeList(): + _ = lambda x: x + return [_("Action"), _("Variable"), _("Inline")] + class ActionTable(wx.grid.PyGridTableBase): """ @@ -2126,16 +2131,22 @@ def GetNumberRows(self): return len(self.data) - def GetColLabelValue(self, col): + def GetColLabelValue(self, col, translate=True): if col < len(self.colnames): - return self.colnames[col] - - def GetRowLabelValues(self, row): + colname = self.colnames[col] + if translate: + return _(colname) + return colname + + def GetRowLabelValues(self, row, translate=True): return row def GetValue(self, row, col): if row < self.GetNumberRows(): - name = str(self.data[row].get(self.GetColLabelValue(col), "")) + colname = self.GetColLabelValue(col, False) + name = str(self.data[row].get(colname, "")) + if colname == "Type": + return _(name) return name def GetValueByName(self, row, colname): @@ -2143,7 +2154,10 @@ def SetValue(self, row, col, value): if col < len(self.colnames): - self.data[row][self.GetColLabelValue(col)] = value + colname = self.GetColLabelValue(col, False) + if colname == "Type": + value = self.Parent.TranslateType[value] + self.data[row][colname] = value def ResetView(self, grid): """ @@ -2187,20 +2201,12 @@ Otherwise default to the default renderer. """ - for col in range(self.GetNumberCols()): - attr = wx.grid.GridCellAttr() - attr.SetAlignment(self.Parent.ColAlignements[col], wx.ALIGN_CENTRE) - grid.SetColAttr(col, attr) - grid.SetColSize(col, self.Parent.ColSizes[col]) - - typelist = None - accesslist = None for row in range(self.GetNumberRows()): for col in range(self.GetNumberCols()): editor = None renderer = None readonly = False - colname = self.GetColLabelValue(col) + colname = self.GetColLabelValue(col, False) if colname == "Qualifier": editor = wx.grid.GridCellChoiceEditor() editor.SetParameters(self.Parent.QualifierList) @@ -2319,11 +2325,11 @@ wx.Dialog.__init__(self, id=ID_ACTIONBLOCKDIALOG, name='ActionBlockDialog', parent=prnt, pos=wx.Point(376, 223), size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, - title='Edit action block properties') + title=_('Edit action block properties')) self.SetClientSize(wx.Size(500, 300)) self.staticText1 = wx.StaticText(id=ID_ACTIONBLOCKDIALOGSTATICTEXT1, - label='Actions:', name='staticText1', parent=self, + label=_('Actions:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.ActionsGrid = wx.grid.Grid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID, @@ -2337,14 +2343,14 @@ self.ActionsGrid.EnableScrolling(False, True) self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnActionsGridCellChange) - self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label='Add', + self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label=_('Add'), name='AddButton', parent=self, pos=wx.Point(0, 0), - size=wx.Size(72, 32), style=0) + size=wx.DefaultSize, style=0) self.Bind(wx.EVT_BUTTON, self.OnAddButton, id=ID_ACTIONBLOCKDIALOGADDBUTTON) - self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label='Delete', + self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label=_('Delete'), name='DeleteButton', parent=self, pos=wx.Point(0, 0), - size=wx.Size(72, 32), style=0) + size=wx.DefaultSize, style=0) self.Bind(wx.EVT_BUTTON, self.OnDeleteButton, id=ID_ACTIONBLOCKDIALOGDELETEBUTTON) self.UpButton = wx.Button(id=ID_ACTIONBLOCKDIALOGUPBUTTON, label='^', @@ -2369,14 +2375,23 @@ self._init_ctrls(parent) self.DefaultValue = {"Qualifier" : "N", "Duration" : "", "Type" : "Action", "Value" : "", "Indicator" : ""} - self.Table = ActionTable(self, [], ["Qualifier","Duration","Type","Value","Indicator"]) - self.TypeList = "Action,Variable,Inline" + self.Table = ActionTable(self, [], GetActionTableColnames()) + typelist = GetTypeList() + self.TypeList = ",".join(map(_,typelist)) + self.TranslateType = dict([(_(value), value) for value in typelist]) self.ColSizes = [60, 90, 80, 110, 80] self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT] self.ActionsGrid.SetTable(self.Table) self.ActionsGrid.SetRowLabelSize(0) + for col in range(self.Table.GetNumberCols()): + attr = wx.grid.GridCellAttr() + attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE) + self.ActionsGrid.SetColAttr(col, attr) + self.ActionsGrid.SetColMinimalWidth(col, self.ColSizes[col]) + self.ActionsGrid.AutoSizeColumn(col, False) + self.Table.ResetView(self.ActionsGrid) def OnOK(self, event): @@ -2490,27 +2505,27 @@ def OnOK(self, event): step_name = self.GetSizer().GetItem(1).GetWindow().GetValue() if step_name == "": - message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif not TestIdentifier(step_name): - message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.PouNames: - message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.Variables: - message = wx.MessageDialog(self, "A variable with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("A variable with \"%s\" as name already exists in this pou!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.StepNames: - message = wx.MessageDialog(self, "\"%s\" step already exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" step already exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -2557,19 +2572,19 @@ def OnOK(self, event): step_name = self.GetSizer().GetItem(1).GetWindow().GetValue() if step_name == "": - message = wx.MessageDialog(self, "You must type a name!", "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("You must type a name!"), _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif not TestIdentifier(step_name): - message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is not a valid identifier!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in IEC_KEYWORDS: - message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() elif step_name.upper() in self.PouNames: - message = wx.MessageDialog(self, "A pou with \"%s\" as name exists!"%step_name, "Error", wx.OK|wx.ICON_ERROR) + message = wx.MessageDialog(self, _("A pou with \"%s\" as name exists!")%step_name, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: @@ -2579,4 +2594,4 @@ self.PouNames = [pou_name.upper() for pou_name in pou_names] def GetValue(self): - return self.GetSizer().GetItem(1).GetWindow().GetValue() \ No newline at end of file + return self.GetSizer().GetItem(1).GetWindow().GetValue()