# HG changeset patch
# User Laurent Bessard
# Date 1368655269 -7200
# Node ID 38d6aaad8ffd9353bbe914dfc4c33f20100d51d4
# Parent  b1c84771e1cf9a94198161046989d6ee2aaf9d79
Fixed bug wxGlade hmi not closed when stopping PLC

diff -r b1c84771e1cf -r 38d6aaad8ffd wxglade_hmi/wxglade_hmi.py
--- a/wxglade_hmi/wxglade_hmi.py	Thu May 16 00:00:35 2013 +0200
+++ b/wxglade_hmi/wxglade_hmi.py	Thu May 16 00:01:09 2013 +0200
@@ -65,7 +65,7 @@
         
         declare_hmi = "\n".join(map(lambda x:"%s = None" % x,
                                 hmi_frames.keys()))
-        global_hmi = "global "+",".join(hmi_frames.keys())
+        global_hmi = "global "+",".join(hmi_frames.keys()) + "\n"
         init_hmi = "\n".join(map(lambda x: """\
 def OnCloseFrame(evt):
     wx.MessageBox(_("Please stop PLC to close"))
@@ -79,7 +79,7 @@
         self.PreSectionsTexts = {
             "globals":define_hmi + declare_hmi,
             "start":global_hmi,
-            "stop":global_hmi
+            "stop":global_hmi + cleanup_hmi
         }
         self.PostSectionsTexts = {
             "start":init_hmi,