# HG changeset patch # User Edouard Tisserant # Date 1591183915 -7200 # Node ID 9442f6a6449ed19a5e2c4d318faf55f1fd29c859 # Parent 8e8812f13d9d291be0274f2ba49b644690a04ff3# Parent 67c6783f221c1f83028430604114b8c9e8a39e80 merge diff -r 67c6783f221c -r 9442f6a6449e ProjectController.py --- 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"), diff -r 67c6783f221c -r 9442f6a6449e runtime/PLCObject.py --- 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: diff -r 67c6783f221c -r 9442f6a6449e svghmi/gen_index_xhtml.xslt --- 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 @@ - - + + @@ -2795,7 +2795,7 @@ - +