-
Notifications
You must be signed in to change notification settings - Fork 50
sphinx gallery #509
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
sphinx gallery #509
Conversation
Can now force offscreen rendering, so the gallery is being generated. Current issue is figuring out how to format the |
@clewis7 remove the "nbsphinx", it seems to create some conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this solves the refs not being generated
@kushalkolar Like Edo said, in order to use |
That's ok, specific examples are more important. |
This is great 😄 ! Some things: Can you pre-download the images in Also need to figure out how to properly set the canvas size so that when the screenshots are taken we don't have that huge blank space. Can you check how we can have animated examples, like pygfx: https://pygfx.com/stable/_gallery/introductory/cube.html#sphx-glr-gallery-introductory-cube-py We can show some of the animations from quickstart, and I guess if you tag it with "test_examples = false" it will generate sphinx gallery docs with that example but not use it for the test suite? Since we don't want animation examples to run with screenshot tests (at least not yet, maybe later 😄 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More:
For each example, specify that the if __name__ == "__main__"
is NOT how it's supposed to be done for interactive use. We should make a doc page on interactive use in ipython
and jupyter
using this: https://wgpu-py.readthedocs.io/en/stable/gui.html#using-wgpu-interactively
Users should never call fpl.run()
for interactive use.
@@ -22,6 +23,9 @@ | ||
fig[1, 0].add_image(data=im3) | ||
fig[1, 1].add_image(data=im4) | ||
|
||
# set canvas variable for sphinx_gallery to properly generate examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specifiy that this line isn't required for users, or see if there's a way for the pygfx
scraper to look for fig.canvas
instead of canvas
?
in all examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think perhaps we can use figure
instead...
pygfx
scraper looks for one of ["renderer", "canvas"]
to be defined, but will also look through proxy objects such as "figure", "display", "disp", "plot"
So I will try that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried changing fig
to figure
so then the scraper would look for figure.canvas
...but then writing the thumbnails failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now, we should just to canvas = fig.canvas
and have a note saying that it is not required for users and after FENS I can look into fixing them
NOTE: |
TODO:
|
After this I propose:
|
This sounds good to me, and doable before FENS |
A few event examples too, click event that changes colors of closest circle, and another example where changing a feature prints the event attributes and event.info. |
I added a simple event example but I am going to hold off adding any more examples until we merge this with graphic features PR |
@kushalkolar merged main and updated...should be ready for review :D |
figure.canvas.set_logical_size(700, 560) | ||
|
||
# NOTE: `if __name__ == "__main__"` is NOT how to use fastplotlib interactively | ||
# please see our docs for using fastplotlib interactively in ipython and jupyter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make a section, perhaps in the guide, on using fpl interactively in jupyter lab and ipython, the wgpu docs might provide some inspiration: https://wgpu-py.readthedocs.io/en/stable/gui.html#using-wgpu-interactively
but basically, there is %gui qt
and in jupyterlab or ipython they can also do fig = fpl.Figure(canvas="glfw")
to use glfw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example seems like it's missing from the gallery 🤔 https://github.com/fastplotlib/fastplotlib/blob/main/examples/desktop/line_collection/line_stack_3d.py |
ahhh, wasn't rendering properly because of the canvas size I found that the canvas size needs to be |
yayyyy! @kushalkolar |
Co-authored-by: Kushal Kolar <kushalkolar@gmail.com>
start #486 for hopefully the last time :)
According to @almarklein, should just be able to directly use
pygfx image scraper
Initially, I am just trying to get it to work with one set of the desktop examples.
Current issues:
os.environ
keys, should have maybe been fixed by Improvements to GUI selection and Qt support #431gflw WgpuCanvas
, thepygfx
scraper is looking for thecanvas
orrenderer
and then attempting to callcanvas.draw()
but the desired method iscanvas.draw_frame()
pygfx
scraper to use the correct draw method, an issue arises with trying to write a frame:@kushalkolar @almarklein thoughts?