| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…essing before a Qt draw happens.
|
I don't see why this is should be necessary. Calling update() is designed to do the exact same thing, it posts a paintEvent to the event loop and returns immediately to the event processing code. If the render thread determines that it has time to draw another frame, it draws another frame. Is there an example where the mpl callbacks do not get processed in time and are causing an event pile up? After we eliminated all synchronous draw calls I haven't seen this behaviour any more. |
Sorry, something went wrong.
|
I might be missing something here but the patch: def draw_idle(self):
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)
...replaces the call to self.update() (the Qt function) with one to self.draw() which is implemented on FigureCanvasBase as a no-op: class FigureCanvasBase(object):
def draw(self, *args, **kwargs):
"""
Render the :class:`~matplotlib.figure.Figure`
"""
pass
...this looks to me as if it would just block the update() (Qt refresh) from occurring. Is there are test-case for the issue this is trying to resolve (the need for a longer delay from zoom, pan, lasso)? I'm wondering if postponing the call to update() until idle would accomplish the same thing: def draw_idle(self):
if self._idle:
self.update()
|
Sorry, something went wrong.
|
@mfitzp The draw() call is reimplemented in the qt backend and will force an agg redraw + emit a qt update. This however eliminates the recent optimization where the agg redraw is done in paintEvent. As discussed in another issue, there is a problem when using interactive mode where stale callbacks are emitting draw_idle calls from within a agg draw call. As I understand it, this is a bug in matplotlib. The self._idle flag in this pull request acts as a workaround for that. |
Sorry, something went wrong.
|
@pwuertz ah, thanks. I was looking up the inheritance rather than down: class FigureCanvasQTAggBase(object):
def draw(self):
FigureCanvasAgg.draw(self)
self.update()
I was confused as the self._idle flag was already present before this commit (but is apparently unused). @jrevans is the purpose of this to postpone Qt redraw? Why use self.draw() rather than self.update()? |
Sorry, something went wrong.
|
You need to consider this with the qt.paintEvent pr for it to make sense. The _idle flash was there for a long time and the removed. I will have an alternate pr to this pair in soon. On Wed, Aug 19, 2015, 7:46 AM Martin Fitzpatrick notifications@github.com
|
Sorry, something went wrong.
FIX: revert changes to qt draw_idle
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Restored 'draw_idle' method to allow for mpl callbacks to finish processing before a Qt draw happens.
This addresses an issue in #4897.