Bug with setting name of function block while opening new Dialog
authorlbessard
Wed, 17 Sep 2008 07:35:19 +0200
changeset 271 4405cd3abbdb
parent 270 351d134babd7
child 272 3a9db28bc6b5
Bug with setting name of function block while opening new Dialog
Increasing number of pins allowed for power rail
Dialogs.py
--- a/Dialogs.py	Mon Sep 15 13:37:03 2008 +0200
+++ b/Dialogs.py	Wed Sep 17 07:35:19 2008 +0200
@@ -284,15 +284,14 @@
         self.PouElementNames = [element_name.upper() for element_name in element_names]
         
     def SetValues(self, values):
+        blocktype = values.get("type", None)
+        if blocktype is not None:
+            inputs = values.get("inputs", None)
+            item = self.FindTreeItem(self.TypeTree.GetRootItem(), blocktype, inputs)
+            if item:
+                self.TypeTree.SelectItem(item)
         for name, value in values.items():
-            if name == "type":
-                inputs = None
-                if "inputs" in values:
-                    inputs = values["inputs"]
-                item = self.FindTreeItem(self.TypeTree.GetRootItem(), value, inputs)
-                if item:
-                    self.TypeTree.SelectItem(item)
-            elif name == "name":
+            if name == "name":
                 self.BlockName.SetValue(value)
             elif name == "extension":
                 self.Inputs.SetValue(value)
@@ -1251,7 +1250,7 @@
 
         self.PinNumber = wx.SpinCtrl(id=ID_LDPOWERRAILDIALOGPINNUMBER,
               name='PinNumber', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=1, max=20)
+              size=wx.Size(0, 24), style=wx.SP_ARROW_KEYS, min=1, max=50)
         self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, id=ID_LDPOWERRAILDIALOGPINNUMBER)
 
         self.Preview = wx.Panel(id=ID_LDPOWERRAILDIALOGPREVIEW,