Skip to content

Commit

Permalink
Merge pull request #4944 from jrevans/issue14
Browse files Browse the repository at this point in the history
FIX: revert changes to qt draw_idle
  • Loading branch information
tacaswell committed Aug 20, 2015
2 parents c8c6fbd + 8279011 commit 5a23a21
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/matplotlib/backends/backend_qt5.py
Expand Up @@ -416,7 +416,21 @@ def stop_event_loop(self):
stop_event_loop.__doc__ = FigureCanvasBase.stop_event_loop_default.__doc__

def draw_idle(self):
self.update()
# This cannot be a call to 'update', we need a slightly longer
# delay, otherwise mouse releases from zooming, panning, or
# lassoing might not finish processing and will not redraw properly.
# We use the guard flag to prevent infinite calls to 'draw_idle' which
# happens with the 'stale' figure & axes callbacks.
d = self._idle
self._idle = False

def idle_draw(*args):
try:
self.draw()
finally:
self._idle = True
if d:
QtCore.QTimer.singleShot(0, idle_draw)


class MainWindow(QtWidgets.QMainWindow):
Expand Down

0 comments on commit 5a23a21

Please sign in to comment.