mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-04 11:51:58 +02:00
[ui] add 'Message' structure to wrap high-level messages
* fix random segfault due to signals with 2+ arguments (PySide bug) * group Connections to '_reconstruction' instance
This commit is contained in:
parent
634eec5914
commit
b46520009f
2 changed files with 39 additions and 24 deletions
|
@ -197,22 +197,6 @@ ApplicationWindow {
|
||||||
id: dialogsFactory
|
id: dialogsFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind log messages to DialogsFactory
|
|
||||||
Connections {
|
|
||||||
target: _reconstruction
|
|
||||||
function createDialog(func, args)
|
|
||||||
{
|
|
||||||
var dialog = func(_window)
|
|
||||||
// Set text afterwards to avoid dialog sizing issues
|
|
||||||
dialog.title = args[0]
|
|
||||||
dialog.text = args[1]
|
|
||||||
dialog.detailedText = args[2]
|
|
||||||
}
|
|
||||||
// onInfo: createDialog(dialogsFactory.info, arguments)
|
|
||||||
// onWarning: createDialog(dialogsFactory.warning, arguments)
|
|
||||||
// onError: createDialog(dialogsFactory.error, arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: undoAction
|
id: undoAction
|
||||||
|
|
||||||
|
@ -316,6 +300,20 @@ ApplicationWindow {
|
||||||
0,
|
0,
|
||||||
graphEditor.boundingBox().height + graphEditor.gridSpacing
|
graphEditor.boundingBox().height + graphEditor.gridSpacing
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Bind messages to DialogsFactory
|
||||||
|
function createDialog(func, message)
|
||||||
|
{
|
||||||
|
var dialog = func(_window)
|
||||||
|
// Set text afterwards to avoid dialog sizing issues
|
||||||
|
dialog.title = message.title
|
||||||
|
dialog.text = message.text
|
||||||
|
dialog.detailedText = message.detailedText
|
||||||
|
}
|
||||||
|
|
||||||
|
onInfo: createDialog(dialogsFactory.info, arguments[0])
|
||||||
|
onWarning: createDialog(dialogsFactory.warning, arguments[0])
|
||||||
|
onError: createDialog(dialogsFactory.error, arguments[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls1.SplitView {
|
Controls1.SplitView {
|
||||||
|
|
|
@ -10,6 +10,20 @@ from meshroom.core import graph
|
||||||
from meshroom.ui.graph import UIGraph
|
from meshroom.ui.graph import UIGraph
|
||||||
|
|
||||||
|
|
||||||
|
class Message(QObject):
|
||||||
|
""" Simple structure wrapping a high-level message. """
|
||||||
|
|
||||||
|
def __init__(self, title, text, detailedText="", parent=None):
|
||||||
|
super(Message, self).__init__(parent)
|
||||||
|
self._title = title
|
||||||
|
self._text = text
|
||||||
|
self._detailedText = detailedText
|
||||||
|
|
||||||
|
title = Property(str, lambda self: self._title, constant=True)
|
||||||
|
text = Property(str, lambda self: self._text, constant=True)
|
||||||
|
detailedText = Property(str, lambda self: self._detailedText, constant=True)
|
||||||
|
|
||||||
|
|
||||||
class LiveSfmManager(QObject):
|
class LiveSfmManager(QObject):
|
||||||
"""
|
"""
|
||||||
Manage a live SfM reconstruction by creating augmentation steps in the graph over time,
|
Manage a live SfM reconstruction by creating augmentation steps in the graph over time,
|
||||||
|
@ -177,9 +191,13 @@ class Reconstruction(UIGraph):
|
||||||
try:
|
try:
|
||||||
super(Reconstruction, self).load(filepath)
|
super(Reconstruction, self).load(filepath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.error.emit("Error while loading {}".format(os.path.basename(filepath)),
|
self.error.emit(
|
||||||
|
Message(
|
||||||
|
"Error while loading {}".format(os.path.basename(filepath)),
|
||||||
"An unexpected error has occurred",
|
"An unexpected error has occurred",
|
||||||
str(e))
|
str(e)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def onGraphChanged(self):
|
def onGraphChanged(self):
|
||||||
""" React to the change of the internal graph. """
|
""" React to the change of the internal graph. """
|
||||||
|
@ -474,8 +492,7 @@ class Reconstruction(UIGraph):
|
||||||
sfmReport = Property(bool, lambda self: len(self._poses) > 0, notify=sfmReportChanged)
|
sfmReport = Property(bool, lambda self: len(self._poses) > 0, notify=sfmReportChanged)
|
||||||
sfmAugmented = Signal(graph.Node, graph.Node)
|
sfmAugmented = Signal(graph.Node, graph.Node)
|
||||||
|
|
||||||
# Signals to propagate high-level log messages
|
# Signals to propagate high-level messages
|
||||||
# Signal(title, text, detailedText)
|
error = Signal(Message)
|
||||||
error = Signal(str, str, str)
|
warning = Signal(Message)
|
||||||
warning = Signal(str, str, str)
|
info = Signal(Message)
|
||||||
info = Signal(str, str, str)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue