equal
deleted
inserted
replaced
89 element_variable_label = wx.StaticText(self, label=_('Variable:')) |
89 element_variable_label = wx.StaticText(self, label=_('Variable:')) |
90 self.LeftGridSizer.AddWindow(element_variable_label, border=5, |
90 self.LeftGridSizer.AddWindow(element_variable_label, border=5, |
91 flag=wx.GROW|wx.TOP) |
91 flag=wx.GROW|wx.TOP) |
92 |
92 |
93 # Create a combo box for defining LD element variable |
93 # Create a combo box for defining LD element variable |
94 self.ElementVariable = wx.ComboBox(self, style=wx.CB_READONLY|wx.CB_SORT) |
94 self.ElementVariable = wx.ComboBox(self, style=wx.CB_SORT) |
95 self.Bind(wx.EVT_COMBOBOX, self.OnVariableChanged, |
95 self.Bind(wx.EVT_COMBOBOX, self.OnVariableChanged, |
96 self.ElementVariable) |
96 self.ElementVariable) |
97 self.LeftGridSizer.AddWindow(self.ElementVariable, border=5, |
97 self.LeftGridSizer.AddWindow(self.ElementVariable, border=5, |
98 flag=wx.GROW|wx.TOP) |
98 flag=wx.GROW|wx.TOP) |
99 |
99 |
115 for name, (var_type, value_type) in self.VariableList.iteritems(): |
115 for name, (var_type, value_type) in self.VariableList.iteritems(): |
116 # Only select BOOL variable and avoid input for coil |
116 # Only select BOOL variable and avoid input for coil |
117 if (type == "contact" or var_type != "Input") and \ |
117 if (type == "contact" or var_type != "Input") and \ |
118 value_type == "BOOL": |
118 value_type == "BOOL": |
119 self.ElementVariable.Append(name) |
119 self.ElementVariable.Append(name) |
120 self.ElementVariable.Enable(self.ElementVariable.GetCount() > 0) |
|
121 |
120 |
122 # Normal radio button is default control having keyboard focus |
121 # Normal radio button is default control having keyboard focus |
123 self.ModifierRadioButtons[element_modifiers[0]].SetFocus() |
122 self.ModifierRadioButtons[element_modifiers[0]].SetFocus() |
124 |
123 |
125 def GetElementModifier(self): |
124 def GetElementModifier(self): |
142 # For each parameters defined, set corresponding control value |
141 # For each parameters defined, set corresponding control value |
143 for name, value in values.items(): |
142 for name, value in values.items(): |
144 |
143 |
145 # Parameter is LD element variable |
144 # Parameter is LD element variable |
146 if name == "variable": |
145 if name == "variable": |
147 self.ElementVariable.SetStringSelection(value) |
146 self.ElementVariable.SetValue(value) |
148 |
147 |
149 # Set value of other controls |
148 # Set value of other controls |
150 elif name == "modifier": |
149 elif name == "modifier": |
151 self.ModifierRadioButtons[value].SetValue(True) |
150 self.ModifierRadioButtons[value].SetValue(True) |
152 |
151 |
187 """ |
186 """ |
188 # Set graphic element displayed, creating a LD element |
187 # Set graphic element displayed, creating a LD element |
189 self.Element = self.ElementClass( |
188 self.Element = self.ElementClass( |
190 self.Preview, |
189 self.Preview, |
191 self.GetElementModifier(), |
190 self.GetElementModifier(), |
192 self.ElementVariable.GetStringSelection()) |
191 self.ElementVariable.GetValue()) |
193 |
192 |
194 # Call BlockPreviewDialog function |
193 # Call BlockPreviewDialog function |
195 BlockPreviewDialog.RefreshPreview(self) |
194 BlockPreviewDialog.RefreshPreview(self) |