add start inkscape methods for svgui plugin
authorgreg
Tue, 02 Sep 2008 12:21:58 +0200
changeset 233 95b5aa098c4a
parent 232 83cc1a306560
child 234 aff053bad924
add start inkscape methods for svgui plugin
plugins/svgui/svgui.py
--- a/plugins/svgui/svgui.py	Mon Sep 01 14:40:51 2008 +0200
+++ b/plugins/svgui/svgui.py	Tue Sep 02 12:21:58 2008 +0200
@@ -11,6 +11,7 @@
 from FBD_Objects import *
 
 from wxPopen import ProcessLogger
+import subprocess
 from wx.wxsvg import SVGDocument
 
 [ID_SVGUIEDITORFBDPANEL, 
@@ -156,6 +157,21 @@
                     self.logger.write_error("No such XML file: %s\n"%xmlpath)
             dialog.Destroy()
 
+    def _StartInkscape(self):
+        if not self._View:
+            svgfile = os.path.join(self.PlugPath(), "gui.svg")
+            popenargs = []
+
+            if wx.Platform == '__WXMSW__':
+                popenargs.append(os.path.join(base_folder, "Inkscape", "inkscape.exe"))
+            else:
+                popenargs.append("/usr/bin/inkscape")
+
+            if os.path.isfile(svgfile):
+                popenargs.append(svgfile)
+
+            subprocess.Popen(popenargs).pid
+
     PluginMethods = [
         {"bitmap" : os.path.join("images","HMIEditor"),
          "name" : "HMI Editor",
@@ -169,6 +185,10 @@
          "name" : "Import XML",
          "tooltip" : "Import XML",
          "method" : "_ImportXML"},
+         {"bitmap" : os.path.join("images","ImportSVG"),
+         "name" : "Inkscape",
+         "tooltip" : "Create HMI",
+         "method" : "_StartInkscape"},
     ]
     
     def OnPlugSave(self):