GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — clean, docs, docs CI test etc. (#275) · fastplotlib/fastplotlib@1729a0d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • ci.yml
  • .readthedocs.yaml
  • docs/source/api
    • graphics
      • HistogramGraphic.rst
      • index.rst
    • layouts
      • gridplot.rst
      • plot.rst
      • subplot.rst
  • fastplotlib
    • graphics
      • __init__.py
      • _base.py
      • _features
        • _base.py
        • _selection_features.py
      • image.py
      • line.py
      • line_collection.py
      • scatter.py
      • selectors
        • _base_selector.py
    • layouts
      • _base.py
      • _gridplot.py
      • _plot.py
      • _subplot.py
      • graphic_methods_mixin.py
    • utils
      • generate_add_methods.py
    • widgets
      • image.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/ci.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+32-1Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,37 @@ on:
1515

1616
jobs:
1717

18+
docs-build:
19+
name: Docs
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python 3.9
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: 3.9
29+
- name: Install llvmpipe and lavapipe for offscreen canvas, and git lfs
30+
run: |
31+
sudo apt-get update -y -qq
32+
sudo apt-get install --no-install-recommends -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers git-lfs
33+
- name: Install pandoc v3.14, nbsphinx complains about older pandoc versions
34+
run: |
35+
wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-1-amd64.deb
36+
sudo apt-get install ./pandoc-3.1.4-1-amd64.deb
37+
- name: Install dev dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
# remove pygfx from requirements, we install a specific commit of pygfx since both fpl and pygfx are fast evolving
41+
sed -i "/pygfx/d" ./setup.py
42+
pip install git+https://github.com/pygfx/pygfx.git@cf1da6c32223ba3cf7256982ce9b89c81b593076
43+
pip install -e ".[notebook,docs,tests]"
44+
- name: Build docs
45+
run: |
46+
cd docs
47+
make html SPHINXOPTS="-W --keep-going"
48+
1849
test-build:
1950
name: Test examples
2051
runs-on: ubuntu-latest
@@ -47,7 +78,7 @@ jobs:
4778
python -m pip install --upgrade pip
4879
# remove pygfx from requirements, we install a specific commit of pygfx since both fpl and pygfx are fast evolving
4980
sed -i "/pygfx/d" ./setup.py
50-
pip install git+https://github.com/pygfx/pygfx.git@b63f22a1aa61993c32cd96895316cb8248a81e4d
81+
pip install git+https://github.com/pygfx/pygfx.git@cf1da6c32223ba3cf7256982ce9b89c81b593076
5182
pip install -e ".["tests"]"
5283
- name: Show wgpu backend
5384
run:
Collapse file

‎.readthedocs.yaml‎

Copy file name to clipboardExpand all lines: .readthedocs.yaml
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ build:
1010
- libxcb-xfixes0-dev
1111
- mesa-vulkan-drivers
1212
- libglfw3
13-
- pandoc
1413
jobs:
1514
post_checkout:
1615
# Download and uncompress the binary
@@ -27,6 +26,9 @@ build:
2726
- ./git-lfs fetch
2827
# Make local files to have the real content on them
2928
- ./git-lfs checkout
29+
# install newer pandoc else nbsphinx complains
30+
- wget https://github.com/jgm/pandoc/releases/download/3.1.4/pandoc-3.1.4-1-amd64.deb
31+
- sudo apt-get install ./pandoc-3.1.4-1-amd64.deb
3032
pre_install:
3133
- pip install git+https://github.com/pygfx/pygfx.git@main
3234

Collapse file

‎docs/source/api/graphics/HistogramGraphic.rst‎

Copy file name to clipboardExpand all lines: docs/source/api/graphics/HistogramGraphic.rst
-36Lines changed: 0 additions & 36 deletions
This file was deleted.
Collapse file

‎docs/source/api/graphics/index.rst‎

Copy file name to clipboardExpand all lines: docs/source/api/graphics/index.rst
-1Lines changed: 0 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Graphics
77
ImageGraphic
88
ScatterGraphic
99
LineGraphic
10-
HistogramGraphic
1110
HeatmapGraphic
1211
LineCollection
1312
LineStack
Collapse file

‎docs/source/api/layouts/gridplot.rst‎

Copy file name to clipboardExpand all lines: docs/source/api/layouts/gridplot.rst
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Properties
2020
.. autosummary::
2121
:toctree: GridPlot_api
2222

23+
GridPlot.canvas
24+
GridPlot.renderer
2325

2426
Methods
2527
~~~~~~~
Collapse file

‎docs/source/api/layouts/plot.rst‎

Copy file name to clipboardExpand all lines: docs/source/api/layouts/plot.rst
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Properties
2323
Plot.camera
2424
Plot.canvas
2525
Plot.controller
26+
Plot.docks
2627
Plot.graphics
2728
Plot.name
2829
Plot.parent
@@ -40,7 +41,6 @@ Methods
4041
Plot.add_animations
4142
Plot.add_graphic
4243
Plot.add_heatmap
43-
Plot.add_histogram
4444
Plot.add_image
4545
Plot.add_line
4646
Plot.add_line_collection
Collapse file

‎docs/source/api/layouts/subplot.rst‎

Copy file name to clipboardExpand all lines: docs/source/api/layouts/subplot.rst
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Properties
2323
Subplot.camera
2424
Subplot.canvas
2525
Subplot.controller
26+
Subplot.docks
2627
Subplot.graphics
2728
Subplot.name
2829
Subplot.parent
@@ -40,7 +41,6 @@ Methods
4041
Subplot.add_animations
4142
Subplot.add_graphic
4243
Subplot.add_heatmap
43-
Subplot.add_histogram
4444
Subplot.add_image
4545
Subplot.add_line
4646
Subplot.add_line_collection
Collapse file

‎fastplotlib/graphics/__init__.py‎

Copy file name to clipboardExpand all lines: fastplotlib/graphics/__init__.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from .histogram import HistogramGraphic
21
from .line import LineGraphic
32
from .scatter import ScatterGraphic
43
from .image import ImageGraphic, HeatmapGraphic
@@ -9,7 +8,6 @@
98
"ImageGraphic",
109
"ScatterGraphic",
1110
"LineGraphic",
12-
"HistogramGraphic",
1311
"HeatmapGraphic",
1412
"LineCollection",
1513
"LineStack",
Collapse file

‎fastplotlib/graphics/_base.py‎

Copy file name to clipboardExpand all lines: fastplotlib/graphics/_base.py
+33-6Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,30 @@ def __init__(
7575
@property
7676
def world_object(self) -> WorldObject:
7777
"""Associated pygfx WorldObject. Always returns a proxy, real object cannot be accessed directly."""
78+
# We use weakref to simplify garbage collection
7879
return weakref.proxy(WORLD_OBJECTS[hex(id(self))])
7980

8081
def _set_world_object(self, wo: WorldObject):
8182
WORLD_OBJECTS[hex(id(self))] = wo
8283

8384
@property
8485
def position(self) -> np.ndarray:
85-
"""The position of the graphic. You can access or change
86-
using position.x, position.y, etc."""
86+
"""position of the graphic, [x, y, z]"""
8787
return self.world_object.world.position
8888

8989
@property
9090
def position_x(self) -> float:
91+
"""x-axis position of the graphic"""
9192
return self.world_object.world.x
9293

9394
@property
9495
def position_y(self) -> float:
96+
"""y-axis position of the graphic"""
9597
return self.world_object.world.y
9698

9799
@property
98100
def position_z(self) -> float:
101+
"""z-axis position of the graphic"""
99102
return self.world_object.world.z
100103

101104
@position.setter
@@ -390,7 +393,19 @@ def graphics(self) -> np.ndarray[Graphic]:
390393
return self._graphics_array
391394

392395
def add_graphic(self, graphic: Graphic, reset_index: False):
393-
"""Add a graphic to the collection"""
396+
"""
397+
Add a graphic to the collection.
398+
399+
Parameters
400+
----------
401+
graphic: Graphic
402+
graphic to add, must be a real ``Graphic`` not a proxy
403+
404+
reset_index: bool, default ``False``
405+
reset the collection index
406+
407+
"""
408+
394409
if not type(graphic).__name__ == self.child_type:
395410
raise TypeError(
396411
f"Can only add graphics of the same type to a collection, "
@@ -413,7 +428,19 @@ def add_graphic(self, graphic: Graphic, reset_index: False):
413428
self._graphics_changed = True
414429

415430
def remove_graphic(self, graphic: Graphic, reset_index: True):
416-
"""Remove a graphic from the collection"""
431+
"""
432+
Remove a graphic from the collection.
433+
434+
Parameters
435+
----------
436+
graphic: Graphic
437+
graphic to remove
438+
439+
reset_index: bool, default ``False``
440+
reset the collection index
441+
442+
"""
443+
417444
self._graphics.remove(graphic.loc)
418445

419446
if reset_index:
@@ -486,8 +513,8 @@ def __init__(
486513
setattr(self, attr_name, collection_feature)
487514

488515
@property
489-
def graphics(self) -> Tuple[Graphic]:
490-
"""Returns a tuple of the selected graphics."""
516+
def graphics(self) -> np.ndarray[Graphic]:
517+
"""Returns an array of the selected graphics. Always returns a proxy to the Graphic"""
491518
return tuple(self._selection)
492519

493520
def __setattr__(self, key, value):
Collapse file

‎fastplotlib/graphics/_features/_base.py‎

Copy file name to clipboardExpand all lines: fastplotlib/graphics/_features/_base.py
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FeatureEvent:
4949
----------
5050
type: str, example "colors"
5151
52-
pick_info: dict in the form:
52+
pick_info: dict:
5353
5454
============== =============================================================================
5555
key value
@@ -59,6 +59,9 @@ class FeatureEvent:
5959
"new_data: the new data for this feature
6060
============== =============================================================================
6161
62+
.. note::
63+
pick info varies between features, this is just the general structure
64+
6265
"""
6366

6467
def __init__(self, type: str, pick_info: dict):
@@ -97,8 +100,17 @@ def __init__(self, parent, data: Any, collection_index: int = None):
97100
def __call__(self, *args, **kwargs):
98101
return self._data
99102

100-
def block_events(self, b: bool):
101-
self._block_events = b
103+
def block_events(self, val: bool):
104+
"""
105+
Block all events from this feature
106+
107+
Parameters
108+
----------
109+
val: bool
110+
``True`` or ``False``
111+
112+
"""
113+
self._block_events = val
102114

103115
@abstractmethod
104116
def _set(self, value):
@@ -113,9 +125,10 @@ def _parse_set_value(self, value):
113125
def add_event_handler(self, handler: callable):
114126
"""
115127
Add an event handler. All added event handlers are called when this feature changes.
116-
The `handler` can optionally accept ``FeatureEvent`` as the first and only argument.
128+
The ``handler`` can optionally accept a :class:`.FeatureEvent` as the first and only argument.
117129
The ``FeatureEvent`` only has two attributes, ``type`` which denotes the type of event
118-
as a ``str`` in the form of "<feature_name>", such as "color".
130+
as a ``str`` in the form of "<feature_name>", such as "color". And ``pick_info`` which contains
131+
information about the event and Graphic that triggered it.
119132
120133
Parameters
121134
----------
@@ -134,7 +147,7 @@ def add_event_handler(self, handler: callable):
134147

135148
def remove_event_handler(self, handler: callable):
136149
"""
137-
Remove a registered event handler
150+
Remove a registered event ``handler``.
138151
139152
Parameters
140153
----------
@@ -148,6 +161,7 @@ def remove_event_handler(self, handler: callable):
148161
self._event_handlers.remove(handler)
149162

150163
def clear_event_handlers(self):
164+
"""Clear all event handlers"""
151165
self._event_handlers.clear()
152166

153167
# TODO: maybe this can be implemented right here in the base class

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.