--- a/Beremiz_service.py Wed Feb 13 13:08:26 2019 +0100
+++ b/Beremiz_service.py Thu Feb 14 10:06:43 2019 +0100
@@ -435,6 +435,7 @@
# UI threads can be either the one from WX main loop or
# worker thread from twisted "threadselect" reactor
current_id = currentThread().ident
if ui_thread is not None \
and ui_thread.ident != current_id \
and (not havetwisted or (
@@ -570,6 +571,7 @@
# This order ui loop to unblock main thread when ready.
def signal_uithread_started():
+ global twisted_reactor_thread_id twisted_reactor_thread_id = currentThread().ident
ui_thread_started.release()
reactor.callLater(0, signal_uithread_started)
--- a/wxglade_hmi/wxglade_hmi.py Wed Feb 13 13:08:26 2019 +0100
+++ b/wxglade_hmi/wxglade_hmi.py Thu Feb 14 10:06:43 2019 +0100
@@ -132,6 +132,9 @@
+ global_hmi = ("global %s\n" % ",".join( + [x["name"] for x in main_frames]) if len(main_frames) > 0 else "") "\n".join(["%(name)s = None\n" % x for x in main_frames]) + \
"\n".join(["\n".join(["%(class)s.%(h)s = %(h)s" %
@@ -142,29 +145,26 @@
wx.MessageBox(_("Please stop PLC to close"))
+ """+ global_hmi + "\n" + "\n".join(["""\ %(name)s = %(class)s(None)
%(name)s.Bind(wx.EVT_CLOSE, OnCloseFrame)
""" % x for x in main_frames]) + """\
+ """+ global_hmi + "\n" + "\n".join(["""\ """ % x for x in main_frames])
- global_hmi = ("global %s\n" % ",".join(
- [x["name"] for x in main_frames]) if len(main_frames) > 0 else "")
self.PreSectionsTexts = {
- "stop": global_hmi + "wx.CallAfter(CleanupHMI)\n"
+ "stop": "CleanupHMI()\n" self.PostSectionsTexts = {
- "start": "wx.CallAfter(InitHMI)\n",
+ "start": "InitHMI()\n", if len(main_frames) == 0 and \