Example #1
0
 def make_toolbar(self):
     result = GlueToolbar(self.central_widget.canvas, self,
                          name='Scatter Plot')
     for mode in self._mouse_modes():
         result.add_mode(mode)
     self.addToolBar(result)
     return result
Example #2
0
 def make_toolbar(self):
     """
     Setup the toolbar
     """
     result = GlueToolbar(self.central_widget.canvas, self,
                          name='Image')
     result.add_mode(ContrastMode(self._axes, move_callback=self._set_norm))
     cm = _colormap_mode(self, self._set_cmap)
     result.addWidget(cm)
     self._cmap_actions = cm.actions()
     self.addToolBar(result)
     return result
Example #3
0
    def __init__(self, browser, model, x, y):
        # the GUI that enables selection and manipulation of
        # astropy spectral components is actually handled by
        # the SpectralModelManager class.
        self.manager = SpectralModelManager()
        # any change in the model manager should trigger
        # a refresh of the local spectral model. Component
        # selection should cause the component to be painted
        # in a distinct color.
        self.manager.changed.connect(browser._sync_model_list)
        self.manager.selected.connect(browser._display_selected_model)
        # the model manager needs to know the actual
        # data being plotted and fitted.
        self.manager.setArrays(x, y)

        model_list_gui = self.manager.buildMainPanel(model)
        model_list_gui.setStretchFactor(0, 0)
        model_tree = self.manager.treeWidget

        win = QMainWindow()
        wid = QWidget()
        win.setCentralWidget(wid)
        l = QHBoxLayout()
        l.setSpacing(2)
        l.setContentsMargins(3, 3, 3, 3)
        wid.setLayout(l)

        widget = MplWidget()
        win.addToolBar(GlueToolbar(widget.canvas, win))
        l.addWidget(widget)

        right = QVBoxLayout()
        right.setSpacing(2)
        right.setContentsMargins(2, 0, 2, 0)

        right.addWidget(model_list_gui)

        buttons = QHBoxLayout()
        buttons.setSpacing(2)
        buttons.setContentsMargins(2, 0, 2, 0)

        right.addLayout(buttons)
        add = QPushButton(get_icon('glue_cross'), '')
        add.setToolTip('Add a spectral component')
        remove = QPushButton(get_icon('glue_delete'), '')
        remove.setToolTip('Remove the current spectral component')
        fit = QPushButton('Fit')
        fit.setToolTip("Fit model to spectrum")

        buttons.insertStretch(0, 1)
        buttons.addWidget(fit)
        l.addLayout(right)

        self.canvas = widget.canvas
        self.window = win
        self.model_list_gui = model_list_gui
        self.model_tree = model_tree
        self.remove = remove
        self.add = add
        self.fit = fit
Example #4
0
    def make_toolbar(self):
        result = GlueToolbar(self.central_widget.canvas, self, name='Image')
        for mode in self._mouse_modes():
            result.add_mode(mode)

        cmap = _colormap_mode(self, self.client.set_cmap)
        result.addWidget(cmap)

        # connect viewport update buttons to client commands to
        # allow resampling
        cl = self.client
        result.buttons['HOME'].triggered.connect(nonpartial(cl.check_update))
        result.buttons['FORWARD'].triggered.connect(nonpartial(
            cl.check_update))
        result.buttons['BACK'].triggered.connect(nonpartial(cl.check_update))

        return result