diff --git a/app_state.py b/app_state.py index 4ae77f3..942dc37 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.094" +VERSION = "0.0.0.095" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/main.py b/main.py index 9e53b9c..623bf2b 100644 --- a/main.py +++ b/main.py @@ -637,6 +637,18 @@ def on_tree_select(event): except Exception: import traceback; traceback.print_exc() + # The DOM rebuild replaced every element object, so a pending link from the + # old tree can no longer be found by identity. Re-resolve it by from/to. + if pending_link is not None: + old_from = pending_link.get("from", "") + old_to = pending_link.get("to", "") + links_container = app_state.xml_root_element.find("links") if app_state.xml_root_element is not None else None + if links_container is not None: + for lnk in links_container: + if lnk.get("from") == old_from and lnk.get("to") == old_to: + pending_link = lnk + break + if element is not None: components_to_render = [child for child in element if child.tag == "comp"] elif tree.exists(selected_id):