editors/LDViewer.py
changeset 2415 f7d8891fe708
parent 1865 0bd5b3099144
child 2432 dbc065a2f7a5
equal deleted inserted replaced
2414:7fad75e5e63d 2415:f7d8891fe708
  1060                         break
  1060                         break
  1061             if len(wires) > 0:
  1061             if len(wires) > 0:
  1062                 rungindex = self.FindRung(wires[0])
  1062                 rungindex = self.FindRung(wires[0])
  1063                 rung = self.Rungs[rungindex]
  1063                 rung = self.Rungs[rungindex]
  1064                 old_bbox = rung.GetBoundingBox()
  1064                 old_bbox = rung.GetBoundingBox()
  1065                 for wire in wires:
  1065                 for w in wires:
  1066                     connections = wire.GetSelectedSegmentConnections()
  1066                     connections = w.GetSelectedSegmentConnections()
  1067                     left_block = wire.EndConnected.GetParentBlock()
  1067                     left_block = w.EndConnected.GetParentBlock()
  1068                     if wire.EndConnected not in left_elements:
  1068                     if w.EndConnected not in left_elements:
  1069                         left_elements.append(wire.EndConnected)
  1069                         left_elements.append(w.EndConnected)
  1070                     if wire.StartConnected not in right_elements:
  1070                     if w.StartConnected not in right_elements:
  1071                         right_elements.append(wire.StartConnected)
  1071                         right_elements.append(w.StartConnected)
  1072                     if connections == (False, False) or connections == (False, True) and isinstance(left_block, LD_PowerRail):
  1072                     if connections == (False, False) or connections == (False, True) and isinstance(left_block, LD_PowerRail):
  1073                         wire.Clean()
  1073                         w.Clean()
  1074                         self.RemoveWire(wire)
  1074                         self.RemoveWire(w)
  1075                         rung.SelectElement(wire)
  1075                         rung.SelectElement(w)
  1076                 for left_element in left_elements:
  1076                 for left_element in left_elements:
  1077                     left_block = left_element.GetParentBlock()
  1077                     left_block = left_element.GetParentBlock()
  1078                     if isinstance(left_block, LD_PowerRail):
  1078                     if isinstance(left_block, LD_PowerRail):
  1079                         if len(left_element.GetWires()) == 0:
  1079                         if len(left_element.GetWires()) == 0:
  1080                             index = left_block.GetConnectorIndex(left_element)
  1080                             index = left_block.GetConnectorIndex(left_element)
  1081                             left_block.DeleteConnector(index)
  1081                             left_block.DeleteConnector(index)
  1082                     else:
  1082                     else:
  1083                         connectors = left_block.GetConnectors()
  1083                         connectors = left_block.GetConnectors()
  1084                         for connector in connectors["outputs"]:
  1084                         for connector in connectors["outputs"]:
  1085                             for wire, _handle in connector.GetWires():
  1085                             for lwire, _handle in connector.GetWires():
  1086                                 self.RefreshPosition(wire.StartConnected.GetParentBlock())
  1086                                 self.RefreshPosition(lwire.StartConnected.GetParentBlock())
  1087                 for right_element in right_elements:
  1087                 for right_element in right_elements:
  1088                     self.RefreshPosition(right_element.GetParentBlock())
  1088                     self.RefreshPosition(right_element.GetParentBlock())
  1089                 rung.RefreshBoundingBox()
  1089                 rung.RefreshBoundingBox()
  1090                 new_bbox = rung.GetBoundingBox()
  1090                 new_bbox = rung.GetBoundingBox()
  1091                 self.RefreshRungs(new_bbox.height - old_bbox.height, rungindex + 1)
  1091                 self.RefreshRungs(new_bbox.height - old_bbox.height, rungindex + 1)