--- a/runtime/PLCObject.py Mon Mar 16 17:31:08 2009 +0100
+++ b/runtime/PLCObject.py Mon Mar 23 16:20:05 2009 +0100
@@ -189,38 +189,38 @@
# TODO handle exceptions in runtime.py
# pyfile may redefine _runtime_cleanup
# or even call _PythonThreadProc itself.
- if os.path.exists(hmifile):
- execfile(hmifile, self.python_threads_vars)
execfile(pyfile, self.python_threads_vars)
- if self.python_threads_vars.has_key('wx'):
- wx = self.python_threads_vars['wx']
- # try to instanciate the first frame found.
- for name, obj in self.python_threads_vars.iteritems():
- if type(obj)==type(type) and issubclass(obj,wx.Frame):
- self.hmi_frame = obj(None)
- self.python_threads_vars[name] = self.hmi_frame
- # keep track of class... never know
- self.python_threads_vars['Class_'+name] = obj
- self.hmi_frame.Bind(wx.EVT_CLOSE, OnCloseFrame)
- self.hmi_frame.Destroy()
- wx.MessageBox("Please stop PLC to close")
- #wx.CallAfter(self.StopPLC)
- PLCprint(traceback.format_exc())
PLCprint(traceback.format_exc())
+ if os.path.exists(hmifile): + execfile(hmifile, self.python_threads_vars) + if self.python_threads_vars.has_key('wx'): + wx = self.python_threads_vars['wx'] + # try to instanciate the first frame found. + for name, obj in self.python_threads_vars.iteritems(): + if type(obj)==type(type) and issubclass(obj,wx.Frame): + self.hmi_frame = obj(None) + self.python_threads_vars[name] = self.hmi_frame + # keep track of class... never know + self.python_threads_vars['Class_'+name] = obj + self.hmi_frame.Bind(wx.EVT_CLOSE, OnCloseFrame) + self.hmi_frame.Destroy() + wx.MessageBox("Please stop PLC to close") + #wx.CallAfter(self.StopPLC) + PLCprint(traceback.format_exc()) def BeginRuntimePy(self):
runtime_begin = self.python_threads_vars.get("_runtime_begin",None)
if runtime_begin is not None: