equal
deleted
inserted
replaced
29 from BlockPreviewDialog import BlockPreviewDialog |
29 from BlockPreviewDialog import BlockPreviewDialog |
30 |
30 |
31 #------------------------------------------------------------------------------- |
31 #------------------------------------------------------------------------------- |
32 # Set Connection Parameters Dialog |
32 # Set Connection Parameters Dialog |
33 #------------------------------------------------------------------------------- |
33 #------------------------------------------------------------------------------- |
|
34 |
|
35 """ |
|
36 Class that implements a dialog for defining parameters of a connection graphic |
|
37 element |
|
38 """ |
34 |
39 |
35 class ConnectionDialog(BlockPreviewDialog): |
40 class ConnectionDialog(BlockPreviewDialog): |
36 |
41 |
37 def __init__(self, parent, controller, tagname, apply_button=False): |
42 def __init__(self, parent, controller, tagname, apply_button=False): |
38 """ |
43 """ |
121 self.SetSizer(main_sizer) |
126 self.SetSizer(main_sizer) |
122 |
127 |
123 # Connector radio button is default control having keyboard focus |
128 # Connector radio button is default control having keyboard focus |
124 self.TypeRadioButtons[CONNECTOR].SetFocus() |
129 self.TypeRadioButtons[CONNECTOR].SetFocus() |
125 |
130 |
|
131 def GetConnectionType(self): |
|
132 """ |
|
133 Return type selected for connection |
|
134 @return: Type selected (CONNECTOR or CONTINUATION) |
|
135 """ |
|
136 return (CONNECTOR |
|
137 if self.TypeRadioButtons[CONNECTOR].GetValue() |
|
138 else CONTINUATION) |
|
139 |
126 def SetValues(self, values): |
140 def SetValues(self, values): |
127 """ |
141 """ |
128 Set default connection parameters |
142 Set default connection parameters |
129 @param values: Connection parameters values |
143 @param values: Connection parameters values |
130 """ |
144 """ |
146 """ |
160 """ |
147 Return connection parameters defined in dialog |
161 Return connection parameters defined in dialog |
148 @return: {parameter_name: parameter_value,...} |
162 @return: {parameter_name: parameter_value,...} |
149 """ |
163 """ |
150 values = { |
164 values = { |
151 "type": (CONNECTOR |
165 "type": self.GetConnectionType(), |
152 if self.TypeRadioButtons[CONNECTOR].GetValue() |
|
153 else CONTINUATION), |
|
154 "name": self.ConnectionName.GetValue()} |
166 "name": self.ConnectionName.GetValue()} |
155 values["width"], values["height"] = self.Element.GetSize() |
167 values["width"], values["height"] = self.Element.GetSize() |
156 return values |
168 return values |
157 |
169 |
158 def TestConnectionName(self): |
170 def TestConnectionName(self): |
219 Refresh preview panel of graphic element |
231 Refresh preview panel of graphic element |
220 Override BlockPreviewDialog function |
232 Override BlockPreviewDialog function |
221 """ |
233 """ |
222 # Set graphic element displayed, creating a FBD connection element |
234 # Set graphic element displayed, creating a FBD connection element |
223 self.Element = FBD_Connector(self.Preview, |
235 self.Element = FBD_Connector(self.Preview, |
224 (CONNECTOR |
236 self.GetConnectionType(), |
225 if self.TypeRadioButtons[CONNECTOR].GetValue() |
|
226 else CONTINUATION), |
|
227 self.ConnectionName.GetValue()) |
237 self.ConnectionName.GetValue()) |
228 |
238 |
229 # Call BlockPreviewDialog function |
239 # Call BlockPreviewDialog function |
230 BlockPreviewDialog.RefreshPreview(self) |
240 BlockPreviewDialog.RefreshPreview(self) |
231 |
241 |