Skip to content

Commit 168486b

Browse files
committed
Merge remote-tracking branch 'matplotlib/v2.1.x'
Conflicts: doc/_templates/citing.html - moved to citing.rst, added entry for 2.1.1 doc/devel/contributing.rst - kept version on master (which has extra paragraph) lib/matplotlib/axes/_axes.py - looks like a git merge issue, both versions are identical
2 parents c5ed696 + d36c42c commit 168486b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

doc/citing.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ publication, please acknowledge this fact by citing `Hunter et al (2007)
2727
2828
DOIs
2929
----
30-
30+
v2.1.1
31+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.1098480.svg
32+
:target: https://doi.org/10.5281/zenodo.1098480
3133
v2.1.0
3234
.. image:: https://zenodo.org/badge/doi/10.5281/zenodo.1004650.svg
3335
:target: https://doi.org/10.5281/zenodo.1004650

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(self, figure):
3535
super(FigureCanvasQTAggBase, self).__init__(figure=figure)
3636
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
3737
self._agg_draw_pending = False
38+
self._agg_is_drawing = False
3839
self._bbox_queue = []
3940
self._drawRect = None
4041

@@ -124,7 +125,14 @@ def draw(self):
124125
"""
125126
# The Agg draw is done here; delaying causes problems with code that
126127
# uses the result of the draw() to update plot elements.
127-
super(FigureCanvasQTAggBase, self).draw()
128+
if self._agg_is_drawing:
129+
return
130+
131+
self._agg_is_drawing = True
132+
try:
133+
super(FigureCanvasQTAggBase, self).draw()
134+
finally:
135+
self._agg_is_drawing = False
128136
self.update()
129137

130138
def draw_idle(self):
@@ -135,7 +143,7 @@ def draw_idle(self):
135143
# current event loop in order to ensure thread affinity and to
136144
# accumulate multiple draw requests from event handling.
137145
# TODO: queued signal connection might be safer than singleShot
138-
if not self._agg_draw_pending:
146+
if not (self._agg_draw_pending or self._agg_is_drawing):
139147
self._agg_draw_pending = True
140148
QtCore.QTimer.singleShot(0, self.__draw_idle_agg)
141149

@@ -146,6 +154,7 @@ def __draw_idle_agg(self, *args):
146154
# we have now tried this function at least once, do not run
147155
# again until re-armed. Doing this here rather than after
148156
# protects against recursive calls triggered through self.draw
157+
# The recursive call is via `repaintEvent`
149158
self._agg_draw_pending = False
150159
# if negative size, bail
151160
if self.height() < 0 or self.width() < 0:

0 commit comments

Comments
 (0)