# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1717502956 -7200
# Node ID d5edde0c145ba1dde2e7d1623aad2fdbfcbeb0c2
# Parent  d5fb90fd2a79df2db77fd56ffeaf1687e6876497
Revert unwanted changes potentially breaking wxGlade support.
Partly revert 34d4c77ccb1bcb14601ab347ec6080466b7e143d. Skips evaluator related changes that was included by mistake.

diff -r d5fb90fd2a79 -r d5edde0c145b runtime/PLCObject.py
--- a/runtime/PLCObject.py	Tue Jun 04 08:35:13 2024 +0200
+++ b/runtime/PLCObject.py	Tue Jun 04 14:09:16 2024 +0200
@@ -330,7 +330,7 @@
 
         return False
 
-    def PythonRuntimeCall(self, methodname, reverse_order=False):
+    def PythonRuntimeCall(self, methodname, use_evaluator=True, reverse_order=False):
         """
         Calls init, start, stop or cleanup method provided by
         runtime python files, loaded when new PLC uploaded
@@ -339,7 +339,10 @@
         if reverse_order:
             methods = reversed(methods)
         for method in methods:
-            _res, exp = default_evaluator(method)
+            if use_evaluator:
+                _res, exp = self.evaluator(method)
+            else:
+                _res, exp = default_evaluator(method)
             if exp is not None:
                 self.LogMessage(0, '\n'.join(traceback.format_exception(*exp)))
 
@@ -403,7 +406,7 @@
             self.LogMessage(0, traceback.format_exc())
             raise
 
-        self.PythonRuntimeCall("init")
+        self.PythonRuntimeCall("init", use_evaluator=False)
 
         self.PythonThreadCondLock = Lock()
         self.PythonThreadCmdCond = Condition(self.PythonThreadCondLock)
@@ -418,7 +421,7 @@
         if self.python_runtime_vars is not None:
             self.PythonThreadCommand("Finish")
             self.PythonThread.join()
-            self.PythonRuntimeCall("cleanup", reverse_order=True)
+            self.PythonRuntimeCall("cleanup", use_evaluator=False, reverse_order=True)
 
         self.python_runtime_vars = None