Skip to content

Commit

Permalink
docs / examples
Browse files Browse the repository at this point in the history
also added some types
  • Loading branch information
time4tea committed Feb 10, 2024
1 parent 5072dbb commit 9403c5f
Show file tree
Hide file tree
Showing 104 changed files with 281 additions and 69 deletions.
1 change: 1 addition & 0 deletions build-scripts/examples/05-moving-map.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Moving Map

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-cairo-gauge-arc-annotated.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Cairo Gauge Arc Annotated

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-cairo-gauge-donut.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Cairo Gauge Donut

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-cairo-gauge-marker.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Cairo Gauge Marker

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-cairo-gauge-round-annotated.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Cairo Gauge Round Annotated

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-journey-map.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Journey Map

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/06-moving-journey-map.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(384,384) -->

# Moving Journey Map

Expand Down
5 changes: 2 additions & 3 deletions build-scripts/examples/07-air-speed-indicator.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<!-- Dimension(256,256) -->

# Air Speed Indicator

** Experimental **

The Air Speed Indicator component draws an air speed indicator.

The best speed indicator that exists at the moment is `speed`, but this does represent
the SOG or Groundspeed, not airspeed, but it might be OK for a video overlay.
the SOG or Ground speed, not airspeed, but it might be OK for a video overlay.

{{ <component type="asi" vs0="10" /> }}

Expand Down
2 changes: 1 addition & 1 deletion build-scripts/examples/07-bar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

<!-- Dimension(500,150) -->
# Bar

Draws a very simple horizontal bar with current metric value
Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/07-chart.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,128) -->

# Chart

Expand Down
69 changes: 69 additions & 0 deletions build-scripts/examples/07-motor-speed-indicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

# Motor Speed Indicator

The Motor Speed Indicator component draws a circular speed indicator


{{ <component type="msi" end="100" /> }}



# Sections

The following sections can be set

| Attribute | Description |
|-----------|--------------------|
| green | Green Section Max |
| yellow | Yellow Section Max |
| end | End of Dial |


{{ <component type="msi" green="30" yellow="60" end="100" /> }}


# Metrics & Conversions

The MSI defaults to speed in knots, but like a text metric, can access any available information, and convert it to
other units

{{ <component type="msi" units="mph" end="100" /> }}

{{ <component type="msi" metric="alt" units="feet" /> }}

# Size

The component can be sized - sizes that are too small or big might not render quite right

{{ <component type="msi" size="128" /> }}

# Rotation

Can rotate the entire gauge clockwise using `rotate`

{{ <component type="msi" rotate="45" /> }}
{{ <component type="msi" rotate="90" /> }}
{{ <component type="msi" rotate="180" /> }}


# Needle or no needle

The MSI component has a needle-less form which has a different style

{{ <component type="msi" needle="no" rotate="45" /> }}

# Variant

The MSI component has a variant "msi2", which doesn't have a needle, it has the same other attributes
`green`, `yellow`, `end`

{{ <component type="msi2" /> }}



# Font

The text font can be changed in size

{{ <component type="msi" textsize="24" /> }}

2 changes: 2 additions & 0 deletions build-scripts/examples/07-zone-bar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Dimension(500,100) -->

# Zone Bar

Draws a simple horizontal bar with current metric value, with 4 zones - so suitable for
Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/08-translate.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Translate

Expand Down
1 change: 1 addition & 0 deletions build-scripts/examples/09-frame.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Dimension(256,256) -->

# Frame

Expand Down
29 changes: 7 additions & 22 deletions build-scripts/generate-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,6 @@ def alphanum_key(s):
return [tryint(c) for c in re.split(r'([0-9]+)', s)]


dimensions_by_file = {
"07-bar.md": Dimension(500, 150),
"07-zone-bar.md": Dimension(500, 100),
"05-moving-map.md": Dimension(256, 256),
"06-journey-map.md": Dimension(256, 256),
"06-cairo-gauge-marker.md": Dimension(256, 256),
"06-cairo-gauge-round-annotated.md": Dimension(256, 256),
"06-cairo-gauge-arc-annotated.md": Dimension(256, 256),
"06-cairo-gauge-donut.md": Dimension(256, 256),
"06-moving-journey-map.md": Dimension(384, 384),
"07-air-speed-indicator.md": Dimension(256, 256),
"07-chart.md": Dimension(256, 128),
"08-translate.md": Dimension(256, 256),
"09-frame.md": Dimension(256, 256),
}


def dimensions_for(filepath: str) -> Dimension:
return dimensions_by_file.get(os.path.basename(filepath), Dimension(200, 100))


AUTO_HEADER = "<!-- \n\nAuto Generated File DO NOT EDIT \n\n-->\n"

if __name__ == "__main__":
Expand Down Expand Up @@ -88,6 +67,12 @@ def dimensions_for(filepath: str) -> Dimension:

example_dest = os.path.join(dest, basename.stem)

dimensions_match = re.search(r"Dimension\((\d+),(\d+)\)", example_markdown)
if dimensions_match is None:
dimensions = Dimension(200, 100)
else:
dimensions = Dimension(int(dimensions_match.group(1)), int(dimensions_match.group(2)))

while True:
match = re.search(r"{{(.+?)}}", example_markdown, re.MULTILINE | re.DOTALL)
if match is None:
Expand Down Expand Up @@ -116,7 +101,7 @@ def dimensions_for(filepath: str) -> Dimension:
)

overlay = Overlay(framemeta=timeseries, create_widgets=layout)
supplier = SimpleFrameSupplier(dimensions_for(filepath), background=(0,0,0,255))
supplier = SimpleFrameSupplier(dimensions, background=(0,0,0,255))
image = overlay.draw(timeseries.mid, supplier.drawing_frame())

os.makedirs(example_dest, exist_ok=True)
Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/05-moving-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Moving Map

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/xml/examples/06-cairo-gauge-arc-annotated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Cairo Gauge Arc Annotated

Expand Down
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-11.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-12.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-13.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-14.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-15.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-16.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-19.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-2.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-20.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-21.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-22.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-3.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-4.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-5.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-6.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-7.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-8.png
Binary file modified docs/xml/examples/06-cairo-gauge-donut/06-cairo-gauge-donut-9.png
1 change: 1 addition & 0 deletions docs/xml/examples/06-cairo-gauge-donut/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Cairo Gauge Donut

Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/06-cairo-gauge-marker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Cairo Gauge Marker

Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/06-cairo-gauge-round-annotated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Cairo Gauge Round Annotated

Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/06-journey-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Journey Map

Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/06-moving-journey-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(384,384) -->

# Moving Journey Map

Expand Down
5 changes: 2 additions & 3 deletions docs/xml/examples/07-air-speed-indicator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,256) -->

# Air Speed Indicator

** Experimental **

The Air Speed Indicator component draws an air speed indicator.

The best speed indicator that exists at the moment is `speed`, but this does represent
the SOG or Groundspeed, not airspeed, but it might be OK for a video overlay.
the SOG or Ground speed, not airspeed, but it might be OK for a video overlay.


```xml
Expand Down
2 changes: 1 addition & 1 deletion docs/xml/examples/07-bar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Auto Generated File DO NOT EDIT
-->

<!-- Dimension(500,150) -->
# Bar

Draws a very simple horizontal bar with current metric value
Expand Down
1 change: 1 addition & 0 deletions docs/xml/examples/07-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Auto Generated File DO NOT EDIT
-->
<!-- Dimension(256,128) -->

# Chart

Expand Down
Loading

0 comments on commit 9403c5f

Please sign in to comment.