Skip to content

Commit 2a34f27

Browse files
[ui] Attribute: Remove occurence to deprecated validValue/errorMessage
1 parent d3b711e commit 2a34f27

File tree

3 files changed

+13
-46
lines changed

3 files changed

+13
-46
lines changed

meshroom/core/attribute.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def __init__(self, node, attributeDesc, isOutput, root=None, parent=None):
7373
self._isOutput = isOutput
7474
self._label = attributeDesc.label
7575
self._enabled = True
76-
self._validValue = True
7776
self._description = attributeDesc.description
7877
self._invalidate = False if self._isOutput else attributeDesc.invalidate
7978

@@ -169,24 +168,6 @@ def getUidIgnoreValue(self):
169168
""" Value for which the attribute should be ignored during the UID computation. """
170169
return self.attributeDesc.uidIgnoreValue
171170

172-
def getValidValue(self):
173-
"""
174-
Get the status of _validValue:
175-
- If it is a function, execute it and return the result
176-
- Otherwise, simply return its value
177-
"""
178-
if isinstance(self.desc.validValue, types.FunctionType):
179-
try:
180-
return self.desc.validValue(self.node)
181-
except Exception:
182-
return True
183-
return self._validValue
184-
185-
def setValidValue(self, value):
186-
if self._validValue == value:
187-
return
188-
self._validValue = value
189-
190171
def validateValue(self, value):
191172
return self.desc.validateValue(value)
192173

@@ -224,7 +205,6 @@ def _set_value(self, value):
224205
self.requestNodeUpdate()
225206

226207
self.valueChanged.emit()
227-
self.validValueChanged.emit()
228208

229209
@Slot()
230210
def _onValueChanged(self):
@@ -550,8 +530,6 @@ def _isMandatory(self) -> bool:
550530
enabled = Property(bool, getEnabled, setEnabled, notify=enabledChanged)
551531
invalidate = Property(bool, lambda self: self._invalidate, constant=True)
552532
uidIgnoreValue = Property(Variant, getUidIgnoreValue, constant=True)
553-
validValueChanged = Signal()
554-
validValue = Property(bool, getValidValue, setValidValue, notify=validValueChanged)
555533
root = Property(BaseObject, root.fget, constant=True)
556534

557535
errorMessageChanged = Signal()

meshroom/core/desc/attribute.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class Attribute(BaseObject):
1919
def __init__(self, name, label, description, value, advanced, semantic, group, enabled,
2020
invalidate=True,
2121
uidIgnoreValue=None,
22-
validValue=True,
23-
errorMessage="",
2422
visible=True,
2523
exposed=False,
2624
validators:list["AttributeValidator"]=None
@@ -37,8 +35,6 @@ def __init__(self, name, label, description, value, advanced, semantic, group, e
3735
self._invalidate = invalidate
3836
self._semantic = semantic
3937
self._uidIgnoreValue = uidIgnoreValue
40-
self._validValue = validValue
41-
self._errorMessage = errorMessage
4238
self._visible = visible
4339
self._exposed = exposed
4440
self._isExpression = (isinstance(self._value, str) and "{" in self._value) \
@@ -108,8 +104,6 @@ def validators(self):
108104
invalidate = Property(Variant, lambda self: self._invalidate, constant=True)
109105
semantic = Property(str, lambda self: self._semantic, constant=True)
110106
uidIgnoreValue = Property(Variant, lambda self: self._uidIgnoreValue, constant=True)
111-
validValue = Property(Variant, lambda self: self._validValue, constant=True)
112-
errorMessage = Property(str, lambda self: self._errorMessage, constant=True)
113107
# visible:
114108
# The attribute is not displayed in the Graph Editor if False but still visible in the Node Editor.
115109
# This property is useful to hide some attributes that are not relevant for the user.
@@ -286,11 +280,11 @@ class Param(Attribute):
286280
"""
287281
"""
288282
def __init__(self, name, label, description, value, group, advanced, semantic, enabled, invalidate=True,
289-
uidIgnoreValue=None, validValue=True, errorMessage="", visible=True, exposed=False, validators=None):
283+
uidIgnoreValue=None, visible=True, exposed=False, validators=None):
290284
super(Param, self).__init__(name=name, label=label, description=description, value=value,
291285
group=group, advanced=advanced, enabled=enabled, invalidate=invalidate,
292-
semantic=semantic, uidIgnoreValue=uidIgnoreValue, validValue=validValue,
293-
errorMessage=errorMessage, visible=visible, exposed=exposed, validators=validators)
286+
semantic=semantic, uidIgnoreValue=uidIgnoreValue, visible=visible, exposed=exposed,
287+
validators=validators)
294288

