diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index 5356f0c3..02e69d25 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -97,8 +97,6 @@ class MeshroomApp(QApplication): args = parser.parse_args(args[1:]) - self._projectOpened = True if getattr(args, "import", None) or args.project or args.importRecursive or args.save or args.pipeline else False - logStringToPython = { 'fatal': logging.FATAL, 'error': logging.ERROR, @@ -492,10 +490,6 @@ class MeshroomApp(QApplication): activeProjectChanged = Signal() activeProject = Property(Variant, lambda self: self._activeProject, notify=activeProjectChanged) - # As activeProject is a Reconstruction, we can't use it directly in QML to know if a project is opened or not - # So we expose a boolean property to know if a project is opened or not - # TODO: find a way to have empty activeProject property - projectOpened = Property(bool, lambda self: self._projectOpened, constant=True) changelogModel = Property("QVariantList", _changelogModel, constant=True) licensesModel = Property("QVariantList", _licensesModel, constant=True) pipelineTemplateFilesChanged = Signal() diff --git a/meshroom/ui/qml/main.qml b/meshroom/ui/qml/main.qml index a9c01d1a..223f8bf7 100644 --- a/meshroom/ui/qml/main.qml +++ b/meshroom/ui/qml/main.qml @@ -609,7 +609,7 @@ ApplicationWindow { anchors.fill: parent Component.onCompleted: { - if (MeshroomApp.projectOpened) { + if (_reconstruction.active) { mainStack.push("Application.qml") } else { mainStack.push("Homepage.qml") diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index 0e26d27c..e1aaaa5f 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -434,11 +434,11 @@ class Reconstruction(UIGraph): "matchProvider": ["FeatureMatching", "StructureFromMotion"] } - def __init__(self, undoStack, taskManager, defaultPipeline='', parent=None): + def __init__(self, undoStack, taskManager, defaultPipeline="", parent=None): super(Reconstruction, self).__init__(undoStack, taskManager, parent) # initialize member variables for key steps of the 3D reconstruction pipeline - + self._active = False self._activeNodes = meshroom.common.DictModel(keyAttrName="nodeType") self.initActiveNodes() @@ -477,10 +477,14 @@ class Reconstruction(UIGraph): self._workerThreads.terminate() self._workerThreads.join() + def setActive(self, active): + self._active = active + @Slot() def clear(self): self.clearActiveNodes() super(Reconstruction, self).clear() + self.setActive(False) def setDefaultPipeline(self, defaultPipeline): self._defaultPipeline = defaultPipeline @@ -534,7 +538,7 @@ class Reconstruction(UIGraph): "Data might have been lost in the process.", "Open it with the corresponding version of Meshroom to recover your data." )) - + self.setActive(True) return status except FileNotFoundError as e: self.error.emit( @@ -1273,6 +1277,11 @@ class Reconstruction(UIGraph): currentViewPathChanged = Signal() currentViewPath = Property(str, lambda self: self._currentViewPath, setCurrentViewPath, notify=currentViewPathChanged) + # Whether the Reconstruction object has been set ("new" has been called) or not ("new" has never + # been called or "clear" has been called) + activeChanged = Signal() + active = Property(bool, lambda self: self._active, setActive, notify=activeChanged) + # Signals to propagate high-level messages error = Signal(Message) warning = Signal(Message)