Fixed coil and contact dialog to let user select a complex type variable for contact and coil expression
authorLaurent Bessard
Thu, 17 Oct 2013 23:27:23 +0200
changeset 1370 ee795a8d4404
parent 1369 9bd4c783c98d
child 1371 3c55c99b10ab
Fixed coil and contact dialog to let user select a complex type variable for contact and coil expression
dialogs/LDElementDialog.py
--- a/dialogs/LDElementDialog.py	Thu Oct 17 12:20:36 2013 +0200
+++ b/dialogs/LDElementDialog.py	Thu Oct 17 23:27:23 2013 +0200
@@ -91,7 +91,7 @@
               flag=wx.GROW|wx.TOP)
         
         # Create a combo box for defining LD element variable
-        self.ElementVariable = wx.ComboBox(self, style=wx.CB_READONLY|wx.CB_SORT)
+        self.ElementVariable = wx.ComboBox(self, style=wx.CB_SORT)
         self.Bind(wx.EVT_COMBOBOX, self.OnVariableChanged, 
                   self.ElementVariable)
         self.LeftGridSizer.AddWindow(self.ElementVariable, border=5,
@@ -117,7 +117,6 @@
             if (type == "contact" or var_type != "Input") and \
                value_type == "BOOL":
                 self.ElementVariable.Append(name)
-        self.ElementVariable.Enable(self.ElementVariable.GetCount() > 0)
         
         # Normal radio button is default control having keyboard focus
         self.ModifierRadioButtons[element_modifiers[0]].SetFocus()
@@ -144,7 +143,7 @@
             
             # Parameter is LD element variable
             if name == "variable":
-                self.ElementVariable.SetStringSelection(value)
+                self.ElementVariable.SetValue(value)
             
             # Set value of other controls
             elif name == "modifier":
@@ -189,7 +188,7 @@
         self.Element = self.ElementClass(
                 self.Preview, 
                 self.GetElementModifier(),
-                self.ElementVariable.GetStringSelection())
+                self.ElementVariable.GetValue())
         
         # Call BlockPreviewDialog function
         BlockPreviewDialog.RefreshPreview(self)