示例#1
0
class AcquisitionPointWidget(_AcquisitionWidget):

    def __init__(self, parent=None):
        _AcquisitionWidget.__init__(self, AcquisitionPoint, parent)

    def _init_ui(self):
        # Widgets
        self._wdg_position = SpecimenPositionWidget(inline=True)

        # Layouts
        layout = _AcquisitionWidget._init_ui(self)
        layout.insertRow(0, 'Position', self._wdg_position)

        # Signals
        self._wdg_position.edited.connect(self.edited)

        return layout

    def _create_parameter(self):
        return self.CLASS(position=SpecimenPosition())

    def parameter(self, parameter=None):
        parameter = _AcquisitionWidget.parameter(self, parameter)
        parameter.position = self._wdg_position.condition()
        return parameter

    def setParameter(self, condition):
        _AcquisitionWidget.setParameter(self, condition)
        if condition.position is not None:
            self._wdg_position.setParameter(condition.position)

    def setReadOnly(self, state):
        _AcquisitionWidget.setReadOnly(self, state)
        self._wdg_position.setReadOnly(state)

    def isReadOnly(self):
        return _AcquisitionWidget.isReadOnly(self) and \
            self._wdg_position.isReadOnly()

    def hasAcceptableInput(self):
        return _AcquisitionWidget.hasAcceptableInput(self) and \
            self._wdg_position.hasAcceptableInput()
示例#2
0
class AcquisitionRasterXYZWidget(_AcquisitionRasterWidget):

    def __init__(self, parent=None):
        _AcquisitionRasterWidget.__init__(self, AcquisitionRasterXYZ, parent)

    def _init_ui(self):
        # Widgets
        self._txt_step_count_x = NumericalAttributeLineEdit(self.CLASS.step_count_x)
        self._txt_step_count_x.setFormat('{0:d}')
        self._txt_step_count_y = NumericalAttributeLineEdit(self.CLASS.step_count_y)
        self._txt_step_count_y.setFormat('{0:d}')
        self._txt_step_count_z = NumericalAttributeLineEdit(self.CLASS.step_count_z)
        self._txt_step_count_z.setFormat('{0:d}')
        self._txt_step_size_x = NumericalAttributeLineEdit(self.CLASS.step_size_x)
        self._txt_step_size_y = NumericalAttributeLineEdit(self.CLASS.step_size_y)
        self._txt_step_size_z = NumericalAttributeLineEdit(self.CLASS.step_size_z)
        self._cb_raster_mode_z = QComboBox()
        self._cb_raster_mode_z.addItems([None] + list(_RASTER_MODES_Z))
        self._cb_location = QComboBox()
        self._cb_location.addItems(list(_POSITION_LOCATIONS))
        self._wdg_position = SpecimenPositionWidget(inline=True)

        # Layouts
        layout = _AcquisitionRasterWidget._init_ui(self)
        layout.insertRow(0, '<i>Step count (x)</i>', self._txt_step_count_x)
        layout.insertRow(1, '<i>Step count (y)</i>', self._txt_step_count_y)
        layout.insertRow(2, '<i>Step count (z)</i>', self._txt_step_count_z)
        layout.insertRow(3, 'Step size (x)', self._txt_step_size_x)
        layout.insertRow(4, 'Step size (y)', self._txt_step_size_y)
        layout.insertRow(5, 'Step size (z)', self._txt_step_size_z)
        layout.addRow('Raster mode (z)', self._cb_raster_mode_z)
        layout.addRow('Position', self._cb_location)
        layout.addWidget(self._wdg_position)

        # Signals
        self._txt_step_count_x.textEdited.connect(self.edited)
        self._txt_step_count_y.textEdited.connect(self.edited)
        self._txt_step_count_z.textEdited.connect(self.edited)
        self._txt_step_size_x.textEdited.connect(self.edited)
        self._txt_step_size_y.textEdited.connect(self.edited)
        self._txt_step_size_z.textEdited.connect(self.edited)
        self._cb_raster_mode_z.currentIndexChanged.connect(self.edited)
        self._cb_location.currentIndexChanged.connect(self.edited)
        self._wdg_position.edited.connect(self.edited)

        return layout

    def _create_parameter(self):
        return self.CLASS(1, 1, 1)

    def parameter(self, parameter=None):
        parameter = _AcquisitionRasterWidget.parameter(self, parameter)
        parameter.step_count_x = self._txt_step_count_x.text()
        parameter.step_count_y = self._txt_step_count_y.text()
        parameter.step_count_z = self._txt_step_count_z.text()
        parameter.step_size_x = self._txt_step_size_x.text()
        parameter.step_size_y = self._txt_step_size_y.text()
        parameter.step_size_z = self._txt_step_size_z.text()
        parameter.raster_mode_z = self._cb_raster_mode_z.currentText()
        parameter.position = (self._wdg_position.condition(),
                              self._cb_location.currentText())
        return parameter

    def setParameter(self, condition):
        _AcquisitionRasterWidget.setParameter(self, condition)
        self._txt_step_count_x.setText(condition.step_count_x)
        self._txt_step_count_y.setText(condition.step_count_y)
        self._txt_step_count_z.setText(condition.step_count_z)
        self._txt_step_size_x.setText(condition.step_size_x)
        self._txt_step_size_y.setText(condition.step_size_y)
        self._txt_step_size_z.setText(condition.step_size_z)
        self._cb_raster_mode_z.setCurrentIndex(self._cb_raster_mode_z.findText(condition.raster_mode_z))

        position, location = condition.get_position(True)
        self._cb_location.setCurrentIndex(self._cb_location.findText(location))
        if position is not None:
            self._wdg_position.setParameter(position)

    def setReadOnly(self, state):
        _AcquisitionRasterWidget.setReadOnly(self, state)
        self._txt_step_count_x.setReadOnly(state)
        self._txt_step_count_y.setReadOnly(state)
        self._txt_step_count_z.setReadOnly(state)
        self._txt_step_size_x.setReadOnly(state)
        self._txt_step_size_y.setReadOnly(state)
        self._txt_step_size_z.setReadOnly(state)
        self._cb_raster_mode_z.setEnabled(not state)
        self._cb_location.setEnabled(not state)
        self._wdg_position.setReadOnly(state)

    def isReadOnly(self):
        return _AcquisitionRasterWidget.isReadOnly(self) and \
            self._txt_step_count_x.isReadOnly() and \
            self._txt_step_count_y.isReadOnly() and \
            self._txt_step_count_z.isReadOnly() and \
            self._txt_step_size_x.isReadOnly() and \
            self._txt_step_size_y.isReadOnly() and \
            self._txt_step_size_z.isReadOnly() and \
            not self._cb_raster_mode_z.isEnabled() and \
            not self._cb_location.isEnabled() and \
            self._wdg_position.isReadOnly()

    def hasAcceptableInput(self):
        return _AcquisitionRasterWidget.hasAcceptableInput(self) and \
            self._txt_step_count_x.hasAcceptableInput() and \
            self._txt_step_count_y.hasAcceptableInput() and \
            self._txt_step_count_z.hasAcceptableInput() and \
            self._txt_step_size_x.hasAcceptableInput() and \
            self._txt_step_size_y.hasAcceptableInput() and \
            self._txt_step_size_z.hasAcceptableInput() and \
            self._wdg_position.hasAcceptableInput()
示例#3
0
class AcquisitionRasterLinescanWidget(_AcquisitionRasterWidget):

    def __init__(self, parent=None):
        _AcquisitionRasterWidget.__init__(self, AcquisitionRasterLinescan, parent)

    def _init_ui(self):
        # Widgets
        self._txt_step_count = NumericalAttributeLineEdit(self.CLASS.step_count)
        self._txt_step_count.setFormat('{0:d}')
        self._txt_step_size = NumericalAttributeLineEdit(self.CLASS.step_size)
        self._txt_frame_count = NumericalAttributeLineEdit(self.CLASS.frame_count)
        self._txt_frame_count.setFormat('{0:d}')
        self._wdg_position_start = SpecimenPositionWidget(inline=True)
        self._wdg_position_end = SpecimenPositionWidget(inline=True)

        # Layout
        layout = _AcquisitionRasterWidget._init_ui(self)
        layout.insertRow(0, '<i>Step count</i>', self._txt_step_count)
        layout.insertRow(1, 'Step size', self._txt_step_size)
        layout.addRow('Frame count', self._txt_frame_count)
        layout.addRow('Start position', self._wdg_position_start)
        layout.addRow('End position', self._wdg_position_end)

        # Signals
        self._txt_step_count.textEdited.connect(self.edited)
        self._txt_step_size.textEdited.connect(self.edited)
        self._txt_frame_count.textEdited.connect(self.edited)
        self._wdg_position_start.edited.connect(self.edited)
        self._wdg_position_end.edited.connect(self.edited)

        return layout

    def _create_parameter(self):
        return self.CLASS(1)

    def parameter(self, parameter=None):
        parameter = _AcquisitionRasterWidget.parameter(self, parameter)
        parameter.step_count = self._txt_step_count.text()
        parameter.step_size = self._txt_step_size.text()
        parameter.frame_count = self._txt_frame_count.text()
        parameter.position_start = self._wdg_position_start.condition()
        parameter.position_end = self._wdg_position_end.condition()
        return parameter

    def setParameter(self, condition):
        _AcquisitionRasterWidget.setParameter(self, condition)
        self._txt_step_count.setText(condition.step_count)
        self._txt_step_size.setText(condition.step_size)
        self._txt_frame_count.setText(condition.frame_count)
        self._wdg_position_start.setParameter(condition.position_start)
        self._wdg_position_end.setParameter(condition.position_end)

    def setReadOnly(self, state):
        _AcquisitionRasterWidget.setReadOnly(self, state)
        self._txt_step_count.setReadOnly(state)
        self._txt_step_size.setReadOnly(state)
        self._txt_frame_count.setReadOnly(state)
        self._wdg_position_start.setReadOnly(state)
        self._wdg_position_end.setReadOnly(state)

    def isReadOnly(self):
        return _AcquisitionRasterWidget.isReadOnly(self) and \
            self._txt_step_count.isReadOnly() and \
            self._txt_step_size.isReadOnly() and \
            self._txt_frame_count.isReadOnly() and \
            self._wdg_position_start.isReadOnly() and \
            self._wdg_position_end.isReadOnly()

    def hasAcceptableInput(self):
        return _AcquisitionRasterWidget.hasAcceptableInput(self) and \
            self._txt_step_count.hasAcceptableInput() and \
            self._txt_step_size.hasAcceptableInput() and \
            self._txt_frame_count.hasAcceptableInput() and \
            self._wdg_position_start.hasAcceptableInput() and \
            self._wdg_position_end.hasAcceptableInput()