# HG changeset patch # User Edouard Tisserant # Date 1653501631 -7200 # Node ID cf4e6a7d40f843dcabf19e832d98705d2bb38d59 # Parent 1b8906ca2a50386d09b54f3a0f98c214e67db724 Various fixes to make svghmi_traffic_light example bahave on windows. diff -r 1b8906ca2a50 -r cf4e6a7d40f8 exemples/svghmi_traffic_light/svghmi_0@svghmi/confnode.xml --- a/exemples/svghmi_traffic_light/svghmi_0@svghmi/confnode.xml Wed May 25 09:18:37 2022 +0200 +++ b/exemples/svghmi_traffic_light/svghmi_0@svghmi/confnode.xml Wed May 25 20:00:31 2022 +0200 @@ -1,2 +1,2 @@ - + diff -r 1b8906ca2a50 -r cf4e6a7d40f8 svghmi/svghmi.py --- a/svghmi/svghmi.py Wed May 25 09:18:37 2022 +0200 +++ b/svghmi/svghmi.py Wed May 25 20:00:31 2022 +0200 @@ -299,18 +299,22 @@ return ret if wx.Platform == '__WXMSW__': - browser_launch_cmd="cmd.exe /c 'start msedge {url}'" + default_cmds={ + "launch":"cmd.exe /c 'start msedge {url}'", + "watchdog":"cmd.exe /k 'echo watchdog for {url} !'"} else: - browser_launch_cmd="chromium {url}" + default_cmds={ + "launch":"chromium {url}", + "watchdog":"echo Watchdog for {name} !"} class SVGHMI(object): XSD = """ - + - + @@ -342,7 +346,7 @@ - """%browser_launch_cmd + """%default_cmds EditorType = SVGHMIEditor @@ -399,9 +403,13 @@ if from_project_path is not None: shutil.copyfile(self._getSVGpath(from_project_path), self._getSVGpath()) - shutil.copyfile(self._getPOTpath(from_project_path), - self._getPOTpath()) - # XXX TODO copy .PO files + + potpath = self._getPOTpath(from_project_path) + if os.path.isfile(potpath): + shutil.copyfile(potpath, self._getPOTpath()) + # copy .PO files + for _name, pofile in GetPoFiles(from_project_path): + shutil.copy(pofile, self.CTNPath()) return True def GetSVGGeometry(self): diff -r 1b8906ca2a50 -r cf4e6a7d40f8 util/misc.py --- a/util/misc.py Wed May 25 09:18:37 2022 +0200 +++ b/util/misc.py Wed May 25 20:00:31 2022 +0200 @@ -45,9 +45,9 @@ dirs[:] = [d for d in dirs if not d[0] == '.'] if sys.platform.startswith('win'): try: - testdirpath = os.path.join(root, "testdir_", random.randint(0, 4294967296)) + testdirpath = os.path.join(root, "testdir_" + str(random.randint(0, 4294967296))) os.mkdir(testdirpath) - os.rmmir(testdirpath) + os.rmdir(testdirpath) except: return False else: