@@ -215,6 +215,7 @@ def __init__(self, name, parent=None):
215215 super (Graph , self ).__init__ (parent )
216216 self .name = name
217217 self ._loading = False
218+ self ._saving = False
218219 self ._updateEnabled = True
219220 self ._updateRequested = False
220221 self .dirtyTopology = False
@@ -251,6 +252,11 @@ def fileFeatures(self):
251252 def isLoading (self ):
252253 """ Return True if the graph is currently being loaded. """
253254 return self ._loading
255+
256+ @property
257+ def isSaving (self ):
258+ """ Return True if the graph is currently being saved. """
259+ return self ._saving
254260
255261 @Slot (str )
256262 def load (self , filepath , setupProjectFile = True , importProject = False , publishOutputs = False ):
@@ -1347,6 +1353,23 @@ def asString(self):
13471353 return str (self .toDict ())
13481354
13491355 def save (self , filepath = None , setupProjectFile = True , template = False ):
1356+ """
1357+ Save the current Meshroom graph as a serialized ".mg" file.
1358+
1359+ Args:
1360+ filepath: project filepath to save as.
1361+ setupProjectFile: Store the reference to the project file and setup the cache directory.
1362+ If false, it only saves the graph of the project file as a template.
1363+ template: If true, saves the current graph as a template.
1364+ """
1365+ # Update the saving flag indicating that the current graph is being saved
1366+ self ._saving = True
1367+ try :
1368+ self ._save (filepath = filepath , setupProjectFile = setupProjectFile , template = template )
1369+ finally :
1370+ self ._saving = False
1371+
1372+ def _save (self , filepath = None , setupProjectFile = True , template = False ):
13501373 path = filepath or self ._filepath
13511374 if not path :
13521375 raise ValueError ("filepath must be specified for unsaved files." )
@@ -1636,6 +1659,7 @@ def setVerbose(self, v):
16361659 edges = Property (BaseObject , edges .fget , constant = True )
16371660 filepathChanged = Signal ()
16381661 filepath = Property (str , lambda self : self ._filepath , notify = filepathChanged )
1662+ isSaving = Property (bool , isSaving .fget , constant = True )
16391663 fileReleaseVersion = Property (str , lambda self : self .header .get (Graph .IO .Keys .ReleaseVersion , "0.0" ),
16401664 notify = filepathChanged )
16411665 fileDateVersion = Property (float , fileDateVersion .fget , fileDateVersion .fset , notify = filepathChanged )
0 commit comments