# HG changeset patch # User Laurent Bessard # Date 1371109379 -7200 # Node ID 02a710c7b5ed434c77fc3435f82740d6c621fb98 # Parent ff59c6a8b79391785fc2860fab907a3fdce427f5 Fixed bug in wxGlade extension when compiling and starting project with no hmi defined diff -r ff59c6a8b793 -r 02a710c7b5ed wxglade_hmi/wxglade_hmi.py --- a/wxglade_hmi/wxglade_hmi.py Thu Jun 13 09:37:43 2013 +0200 +++ b/wxglade_hmi/wxglade_hmi.py Thu Jun 13 09:42:59 2013 +0200 @@ -71,12 +71,16 @@ define_hmi = hmipyfile.read().decode('utf-8') hmipyfile.close() + else: + define_hmi = "" + declare_hmi = "\n".join(["%(name)s = None\n" % x + "\n".join(["%(class)s.%(h)s = %(h)s"% dict(x,h=h) for h in x['handlers']]) for x in hmi_frames]) - global_hmi = "global %s\n"%",".join( - [x["name"] for x in hmi_frames]) + global_hmi = ("global %s\n"%",".join( + [x["name"] for x in hmi_frames]) + if len(hmi_frames) > 0 else "") init_hmi = "\n".join(["""\ def OnCloseFrame(evt): wx.MessageBox(_("Please stop PLC to close"))