author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Thu, 21 Apr 2016 20:42:37 +0300 | |
changeset 1498 | b11045a2f17c |
parent 1493 | 6dbebfcec074 |
child 1571 | 486f94a8032c |
permissions | -rw-r--r-- |
814 | 1 |
# -*- coding: utf-8 -*- |
2 |
||
3 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
|
4 |
#based on the plcopen standard. |
|
5 |
# |
|
6 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
7 |
# |
|
8 |
#See COPYING file for copyrights details. |
|
9 |
# |
|
10 |
#This library is free software; you can redistribute it and/or |
|
11 |
#modify it under the terms of the GNU General Public |
|
12 |
#License as published by the Free Software Foundation; either |
|
13 |
#version 2.1 of the License, or (at your option) any later version. |
|
14 |
# |
|
15 |
#This library is distributed in the hope that it will be useful, |
|
16 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 |
#General Public License for more details. |
|
19 |
# |
|
20 |
#You should have received a copy of the GNU General Public |
|
21 |
#License along with this library; if not, write to the Free Software |
|
22 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
||
24 |
import wx |
|
25 |
||
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
26 |
from graphics.SFC_Objects import SFC_Step |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
27 |
from BlockPreviewDialog import BlockPreviewDialog |
814 | 28 |
|
29 |
#------------------------------------------------------------------------------- |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
30 |
# Set SFC Step Parameters Dialog |
814 | 31 |
#------------------------------------------------------------------------------- |
32 |
||
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
33 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
34 |
Class that implements a dialog for defining parameters of a SFC step graphic |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
35 |
element |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
36 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
37 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
38 |
class SFCStepDialog(BlockPreviewDialog): |
814 | 39 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
40 |
def __init__(self, parent, controller, tagname, initial=False): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
41 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
42 |
Constructor |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
43 |
@param parent: Parent wx.Window of dialog for modal |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
44 |
@param controller: Reference to project controller |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
45 |
@param tagname: Tagname of project POU edited |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
46 |
@param initial: True if step is initial (default: False) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
47 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
48 |
BlockPreviewDialog.__init__(self,parent, controller, tagname, |
1493
6dbebfcec074
increase height of some dialog windows so they have enough space for buttons
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1252
diff
changeset
|
49 |
size=wx.Size(400, 280), title=_('Edit Step')) |
814 | 50 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
51 |
# Init common sizers |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
52 |
self._init_sizers(2, 0, 6, None, 2, 1) |
814 | 53 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
54 |
# Create label for SFC step name |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
55 |
name_label = wx.StaticText(self, label=_('Name:')) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
56 |
self.LeftGridSizer.AddWindow(name_label, flag=wx.GROW) |
814 | 57 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
58 |
# Create text control for defining SFC step name |
814 | 59 |
self.StepName = wx.TextCtrl(self) |
60 |
self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.StepName) |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
61 |
self.LeftGridSizer.AddWindow(self.StepName, flag=wx.GROW) |
814 | 62 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
63 |
# Create label for SFC step connectors |
814 | 64 |
connectors_label = wx.StaticText(self, label=_('Connectors:')) |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
65 |
self.LeftGridSizer.AddWindow(connectors_label, flag=wx.GROW) |
814 | 66 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
67 |
# Create check boxes for defining connectors available on SFC step |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
68 |
self.ConnectorsCheckBox = {} |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
69 |
for name, label in [("input", _("Input")), |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
70 |
("output", _("Output")), |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
71 |
("action", _("Action"))]: |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
72 |
check_box = wx.CheckBox(self, label=label) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
73 |
self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, check_box) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
74 |
self.LeftGridSizer.AddWindow(check_box, flag=wx.GROW) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
75 |
self.ConnectorsCheckBox[name] = check_box |
814 | 76 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
77 |
# Add preview panel and associated label to sizers |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
78 |
self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
79 |
self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW) |
814 | 80 |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
81 |
# Add buttons sizer to sizers |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
82 |
self.MainSizer.AddSizer(self.ButtonSizer, border=20, |
814 | 83 |
flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
84 |
||
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
85 |
# Save flag that indicates that step is initial |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
86 |
self.Initial = initial |
814 | 87 |
|
1252 | 88 |
# Set default name for step |
89 |
self.StepName.ChangeValue(controller.GenerateNewName( |
|
90 |
tagname, None, "Step%d", 0)) |
|
91 |
||
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
92 |
# Step name text control is default control having keyboard focus |
814 | 93 |
self.StepName.SetFocus() |
94 |
||
95 |
def SetValues(self, values): |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
96 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
97 |
Set default block parameters |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
98 |
@param values: Block parameters values |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
99 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
100 |
# For each parameters defined, set corresponding control value |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
101 |
for name, value in values.items(): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
102 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
103 |
# Parameter is step name |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
104 |
if name == "name": |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
105 |
self.StepName.ChangeValue(value) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
106 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
107 |
# Set value of other controls |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
108 |
else: |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
109 |
control = self.ConnectorsCheckBox.get(name, None) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
110 |
if control is not None: |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
111 |
control.SetValue(value) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
112 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
113 |
# Refresh preview panel |
814 | 114 |
self.RefreshPreview() |
115 |
||
116 |
def GetValues(self): |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
117 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
118 |
Return step parameters defined in dialog |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
119 |
@return: {parameter_name: parameter_value,...} |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
120 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
121 |
values = {"name": self.StepName.GetValue()} |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
122 |
values.update({ |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
123 |
name: control.IsChecked() |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
124 |
for name, control in self.ConnectorsCheckBox.iteritems()}) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
125 |
values["width"], values["height"] = self.Element.GetSize() |
814 | 126 |
return values |
127 |
||
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
128 |
def OnOK(self, event): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
129 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
130 |
Called when dialog OK button is pressed |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
131 |
Test if step name defined is valid |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
132 |
@param event: wx.Event from OK button |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
133 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
134 |
message = None |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
135 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
136 |
# Get step name typed by user |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
137 |
step_name = self.StepName.GetValue() |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
138 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
139 |
# Test that a name have been defined |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
140 |
if step_name == "": |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
141 |
message = _("Form isn't complete. Name must be filled!") |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
142 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
143 |
# If an error have been identify, show error message dialog |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
144 |
if message is not None: |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
145 |
self.ShowErrorMessage(message) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
146 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
147 |
# Test step name validity |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
148 |
elif self.TestElementName(step_name): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
149 |
# Call BlockPreviewDialog function |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
150 |
BlockPreviewDialog.OnOK(self, event) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
151 |
|
814 | 152 |
def OnConnectorsChanged(self, event): |
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
153 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
154 |
Called when a step connector value changed |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
155 |
@param event: wx.CheckBoxEvent |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
156 |
""" |
814 | 157 |
self.RefreshPreview() |
158 |
event.Skip() |
|
159 |
||
160 |
def OnNameChanged(self, event): |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
161 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
162 |
Called when step name value changed |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
163 |
@param event: wx.TextEvent |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
164 |
""" |
814 | 165 |
self.RefreshPreview() |
166 |
event.Skip() |
|
167 |
||
168 |
def RefreshPreview(self): |
|
1250
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
169 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
170 |
Refresh preview panel of graphic element |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
171 |
Override BlockPreviewDialog function |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
172 |
""" |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
173 |
# Set graphic element displayed, creating a SFC step element |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
174 |
self.Element = SFC_Step(self.Preview, |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
175 |
self.StepName.GetValue(), |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
176 |
self.Initial) |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
177 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
178 |
# Update connectors of SFC step element according to check boxes value |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
179 |
for name, control in self.ConnectorsCheckBox.iteritems(): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
180 |
if control.IsChecked(): |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
181 |
getattr(self.Element, "Add" + name.capitalize())() |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
182 |
else: |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
183 |
getattr(self.Element, "Remove" + name.capitalize())() |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
184 |
|
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
185 |
# Call BlockPreviewDialog function |
7e6de17c687a
Rewrite SFCStepDialog and factorize code for creating common dialog sizers
Laurent Bessard
parents:
814
diff
changeset
|
186 |
BlockPreviewDialog.RefreshPreview(self) |