295289

296290
class File(Attribute):
@@ -351,11 +345,11 @@ class IntParam(Param):
351345
"""
352346
"""
353347
def __init__(self, name, label, description, value, range=None, group="allParams", advanced=False, enabled=True,
354-
invalidate=True, semantic="", validValue=True, errorMessage="", visible=True, exposed=False, validators=None):
348+
invalidate=True, semantic="", visible=True, exposed=False, validators=None):
355349
self._range = range
356350
super(IntParam, self).__init__(name=name, label=label, description=description, value=value,
357351
group=group, advanced=advanced, enabled=enabled, invalidate=invalidate,
358-
semantic=semantic, validValue=validValue, errorMessage=errorMessage,
352+
semantic=semantic,
359353
visible=visible, exposed=exposed, validators=validators)
360354
self._valueType = int
361355

@@ -381,11 +375,11 @@ class FloatParam(Param):
381375
"""
382376
"""
383377
def __init__(self, name, label, description, value, range=None, group="allParams", advanced=False, enabled=True,
384-
invalidate=True, semantic="", validValue=True, errorMessage="", visible=True, exposed=False, validators=None):
378+
invalidate=True, semantic="", visible=True, exposed=False, validators=None):
385379
self._range = range
386380
super(FloatParam, self).__init__(name=name, label=label, description=description, value=value,
387381
group=group, advanced=advanced, enabled=enabled, invalidate=invalidate,
388-
semantic=semantic, validValue=validValue, errorMessage=errorMessage,
382+
semantic=semantic,
389383
visible=visible, exposed=exposed, validators=validators)
390384
self._valueType = float
391385

@@ -447,13 +441,12 @@ class ChoiceParam(Param):
447441
_OVERRIDE_SERIALIZATION_KEY_VALUES = "__ChoiceParam_values__"
448442

449443
def __init__(self, name: str, label: str, description: str, value, values, exclusive=True, saveValuesOverride=False,
450-
group="allParams", joinChar=" ", advanced=False, enabled=True, invalidate=True, semantic="",
451-
validValue=True, errorMessage="",
444+
group="allParams", joinChar=" ", advanced=False, enabled=True, invalidate=True, semantic="",
452445
visible=True, exposed=False, validators=None):
453446

454447
super(ChoiceParam, self).__init__(name=name, label=label, description=description, value=value,
455448
group=group, advanced=advanced, enabled=enabled, invalidate=invalidate,
456-
semantic=semantic, validValue=validValue, errorMessage=errorMessage,
449+
semantic=semantic,
457450
visible=visible, exposed=exposed, validators=validators)
458451
self._values = values
459452
self._saveValuesOverride = saveValuesOverride
@@ -527,12 +520,12 @@ class StringParam(Param):
527520
"""
528521
"""
529522
def __init__(self, name, label, description, value, group="allParams", advanced=False, enabled=True,
530-
invalidate=True, semantic="", uidIgnoreValue=None, validValue=True, errorMessage="", visible=True,
523+
invalidate=True, semantic="", uidIgnoreValue=None, visible=True,
531524
exposed=False, validators=None):
532525
super(StringParam, self).__init__(name=name, label=label, description=description, value=value,
533526
group=group, advanced=advanced, enabled=enabled, invalidate=invalidate,
534-
semantic=semantic, uidIgnoreValue=uidIgnoreValue, validValue=validValue,
535-
errorMessage=errorMessage, visible=visible, exposed=exposed, validators=validators)
527+
semantic=semantic, uidIgnoreValue=uidIgnoreValue,
528+
visible=visible, exposed=exposed, validators=validators)
536529
self._valueType = str
537530

538531
def validateValue(self, value):

meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ RowLayout {
102102
y: parameterMA.mouseY + 10
103103

104104
text: {
105-
var tooltip = ""
106-
if (!object.validValue && object.desc.errorMessage !== "")
107-
tooltip += "<i><b>Error: </b>" + Format.plainToHtml(object.desc.errorMessage) + "</i><br><br>"
108-
tooltip += "<b>" + object.desc.name + ":</b> " + attribute.type + "<br>" + Format.plainToHtml(object.description)
109-
return tooltip
105+
return `<b>${object.desc.name} :</b> ${attribute.type} <br> ${Format.plainToHtml(object.description)}`
110106
}
111107
visible: parameterMA.containsMouse
112108
delay: 800

0 commit comments

Comments
 (0)