wxglade_hmi/wxglade_hmi.py
changeset 1151 38d6aaad8ffd
parent 1132 28f96aa9c070
child 1155 412e30abf7e5
equal deleted inserted replaced
1150:b1c84771e1cf 1151:38d6aaad8ffd
    63             define_hmi = hmipyfile.read().decode('utf-8')
    63             define_hmi = hmipyfile.read().decode('utf-8')
    64             hmipyfile.close()
    64             hmipyfile.close()
    65         
    65         
    66         declare_hmi = "\n".join(map(lambda x:"%s = None" % x,
    66         declare_hmi = "\n".join(map(lambda x:"%s = None" % x,
    67                                 hmi_frames.keys()))
    67                                 hmi_frames.keys()))
    68         global_hmi = "global "+",".join(hmi_frames.keys())
    68         global_hmi = "global "+",".join(hmi_frames.keys()) + "\n"
    69         init_hmi = "\n".join(map(lambda x: """\
    69         init_hmi = "\n".join(map(lambda x: """\
    70 def OnCloseFrame(evt):
    70 def OnCloseFrame(evt):
    71     wx.MessageBox(_("Please stop PLC to close"))
    71     wx.MessageBox(_("Please stop PLC to close"))
    72 
    72 
    73 %(name)s = %(class)s(None)
    73 %(name)s = %(class)s(None)
    77         cleanup_hmi = "\n".join(map(lambda x:"if %s is not None: %s.Destroy()" % (x,x), hmi_frames.keys()))
    77         cleanup_hmi = "\n".join(map(lambda x:"if %s is not None: %s.Destroy()" % (x,x), hmi_frames.keys()))
    78         
    78         
    79         self.PreSectionsTexts = {
    79         self.PreSectionsTexts = {
    80             "globals":define_hmi + declare_hmi,
    80             "globals":define_hmi + declare_hmi,
    81             "start":global_hmi,
    81             "start":global_hmi,
    82             "stop":global_hmi
    82             "stop":global_hmi + cleanup_hmi
    83         }
    83         }
    84         self.PostSectionsTexts = {
    84         self.PostSectionsTexts = {
    85             "start":init_hmi,
    85             "start":init_hmi,
    86         }
    86         }
    87 
    87