36
36
_decref .argtypes = [ctypes .py_object ]
37
37
_decref .restype = None
38
38
39
+
39
40
def new_figure_manager (num , * args , ** kwargs ):
40
41
"""
41
42
Create a new figure manager instance
@@ -46,13 +47,15 @@ def new_figure_manager(num, *args, **kwargs):
46
47
thisFig = FigureClass (* args , ** kwargs )
47
48
return new_figure_manager_given_figure (num , thisFig )
48
49
50
+
49
51
def new_figure_manager_given_figure (num , figure ):
50
52
"""
51
53
Create a new figure manager instance for the given figure.
52
54
"""
53
55
canvas = FigureCanvasQTAgg (figure )
54
56
return FigureManagerQT (canvas , num )
55
57
58
+
56
59
class FigureCanvasQTAggBase (object ):
57
60
"""
58
61
The canvas the figure renders into. Calls the draw and print fig
@@ -62,7 +65,7 @@ class FigureCanvasQTAggBase(object):
62
65
63
66
figure - A Figure instance
64
67
"""
65
-
68
+
66
69
def drawRectangle (self , rect ):
67
70
self ._drawRect = rect
68
71
self .repaint ()
@@ -74,7 +77,7 @@ def paintEvent(self, e):
74
77
shown onscreen.
75
78
"""
76
79
77
- #FigureCanvasQT.paintEvent(self, e)
80
+ # FigureCanvasQT.paintEvent(self, e)
78
81
if DEBUG :
79
82
print ('FigureCanvasQtAgg.paintEvent: ' , self ,
80
83
self .get_width_height ())
@@ -157,12 +160,14 @@ def blit(self, bbox=None):
157
160
def print_figure (self , * args , ** kwargs ):
158
161
FigureCanvasAgg .print_figure (self , * args , ** kwargs )
159
162
self .draw ()
160
-
161
- class FigureCanvasQTAgg (FigureCanvasQTAggBase , FigureCanvasQT , FigureCanvasAgg ):
163
+
164
+
165
+ class FigureCanvasQTAgg (FigureCanvasQTAggBase ,
166
+ FigureCanvasQT , FigureCanvasAgg ):
162
167
"""
163
168
The canvas the figure renders into. Calls the draw and print fig
164
- methods, creates the renderers, etc.
165
-
169
+ methods, creates the renderers, etc.
170
+
166
171
Modified to import from Qt5 backend for new-style mouse events.
167
172
168
173
Public attribute
@@ -194,7 +199,8 @@ def __init__(self, figure):
194
199
self ._priv_update = self .repaint
195
200
else :
196
201
self ._priv_update = self .update
197
-
202
+
203
+
198
204
class NavigationToolbar2QTAgg (NavigationToolbar2QT ):
199
205
def __init__ (* args , ** kwargs ):
200
206
warnings .warn ('This class has been deprecated in 1.4 ' +
@@ -205,6 +211,5 @@ def __init__(*args, **kwargs):
205
211
NavigationToolbar2QT .__init__ (* args , ** kwargs )
206
212
207
213
208
-
209
214
FigureCanvas = FigureCanvasQTAgg
210
215
FigureManager = FigureManagerQT
0 commit comments