LDViewer.py
changeset 67 3a1b0afdaf84
parent 64 dd6f693e46a1
child 80 c798a68c5560
--- a/LDViewer.py	Thu Aug 09 18:06:54 2007 +0200
+++ b/LDViewer.py	Thu Aug 09 18:07:44 2007 +0200
@@ -179,9 +179,10 @@
         for i, rung in enumerate(self.Rungs):
             bbox = rung.GetBoundingBox()
             if i < len(self.RungComments):
-                pos = self.RungComments[i].GetPosition()
-                if pos[1] > bbox.y:
-                    self.RungComments.insert(i, None)
+                if self.RungComments[i]:
+                    pos = self.RungComments[i].GetPosition()
+                    if pos[1] > bbox.y:
+                        self.RungComments.insert(i, None)
             else:
                 self.RungComments.insert(i, None)
     
@@ -207,7 +208,8 @@
             for connector in element.GetConnectors():
                 for wire, num in connector.GetWires():
                     self.Rungs[rungs[0]].SelectElement(wire)
-            self.RefreshPosition(element)
+            if self.GetDrawingMode() != FREEDRAWING_MODE:
+                self.RefreshPosition(element)
         elif instance["type"] in ["contact", "coil"]:
             rungs = []
             for link in instance["connectors"]["input"]["links"]:
@@ -221,7 +223,8 @@
             self.Rungs[rungs[0]].SelectElement(element)
             for wire, num in element.GetConnectors()["input"].GetWires():
                 self.Rungs[rungs[0]].SelectElement(wire)
-            self.RefreshPosition(element)
+            if self.GetDrawingMode() != FREEDRAWING_MODE:
+                self.RefreshPosition(element)
         elif instance["type"] == "comment":
             element = self.FindElementById(instance["id"])
             pos = element.GetPosition()