SVGHMI: Fix update of HMI tree in UI when loading from XML at start. Removed some dead code left after split of svghmi.py into svghmi.py+ui.py.
--- a/svghmi/svghmi.py Mon Mar 29 10:26:42 2021 +0200
+++ b/svghmi/svghmi.py Mon Mar 29 14:35:45 2021 +0200
@@ -261,7 +261,11 @@
hmitree_backup_file = open(hmitree_backup_path, 'rb')
hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot())
- return SVGHMI_UI(parent, Register_SVGHMI_UI_for_HMI_tree_updates)
+ ret = SVGHMI_UI(parent, Register_SVGHMI_UI_for_HMI_tree_updates)
+
+ on_hmitree_update(hmi_tree_root)
+
+ return ret
class SVGHMI(object):
XSD = """<?xml version="1.0" encoding="utf-8" ?>
--- a/svghmi/ui.py Mon Mar 29 10:26:42 2021 +0200
+++ b/svghmi/ui.py Mon Mar 29 14:35:45 2021 +0200
@@ -18,13 +18,6 @@
from util.ProcessLogger import ProcessLogger
-def SVGHMIEditorUpdater(ref):
- def SVGHMIEditorUpdate():
- o = ref()
- if o is not None:
- wx.CallAfter(o.MakeTree)
- return SVGHMIEditorUpdate
-
class HMITreeSelector(wx.TreeCtrl):
def __init__(self, parent):
global on_hmitree_update
@@ -34,7 +27,6 @@
wx.SUNKEN_BORDER |
wx.TR_LINES_AT_ROOT))
- on_hmitree_update = SVGHMIEditorUpdater(weakref.ref(self))
self.MakeTree()
def _recurseTree(self, current_hmitree_root, current_tc_root):