Esempio n. 1
0
    def _setup_gui(self):
        """Create the gui for the widget."""
        view_type_radio_surface = QtGui.QRadioButton("Isosurface plot")
        view_type_radio_slice = QtGui.QRadioButton("Slice plot")
        view_type_radio_slice.setChecked(True)
        view_type_layout = QtGui.QVBoxLayout()
        view_type_layout.addWidget(view_type_radio_surface)
        view_type_layout.addWidget(view_type_radio_slice)
        view_type_radio_surface.clicked.connect(
            partial(self.set_view_type, VIEW_TYPE.surface))
        view_type_radio_slice.clicked.connect(
            partial(self.set_view_type, VIEW_TYPE.slice))

        #surface controll setup
        self._surface_level_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
        self._surface_level_slider.setTracking(True)
        self._surface_level_slider.setRange(1, self._slider_length)

        def on_slider_changed(self, slider_level):
            """Handles the signal from a surface level slider change."""
            # surface_level = slider_level/float(cls._slider_length)
            # surface_level = self._slider_length/(float(slider_level))
            surface_level = (
                (numpy.exp(float(slider_level) / float(self._slider_length)) -
                 1.) / (numpy.exp(1.) - 1.))
            self._viewer.set_surface_level(surface_level)

        self._surface_level_slider.valueChanged.connect(
            partial(on_slider_changed, self))
        self._surface_level_slider.blockSignals(True)
        self._surface_level_slider.setSliderPosition(self._slider_length *
                                                     INIT_SURFACE_LEVEL)

        # slice controll widget setup
        log_scale_box = QtGui.QCheckBox()
        log_scale_label = QtGui.QLabel('Log Scale')
        log_scale_layout = QtGui.QHBoxLayout()
        log_scale_layout.addWidget(log_scale_label)
        log_scale_layout.addWidget(log_scale_box)
        log_scale_layout.addStretch()
        log_scale_box.stateChanged.connect(self.set_log_scale)
        self._log_scale_widget = QtGui.QWidget()
        self._log_scale_widget.setLayout(log_scale_layout)
        #self._log_scale_widget.hide()

        layout = QtGui.QVBoxLayout()
        layout.addLayout(view_type_layout)
        layout.addWidget(self._surface_level_slider)
        layout.addWidget(self._log_scale_widget)
        #layout.addStretch()
        self._widget.setLayout(layout)
        self._widget.setFixedHeight(120)
Esempio n. 2
0
    def _setup_module_select(self):
        """Create a drop down menu for selecting modules. Returns a layout containing it."""
        self._module_box = QtGui.QComboBox()
        self._module_box.activated.connect(self._select_module)
        # self._module_box.activated.connect(self._view_stack.setCurrentIndex)
        # self._module_box.activated.connect(self._controll_stack.setCurrentIndex)

        label = QtGui.QLabel("Display module: ")
        layout = QtGui.QHBoxLayout()
        layout.addWidget(label)
        layout.addWidget(self._module_box)
        layout.addStretch()
        return layout
Esempio n. 3
0
 def _setup_dir_chooser(self):
     """Return a directory cooser layout."""
     work_dir_label = QtGui.QLabel("Dir:")
     file_system_completer = QtGui.QCompleter()
     self._file_system_model = QtGui.QFileSystemModel(file_system_completer)
     #file_system_model.setRootPath('/')
     self._file_system_model.setFilter(QtCore.QDir.Dirs
                                       | QtCore.QDir.Hidden)
     file_system_completer.setModel(self._file_system_model)
     self._work_dir_edit = QtGui.QLineEdit(os.getcwd())
     self._work_dir_edit.setCompleter(file_system_completer)
     self._work_dir_edit.editingFinished.connect(self._on_work_dir_changed)
     work_dir_layout = QtGui.QHBoxLayout()
     work_dir_layout.addWidget(work_dir_label)
     work_dir_layout.addWidget(self._work_dir_edit)
     return work_dir_layout
Esempio n. 4
0
    def _setup_gui(self):
        """Create the gui and set layout."""
        self._spin_box = QtGui.QSpinBox()
        self._update_spinbox_max(self._max_lim)
        #self._spin_box.setRange(self._min_lim, self._max_lim)
        self._spin_box.setValue(self._value)

        self._max_label = QtGui.QLabel("")
        self._update_max_label(self._max_lim)

        self._prev_button = QtGui.QPushButton("Previous")
        self._next_button = QtGui.QPushButton("Next")

        layout = QtGui.QHBoxLayout()
        layout.addWidget(self._spin_box)
        layout.addWidget(self._max_label)
        layout.addWidget(self._prev_button)
        layout.addWidget(self._next_button)

        self.setLayout(layout)
Esempio n. 5
0
    def _setup_gui(self):
        """Create the gui for the widget."""
        layout = QtGui.QVBoxLayout()
        self._image_index_chooser = convenient_widgets.IntegerControll(
            0, max_lim=self._data.get_number_of_images())
        self._image_index_chooser.valueChanged.connect(self.set_image)
        self._data.number_of_images_changed.connect(
            self._image_index_chooser.set_max)
        layout.addWidget(self._image_index_chooser)

        log_scale_box = QtGui.QCheckBox()
        log_scale_label = QtGui.QLabel("Log Scale")
        log_scale_layout = QtGui.QHBoxLayout()
        log_scale_layout.addWidget(log_scale_box)
        log_scale_layout.addWidget(log_scale_label)
        log_scale_layout.addStretch()
        log_scale_box.stateChanged.connect(self.set_log_scale)
        layout.addLayout(log_scale_layout)

        self._widget.setLayout(layout)