Fixing bug while editing PowerRail element in Viewer
authorlaurent
Mon, 07 Nov 2011 10:55:17 +0100
changeset 585 bd8c7a033b17
parent 584 c04e7af597d9
child 586 9aa96a36cf33
Fixing bug while editing PowerRail element in Viewer
Viewer.py
--- a/Viewer.py	Fri Nov 04 10:59:12 2011 +0100
+++ b/Viewer.py	Mon Nov 07 10:55:17 2011 +0100
@@ -2249,14 +2249,20 @@
         dialog.Destroy()
 
     def EditPowerRailContent(self, powerrail):
-        dialog = LDPowerRailDialog(self.ParentWindow, self.Controler, powerrail.GetType(), len(powerrail.GetConnectors()))
+        connectors = powerrail.GetConnectors()
+        type = powerrail.GetType()
+        if type == LEFTRAIL:
+            pin_number = len(connectors["outputs"])
+        else:
+            pin_number = len(connectors["inputs"])
+        dialog = LDPowerRailDialog(self.ParentWindow, self.Controler, type, pin_number)
         dialog.SetPreviewFont(self.GetFont())
         dialog.SetMinSize(powerrail.GetSize())
         if dialog.ShowModal() == wx.ID_OK:
             old_type = powerrail.GetType()
             values = dialog.GetValues()
             rect = powerrail.GetRedrawRect(1, 1)
-            powerrail.SetType(values["type"], [True for i in xrange(values["number"])])
+            powerrail.SetType(values["type"], values["number"])
             powerrail.SetSize(*self.GetScaledSize(values["width"], values["height"]))
             rect = rect.Union(powerrail.GetRedrawRect())
             if old_type != values["type"]: