svghmi/svghmi.py
branchsvghmi
changeset 3274 16066300b254
parent 3270 38f7122ccbf9
child 3277 8e81e4ce9bc6
--- a/svghmi/svghmi.py	Mon Jul 12 14:13:29 2021 +0200
+++ b/svghmi/svghmi.py	Mon Jul 12 16:29:55 2021 +0200
@@ -535,7 +535,10 @@
         else:
             target_file = open(target_path, 'wb')
             target_file.write("""<!DOCTYPE html>
-<html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>SVGHMI</title>
+</head>
 <body>
 <h1> No SVG file provided </h1>
 </body>
@@ -548,6 +551,8 @@
         port = self.GetParamsAttributes("SVGHMI.Port")["value"]
         interface = self.GetParamsAttributes("SVGHMI.Interface")["value"]
         path = self.GetParamsAttributes("SVGHMI.Path")["value"].format(name=view_name)
+        if path and path[0]=='/':
+            path = path[1:]
         enable_watchdog = self.GetParamsAttributes("SVGHMI.EnableWatchdog")["value"]
         url="http://"+interface+("" if port==80 else (":"+str(port))
             ) + (("/"+path) if path else ""
@@ -672,7 +677,9 @@
             dialog.Destroy()
         if open_inkscape:
             if not os.path.isfile(svgfile):
-                svgfile = None
+                # make a copy of default svg from source
+                default = os.path.join(ScriptDirectory, "default.svg")
+                shutil.copyfile(default, svgfile)
             open_svg(svgfile)
 
     def _StartPOEdit(self, POFile):