From a777620d2f15543b37d2a3b913f1036fade3859f Mon Sep 17 00:00:00 2001 From: Jumper78 <52802286+Jumper78@users.noreply.github.com> Date: Tue, 13 Jul 2021 21:07:30 +0200 Subject: [PATCH] Add British flags to the Flag effect (#1264) * add britisch flags to flag.py adding the flags of England, Scotland and the United Kingdom to flag.py * adding British flags to flag.schema.json adding the flag of Great Britain (gb), England (gb-eng) and Scotland (gb-sct) to the GUI * added flag updates to CHANGELOG.md mentioning the Britisch flags as well as Cameroon and Russia --- CHANGELOG.md | 1 + effects/flag.py | 26 ++++++++++++++++++++++++++ effects/schema/flag.schema.json | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db71eb76..6b0f98e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - WLED: Support storing/restoring state, fixes #1101 - LED-Devices: Allow to get properties for Atmo and Karatedevices to limit LED numbers configurable - LED-Devices: Add timeouts for REST-API calls +- new Flags: Russia, Cameroon, Great Britain, England, Scotland ### Changed - Updated dependency rpi_ws281x to latest upstream diff --git a/effects/flag.py b/effects/flag.py index 7802b842..00eaca75 100644 --- a/effects/flag.py +++ b/effects/flag.py @@ -184,6 +184,32 @@ def printFlag(country): hyperion.imageSolidFill(0, int(iH*0.33), iW, int(iH*0.33), 0, 57, 166) hyperion.imageSolidFill(0, int(iH*0.66), iW, iH, 213, 43, 30) + # gb-eng flag (England) + if country == "gb-eng": + hyperion.imageSolidFill(255, 255, 255) + hyperion.imageDrawLine(0, int(iH*0.50), iW, int(iH*0.50), int(iW*0.10), 255, 0, 0) + hyperion.imageDrawLine(int(iW*0.50), 0, int(iW*0.50), iH, int(iW*0.10), 255, 0, 0) + + # gb-sct flag (Scotland) + if country == "gb-sct": + hyperion.imageSolidFill(0, 0, 255) + hyperion.imageDrawLine(0, 0, iW, iH, int(iW*0.15), 255, 255, 255) + hyperion.imageDrawLine(0, iH, iW, 0, int(iW*0.15), 255, 255, 255) + + # gb flag (United Kingdom) + if country == "gb": + hyperion.imageSolidFill(0, 0, 255) + hyperion.imageDrawLine(0, int(iH*0.50), iW, int(iH*0.50), int(iW*0.25), 255, 255, 255) + hyperion.imageDrawLine(int(iW*0.50), 0, int(iW*0.50), iH, int(iW*0.25), 255, 255, 255) + hyperion.imageDrawLine(0, 0, iW, iH, int(iH*0.25), 255, 255, 255) + hyperion.imageDrawLine(0, iH, iW, 0, int(iH*0.25), 255, 255, 255) + hyperion.imageDrawLine(0, int(iH*0.50), iW, int(iH*0.50), int(iW*0.15), 255, 0, 0) + hyperion.imageDrawLine(int(iW*0.50), 0, int(iW*0.50), iH, int(iW*0.15), 255, 0, 0) + hyperion.imageDrawLine(int(iW*0.95), 0, int(iW*0.475), int(iH*0.50), int(iH*0.10), 255, 0, 0) + hyperion.imageDrawLine(int(iW*0.05), iH, int(iW*0.525), int(iH*0.50), int(iH*0.10), 255, 0, 0) + hyperion.imageDrawLine(int(-iW*0.05), 0, int(iW*0.475), int(iH*0.50), int(iH*0.10), 255, 0, 0) + hyperion.imageDrawLine(int(iW*1.05), iH, int(iW*0.475), int(iH*0.50), int(iH*0.10), 255, 0, 0) + #prepare wanted flags for cf in countries: printFlag(cf) diff --git a/effects/schema/flag.schema.json b/effects/schema/flag.schema.json index 7a61df9d..ecf2b68c 100644 --- a/effects/schema/flag.schema.json +++ b/effects/schema/flag.schema.json @@ -10,7 +10,7 @@ "uniqueItems": true, "items": { "type": "string", - "enum": ["at","be","bg","ch","cmr","cz","de","dk","ee","es","fi","fr","gr","hu","ie","it","lt","lu","lv","mt","nl","pl","pt","ro","ru","se","sl"] + "enum": ["at","be","bg","ch","cmr","cz","de","dk","ee","es","fi","fr","gb","gb-eng","gb-sct","gr","hu","ie","it","lt","lu","lv","mt","nl","pl","pt","ro","ru","se","sl"] }, "propertyOrder" : 1 },