Skip to content
Snippets Groups Projects
Commit 02f43201 authored by payno's avatar payno
Browse files

[gui][axis] add ShiftMode to edit ony x shift, y shift or both

parent 7607f09e
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ from tomwer.core.log import TomwerLogger ...@@ -33,7 +33,7 @@ from tomwer.core.log import TomwerLogger
from tomwer.core.utils import image from tomwer.core.utils import image
import functools import functools
import numpy import numpy
import enum
from silx.gui.plot.CompareImages import VisualizationMode from silx.gui.plot.CompareImages import VisualizationMode
from tomwer.core.scan.scanbase import ScanBase from tomwer.core.scan.scanbase import ScanBase
from tomwer.core.scan.scanfactory import ScanFactory from tomwer.core.scan.scanfactory import ScanFactory
...@@ -325,7 +325,8 @@ class _AxisGUIControl(qt.QWidget): ...@@ -325,7 +325,8 @@ class _AxisGUIControl(qt.QWidget):
self._main_widget_recons_params = QReconsParams(empty=True) self._main_widget_recons_params = QReconsParams(empty=True)
self._main_widget_recons_params.copy(self._axis) self._main_widget_recons_params.copy(self._axis)
self._manualSelectionWidget = _AxisManualSelection(parent=self) self._manualSelectionWidget = _AxisManualSelection(parent=self,
shift_mode=ShiftMode.x_only)
self._manualSelectionWidget.layout().setContentsMargins(0, 0, 0, 0) self._manualSelectionWidget.layout().setContentsMargins(0, 0, 0, 0)
self._displacementSelector = self._manualSelectionWidget._displacementSelector self._displacementSelector = self._manualSelectionWidget._displacementSelector
...@@ -441,13 +442,13 @@ class _AxisGUIControl(qt.QWidget): ...@@ -441,13 +442,13 @@ class _AxisGUIControl(qt.QWidget):
class _AxisManualSelection(qt.QWidget): class _AxisManualSelection(qt.QWidget):
def __init__(self, parent): def __init__(self, parent, shift_mode):
qt.QWidget.__init__(self, parent) qt.QWidget.__init__(self, parent)
self.setLayout(qt.QVBoxLayout()) self.setLayout(qt.QVBoxLayout())
self._displacementSelector = _DisplacementSelector(parent=self) self._displacementSelector = _DisplacementSelector(parent=self)
self.layout().addWidget(self._displacementSelector) self.layout().addWidget(self._displacementSelector)
self._shiftControl = _ShiftControl(parent=self) self._shiftControl = _ShiftControl(parent=self, shift_mode=shift_mode)
self.layout().addWidget(self._shiftControl) self.layout().addWidget(self._shiftControl)
self._roiControl = _ROIControl(parent=self) self._roiControl = _ROIControl(parent=self)
...@@ -578,6 +579,13 @@ class _ROIDefinition(qt.QWidget): ...@@ -578,6 +579,13 @@ class _ROIDefinition(qt.QWidget):
self.__roiChanged() self.__roiChanged()
@enum.unique
class ShiftMode(enum.Enum):
x_only = 0
y_only = 1
x_and_y = 2
class _ShiftControl(qt.QWidget): class _ShiftControl(qt.QWidget):
""" """
Widget to control the shift step we want to apply Widget to control the shift step we want to apply
...@@ -595,7 +603,12 @@ class _ShiftControl(qt.QWidget): ...@@ -595,7 +603,12 @@ class _ShiftControl(qt.QWidget):
sigAuto = qt.Signal() sigAuto = qt.Signal()
"""Signal emitted when the auto button is activated""" """Signal emitted when the auto button is activated"""
def __init__(self, parent): def __init__(self, parent, shift_mode):
"""
:param parent: qt.QWidget
:param ShiftMode shift_mode: what are the shift we want to control
"""
qt.QWidget.__init__(self, parent) qt.QWidget.__init__(self, parent)
self.setLayout(qt.QGridLayout()) self.setLayout(qt.QGridLayout())
self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setContentsMargins(0, 0, 0, 0)
...@@ -635,6 +648,20 @@ class _ShiftControl(qt.QWidget): ...@@ -635,6 +648,20 @@ class _ShiftControl(qt.QWidget):
self._updateShiftInfo = self._shiftInfo._updateShiftInfo self._updateShiftInfo = self._shiftInfo._updateShiftInfo
self.sigShiftChanged = self._shiftInfo.sigShiftChanged self.sigShiftChanged = self._shiftInfo.sigShiftChanged
self.setShiftMode(shift_mode)
def setShiftMode(self, shift_mode):
show_x_shift = shift_mode in (ShiftMode.x_only, ShiftMode.x_and_y)
show_y_shift = shift_mode in (ShiftMode.y_only, ShiftMode.x_and_y)
self._leftButton.setVisible(show_x_shift)
self._rightButton.setVisible(show_x_shift)
self._topButton.setVisible(show_y_shift)
self._bottomButton.setVisible(show_y_shift)
self._shiftInfo._xLE.setVisible(show_x_shift)
self._shiftInfo._xLabel.setVisible(show_x_shift)
self._shiftInfo._yLE.setVisible(show_y_shift)
self._shiftInfo._yLabel.setVisible(show_y_shift)
class _ShiftInformation(qt.QWidget): class _ShiftInformation(qt.QWidget):
""" """
...@@ -658,12 +685,14 @@ class _ShiftInformation(qt.QWidget): ...@@ -658,12 +685,14 @@ class _ShiftInformation(qt.QWidget):
self.setLayout(qt.QHBoxLayout()) self.setLayout(qt.QHBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setContentsMargins(0, 0, 0, 0)
self.layout().setSpacing(0) self.layout().setSpacing(0)
self.layout().addWidget(qt.QLabel('x='))
self._xLabel = qt.QLabel('x=', parent=self)
self.layout().addWidget(self._xLabel)
self._xLE = _ShiftInformation._ShiftLineEdit('', parent=self) self._xLE = _ShiftInformation._ShiftLineEdit('', parent=self)
self.layout().addWidget(self._xLE) self.layout().addWidget(self._xLE)
self.layout().addWidget(qt.QLabel('y=')) self._yLabel = qt.QLabel('y=', parent=self)
self.layout().addWidget(self._yLabel)
self._yLE = _ShiftInformation._ShiftLineEdit('', parent=self) self._yLE = _ShiftInformation._ShiftLineEdit('', parent=self)
self.layout().addWidget(self._yLE) self.layout().addWidget(self._yLE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment