134 |
134 |
135 global_hmi = ("global %s\n" % ",".join( |
135 global_hmi = ("global %s\n" % ",".join( |
136 [x["name"] for x in main_frames]) if len(main_frames) > 0 else "") |
136 [x["name"] for x in main_frames]) if len(main_frames) > 0 else "") |
137 |
137 |
138 declare_hmi = \ |
138 declare_hmi = \ |
139 "\n".join(["%(name)s = None\n" % x for x in main_frames]) + \ |
139 "\n".join(["%(name)s = None\n" % x for x in main_frames]) + \ |
140 "\n".join(["\n".join(["%(class)s.%(h)s = %(h)s" % |
140 "\n".join(["\n".join(["%(class)s.%(h)s = %(h)s" % dict(x, h=h) |
141 dict(x, h=h) for h in x['handlers']]) |
141 for h in x['handlers']]) |
142 for x in hmi_objects]) + """\ |
142 for x in hmi_objects]) + """\ |
143 |
143 |
144 def OnCloseFrame(evt): |
144 def OnCloseFrame(evt): |
145 wx.MessageBox(_("Please stop PLC to close")) |
145 wx.MessageBox(_("Please stop PLC to close")) |
146 |
146 |
147 def InitHMI(): |
147 def InitHMI(): |
148 """+ global_hmi + "\n" + "\n".join(["""\ |
148 """ + global_hmi + "\n" + "\n".join(["""\ |
149 %(name)s = %(class)s(None) |
149 %(name)s = %(class)s(None) |
150 %(name)s.Bind(wx.EVT_CLOSE, OnCloseFrame) |
150 %(name)s.Bind(wx.EVT_CLOSE, OnCloseFrame) |
151 %(name)s.Show() |
151 %(name)s.Show() |
152 |
152 |
153 """ % x for x in main_frames]) + """\ |
153 """ % x for x in main_frames]) + """\ |
154 def CleanupHMI(): |
154 def CleanupHMI(): |
155 """+ global_hmi + "\n" + "\n".join(["""\ |
155 """ + global_hmi + "\n" + "\n".join(["""\ |
156 if %(name)s is not None: |
156 if %(name)s is not None: |
157 %(name)s.Destroy() |
157 %(name)s.Destroy() |
158 """ % x for x in main_frames]) |
158 """ % x for x in main_frames]) |
159 |
159 |
160 self.PreSectionsTexts = { |
160 self.PreSectionsTexts = { |
161 "globals": define_hmi, |
161 "globals": define_hmi, |