SVGHMI: various fixes to make SVGHMI behave on more versions of twisted and GCC. svghmi
authorEdouard Tisserant
Thu, 07 Nov 2019 16:40:48 +0100
branchsvghmi
changeset 2812 68ac5bf43525
parent 2811 4a81cec5f786
child 2813 ac736a878188
SVGHMI: various fixes to make SVGHMI behave on more versions of twisted and GCC.
svghmi/svghmi.c
svghmi/svghmi.py
--- a/svghmi/svghmi.c	Wed Oct 30 15:17:05 2019 +0100
+++ b/svghmi/svghmi.c	Thu Nov 07 16:40:48 2019 +0100
@@ -170,7 +170,7 @@
     return 0;
 }
 
-inline void update_refresh_period(hmi_tree_item_t *dsc, uint16_t refresh_period_ms)
+void update_refresh_period(hmi_tree_item_t *dsc, uint16_t refresh_period_ms)
 {
     while(AtomicCompareExchange(&dsc->wlock, 0, 1)) sched_yield();
     dsc->refresh_period_ms = refresh_period_ms;
--- a/svghmi/svghmi.py	Wed Oct 30 15:17:05 2019 +0100
+++ b/svghmi/svghmi.py	Thu Nov 07 16:40:48 2019 +0100
@@ -340,10 +340,10 @@
 
         res = ([], "", False)
 
-        target_fname = "sghmi_"+location_str+".xhtml"
+        target_fname = "svghmi_"+location_str+".xhtml"
 
         target_path = os.path.join(self._getBuildPath(), target_fname)
-        target_file = open(target_path, 'w')
+        target_file = open(target_path, 'wb')
 
         if os.path.exists(svgfile):
 
@@ -385,7 +385,7 @@
         runtimefile = open(runtimefile_path, 'w')
         runtimefile.write("""
 def _runtime_svghmi1_%(location)s_start():
-    svghmi_root.putChild('%(view_name)s',File('%(xhtml)s'))
+    svghmi_root.putChild('%(view_name)s',File('%(xhtml)s', defaultType='application/xhtml+xml'))
 
 def _runtime_svghmi1_%(location)s_stop():
     svghmi_root.delEntity('%(view_name)s')