svghmi/i18n.py
branchsvghmi
changeset 3157 279e08f238ca
parent 3144 2af6afaccaf2
child 3198 d9c8f8789fc8
--- a/svghmi/i18n.py	Fri Feb 19 10:04:36 2021 +0100
+++ b/svghmi/i18n.py	Fri Feb 19 12:02:49 2021 +0100
@@ -14,12 +14,15 @@
 import time
 import ast
 import wx
+import re
 
 # to have it for python 2, had to install 
 # https://pypi.org/project/pycountry/18.12.8/
 # python2 -m pip install pycountry==18.12.8 --user
 import pycountry
 
+cmd_parser = re.compile(r'(?:"([^"]+)"\s*|([^\s]+)\s*)?')
+
 def open_pofile(pofile):
     """ Opens PO file with POEdit """
     
@@ -29,7 +32,9 @@
         try:
             poedit_cmd = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
                                            'SOFTWARE\\Classes\\poedit\\shell\\open\\command')
-            poedit_path = poedit_cmd.replace('"%1"', '').strip().replace('"', '')
+            cmd = re.findall(cmd_parser, poedit_cmd)
+            dblquote_value,smpl_value = cmd[0]
+            poedit_path = dblquote_value+smpl_value
         except OSError:
             poedit_path = None