# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1653322291 -7200
# Node ID 9ec5ecf9f589e4394286a919e81c296d91fab8ee
# Parent  46a7aac382ef7265fab598900745d78408ff86ca
IDE/Windows: Find Inkscape binary even if Inkscape was installed for current user only.

diff -r 46a7aac382ef -r 9ec5ecf9f589 docutil/docsvg.py
--- a/docutil/docsvg.py	Mon May 23 18:10:13 2022 +0200
+++ b/docutil/docsvg.py	Mon May 23 18:11:31 2022 +0200
@@ -33,15 +33,19 @@
     if wx.Platform == '__WXMSW__':
         from six.moves import winreg
         inkcmd = None
-        try:
-            inkcmd = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
-                                           'Software\\Classes\\svgfile\\shell\\Inkscape\\command')
-        except OSError:
+        tries = [(winreg.HKEY_LOCAL_MACHINE, 'Software\\Classes\\svgfile\\shell\\Inkscape\\command'),
+                 (winreg.HKEY_LOCAL_MACHINE, 'Software\\Classes\\inkscape.svg\\shell\\open\\command'),
+                 (winreg.HKEY_CURRENT_USER, 'Software\\Classes\\inkscape.svg\\shell\\open\\command')]
+
+        for subreg, key in tries:
             try:
-                inkcmd = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
-                                               'Software\\Classes\\inkscape.svg\\shell\\open\\command')
+                inkcmd = winreg.QueryValue(subreg, key)
+                break;
             except OSError:
-                return None
+                pass
+
+        if inkcmd is None:
+            return None
 
         return inkcmd.replace('"%1"', '').strip().replace('"', '')