9 from SVGUIControler import * |
9 from SVGUIControler import * |
10 from SVGUIEditor import * |
10 from SVGUIEditor import * |
11 from FBD_Objects import * |
11 from FBD_Objects import * |
12 |
12 |
13 from wxPopen import ProcessLogger |
13 from wxPopen import ProcessLogger |
|
14 import subprocess |
14 from wx.wxsvg import SVGDocument |
15 from wx.wxsvg import SVGDocument |
15 |
16 |
16 [ID_SVGUIEDITORFBDPANEL, |
17 [ID_SVGUIEDITORFBDPANEL, |
17 ] = [wx.NewId() for _init_ctrls in range(1)] |
18 ] = [wx.NewId() for _init_ctrls in range(1)] |
18 |
19 |
154 shutil.copy(xmlpath, os.path.join(self.PlugPath(), "gui.xml")) |
155 shutil.copy(xmlpath, os.path.join(self.PlugPath(), "gui.xml")) |
155 else: |
156 else: |
156 self.logger.write_error("No such XML file: %s\n"%xmlpath) |
157 self.logger.write_error("No such XML file: %s\n"%xmlpath) |
157 dialog.Destroy() |
158 dialog.Destroy() |
158 |
159 |
|
160 def _StartInkscape(self): |
|
161 if not self._View: |
|
162 svgfile = os.path.join(self.PlugPath(), "gui.svg") |
|
163 popenargs = [] |
|
164 |
|
165 if wx.Platform == '__WXMSW__': |
|
166 popenargs.append(os.path.join(base_folder, "Inkscape", "inkscape.exe")) |
|
167 else: |
|
168 popenargs.append("/usr/bin/inkscape") |
|
169 |
|
170 if os.path.isfile(svgfile): |
|
171 popenargs.append(svgfile) |
|
172 |
|
173 subprocess.Popen(popenargs).pid |
|
174 |
159 PluginMethods = [ |
175 PluginMethods = [ |
160 {"bitmap" : os.path.join("images","HMIEditor"), |
176 {"bitmap" : os.path.join("images","HMIEditor"), |
161 "name" : "HMI Editor", |
177 "name" : "HMI Editor", |
162 "tooltip" : "HMI Editor", |
178 "tooltip" : "HMI Editor", |
163 "method" : "_OpenView"}, |
179 "method" : "_OpenView"}, |
167 "method" : "_ImportSVG"}, |
183 "method" : "_ImportSVG"}, |
168 {"bitmap" : os.path.join("images","ImportDEF"), |
184 {"bitmap" : os.path.join("images","ImportDEF"), |
169 "name" : "Import XML", |
185 "name" : "Import XML", |
170 "tooltip" : "Import XML", |
186 "tooltip" : "Import XML", |
171 "method" : "_ImportXML"}, |
187 "method" : "_ImportXML"}, |
|
188 {"bitmap" : os.path.join("images","ImportSVG"), |
|
189 "name" : "Inkscape", |
|
190 "tooltip" : "Create HMI", |
|
191 "method" : "_StartInkscape"}, |
172 ] |
192 ] |
173 |
193 |
174 def OnPlugSave(self): |
194 def OnPlugSave(self): |
175 self.SaveXMLFile(os.path.join(self.PlugPath(), "gui.xml")) |
195 self.SaveXMLFile(os.path.join(self.PlugPath(), "gui.xml")) |
176 return True |
196 return True |