def __init__(self, common_controll, viewer, data):
     super(Controll, self).__init__()
     self._common_controll = common_controll
     self._viewer = viewer
     self._data = data
     self._widget = QtGui.QWidget()
     self._active = True
Exemple #2
0
    def _setup_gui(self):
        """Setup the entire gui of the program"""
        self._view_stack = QtGui.QStackedWidget(self)
        self._controll_stack = QtGui.QStackedWidget(self)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self._view_stack)
        layout.addLayout(self._setup_module_select())

        common_controll_group = QtGui.QGroupBox("Common controlls")
        common_controll_dummy_layout = QtGui.QHBoxLayout()
        common_controll_dummy_layout.addWidget(self._common_controll)
        common_controll_group.setLayout(common_controll_dummy_layout)
        layout.addWidget(common_controll_group)

        module_controll_group = QtGui.QGroupBox("Module controlls")
        module_controll_dummy_layout = QtGui.QHBoxLayout()
        module_controll_dummy_layout.addWidget(self._controll_stack)
        module_controll_group.setLayout(module_controll_dummy_layout)
        layout.addWidget(module_controll_group)

        size_policy_large = self._view_stack.sizePolicy()
        size_policy_large.setVerticalStretch(1)
        self._view_stack.setSizePolicy(size_policy_large)

        # module_controll_group = QtGui.QGroupBox("Module controlls")
        # module_controll_group.setWidget(self._common_controll)
        # layout.addWidget(self.module_cocntroll_group)

        self._central_widget = QtGui.QWidget()
        self._central_widget.setLayout(layout)
        self.setCentralWidget(self._central_widget)
def get_matplotlib_widget():
    """Returns four objects: A widget, a figure, a canvas an mpl_toolbar."""
    widget = QtGui.QWidget()
    fig = Figure((5., 4.))
    canvas = FigureCanvas(fig)
    canvas.setParent(widget)
    mpl_toolbar = NavigationToolbar(canvas, widget)
    layout = QtGui.QVBoxLayout()
    layout.addWidget(canvas)
    layout.addWidget(mpl_toolbar)
    widget.setLayout(layout)
    return widget, fig, canvas, mpl_toolbar
    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)
 def __init__(self, parent=None):
     super(Viewer, self).__init__(parent)
     self._widget = QtGui.QWidget(parent)