Skip to content

Commit e4e4869

Browse files
authored
Add simple gallery (#22)
1 parent 8ae174f commit e4e4869

20 files changed

+74
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Special for this repo
22
nogit/
3+
docs/gallery/
4+
docs/sg_execution_times.rst
35

46
# Byte-compiled / optimized / DLL files
57
__pycache__/

docs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ BUILDDIR = _build
1212
help:
1313
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

15+
clean :
16+
-rm -r _build
17+
-rm -r gallery
18+
1519
.PHONY: help Makefile
1620

1721
# Catch-all target: route all unknown targets to Sphinx using the new

docs/conf.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"sphinx.ext.napoleon",
4545
"sphinx.ext.intersphinx",
4646
"sphinx_rtd_theme",
47+
"sphinx_gallery.gen_gallery",
4748
]
4849

4950
intersphinx_mapping = {
@@ -63,6 +64,22 @@
6364
master_doc = "index"
6465

6566

67+
# -- Sphinx Gallery -----------------------------------------------------
68+
69+
# Suppress "cannot cache unpickable configuration value" for sphinx_gallery_conf
70+
# See https://github.com/sphinx-doc/sphinx/issues/12300
71+
suppress_warnings = ["config.cache"]
72+
73+
# The gallery conf. See https://sphinx-gallery.github.io/stable/configuration.html
74+
sphinx_gallery_conf = {
75+
"gallery_dirs": "gallery",
76+
"backreferences_dir": "gallery/backreferences",
77+
"doc_module": ("rendercanvas",),
78+
# "image_scrapers": (),,
79+
"remove_config_comments": True,
80+
"examples_dirs": "../examples/",
81+
}
82+
6683
# -- Options for HTML output -------------------------------------------------
6784

6885
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -73,4 +90,5 @@
7390
# Add any paths that contain custom static files (such as style sheets) here,
7491
# relative to this directory. They are copied after the builtin static files,
7592
# so a file named "default.css" will overwrite the builtin "default.css".
76-
html_static_path = []
93+
html_static_path = ["static"]
94+
html_css_files = ["custom.css"]

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Welcome to the rendercanvas docs!
1111
api
1212
backends
1313
utils
14+
Gallery <gallery/index.rst>
1415
advanced
1516

1617

docs/static/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
div.sphx-glr-download,
2+
div.sphx-glr-download-link-note {
3+
display: none;
4+
}

examples/README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
RenderCanvas examples
2+
=====================

examples/cube_auto.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Cube auto
3+
---------
4+
25
Run a wgpu example on an automatically selected backend.
36
"""
47

examples/cube_glfw.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Cube glfw
3+
---------
4+
25
Run a wgpu example on the glfw backend.
36
"""
47

examples/cube_offscreen.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Cube offscreen
3+
--------------
4+
25
Render a wgpu example offscreen, and display as an image.
36
"""
47

examples/cube_qt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Cube qt
3+
-------
4+
25
Run a wgpu example on the Qt backend.
36
47
Works with either PySide6, PyQt6, PyQt5 or PySide2.

examples/cube_wx.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Cube wx
3+
-------
4+
25
Run a wgpu example on the wx backend.
36
"""
47

examples/demo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Demo
3+
----
4+
25
An example that uses events to trigger some canvas functionality.
36
47
A nice demo, and very convenient to test the different backends.

examples/events.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Events
3+
------
4+
25
A simple example to demonstrate events.
36
"""
47

examples/multiple.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Multiple
3+
--------
4+
25
Run cube example in two canvases.
36
"""
47

examples/noise.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Noise
3+
-----
4+
25
Simple example that uses the bitmap-context to show images of noise.
36
"""
47

examples/offsceen_threaded.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Offscreen threaded
3+
------------------
4+
25
Example that renders frames in a separate thread.
36
47
This uses an offscreen canvas, the result is only used to print the

examples/qt_app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Qt app
3+
------
4+
25
An example demonstrating a qt app with a wgpu viz inside.
36
If needed, change the PySide6 import to e.g. PyQt6, PyQt5, or PySide2.
47

examples/qt_app_asyncio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Qt app with asyncio
3+
-------------------
4+
25
An example demonstrating a qt app with a wgpu viz inside.
36
47
This is the same as the ``qt_app.py`` example, except this uses

examples/snake.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
Snake game
3+
----------
4+
25
Simple snake game based on bitmap rendering. Work in progress.
36
"""
47

examples/wx_app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""
2+
wx app
3+
------
4+
25
An example demonstrating a wx app with a wgpu viz inside.
36
"""
47

0 commit comments

Comments
 (0)