68 for element, values in element_tree.items(): |
68 for element, values in element_tree.items(): |
69 if "stop" in values["children"]: |
69 if "stop" in values["children"]: |
70 removed = [] |
70 removed = [] |
71 for child in values["children"]: |
71 for child in values["children"]: |
72 if child != "stop": |
72 if child != "stop": |
73 # if child in elements: |
73 # if child in elements: |
74 # RemoveElement(child, element_tree) |
74 # RemoveElement(child, element_tree) |
75 # removed.append(child) |
75 # removed.append(child) |
76 if "start" in element_tree[child]["parents"]: |
76 if "start" in element_tree[child]["parents"]: |
77 if element not in remove_stops["stop"]: |
77 if element not in remove_stops["stop"]: |
78 remove_stops["stop"].append(element) |
78 remove_stops["stop"].append(element) |
79 if child not in remove_stops["start"]: |
79 if child not in remove_stops["start"]: |
80 remove_stops["start"].append(child) |
80 remove_stops["start"].append(child) |
116 input_connectors = [connectors["input"]] |
116 input_connectors = [connectors["input"]] |
117 for connector in input_connectors: |
117 for connector in input_connectors: |
118 for wire, handle in connector.GetWires(): |
118 for wire, handle in connector.GetWires(): |
119 next = wire.EndConnected.GetParentBlock() |
119 next = wire.EndConnected.GetParentBlock() |
120 if isinstance(next, LD_PowerRail) and next.GetType() == LEFTRAIL or next in stop_list: |
120 if isinstance(next, LD_PowerRail) and next.GetType() == LEFTRAIL or next in stop_list: |
121 # for remove in element_tree[element]["children"]: |
121 # for remove in element_tree[element]["children"]: |
122 # RemoveElement(remove, element_tree) |
122 # RemoveElement(remove, element_tree) |
123 # element_tree[element]["children"] = ["stop"] |
123 # element_tree[element]["children"] = ["stop"] |
124 element_tree[element]["children"].append("stop") |
124 element_tree[element]["children"].append("stop") |
125 # elif element_tree[element]["children"] == ["stop"]: |
125 # elif element_tree[element]["children"] == ["stop"]: |
126 # element_tree[next] = None |
126 # element_tree[next] = None |
127 elif next not in element_tree or element_tree[next]: |
127 elif next not in element_tree or element_tree[next]: |
128 element_tree[element]["children"].append(next) |
128 element_tree[element]["children"].append(next) |
129 if next in element_tree: |
129 if next in element_tree: |
130 element_tree[next]["parents"].append(element) |
130 element_tree[next]["parents"].append(element) |
131 else: |
131 else: |