def __createPlotToolBar(self, plot): toolBar = qt.QToolBar("Plot tools", plot) toolBar.addAction(PlotActions.ResetZoomAction(plot, toolBar)) toolBar.addAction(PlotActions.ZoomInAction(plot, toolBar)) toolBar.addAction(PlotActions.ZoomOutAction(plot, toolBar)) toolBar.addSeparator() toolBar.addAction(PlotActions.ColormapAction(plot, toolBar)) toolBar.addAction(PlotActions.PixelIntensitiesHistoAction(plot, toolBar)) toolBar.addSeparator() toolBar.addAction(PlotActions.CopyAction(plot, toolBar)) toolBar.addAction(PlotActions.SaveAction(plot, toolBar)) toolBar.addAction(PlotActions.PrintAction(plot, toolBar)) return toolBar
def createEditor(self, parent, option, index): if not index.isValid(): return super(_PeakToolItemDelegate, self).createEditor(parent, option, index) editor = qt.QToolBar(parent=parent) editor.setIconSize(qt.QSize(32, 32)) editor.setStyleSheet("QToolBar { border: 0px }") editor.setMinimumSize(32, 32) editor.setMaximumSize(32, 32) editor.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed) remove = qt.QAction(editor) remove.setIcon(icons.getQIcon("remove-peak")) remove._customSignal = None persistantIndex = qt.QPersistentModelIndex(index) remove.triggered.connect(functools.partial(self.__removePeak, persistantIndex)) editor.addAction(remove) return editor
def __createPlotToolBar(self, plot): toolBar = qt.QToolBar("Plot tools", plot) toolBar.addAction(PlotActions.ResetZoomAction(plot, toolBar)) toolBar.addAction(PlotActions.ZoomInAction(plot, toolBar)) toolBar.addAction(PlotActions.ZoomOutAction(plot, toolBar)) toolBar.addSeparator() toolBar.addAction(PlotActions.ColormapAction(plot, toolBar)) toolBar.addAction( PlotActions.PixelIntensitiesHistoAction(plot, toolBar)) toolBar.addSeparator() toolBar.addAction(PlotActions.CopyAction(plot, toolBar)) toolBar.addAction(PlotActions.SaveAction(plot, toolBar)) toolBar.addAction(PlotActions.PrintAction(plot, toolBar)) stretch = qt.QWidget(self) stretch.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed) toolBar.addWidget(stretch) self.__options = self.__createOptionsWidget() toolBar.addWidget(self.__options) return toolBar