Skip to content

feat: make a PNG export of the figure available in the kernel#1397

Merged
martinRenou merged 1 commit intobqplot:masterfrom
mariobuikhuizen:feat_png_export_kernel
Sep 30, 2021
Merged

feat: make a PNG export of the figure available in the kernel#1397
martinRenou merged 1 commit intobqplot:masterfrom
mariobuikhuizen:feat_png_export_kernel

Conversation

@mariobuikhuizen
Copy link
Copy Markdown
Contributor

@mariobuikhuizen mariobuikhuizen commented Aug 19, 2021

A solution for #1393

Usage:

def on_png_received(data):
    with open('mychart.png', 'bw') as f:
        f.write(data)

figure.get_png_data(on_png_received)

@maartenbreddels
Copy link
Copy Markdown
Member

LGTM, would like a 2nd opinion from @SylvainCorlay or @martinRenou on this.

Some thoughts that don't need addressing perse:

@martinRenou martinRenou force-pushed the feat_png_export_kernel branch from 1749522 to d2382a9 Compare September 30, 2021 15:26
@martinRenou
Copy link
Copy Markdown
Member

Rebased

@martinRenou
Copy link
Copy Markdown
Member

@meeseeksdev backport to 0.12.x

@pllim
Copy link
Copy Markdown
Contributor

pllim commented Sep 30, 2021

Thanks! Nice! Which release will this feature be in? 😸

@martinRenou
Copy link
Copy Markdown
Member

0.12.31 :) It should come soon

@mariobuikhuizen mariobuikhuizen deleted the feat_png_export_kernel branch September 30, 2021 16:11
martinRenou added a commit that referenced this pull request Sep 30, 2021
…7-on-0.12.x

Backport PR #1397 on branch 0.12.x (feat: make a PNG export of the figure available in the kernel)
Comment thread bqplot/figure.py
if self._upload_png_callback:
raise Exception('get_png_data already in progress')
self._upload_png_callback = callback
self.send({'type': 'upload_png', 'scale': scale})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work, though this thing gets stuck in display-less CI, so I cannot write a test for it. Any trick I need to know to write a Python unit test that calls this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants