def __init__(self, name: str, parent: Optional[QtWidgets.QWidget] = None): """Constructor for :class:`AutoPlotToolBar`""" super().__init__(name, parent=parent) self.plotasMultiTraces = self.addAction(get_multiTracePlotIcon(), 'Multiple traces') self.plotasMultiTraces.setCheckable(True) self.plotasMultiTraces.triggered.connect( lambda: self.selectPlotType(PlotType.multitraces)) self.plotasSingleTraces = self.addAction(get_singleTracePlotIcon(), 'Individual traces') self.plotasSingleTraces.setCheckable(True) self.plotasSingleTraces.triggered.connect( lambda: self.selectPlotType(PlotType.singletraces)) self.addSeparator() self.plotasImage = self.addAction(get_imagePlotIcon(), 'Image') self.plotasImage.setCheckable(True) self.plotasImage.triggered.connect( lambda: self.selectPlotType(PlotType.image)) self.plotasMesh = self.addAction(get_colormeshPlotIcon(), 'Color mesh') self.plotasMesh.setCheckable(True) self.plotasMesh.triggered.connect( lambda: self.selectPlotType(PlotType.colormesh)) self.plotasScatter2d = self.addAction(get_scatterPlot2dIcon(), 'Scatter 2D') self.plotasScatter2d.setCheckable(True) self.plotasScatter2d.triggered.connect( lambda: self.selectPlotType(PlotType.scatter2d)) # other options self.addSeparator() self.plotComplexPolar = self.addAction('Mag/Phase') self.plotComplexPolar.setCheckable(True) self.plotComplexPolar.triggered.connect( self._trigger_complex_mag_phase) self.plotTypeActions = OrderedDict({ PlotType.multitraces: self.plotasMultiTraces, PlotType.singletraces: self.plotasSingleTraces, PlotType.image: self.plotasImage, PlotType.colormesh: self.plotasMesh, PlotType.scatter2d: self.plotasScatter2d, }) self._currentPlotType = PlotType.empty self._currentlyAllowedPlotTypes: Tuple[PlotType, ...] = ()
def __init__(self, name: str, parent: Optional[QtWidgets.QWidget] = None): """Constructor for :class:`AutoPlotToolBar`""" super().__init__(name, parent=parent) self.plotasMultiTraces = self.addAction(get_multiTracePlotIcon(), 'Multiple traces') self.plotasMultiTraces.setCheckable(True) self.plotasMultiTraces.triggered.connect( lambda: self.selectPlotType(PlotType.multitraces)) self.plotasSingleTraces = self.addAction(get_singleTracePlotIcon(), 'Individual traces') self.plotasSingleTraces.setCheckable(True) self.plotasSingleTraces.triggered.connect( lambda: self.selectPlotType(PlotType.singletraces)) self.addSeparator() self.plotasImage = self.addAction(get_imagePlotIcon(), 'Image') self.plotasImage.setCheckable(True) self.plotasImage.triggered.connect( lambda: self.selectPlotType(PlotType.image)) self.plotasMesh = self.addAction(get_colormeshPlotIcon(), 'Color mesh') self.plotasMesh.setCheckable(True) self.plotasMesh.triggered.connect( lambda: self.selectPlotType(PlotType.colormesh)) self.plotasScatter2d = self.addAction(get_scatterPlot2dIcon(), 'Scatter 2D') self.plotasScatter2d.setCheckable(True) self.plotasScatter2d.triggered.connect( lambda: self.selectPlotType(PlotType.scatter2d)) # other options self.addSeparator() self.plotReal = self.addAction('Real') self.plotReal.setCheckable(True) self.plotReal.triggered.connect( lambda: self.selectComplexType(ComplexRepresentation.real)) self.plotReIm = self.addAction('Re/Im') self.plotReIm.setCheckable(True) self.plotReIm.triggered.connect( lambda: self.selectComplexType(ComplexRepresentation.realAndImag)) self.plotReImSep = self.addAction('Split Re/Im') self.plotReImSep.setCheckable(True) self.plotReImSep.triggered.connect(lambda: self.selectComplexType( ComplexRepresentation.realAndImagSeparate)) self.plotMagPhase = self.addAction('Mag/Phase') self.plotMagPhase.setCheckable(True) self.plotMagPhase.triggered.connect( lambda: self.selectComplexType(ComplexRepresentation.magAndPhase)) self.plotTypeActions = OrderedDict({ PlotType.multitraces: self.plotasMultiTraces, PlotType.singletraces: self.plotasSingleTraces, PlotType.image: self.plotasImage, PlotType.colormesh: self.plotasMesh, PlotType.scatter2d: self.plotasScatter2d, }) self.ComplexActions = OrderedDict({ ComplexRepresentation.real: self.plotReal, ComplexRepresentation.realAndImag: self.plotReIm, ComplexRepresentation.realAndImagSeparate: self.plotReImSep, ComplexRepresentation.magAndPhase: self.plotMagPhase }) self._currentPlotType = PlotType.empty self._currentlyAllowedPlotTypes: Tuple[PlotType, ...] = () self._currentComplex = ComplexRepresentation.realAndImag self.ComplexActions[self._currentComplex].setChecked(True) self._currentlyAllowedComplexTypes: Tuple[ComplexRepresentation, ...] = ()