Commit 4c0a0d30 authored by Andy Regensky's avatar Andy Regensky
Browse files

Improve properties labeling and motion model update logic

parent d116953e
......@@ -181,7 +181,6 @@ class MainViewModel(QObject):
def setMotionModel(self, motion_model):
self.motion_model = motion_model
self.control_point_motion_vectors[1:, :] = self.control_point_motion_vectors[0, :]
self.propertiesDidChange.emit()
self.updateBlockProjection()
......
......@@ -54,7 +54,7 @@ class PropertiesWidget(QWidget):
self.label.setText("Properties")
self.sensorSizeLabel = QLabel(self)
self.sensorSizeLabel.setText("Sensor size in mm:")
self.sensorSizeLabel.setText("Sensor size in mm")
self.sensorSizeWidthEdit = QLineEdit(self)
self.sensorSizeWidthEdit.setValidator(doubleValidator)
......@@ -65,7 +65,7 @@ class PropertiesWidget(QWidget):
self.sensorSizeHeightEdit.editingFinished.connect(self.sensorSizeHeightEditingFinished)
self.resolutionLabel = QLabel(self)
self.resolutionLabel.setText("Sensor resolution:")
self.resolutionLabel.setText("Sensor resolution")
self.resolutionWidthEdit = QLineEdit(self)
self.resolutionWidthEdit.setValidator(intValidator)
......@@ -76,21 +76,21 @@ class PropertiesWidget(QWidget):
self.resolutionHeightEdit.editingFinished.connect(self.resolutionHeightEditingFinished)
self.focalLengthLabel = QLabel(self)
self.focalLengthLabel.setText("Focal length:")
self.focalLengthLabel.setText("Focal length in mm")
self.focalLengthEdit = QLineEdit(self)
self.focalLengthEdit.setValidator(doubleValidator)
self.focalLengthEdit.editingFinished.connect(self.focalLengthEditingFinished)
self.projectionLabel = QLabel(self)
self.projectionLabel.setText("Projection:")
self.projectionLabel.setText("Projection")
self.projectionComboBox = QComboBox(self)
self.projectionComboBox.addItems(list(self.viewModel.projections.keys()))
self.projectionComboBox.currentTextChanged.connect(self.projectionComboBoxTextChanged)
self.originLabel = QLabel(self)
self.originLabel.setText("Origin:")
self.originLabel.setText("Origin")
self.originXEdit = QLineEdit(self)
self.originXEdit.setValidator(intValidator)
......@@ -101,7 +101,7 @@ class PropertiesWidget(QWidget):
self.originYEdit.editingFinished.connect(self.originYEditingFinished)
self.blocksizeLabel = QLabel(self)
self.blocksizeLabel.setText("Blocksize:")
self.blocksizeLabel.setText("Blocksize")
self.blocksizeWidthEdit = QLineEdit(self)
self.blocksizeWidthEdit.setValidator(intValidator)
......@@ -111,12 +111,15 @@ class PropertiesWidget(QWidget):
self.blocksizeHeightEdit.setValidator(intValidator)
self.blocksizeHeightEdit.editingFinished.connect(self.blocksizeHeightEditingFinished)
self.motionModelLabel = QLabel(self)
self.motionModelLabel.setText("Motion Model")
self.motionModelComboBox = QComboBox(self)
self.motionModelComboBox.addItems(list(motion_models.keys()))
self.motionModelComboBox.currentTextChanged.connect(self.motionModelComboBoxTextChanged)
self.motionVector0Label = QLabel(self)
self.motionVector0Label.setText("Motion Vector:")
self.motionVector0Label.setText("Motion Vector")
self.motionVectorX0Edit = QLineEdit(self)
self.motionVectorX0Edit.setValidator(negIntValidator)
......@@ -127,7 +130,7 @@ class PropertiesWidget(QWidget):
self.motionVectorY0Edit.editingFinished.connect(self.motionVectorY0EditingFinished)
self.motionVector1Label = QLabel(self)
self.motionVector1Label.setText("CP1 Motion Vector:")
self.motionVector1Label.setText("CP1 Motion Vector")
self.motionVectorX1Edit = QLineEdit(self)
self.motionVectorX1Edit.setValidator(negIntValidator)
......@@ -138,7 +141,7 @@ class PropertiesWidget(QWidget):
self.motionVectorY1Edit.editingFinished.connect(self.motionVectorY1EditingFinished)
self.motionVector2Label = QLabel(self)
self.motionVector2Label.setText("CP2 Motion Vector:")
self.motionVector2Label.setText("CP2 Motion Vector")
self.motionVectorX2Edit = QLineEdit(self)
self.motionVectorX2Edit.setValidator(negIntValidator)
......@@ -180,19 +183,20 @@ class PropertiesWidget(QWidget):
layout.addWidget(self.blocksizeWidthEdit, 12, 0)
layout.addWidget(self.blocksizeHeightEdit, 12, 1)
layout.addItem(QSpacerItem(10, 20), 13, 0)
layout.addWidget(self.motionModelComboBox, 14, 0, 1, -1)
layout.addWidget(self.motionVector0Label, 15, 0, 1, -1)
layout.addWidget(self.motionVectorX0Edit, 16, 0)
layout.addWidget(self.motionVectorY0Edit, 16, 1)
layout.addWidget(self.motionVector1Label, 17, 0, 1, -1)
layout.addWidget(self.motionVectorX1Edit, 18, 0)
layout.addWidget(self.motionVectorY1Edit, 18, 1)
layout.addWidget(self.motionVector2Label, 19, 0, 1, -1)
layout.addWidget(self.motionVectorX2Edit, 20, 0)
layout.addWidget(self.motionVectorY2Edit, 20, 1)
layout.addItem(QSpacerItem(10, 20), 21, 0)
layout.addWidget(self.perspectiveScaleLabel, 22, 0, 1, -1)
layout.addWidget(self.perspectiveScaleSlider, 23, 0, 1, -1)
layout.addWidget(self.motionModelLabel, 14, 0, 1, -1)
layout.addWidget(self.motionModelComboBox, 15, 0, 1, -1)
layout.addWidget(self.motionVector0Label, 16, 0, 1, -1)
layout.addWidget(self.motionVectorX0Edit, 17, 0)
layout.addWidget(self.motionVectorY0Edit, 17, 1)
layout.addWidget(self.motionVector1Label, 18, 0, 1, -1)
layout.addWidget(self.motionVectorX1Edit, 19, 0)
layout.addWidget(self.motionVectorY1Edit, 19, 1)
layout.addWidget(self.motionVector2Label, 20, 0, 1, -1)
layout.addWidget(self.motionVectorX2Edit, 21, 0)
layout.addWidget(self.motionVectorY2Edit, 21, 1)
layout.addItem(QSpacerItem(10, 20), 22, 0)
layout.addWidget(self.perspectiveScaleLabel, 23, 0, 1, -1)
layout.addWidget(self.perspectiveScaleSlider, 24, 0, 1, -1)
layout.setAlignment(Qt.AlignTop)
self.setLayout(layout)
......@@ -220,7 +224,7 @@ class PropertiesWidget(QWidget):
self.perspectiveScaleLabel.setText(f"Perspective scale: {self.viewModel.perspective_scale}")
self.perspectiveScaleSlider.setValue(self.viewModel.perspective_scale)
if self.viewModel.motion_model == 'translatory':
self.motionVector0Label.setText("Motion Vector:")
self.motionVector0Label.setText("Motion Vector")
self.motionVector1Label.setHidden(True)
self.motionVectorX1Edit.setHidden(True)
self.motionVectorY1Edit.setHidden(True)
......@@ -228,7 +232,7 @@ class PropertiesWidget(QWidget):
self.motionVectorX2Edit.setHidden(True)
self.motionVectorY2Edit.setHidden(True)
elif self.viewModel.motion_model == 'affine4':
self.motionVector0Label.setText("CP0 Motion Vector:")
self.motionVector0Label.setText("CP0 Motion Vector")
self.motionVector1Label.setHidden(False)
self.motionVectorX1Edit.setHidden(False)
self.motionVectorY1Edit.setHidden(False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment