mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-30 06:48:47 +02:00
Compare last saved date before saving to prevent overwrite
This commit is contained in:
parent
bc139d13e7
commit
e63c2df2a8
3 changed files with 56 additions and 1 deletions
|
@ -223,6 +223,7 @@ class Graph(BaseObject):
|
|||
self._compatibilityNodes = DictModel(keyAttrName='name', parent=self)
|
||||
self.cacheDir = meshroom.core.defaultCacheFolder
|
||||
self._filepath = ''
|
||||
self._fileDateVersion = 0
|
||||
self.header = {}
|
||||
|
||||
def clear(self):
|
||||
|
@ -267,6 +268,8 @@ class Graph(BaseObject):
|
|||
|
||||
if not isinstance(graphData, dict):
|
||||
raise RuntimeError('loadGraph error: Graph is not a dict. File: {}'.format(filepath))
|
||||
|
||||
self._fileDateVersion = os.path.getmtime(filepath)
|
||||
|
||||
self.header = fileData.get(Graph.IO.Keys.Header, {})
|
||||
nodesVersions = self.header.get(Graph.IO.Keys.NodesVersions, {})
|
||||
|
@ -1539,6 +1542,18 @@ class Graph(BaseObject):
|
|||
self.updateStatusFromCache(force=True)
|
||||
self.cacheDirChanged.emit()
|
||||
|
||||
@property
|
||||
def fileDateVersion(self):
|
||||
return self._fileDateVersion
|
||||
|
||||
@fileDateVersion.setter
|
||||
def fileDateVersion(self, value):
|
||||
self._fileDateVersion = value
|
||||
|
||||
@Slot(str, result=float)
|
||||
def getFileDateVersionFromPath(self, value):
|
||||
return os.path.getmtime(value)
|
||||
|
||||
def setVerbose(self, v):
|
||||
with GraphModification(self):
|
||||
for node in self._nodes:
|
||||
|
@ -1553,6 +1568,7 @@ class Graph(BaseObject):
|
|||
filepathChanged = Signal()
|
||||
filepath = Property(str, lambda self: self._filepath, notify=filepathChanged)
|
||||
fileReleaseVersion = Property(str, lambda self: self.header.get(Graph.IO.Keys.ReleaseVersion, "0.0"), notify=filepathChanged)
|
||||
fileDateVersion = Property(float, fileDateVersion.fget, fileDateVersion.fset, notify=filepathChanged)
|
||||
cacheDirChanged = Signal()
|
||||
cacheDir = Property(str, cacheDir.fget, cacheDir.fset, notify=cacheDirChanged)
|
||||
updated = Signal()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue