From 3d56ea5c7120212f216ca88a58d75d0711100851 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Jan 2016 07:22:19 -0700 Subject: [PATCH] applets/plot_xy_hist: use normal Qt widget as top-level to workaround pyqtgraph.GraphicsWindow misbehaviour with embedding --- artiq/applets/plot_xy_hist.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/artiq/applets/plot_xy_hist.py b/artiq/applets/plot_xy_hist.py index f22c628ce..2a97a324c 100755 --- a/artiq/applets/plot_xy_hist.py +++ b/artiq/applets/plot_xy_hist.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3.5 import numpy as np +from quamash import QtWidgets import pyqtgraph from artiq.applets.simple import SimpleApplet @@ -17,18 +18,22 @@ def _compute_ys(histogram_bins, histograms_counts): return ys -class XYHistPlot(pyqtgraph.GraphicsWindow): +# pyqtgraph.GraphicsWindow fails to behave like a regular Qt widget +# and breaks embedding. Do not use as top widget. +class XYHistPlot(QtWidgets.QSplitter): def __init__(self, args): - pyqtgraph.GraphicsWindow.__init__(self, title="XY/Histogram") + QtWidgets.QSplitter.__init__(self) self.resize(1000,600) self.setWindowTitle("XY/Histogram") - self.xy_plot = self.addPlot() + self.xy_plot = pyqtgraph.PlotWidget() + self.insertWidget(0, self.xy_plot) self.xy_plot_data = None self.arrow = None self.selected_index = None - self.hist_plot = self.addPlot() + self.hist_plot = pyqtgraph.PlotWidget() + self.insertWidget(1, self.hist_plot) self.hist_plot_data = None self.args = args