Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preview() .svg files on jupyter notebook #15

Closed
ftxi opened this issue May 1, 2017 · 5 comments
Closed

preview() .svg files on jupyter notebook #15

ftxi opened this issue May 1, 2017 · 5 comments

Comments

@ftxi
Copy link

ftxi commented May 1, 2017

Previewing a svg file on IJulia results in opening the file by default program on my platform.
I read that:

"""
    preview()

If working in Jupyter (IJUlia), display a PNG file in the notebook.
On macOS, open the file, which probably uses the default, Preview.app.
On Unix, open the file with `xdg-open`.
On Windows, pass the filename to `explorer`.
"""
function preview()
    if isdefined(Main, :IJulia) && Main.IJulia.inited && currentdrawing.surfacetype == "png"
        display(load(currentdrawing.filename))
 ...

But why shouldn't it pass the file to jupyter? For me, open luxor-drawing.svg will open it with an outdated Adobe Illustrator, which is contrary to my expectations. Opening in on a web browser should even create a better experience.

@cormullion
Copy link
Member

cormullion commented May 1, 2017

Yes this area is interesting, and difficult, because of the OS. On my Mac, SVGs always open in a web browser. I don't really know why. I know I can tell my Mac to open certain files in certain apps, (using Finder/GetInfo) but I don't know how much a Julia program can do to override this process.

I'll investigate it in the next few days and see what happens...

@ftxi
Copy link
Author

ftxi commented May 1, 2017

Actually, I would prefer to store the output image inside the notebook. Is this also difficult?

@cormullion
Copy link
Member

I'll look into it.

@cormullion
Copy link
Member

SVGs are mostly loading in the notebook now:

screen shot 2017-05-02 at 19 01 43

There's a slight problem in Jupyter if you send too much data all at once - I suppose SVGs by their nature can be very bulky, compared with PNGs. That issue is at JuliaLang/IJulia.jl#534...

I'll test and upload this later today.

@cormullion
Copy link
Member

Looks like the speed limit problem in IJulia has been fixed in master, which will get into a release before long.

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

No branches or pull requests

2 participants