Пример #1
0
    def _initWidgets(self, backend):
        """Set-up layout and plots."""
        # Monkey-patch for histogram size
        # alternative: create a layout that does not use widget size hints
        def sizeHint():
            return qt.QSize(self.HISTOGRAMS_HEIGHT, self.HISTOGRAMS_HEIGHT)

        self._histoHPlot = Plot.Plot(backend=backend)
        self._histoHPlot.setZoomModeEnabled(True)
        self._histoHPlot.setCallback(self._histoHPlotCB)
        self._histoHPlot.getWidgetHandle().sizeHint = sizeHint
        self._histoHPlot.getWidgetHandle().minimumSizeHint = sizeHint

        self._imagePlot = PlotWindow(backend=backend, plugins=False,
                                     colormap=True, flip=True,
                                     grid=False, togglePoints=False,
                                     logx=False, logy=False,
                                     aspect=True)
        self._imagePlot.usePlotBackendColormap = True
        self._imagePlot.setPanWithArrowKeys(True)

        self._imagePlot.setZoomModeEnabled(True)  # Color is set in setColormap
        self._imagePlot.sigPlotSignal.connect(self._imagePlotCB)
        self._imagePlot.hFlipToolButton.clicked.connect(
            self._updateYAxisInverted)
        self._imagePlot.sigColormapChangedSignal.connect(self.setColormap)

        self._histoVPlot = Plot.Plot(backend=backend)
        self._histoVPlot.setZoomModeEnabled(True)
        self._histoVPlot.setCallback(self._histoVPlotCB)
        self._histoVPlot.getWidgetHandle().sizeHint = sizeHint
        self._histoVPlot.getWidgetHandle().minimumSizeHint = sizeHint

        self._radarView = RadarView()
        self._radarView.visibleRectDragged.connect(self._radarViewCB)

        self._layout = qt.QGridLayout()
        self._layout.addWidget(self._imagePlot, 0, 0)
        self._layout.addWidget(self._histoVPlot.getWidgetHandle(), 0, 1)
        self._layout.addWidget(self._histoHPlot.getWidgetHandle(), 1, 0)
        self._layout.addWidget(self._radarView, 1, 1)

        self._layout.setColumnMinimumWidth(0, self.IMAGE_MIN_SIZE)
        self._layout.setColumnStretch(0, 1)
        self._layout.setColumnMinimumWidth(1, self.HISTOGRAMS_HEIGHT)
        self._layout.setColumnStretch(1, 0)

        self._layout.setRowMinimumHeight(0, self.IMAGE_MIN_SIZE)
        self._layout.setRowStretch(0, 1)
        self._layout.setRowMinimumHeight(1, self.HISTOGRAMS_HEIGHT)
        self._layout.setRowStretch(1, 0)

        self._layout.setSpacing(0)
        self._layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(self._layout)
Пример #2
0
    return ob


if __name__ == "__main__":
    import os
    try:
        from PyMca5.PyMcaGui import PyMcaQt as qt
        from PyMca5.PyMcaGui.plotting import PlotWindow
        app = qt.QApplication([])
        QT = True
        plot = PlotWindow.PlotWindow()
    except:
        # test without graphical interface
        QT = False
        from PyMca5.PyMcaGraph import Plot
        plot = Plot.Plot()
    pluginDir = [os.path.dirname(__file__)]
    plot.getPlugins(method="getPlugin1DInstance", directoryList=pluginDir)
    i = numpy.arange(1000.)
    y1 = 10.0 + 5000.0 * numpy.exp(-0.01 * (i - 50)**2)
    y2 = 10.0 + 5000.0 * numpy.exp(-((i - 55) / 5.)**2)
    plot.addCurve(i, y1, "y1")
    plot.addCurve(i, y2, "y2")
    plugin = getPlugin1DInstance(plot)
    for method in plugin.getMethods():
        print(method, ":", plugin.getMethodToolTip(method))
    plugin.applyMethod(plugin.getMethods()[0])
    curves = plugin.getAllCurves()
    #for curve in curves:
    #    print(curve[2])
    print("LIMITS = ", plugin.getGraphYLimits())