mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
Merge pull request #1898 from alicevision/fix/intrinsicsWarnings
[ui] Intrinsics: Fix warnings and exceptions
This commit is contained in:
commit
69d45fde1b
3 changed files with 14 additions and 11 deletions
|
@ -514,7 +514,7 @@ Panel {
|
||||||
|
|
||||||
model: intrinsicModel
|
model: intrinsicModel
|
||||||
|
|
||||||
delegate: IntrinsicDisplayDelegate{}
|
delegate: IntrinsicDisplayDelegate { attribute: model.display }
|
||||||
|
|
||||||
ScrollBar.horizontal: ScrollBar { id: sb }
|
ScrollBar.horizontal: ScrollBar { id: sb }
|
||||||
ScrollBar.vertical : ScrollBar { id: sbv }
|
ScrollBar.vertical : ScrollBar { id: sbv }
|
||||||
|
|
|
@ -9,12 +9,12 @@ RowLayout {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
property variant attribute: model.display
|
property variant attribute: null
|
||||||
property int rowIndex: model.row
|
property int rowIndex: model.row
|
||||||
property int columnIndex: model.column
|
property int columnIndex: model.column
|
||||||
property bool readOnly: false
|
property bool readOnly: false
|
||||||
property string toolTipText: {
|
property string toolTipText: {
|
||||||
if(!attribute || Object.keys(attribute).length === 0)
|
if (!attribute || Object.keys(attribute).length === 0)
|
||||||
return ""
|
return ""
|
||||||
return attribute.fullLabel
|
return attribute.fullLabel
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@ RowLayout {
|
||||||
clip: true
|
clip: true
|
||||||
Loader {
|
Loader {
|
||||||
id: loaderComponent
|
id: loaderComponent
|
||||||
active: !!model.display // convert to bool with "!!"
|
active: !!attribute // convert to bool with "!!"
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(!model.display)
|
if (!attribute)
|
||||||
return undefined
|
return undefined
|
||||||
switch(model.display.type)
|
switch (attribute.type)
|
||||||
{
|
{
|
||||||
case "ChoiceParam": return choice_component
|
case "ChoiceParam": return choice_component
|
||||||
case "IntParam": return int_component
|
case "IntParam": return int_component
|
||||||
|
@ -65,7 +65,7 @@ RowLayout {
|
||||||
Component {
|
Component {
|
||||||
id: textField_component
|
id: textField_component
|
||||||
TextInput{
|
TextInput{
|
||||||
text: model.display.value
|
text: attribute.value
|
||||||
width: intrinsicModel.columnWidths[columnIndex]
|
width: intrinsicModel.columnWidths[columnIndex]
|
||||||
horizontalAlignment: TextInput.AlignRight
|
horizontalAlignment: TextInput.AlignRight
|
||||||
color: 'white'
|
color: 'white'
|
||||||
|
@ -155,7 +155,7 @@ RowLayout {
|
||||||
Component {
|
Component {
|
||||||
id: float_component
|
id: float_component
|
||||||
TextInput{
|
TextInput{
|
||||||
readonly property real formattedValue: model.display.value.toFixed(2)
|
readonly property real formattedValue: attribute.value.toFixed(2)
|
||||||
property string displayValue: String(formattedValue)
|
property string displayValue: String(formattedValue)
|
||||||
|
|
||||||
text: displayValue
|
text: displayValue
|
||||||
|
@ -179,8 +179,10 @@ RowLayout {
|
||||||
//while keeping the trick for formatting the text
|
//while keeping the trick for formatting the text
|
||||||
//Timing issues otherwise
|
//Timing issues otherwise
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if(activeFocus) text = String(model.display.value)
|
if (activeFocus)
|
||||||
else text = String(formattedValue)
|
text = String(attribute.value)
|
||||||
|
else
|
||||||
|
text = String(formattedValue)
|
||||||
cursorPosition = 0
|
cursorPosition = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,8 @@ class ViewpointWrapper(QObject):
|
||||||
else:
|
else:
|
||||||
self._initialIntrinsics = self._reconstruction.getIntrinsic(self._viewpoint)
|
self._initialIntrinsics = self._reconstruction.getIntrinsic(self._viewpoint)
|
||||||
try:
|
try:
|
||||||
self._metadata = json.loads(self._viewpoint.metadata.value) if self._viewpoint.metadata.value else None
|
# When the viewpoint attribute has already been deleted, metadata.value becomes a PySide property (whereas a string is expected)
|
||||||
|
self._metadata = json.loads(self._viewpoint.metadata.value) if isinstance(self._viewpoint.metadata.value, str) and self._viewpoint.metadata.value else None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning("Failed to parse Viewpoint metadata: '{}', '{}'".format(str(e), str(self._viewpoint.metadata.value)))
|
logging.warning("Failed to parse Viewpoint metadata: '{}', '{}'".format(str(e), str(self._viewpoint.metadata.value)))
|
||||||
self._metadata = {}
|
self._metadata = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue