Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

qt backend draw_idle doesn't work#4944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:masterfromjrevans:issue14
Aug 20, 2015

Conversation

jrevans
Copy link

Restored 'draw_idle' method to allow for mpl callbacks to finish processing before a Qt draw happens.

This addresses an issue in#4897.

@tacaswelltacaswell added this to thenext point release milestoneAug 17, 2015
@tacaswell
Copy link
Member

attn@pwuertz

@tacaswell
Copy link
Member

attn@mfitzp

@tacaswelltacaswell modified the milestone:next point releaseAug 18, 2015
@pwuertz
Copy link
Contributor

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.

@mfitzp
Copy link
Member

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 toself.update() (the Qt function) with one toself.draw() which is implemented onFigureCanvasBase 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 theupdate() (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 toupdate() until idle would accomplish the same thing:

def draw_idle(self):    if self._idle:        self.update()

@pwuertz
Copy link
Contributor

@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.

@mfitzp
Copy link
Member

@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 theself._idle flag was already present before this commit (but is apparently unused).

@jrevans is the purpose of this to postpone Qt redraw? Why useself.draw() rather thanself.update()?

@tacaswell
Copy link
Member

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 Fitzpatricknotifications@github.com
wrote:

@pwuertzhttps://github.com/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).

@jrevanshttps://github.com/jrevans is the purpose of this to postpone
Qt redraw? Why use self.draw() rather than self.update()?


Reply to this email directly or view it on GitHub
#4944 (comment)
.

tacaswell added a commit that referenced this pull requestAug 20, 2015
FIX: revert changes to qt draw_idle
@tacaswelltacaswell merged commit5a23a21 intomatplotlib:masterAug 20, 2015
@tacaswell
Copy link
Member

tightly linked with#4943

Please move this discussion to#4962

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Projects
None yet
Milestone
v1.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@jrevans@tacaswell@pwuertz@mfitzp

[8]ページ先頭

©2009-2025 Movatter.jp