Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/images/screenshots/de/capture.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 added docs/images/screenshots/de/dashboard-status.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/images/screenshots/de/dashboard.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/images/screenshots/de/export-logs.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/images/screenshots/de/export.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/images/screenshots/de/measurements-node-cooling.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/images/screenshots/de/measurements-node-core.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/images/screenshots/de/measurements-node-cpu.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/images/screenshots/de/measurements-node-disk.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/images/screenshots/de/measurements-node-gpu.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/images/screenshots/de/measurements-node-net.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/images/screenshots/de/measurements-node-ram.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/images/screenshots/de/measurements-rung.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/images/screenshots/de/measurements.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/images/screenshots/en/capture.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 added docs/images/screenshots/en/dashboard-status.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/images/screenshots/en/dashboard.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/images/screenshots/en/export-logs.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/images/screenshots/en/export.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/images/screenshots/en/measurements-node-cooling.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/images/screenshots/en/measurements-node-core.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/images/screenshots/en/measurements-node-cpu.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/images/screenshots/en/measurements-node-disk.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/images/screenshots/en/measurements-node-gpu.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/images/screenshots/en/measurements-node-net.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/images/screenshots/en/measurements-node-ram.png
Binary file modified docs/images/screenshots/en/measurements-rung.png
Binary file modified docs/images/screenshots/en/measurements.png
41 changes: 38 additions & 3 deletions tools/screenshots.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,20 @@ $pages = [ordered]@{
# ids of the cards and do not change with the language — unlike their height,
# which is why their position is measured rather than written down here.
$boxes = @{
# The dashboard names only its first card. The list is "the cards to save,
# from the top" rather than "every card on the page" — the hardware panels
# below it are long, machine-specific and already covered by the full-page
# shot, while the status card is the one a page wants to show on its own.
"dashboard" = @("status")

"export" = @("mqtt", "ha", "recorder", "data", "influx", "app", "logs")
"measurements" = @("rung", "node-core", "node-gpu", "node-cpu", "node-ram", "node-disk", "node-net", "node-cooling")
}

# Pages whose FIRST card is saved together with everything above it. Everything
# else is cut to the card alone.
$withHeader = @("dashboard")

function Invoke-UI([string]$path, [string]$body) {
$uri = [Uri]"$BaseUrl$path"
$client = New-Object System.Net.Sockets.TcpClient($uri.Host, $uri.Port)
Expand Down Expand Up @@ -139,6 +149,20 @@ function Save-Crop([System.Drawing.Bitmap]$bmp, [int]$top, [int]$cardHeight, [st
$crop.Dispose()
}

# Save-TopCrop keeps everything above the card as well: the logo, the version,
# the navigation and the language switch, at the full width of the page.
#
# A card lifted out on its own says nothing about where it lives. For the first
# card of a page that is exactly the information the picture is for — the reader
# has to see which of the four pages they are being shown.
function Save-TopCrop([System.Drawing.Bitmap]$bmp, [int]$bottom, [string]$file) {
$h = [Math]::Min($bmp.Height, $bottom + 12)
$rect = New-Object System.Drawing.Rectangle 0, 0, $bmp.Width, $h
$crop = $bmp.Clone($rect, $bmp.PixelFormat)
$crop.Save($file, [System.Drawing.Imaging.ImageFormat]::Png)
$crop.Dispose()
}

# ------------------------------------------------------------------- run ----

$outDir = Join-Path (Resolve-Path $OutRoot) $Lang
Expand All @@ -163,11 +187,22 @@ try {
if ($boxes.ContainsKey($name)) {
$bands = Get-CardBands $bmp
$ids = $boxes[$name]
if ($bands.Count -ne $ids.Count) {
Write-Warning "$name : found $($bands.Count) cards, expected $($ids.Count) — check the mapping"
# Fewer cards than names is a fault: a card the page should have is
# missing, or the detection lost one. More is not — a page may
# deliberately name only its first few, as the dashboard does.
if ($bands.Count -lt $ids.Count) {
Write-Warning "$name : found $($bands.Count) cards, expected at least $($ids.Count) — check the mapping"
}
for ($i = 0; $i -lt [Math]::Min($bands.Count, $ids.Count); $i++) {
Save-Crop $bmp $bands[$i].Top $bands[$i].Height (Join-Path $outDir "$name-$($ids[$i]).png")
# NOT $file: the page's own path is already in $file, and the
# trim below writes to it. Overwriting it here put the trimmed
# full page into the card's file and left the page untrimmed.
$cardFile = Join-Path $outDir "$name-$($ids[$i]).png"
if ($i -eq 0 -and $withHeader -contains $name) {
Save-TopCrop $bmp ($bands[$i].Top + $bands[$i].Height) $cardFile
} else {
Save-Crop $bmp $bands[$i].Top $bands[$i].Height $cardFile
}
}
"{0,-16} {1} cards" -f $name, $bands.Count
}
Expand Down
Loading