svghmi/svghmi.py
branchpython3
changeset 3750 f62625418bff
parent 3688 c2992796a859
child 3817 3deeda82636a
equal deleted inserted replaced
3749:fda6c1a37662 3750:f62625418bff
     4 # This file is part of Beremiz
     4 # This file is part of Beremiz
     5 # Copyright (C) 2021: Edouard TISSERANT
     5 # Copyright (C) 2021: Edouard TISSERANT
     6 #
     6 #
     7 # See COPYING file for copyrights details.
     7 # See COPYING file for copyrights details.
     8 
     8 
     9 from __future__ import absolute_import
     9 
    10 import os
    10 import os
    11 import sys
    11 import sys
    12 import shutil
    12 import shutil
    13 import hashlib
    13 import hashlib
    14 import shlex
    14 import shlex
   305 
   305 
   306 if sys.platform.startswith('win'):
   306 if sys.platform.startswith('win'):
   307     default_cmds={
   307     default_cmds={
   308         "launch":"cmd.exe /c 'start msedge {url}'",
   308         "launch":"cmd.exe /c 'start msedge {url}'",
   309         "watchdog":"cmd.exe /k 'echo watchdog for {url} !'"}
   309         "watchdog":"cmd.exe /k 'echo watchdog for {url} !'"}
   310 elif os.environ.has_key("SNAP"):
   310 elif "SNAP" in os.environ:
   311     default_cmds={
   311     default_cmds={
   312         "launch":"xdg-open {url}",
   312         "launch":"xdg-open {url}",
   313         "watchdog":"echo Watchdog for {name} !"}
   313         "watchdog":"echo Watchdog for {name} !"}
   314 else:
   314 else:
   315     default_cmds={
   315     default_cmds={
   441 
   441 
   442         res = []
   442         res = []
   443         for line in result.split():
   443         for line in result.split():
   444             strippedline = line.strip()
   444             strippedline = line.strip()
   445             attrs = dict(
   445             attrs = dict(
   446                 zip(InkscapeGeomColumns, line.strip().split(',')))
   446                 list(zip(InkscapeGeomColumns, line.strip().split(','))))
   447 
   447 
   448             res.append(etree.Element("bbox", **attrs))
   448             res.append(etree.Element("bbox", **attrs))
   449 
   449 
   450         self.ProgressEnd("inkscape")
   450         self.ProgressEnd("inkscape")
   451         return res
   451         return res