docutil/docsvg.py
changeset 1736 7e61baa047f0
parent 1735 c02818d7e29f
child 1739 ec153828ded2
equal deleted inserted replaced
1735:c02818d7e29f 1736:7e61baa047f0
    24 
    24 
    25 import wx
    25 import wx
    26 import os
    26 import os
    27 import subprocess
    27 import subprocess
    28 
    28 
       
    29 
    29 def get_inkscape_path():
    30 def get_inkscape_path():
    30     """ Return the Inkscape path """
    31     """ Return the Inkscape path """
    31     import _winreg
    32     import _winreg
    32     svgexepath = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE,
    33     svgexepath = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE,
    33                  'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
    34                  'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
    34     svgexepath = svgexepath.replace('"%1"', '')
    35     svgexepath = svgexepath.replace('"%1"', '')
    35     return svgexepath.replace('"', '')
    36     return svgexepath.replace('"', '')
    36 
    37 
       
    38 
    37 def open_win_svg(svgexepath, svgfile):
    39 def open_win_svg(svgexepath, svgfile):
    38     """ Open Inkscape on Windows platform """
    40     """ Open Inkscape on Windows platform """
    39     popenargs = [svgexepath]
    41     popenargs = [svgexepath]
    40     if svgfile is not None :
    42     if svgfile is not None :
    41         popenargs.append(svgfile)
    43         popenargs.append(svgfile)
    42     subprocess.Popen(popenargs).pid
    44     subprocess.Popen(popenargs).pid
    43 
    45 
       
    46 
    44 def open_lin_svg(svgexepath, svgfile):
    47 def open_lin_svg(svgexepath, svgfile):
    45     """ Open Inkscape on Linux platform """
    48     """ Open Inkscape on Linux platform """
    46     if os.path.isfile("/usr/bin/inkscape"):
    49     if os.path.isfile("/usr/bin/inkscape"):
    47         os.system("%s %s &" % (svgexepath , svgfile))
    50         os.system("%s %s &" % (svgexepath , svgfile))
       
    51 
    48 
    52 
    49 def open_svg(svgfile):
    53 def open_svg(svgfile):
    50     """ Generic function to open SVG file """
    54     """ Generic function to open SVG file """
    51     if wx.Platform == '__WXMSW__' :
    55     if wx.Platform == '__WXMSW__' :
    52         try:
    56         try: