Exemple #1
0
    def _init_ui(self):
        # Widgets
        self._rdb_sum = QRadioButton("Sum")
        self._rdb_sum.setChecked(True)
        self._rdb_max = QRadioButton("Maximum")
        self._rdb_single = QRadioButton("Single")
        self._rdb_range = QRadioButton("Range")

        self._sld_start = QSlider(Qt.Horizontal)
        self._sld_start.setTickPosition(QSlider.TicksBelow)
        self._sld_start.setEnabled(False)

        self._sld_end = QSlider(Qt.Horizontal)
        self._sld_end.setTickPosition(QSlider.TicksBelow)
        self._sld_end.setEnabled(False)

        self._wdg_imageraster2d = self._create_imageraster2d_widget()
        self._wdg_analysis = self._create_analysis1d_widget()

        # Layouts
        layout = _DatumWidget._init_ui(self)

        sublayout = QHBoxLayout()
        sublayout.addWidget(self._rdb_sum)
        sublayout.addWidget(self._rdb_max)
        sublayout.addWidget(self._rdb_single)
        sublayout.addWidget(self._rdb_range)
        layout.addLayout(sublayout)

        sublayout = QFormLayout()
        sublayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) # Fix for Mac OS
        sublayout.addRow('Channels (Start)', self._sld_start)
        sublayout.addRow('Channels (End)', self._sld_end)
        layout.addLayout(sublayout)

        splitter = QSplitter()
        splitter.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        splitter.addWidget(self._wdg_imageraster2d)
        splitter.addWidget(self._wdg_analysis)
        layout.addWidget(splitter)

        # Signals
        self._rdb_sum.toggled.connect(self._on_mode_sum)
        self._rdb_max.toggled.connect(self._on_mode_max)
        self._rdb_single.toggled.connect(self._on_mode_single)
        self._rdb_range.toggled.connect(self._on_mode_range)

        self._sld_start.valueChanged.connect(self._on_slide_start)
        self._sld_end.valueChanged.connect(self._on_slide_end)

        self._wdg_imageraster2d.valueSelected.connect(self._on_value_selected)

        # Defaults
        self.setMode(self.MODE_SUM)

        return layout