8000 Merge pull request #4944 from jrevans/issue14 · matplotlib/matplotlib@5a23a21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a23a21

Browse files
committed
Merge pull request #4944 from jrevans/issue14
FIX: revert changes to qt draw_idle
2 parents c8c6fbd + 8279011 commit 5a23a21

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,21 @@ def stop_event_loop(self):
416416
stop_event_loop.__doc__ = FigureCanvasBase.stop_event_loop_default.__doc__
417417

418418
def draw_idle(self):
419-
self.update()
419+
# This cannot be a call to 'update', we need a slightly longer
420+
# delay, otherwise mouse releases from zooming, panning, or
421+
# lassoing might not finish processing and will not redraw properly.
422+
# We use the guard flag to prevent infinite calls to 'draw_idle' which
423+
# happens with the 'stale' figure & axes callbacks.
424+
d = self._idle
425+
self._idle = False
426+
427+
def idle_draw(*args):
428+
try:
429+
self.draw()
430+
finally:
431+
self._idle = True
432+
if d:
433+
QtCore.QTimer.singleShot(0, idle_draw)
420434

421435

422436
class MainWindow(QtWidgets.QMainWindow):

0 commit comments

Comments
 (0)
0