mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-02 03:37:13 +02:00
[core/ui] Modifiable label and description of node available
This commit is contained in:
parent
bb8b544550
commit
55c657dc1d
2 changed files with 27 additions and 3 deletions
|
@ -68,6 +68,7 @@ class Attribute(BaseObject):
|
||||||
self._label = attributeDesc.label
|
self._label = attributeDesc.label
|
||||||
self._enabled = True
|
self._enabled = True
|
||||||
self._validValue = True
|
self._validValue = True
|
||||||
|
self._description = attributeDesc.description
|
||||||
|
|
||||||
# invalidation value for output attributes
|
# invalidation value for output attributes
|
||||||
self._invalidationValue = ""
|
self._invalidationValue = ""
|
||||||
|
@ -212,6 +213,21 @@ class Attribute(BaseObject):
|
||||||
self.valueChanged.emit()
|
self.valueChanged.emit()
|
||||||
self.validValueChanged.emit()
|
self.validValueChanged.emit()
|
||||||
|
|
||||||
|
def _set_label(self, label):
|
||||||
|
if self._label == label:
|
||||||
|
return
|
||||||
|
self._label = label
|
||||||
|
self.labelChanged.emit()
|
||||||
|
|
||||||
|
def _get_description(self):
|
||||||
|
return self._description
|
||||||
|
|
||||||
|
def _set_description(self, desc):
|
||||||
|
if self._description == desc:
|
||||||
|
return
|
||||||
|
self._description = desc
|
||||||
|
self.descriptionChanged.emit()
|
||||||
|
|
||||||
def upgradeValue(self, exportedValue):
|
def upgradeValue(self, exportedValue):
|
||||||
self._set_value(exportedValue)
|
self._set_value(exportedValue)
|
||||||
|
|
||||||
|
@ -364,14 +380,22 @@ class Attribute(BaseObject):
|
||||||
fullName = Property(str, getFullName, constant=True)
|
fullName = Property(str, getFullName, constant=True)
|
||||||
fullNameToNode = Property(str, getFullNameToNode, constant=True)
|
fullNameToNode = Property(str, getFullNameToNode, constant=True)
|
||||||
fullNameToGraph = Property(str, getFullNameToGraph, constant=True)
|
fullNameToGraph = Property(str, getFullNameToGraph, constant=True)
|
||||||
label = Property(str, getLabel, constant=True)
|
labelChanged = Signal()
|
||||||
|
label = Property(str, getLabel, _set_label, notify=labelChanged)
|
||||||
fullLabel = Property(str, getFullLabel, constant=True)
|
fullLabel = Property(str, getFullLabel, constant=True)
|
||||||
fullLabelToNode = Property(str, getFullLabelToNode, constant=True)
|
fullLabelToNode = Property(str, getFullLabelToNode, constant=True)
|
||||||
fullLabelToGraph = Property(str, getFullLabelToGraph, constant=True)
|
fullLabelToGraph = Property(str, getFullLabelToGraph, constant=True)
|
||||||
type = Property(str, getType, constant=True)
|
type = Property(str, getType, constant=True)
|
||||||
baseType = Property(str, getType, constant=True)
|
baseType = Property(str, getType, constant=True)
|
||||||
isReadOnly = Property(bool, _isReadOnly, constant=True)
|
isReadOnly = Property(bool, _isReadOnly, constant=True)
|
||||||
|
|
||||||
|
# description of the attribute
|
||||||
|
descriptionChanged = Signal()
|
||||||
|
description = Property(str, _get_description, _set_description, notify=descriptionChanged)
|
||||||
|
|
||||||
|
# definition of the attribute
|
||||||
desc = Property(desc.Attribute, lambda self: self.attributeDesc, constant=True)
|
desc = Property(desc.Attribute, lambda self: self.attributeDesc, constant=True)
|
||||||
|
|
||||||
valueChanged = Signal()
|
valueChanged = Signal()
|
||||||
value = Property(Variant, _get_value, _set_value, notify=valueChanged)
|
value = Property(Variant, _get_value, _set_value, notify=valueChanged)
|
||||||
valueStr = Property(Variant, getValueStr, notify=valueChanged)
|
valueStr = Property(Variant, getValueStr, notify=valueChanged)
|
||||||
|
|
|
@ -78,7 +78,7 @@ RowLayout {
|
||||||
var tooltip = ""
|
var tooltip = ""
|
||||||
if (!object.validValue && object.desc.errorMessage !== "")
|
if (!object.validValue && object.desc.errorMessage !== "")
|
||||||
tooltip += "<i><b>Error: </b>" + Format.plainToHtml(object.desc.errorMessage) + "</i><br><br>"
|
tooltip += "<i><b>Error: </b>" + Format.plainToHtml(object.desc.errorMessage) + "</i><br><br>"
|
||||||
tooltip += "<b>" + object.desc.name + "</b><br>" + Format.plainToHtml(object.desc.description)
|
tooltip += "<b>" + object.desc.name + "</b><br>" + Format.plainToHtml(object.description)
|
||||||
return tooltip
|
return tooltip
|
||||||
}
|
}
|
||||||
visible: parameterMA.containsMouse
|
visible: parameterMA.containsMouse
|
||||||
|
@ -208,7 +208,7 @@ RowLayout {
|
||||||
Component {
|
Component {
|
||||||
id: pushButton_component
|
id: pushButton_component
|
||||||
Button {
|
Button {
|
||||||
text: attribute.desc.label
|
text: attribute.label
|
||||||
enabled: root.editable
|
enabled: root.editable
|
||||||
onClicked: {
|
onClicked: {
|
||||||
attribute.clicked()
|
attribute.clicked()
|
||||||
|
|
Loading…
Add table
Reference in a new issue