mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[ui] Detect if the reconstruction has been set yet or reset
An `active` property is added to the `Reconstruction` object to share whether it has been initialized or not.
This commit is contained in:
parent
da2c3fda05
commit
cb062a4b4c
3 changed files with 13 additions and 10 deletions
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue