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"]]), |
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 |
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), |
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, |
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) |
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 |
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 |