mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-01 15:58:36 +02:00
[core] Graph: initial refactoring of graph loading API and logic
* API Instead of having a single `load` function that exposes in its API some elements only applicable to initializing a graph from a templates, split it into 2 distinct functions: `load` and `initFromTemplate`. Apply those changes to users of the API (UI, CLI), and simplify Graph wrapper classes to better align with those concepts. * Deserialization Reduce the cognitive complexity of the deserizalization process by splitting it into more atomic functions, while maintaining the current behavior.
This commit is contained in:
parent
c883c53397
commit
7eab289d30
8 changed files with 153 additions and 127 deletions
|
@ -451,17 +451,21 @@ class UIGraph(QObject):
|
|||
self.stopExecution()
|
||||
self._chunksMonitor.stop()
|
||||
|
||||
@Slot(str, result=bool)
|
||||
def loadGraph(self, filepath, setupProjectFile=True, publishOutputs=False):
|
||||
g = Graph('')
|
||||
status = True
|
||||
@Slot(str)
|
||||
def loadGraph(self, filepath):
|
||||
g = Graph("")
|
||||
if filepath:
|
||||
status = g.load(filepath, setupProjectFile, importProject=False, publishOutputs=publishOutputs)
|
||||
g.load(filepath)
|
||||
if not os.path.exists(g.cacheDir):
|
||||
os.mkdir(g.cacheDir)
|
||||
g.fileDateVersion = os.path.getmtime(filepath)
|
||||
self.setGraph(g)
|
||||
return status
|
||||
|
||||
@Slot(str, bool, result=bool)
|
||||
def initFromTemplate(self, filepath, publishOutputs=False):
|
||||
graph = Graph("")
|
||||
if filepath:
|
||||
graph.initFromTemplate(filepath, publishOutputs=publishOutputs)
|
||||
self.setGraph(graph)
|
||||
|
||||
@Slot(QUrl, result="QVariantList")
|
||||
@Slot(QUrl, QPoint, result="QVariantList")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue