Skip to content

Commit f268ba1

Browse files
committed
[ui] Catch nodes that failed to be reloaded and send an error message
When reloading nodes, if some failed to be reloaded, the "Plugins reloaded" message was still sent. We now keep track of those which failed to be reloaded (meaning that the node descriptions were modified but there was an actual error during the reloading process), and send an error message listing the nodes that failed to be reloaded if there was any.
1 parent a58a1ca commit f268ba1

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

meshroom/ui/reconstruction.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from meshroom.core.node import Node, CompatibilityNode, Status, Position, CompatibilityIssue
2020
from meshroom.core.taskManager import TaskManager
2121
from meshroom.core.evaluation import MathEvaluator
22+
from meshroom.core.plugins import NodePluginStatus
2223

2324
from meshroom.ui import commands
2425
from meshroom.ui.graph import UIGraph
@@ -445,17 +446,25 @@ def _reloadPlugins(self):
445446
The nodes in the graph will be updated to match the changes in the description, if
446447
there was any.
447448
"""
448-
nodeTypes: list[str] = []
449+
reloadedNodes: list[str] = []
450+
errorNodes: list[str] = []
449451
for plugin in meshroom.core.pluginManager.getPlugins().values():
450452
for node in plugin.nodes.values():
451453
if node.reload():
452-
nodeTypes.append(node.nodeDescriptor.__name__)
453-
self.pluginsReloaded.emit(nodeTypes)
454+
reloadedNodes.append(node.nodeDescriptor.__name__)
455+
else:
456+
if node.status == NodePluginStatus.DESC_ERROR or node.status == NodePluginStatus.ERROR:
457+
errorNodes.append(node.nodeDescriptor.__name__)
458+
459+
self.pluginsReloaded.emit(reloadedNodes, errorNodes)
454460

455461
@Slot(list)
456-
def _onPluginsReloaded(self, nodeTypes: list):
457-
self._graph.reloadNodePlugins(nodeTypes)
458-
self.parent().showMessage("Plugins reloaded!", "ok")
462+
def _onPluginsReloaded(self, reloadedNodes: list, errorNodes: list):
463+
self._graph.reloadNodePlugins(reloadedNodes)
464+
if len(errorNodes) > 0:
465+
self.parent().showMessage(f"Some plugins failed to reload: {', '.join(errorNodes)}", "error")
466+
else:
467+
self.parent().showMessage("Plugins reloaded!", "ok")
459468

460469
@Slot()
461470
@Slot(str)
@@ -944,7 +953,7 @@ def setBuildingIntrinsics(self, value):
944953
displayedAttrs3DChanged = Signal()
945954
displayedAttrs3D = Property(QObject, lambda self: self._displayedAttrs3D, notify=displayedAttrs3DChanged)
946955

947-
pluginsReloaded = Signal(list)
956+
pluginsReloaded = Signal(list, list)
948957

949958
@Slot(QObject)
950959
def setActiveNode(self, node, categories=True, inputs=True):

0 commit comments

Comments
 (0)