# HG changeset patch # User Edouard Tisserant # Date 1613732569 -3600 # Node ID 279e08f238ca88232d4845ea632dc985bedb8c2a # Parent a8c81a080588db1f39de45a08a7193fbcbb7db2a SVGHMI: Fix launch of POEdit on widows. Parsing oommand in registry based on heuristic was bad, now using regex should be safer. TODO : replicate for Inkscape launch. diff -r a8c81a080588 -r 279e08f238ca svghmi/i18n.py --- 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