--- a/ProjectController.py Fri May 29 09:46:07 2020 +0200
+++ b/ProjectController.py Wed Jun 03 13:31:55 2020 +0200
@@ -1440,7 +1440,8 @@
PlcStatus.Stopped: {"_Run": True,
"_Transfer": True,
"_Connect": False,
- "_Disconnect": True},
+ "_Disconnect": True,
+ "_Repair": True},
PlcStatus.Empty: {"_Transfer": True,
"_Connect": False,
"_Disconnect": True},
@@ -1966,6 +1967,13 @@
"shown": False,
},
{
+ "bitmap": "Disconnect",
+ "name": _("Disconnect"),
+ "tooltip": _("Disconnect from PLC"),
+ "method": "_Disconnect",
+ "shown": False,
+ },
+ {
"bitmap": "Repair",
"name": _("Repair"),
"tooltip": _("Repair broken PLC"),
@@ -1973,13 +1981,6 @@
"shown": False,
},
{
- "bitmap": "Disconnect",
- "name": _("Disconnect"),
- "tooltip": _("Disconnect from PLC"),
- "method": "_Disconnect",
- "shown": False,
- },
- {
"bitmap": "IDManager",
"name": _("ID Manager"),
"tooltip": _("Manage secure connection identities"),
--- a/runtime/PLCObject.py Fri May 29 09:46:07 2020 +0200
+++ b/runtime/PLCObject.py Wed Jun 03 13:31:55 2020 +0200
@@ -520,7 +520,7 @@
@RunInMain
def SeedBlob(self, seed):
blob = (mkstemp(dir=self.tmpdir) + (hashlib.new('md5'),))
- _fobj, _path, md5sum = blob
+ _fd, _path, md5sum = blob
md5sum.update(seed)
newBlobID = md5sum.digest()
self.blobs[newBlobID] = blob
@@ -533,17 +533,17 @@
if blob is None:
return None
- fobj, _path, md5sum = blob
+ fd, _path, md5sum = blob
md5sum.update(data)
newBlobID = md5sum.digest()
- os.write(fobj, data)
+ os.write(fd, data)
self.blobs[newBlobID] = blob
return newBlobID
@RunInMain
def PurgeBlobs(self):
- for fobj, _path, _md5sum in self.blobs.values():
- os.close(fobj)
+ for fd, _path, _md5sum in self.blobs.values():
+ os.close(fd)
self._init_blobs()
def _BlobAsFile(self, blobID, newpath):
@@ -552,8 +552,11 @@
if blob is None:
raise Exception(_("Missing data to create file: {}").format(newpath))
- fobj, path, _md5sum = blob
- os.close(fobj)
+ fd, path, _md5sum = blob
+ fobj = os.fdopen(fd)
+ fobj.flush()
+ os.fsync(fd)
+ fobj.close()
shutil.move(path, newpath)
def _extra_files_log_path(self):
@@ -609,9 +612,6 @@
# Create new PLC file
self._BlobAsFile(plc_object, new_PLC_filename)
- # Store new PLC filename based on md5 key
- open(self._GetMD5FileName(), "w").write(md5sum)
-
# Then write the files
log = open(extra_files_log, "w")
for fname, blobID in extrafiles:
@@ -619,6 +619,12 @@
self._BlobAsFile(blobID, fpath)
log.write(fname+'\n')
+ # Store new PLC filename based on md5 key
+ with open(self._GetMD5FileName(), "w") as f:
+ f.write(md5sum)
+ f.flush()
+ os.fsync(f.fileno())
+
# Store new PLC filename
self.CurrentPLCFilename = NewFileName
except Exception:
--- a/svghmi/gen_index_xhtml.xslt Fri May 29 09:46:07 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt Wed Jun 03 13:31:55 2020 +0200
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions">
- <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
+<xsl:stylesheet xmlns:ns="beremiz" xmlns:definitions="definitions" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:func="http://exslt.org/functions" xmlns:epilogue="epilogue" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:declarations="declarations" xmlns:debug="debug" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0">
+ <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
<xsl:variable name="svg" select="/svg:svg"/>
<xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
<xsl:variable name="hmitree" select="ns:GetHMITree()"/>
@@ -2795,7 +2795,7 @@
<xsl:comment>
<xsl:apply-templates select="document('')/*/debug:*"/>
</xsl:comment>
- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
<head/>
<body style="margin:0;overflow:hidden;">
<xsl:copy-of select="$result_svg"/>