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

Easy Widgets for Pluto #8

Open
TheCedarPrince opened this issue Jan 18, 2022 · 5 comments
Open

Easy Widgets for Pluto #8

TheCedarPrince opened this issue Jan 18, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@TheCedarPrince
Copy link
Member

Is your feature request related to a problem? Please explain.

Not really a problem so much as a cool piece of inspiration from work done by @leephillips in his great blog on Ptolemy's Universe.
What I think is worth a discussion is about how to maybe define helpful auxiliary tools in JavisNB tailored specifically to notebooks such as Pluto and Jupyter.

Describe the solution you'd like

I really loved the layout Lee made here:

image

I would love it if we can provide specific sorts of toggles and buttons for JavisNB users to automatically add in their sliders.
@leephillips - in your experience, was there much difficulty with making these sliders and widgets in Pluto?

Describe alternatives you've considered

Letting a user define their own widgets and bindings can be useful, but it may be better to make some convenience notebook widgets available.
I do not know if that would be great - what do you think @gpucce ?

Additional context

N/A

@TheCedarPrince TheCedarPrince added the enhancement New feature or request label Jan 18, 2022
@leephillips
Copy link

leephillips commented Jan 18, 2022

I’m glad you like what I did; it was fun making it. Looks like JavisNB is a new project; I glanced through the source but I would love some documentation soon! Because I want to make more of these.

Making the sliders and widgets was easy because I used PlutoUI.jl, which wraps the HTML inputs in Julia functions, and has a function for making groups of controls; the bound variable becomes a tuple. I really just copied an example from the documentation. An essential ingredient is HypertextLiteral.jl, which allows you to interpolate variables into an HTML object, and does context-aware escaping. The rest is just HTML and CSS.

The only glitch was that Javis, as you know, can’t be installed on a headless server, and the branch that addresses that (JuliaAnimators/Javis.jl#298) is too old. So I just used xvfb, which I’ve used in other projects.

You can get the notebook source at https://lee-phillips.org/plutoNotebooks/epicycles.jl

@TheCedarPrince
Copy link
Member Author

Hey @leephillips !
Thanks for the quick reply here!

Yes, JavisNB is a new member of the JuliaAnimators ecosystem mostly overseen by @gpucce !
It's whole purpose is to manage Javis and notebook interaction more easily and to enable more folks to join in to add support specifically for working with notebooks.
The documentation is here and will continue to be improved. :)
Currently, by adding JavisNB into the ecosystem, to use Javis effectively in notebooks, one must also use JavisNB after we release Javis v0.8.0 (we will make sure to include migration notes on how to deal with this if anyone was dependent on Javis + notebooks).
Frankly, if you have any thoughts about using Javis with notebooks, if you are willing, we would love to hear your thoughts!

Thanks for letting me know again about that headless server issue.
I am currently in the process of migrating GTK and other dependencies out of core Javis into a separate viewer package.
By doing that, we will be one step closer to solving that issue.
We are in the process of restructuring Javis in the JuliaAnimators ecosystem so hopefully things will become much more digestible and simpler to work with. :)

I read through the source code - wow!
That was much more straightforward than I was expecting - super impressive!
Any thoughts on it @gpucce ?

@gpucce
Copy link
Member

gpucce commented Jan 18, 2022

Hi @TheCedarPrince and @leephillips.

I think since PlutoUI is so well made and easy to use instead of adding widgets it is best to add examples at least for now, similar to the amazing notebook from @leephillips.

Indeed, adding something done with PlutoSliderServer to the documentation could be the next thing to do!

@leephillips
Copy link

My first thought is that this makes sense. Note in particular that my notebook uses only a couple of the ready-made controls from PlutoUI; the layout details are done with HTML/CSS. But this just scratches the surface. Fons’ notebook at https://plutocon2021-demos.netlify.app/fonsp%20%E2%80%94%20javascript%20inside%20pluto shows how you can use JavaScript to do more. He has a video based on the notebook here: https://www.youtube.com/watch?v=SAC_RCjyRRs

After looking at the notes for JavisNB I was wondering what is different with the embed() function, as we can already embed the animation on the page with render(liveview=false).

@gpucce
Copy link
Member

gpucce commented Jan 18, 2022

Hi @leephillips the idea is to remove that functionality from Javis itself in its next release. This goes together with other satellite pacakages that will be added to JuliaAnimators to work together with Javis to make the core package lighter. And to add features for specific use cases in these separate packages.

I think the next one could be JavisLiveViewer or smth similar that might resolve the issue of working on headless servers, since right now I think Gtk is the issure there.

For the widgets I know very little html, CSS or javascript myself so it makes sense that I can't really figure out all the things that can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants