diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index 7618fa67..7196a459 100755 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -397,6 +397,7 @@ class Node(object): outputs = [] size = StaticNodeSize(1) parallelization = None + documentation = '' def __init__(self): pass diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 51a96f64..dc8caa6a 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -474,6 +474,9 @@ class BaseNode(BaseObject): t, idx = self._name.split("_") return "{}{}".format(t, idx if int(idx) > 1 else "") + def getDocumentation(self): + return self.nodeDesc.documentation + @property def packageFullName(self): return '-'.join([self.packageName, self.packageVersion]) @@ -766,6 +769,7 @@ class BaseNode(BaseObject): name = Property(str, getName, constant=True) label = Property(str, getLabel, constant=True) nodeType = Property(str, nodeType.fget, constant=True) + documentation = Property(str, getDocumentation, constant=True) positionChanged = Signal() position = Property(Variant, position.fget, position.fset, notify=positionChanged) x = Property(float, lambda self: self._position.x, notify=positionChanged) diff --git a/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml new file mode 100644 index 00000000..337f3e37 --- /dev/null +++ b/meshroom/ui/qml/GraphEditor/NodeDocumentation.qml @@ -0,0 +1,38 @@ +import QtQuick 2.11 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 +import Controls 1.0 + +import "common.js" as Common + +/** + * Displays Node documentation + */ +FocusScope { + id: root + + property variant node + + SystemPalette { id: activePalette } + + ScrollView { + width: parent.width + height: parent.height + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + clip: true + + TextEdit { + width: parent.parent.width + height: parent.height + + padding: 8 + textFormat: TextEdit.MarkdownText + selectByMouse: true + selectionColor: activePalette.highlight + color: activePalette.text + text: node.documentation + wrapMode: TextEdit.Wrap + } + } +} diff --git a/meshroom/ui/qml/GraphEditor/NodeEditor.qml b/meshroom/ui/qml/GraphEditor/NodeEditor.qml index b0d1041d..4cc96ae6 100644 --- a/meshroom/ui/qml/GraphEditor/NodeEditor.qml +++ b/meshroom/ui/qml/GraphEditor/NodeEditor.qml @@ -148,6 +148,12 @@ Panel { chunkCurrentIndex: m.chunkCurrentIndex onChangeCurrentChunk: { m.chunkCurrentIndex = chunkIndex } } + + NodeDocumentation { + id: nodeDocumentation + Layout.fillWidth: true + node: root.node + } } } } @@ -185,6 +191,12 @@ Panel { leftPadding: 8 rightPadding: leftPadding } + TabButton { + text: "Documentation" + width: implicitWidth + leftPadding: 8 + rightPadding: leftPadding + } } } }