# HG changeset patch # User Edouard Tisserant # Date 1565607971 -7200 # Node ID 4efc509e9a1a6e2d273c806e86d2ac401adcfa7d # Parent a46311f8860483cef1034b075139fec1cf95fa78 Allow using docutil.get_inkscape_path() on Linux also. diff -r a46311f88604 -r 4efc509e9a1a docutil/docsvg.py --- a/docutil/docsvg.py Fri Aug 09 12:12:24 2019 +0200 +++ b/docutil/docsvg.py Mon Aug 12 13:06:11 2019 +0200 @@ -31,15 +31,19 @@ def get_inkscape_path(): """ Return the Inkscape path """ - from six.moves import winreg - try: - svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, - 'Software\\Classes\\svgfile\\shell\\Inkscape\\command') - except OSError: - svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, - 'Software\\Classes\\inkscape.svg\\shell\\open\\command') - svgexepath = svgexepath.replace('"%1"', '') - return svgexepath.replace('"', '') + if wx.Platform == '__WXMSW__': + from six.moves import winreg + try: + svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, + 'Software\\Classes\\svgfile\\shell\\Inkscape\\command') + except OSError: + svgexepath = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, + 'Software\\Classes\\inkscape.svg\\shell\\open\\command') + svgexepath = svgexepath.replace('"%1"', '').strip() + return svgexepath.replace('"', '') + else: + # TODO: search path + return os.path.join("/usr/bin", "inkscape") def open_win_svg(svgexepath, svgfile): @@ -65,7 +69,7 @@ wx.MessageBox("Inkscape is not found or installed !") return None else: - svgexepath = os.path.join("/usr/bin", "inkscape") + svgexepath=get_inkscape_path() if os.path.isfile(svgexepath): open_lin_svg(svgexepath, svgfile) else: