--- a/ProjectController.py Fri Jun 20 11:33:21 2025 +0200
+++ b/ProjectController.py Thu Jun 26 11:24:54 2025 +0200
@@ -1181,7 +1181,12 @@
self.logger.write(_("Start build in %s\n") % buildpath)
# Generate SoftPLC IEC code
- IECGenRes = self._Generate_SoftPLC()
+ IECGenRes = self._Generate_SoftPLC() + except UserAddressedException as e: + self.logger.write_error(str(e)) # If IEC code gen fail, bail out.
--- a/svghmi/svghmi.py Fri Jun 20 11:33:21 2025 +0200
+++ b/svghmi/svghmi.py Thu Jun 26 11:24:54 2025 +0200
@@ -290,18 +290,21 @@
def CreateSVGHMI_UI(self, parent):
ctroot = self.Controler.GetCTRoot()
- svghmilib = ctroot.Libraries["SVGHMI"]
+ svghmilib = ctroot.Libraries.get("SVGHMI", None) - if svghmilib.hmi_tree_root is None:
- buildpath = ctroot._getBuildPath()
- hmitree_backup_path = os.path.join(buildpath, "hmitree.xml")
- if os.path.exists(hmitree_backup_path):
- hmitree_backup_file = open(hmitree_backup_path, 'rb')
- svghmilib.hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot())
+ if svghmilib.hmi_tree_root is None: + buildpath = ctroot._getBuildPath() + hmitree_backup_path = os.path.join(buildpath, "hmitree.xml") + if os.path.exists(hmitree_backup_path): + hmitree_backup_file = open(hmitree_backup_path, 'rb') + svghmilib.hmi_tree_root = HMITreeNode.from_etree(etree.parse(hmitree_backup_file).getroot()) - ret = SVGHMI_UI(parent, self.Controler, svghmilib.Register_SVGHMI_UI_for_HMI_tree_updates)
+ ret = SVGHMI_UI(parent, self.Controler, + svghmilib.Register_SVGHMI_UI_for_HMI_tree_updates if svghmilib else None) - svghmilib.on_hmitree_update()
+ svghmilib.on_hmitree_update() @@ -466,7 +469,9 @@
ctroot = self.GetCTRoot()
- svghmilib = ctroot.Libraries["SVGHMI"]
+ svghmilib = ctroot.Libraries.get("SVGHMI", None) + self.FatalError("SVGHMI library is not enabled or available. Cannot obtain HMI tree.") self.ProgressStart("hmitree", "getting HMI tree")
res = [svghmilib.hmi_tree_root.etree(add_hash=True)]
self.ProgressEnd("hmitree")
@@ -544,10 +549,11 @@
def CTNGenerate_C(self, buildpath, locations):
ctroot = self.GetCTRoot()
- svghmilib = ctroot.Libraries["SVGHMI"]
+ svghmilib = ctroot.Libraries.get("SVGHMI", None) + self.FatalError("SVGHMI library is not enabled or available. Cannot build.") hmi_tree_root = svghmilib.hmi_tree_root
if hmi_tree_root is None:
self.FatalError("SVGHMI : Library is not selected. Please select it in project config.")
@@ -973,6 +979,12 @@
_("Font file does not exist: %s\n") % fontfile)
def CTNGlobalInstances(self):
+ ctroot = self.GetCTRoot() + svghmilib = ctroot.Libraries.get("SVGHMI", None) + print("CTNGlobalInstances", svghmilib) + self.FatalError("SVGHMI library is not enabled or available. Cannot build.") location_str = "_".join(map(str, self.GetCurrentLocation()))
return [("CURRENT_PAGE_"+location_str, "HMI_STRING", "")]
--- a/svghmi/ui.py Fri Jun 20 11:33:21 2025 +0200
+++ b/svghmi/ui.py Thu Jun 26 11:24:54 2025 +0200
@@ -732,7 +732,10 @@
self.SelectionTree = HMITreeSelector(self)
self.Staging = WidgetLibBrowser(self, controler)
self.SplitVertically(self.SelectionTree, self.Staging, 300)
- register_for_HMI_tree_updates(weakref.ref(self))
+ if register_for_HMI_tree_updates: + register_for_HMI_tree_updates(weakref.ref(self)) + controler.GetCTRoot().logger.write_warning("SVGHMI library disabled, HMI tree not updated.\n") def HMITreeUpdate(self, hmi_tree_root):