[qt5] fix QMplCanvas

Tue, 15 May 2018 16:08:33 +0200

author
David Douard <david.douard@logilab.fr>
date
Tue, 15 May 2018 16:08:33 +0200
changeset 88
2612a4d53bf8
parent 87
59a0946aa3d1
child 89
61074a32808a

[qt5] fix QMplCanvas

pygpibtoolkit/qt5/mpl.py file | annotate | diff | comparison | revisions
--- a/pygpibtoolkit/qt5/mpl.py	Fri May 04 01:00:59 2018 +0200
+++ b/pygpibtoolkit/qt5/mpl.py	Tue May 15 16:08:33 2018 +0200
@@ -26,15 +26,13 @@
 http://www.logilab.org/project/pygpibtoolkit -- mailto:david.douard@sdfa3.org
 """
 
+from PyQt5 import QtCore, QtWidgets
 
-from PyQt5 import QtGui, QtCore, QtWidgets
-
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
+from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as Canvas
 from matplotlib.figure import Figure
 
 
-class QMplCanvas(FigureCanvas):
-    """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
+class QMplCanvas(Canvas):
     def __init__(self, parent=None, width=5, height=4, dpi=100):
         self.fig = Figure(figsize=(width, height), dpi=dpi)
         self.axes = self.fig.add_subplot(111)
@@ -44,10 +42,9 @@
         super().__init__(self.fig)
         self.setParent(parent)
 
-        FigureCanvas.setSizePolicy(self,
-                                   QtWidgets.QSizePolicy.Expanding,
-                                   QtWidgets.QSizePolicy.Expanding)
-        FigureCanvas.updateGeometry(self)
+        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
+                           QtWidgets.QSizePolicy.Expanding)
+        self.updateGeometry()
 
     def sizeHint(self):
         w, h = self.get_width_height()

mercurial