equal
deleted
inserted
replaced
18 |
18 |
19 # to have it for python 2, had to install |
19 # to have it for python 2, had to install |
20 # https://pypi.org/project/pycountry/18.12.8/ |
20 # https://pypi.org/project/pycountry/18.12.8/ |
21 # python2 -m pip install pycountry==18.12.8 --user |
21 # python2 -m pip install pycountry==18.12.8 --user |
22 import pycountry |
22 import pycountry |
|
23 from dialogs import MessageBoxOnce |
23 |
24 |
24 cmd_parser = re.compile(r'(?:"([^"]+)"\s*|([^\s]+)\s*)?') |
25 cmd_parser = re.compile(r'(?:"([^"]+)"\s*|([^\s]+)\s*)?') |
25 |
26 |
26 def open_pofile(pofile): |
27 def open_pofile(pofile): |
27 """ Opens PO file with POEdit """ |
28 """ Opens PO file with POEdit """ |
37 poedit_path = dblquote_value+smpl_value |
38 poedit_path = dblquote_value+smpl_value |
38 except OSError: |
39 except OSError: |
39 poedit_path = None |
40 poedit_path = None |
40 |
41 |
41 else: |
42 else: |
42 try: |
43 if os.environ.has_key("SNAP"): |
43 poedit_path = subprocess.check_output("command -v poedit", shell=True).strip() |
44 MessageBoxOnce("Launching POEdit with xdg-open", |
44 except subprocess.CalledProcessError: |
45 "Confined app can't launch POEdit directly.\n"+ |
45 poedit_path = None |
46 "Instead, PO/POT file is passed to xdg-open.\n"+ |
|
47 "Please select POEdit when proposed.\n\n"+ |
|
48 "Notes: \n"+ |
|
49 " - POEdit must be installed on you system.\n"+ |
|
50 " - If no choice is proposed, use file manager to change POT/PO file properties.\n", |
|
51 "SVGHMII18SnapWarning") |
|
52 poedit_path = "xdg-open" |
|
53 else: |
|
54 try: |
|
55 poedit_path = subprocess.check_output("command -v poedit", shell=True).strip() |
|
56 except subprocess.CalledProcessError: |
|
57 poedit_path = None |
46 |
58 |
47 if poedit_path is None: |
59 if poedit_path is None: |
48 wx.MessageBox("POEdit is not found or installed !") |
60 wx.MessageBox("POEdit is not found or installed !") |
49 else: |
61 else: |
50 subprocess.Popen([poedit_path,pofile]) |
62 subprocess.Popen([poedit_path,pofile]) |