Skip to content
New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 1 commit into from
Sep 30, 2021

Conversation

mariobuikhuizen
Copy link
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
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
Member

Rebased

@martinRenou
Copy link
Member

@meeseeksdev backport to 0.12.x

@pllim
Copy link
Contributor

pllim commented Sep 30, 2021

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

@martinRenou
Copy link
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)
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
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?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants