- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
Some checks are pending
Version release / version (push) Waiting to run
Reviewed-on: #1 |
||
| .github/workflows | ||
| tools | ||
| .gitignore | ||
| __init__.py | ||
| channel.py | ||
| dialog.py | ||
| paths.py | ||
| plugin.png | ||
| plugin.py | ||
| README.md | ||
| settings.py | ||
| theme.py | ||
| updater.py | ||
| VERSION | ||
| weather.py | ||
b4Default-FHD Skin App
Aplikacja konfiguracyjna skina b4Default-FHD dla Enigma2. Obsługuje zmianę
wyglądu, aktualizacje aplikacji i skina oraz wspólne źródła pogody dostępne
w skin.xml.
Dostawcy pogody
Źródło danych wybiera się w ustawieniach aplikacji w pozycji Źródło danych pogody:
Weather Plugin– klasyczny OE-Alliance Weather Plugin;OAWeather– dane i cache skonfigurowanej wtyczki OAWeather;OpenATV / MetrixWeather– konfiguracja pogody OpenATV;Auto– kolejno Weather Plugin, OAWeather i OpenATV / MetrixWeather.
Opcja Pogoda bezpośrednio w skinie musi być włączona. Po zmianie providera zalecany jest restart GUI Enigma2.
Źródła dostępne w skin.xml
Aplikacja rejestruje źródła sesji podczas uruchamiania Enigma2. W skinie należy
używać pełnej nazwy session.b4Weather....
| Źródło | Przykładowa wartość | Znaczenie |
|---|---|---|
session.b4WeatherCity |
Warszawa |
miejscowość |
session.b4WeatherTemp |
10°C |
temperatura aktualna |
session.b4WeatherFeelsLikeTemp |
7°C |
temperatura odczuwalna |
session.b4WeatherTempHigh |
12°C |
temperatura maksymalna na dziś |
session.b4WeatherTempLow |
5°C |
temperatura minimalna na dziś |
session.b4WeatherCondition |
Zachmurzenie |
opis warunków pogodowych |
session.b4WeatherWindCondition |
↗ NE 12 km/h |
kierunek i prędkość wiatru |
session.b4WeatherHumidity |
80% |
wilgotność |
session.b4WeatherPressure |
1015 hPa |
ciśnienie |
session.b4WeatherPrecipitation |
40% |
prawdopodobieństwo opadów |
session.b4WeatherWindGust |
35 km/h |
porywy wiatru |
session.b4WeatherUVIndex |
2 |
indeks UV |
session.b4WeatherSunrise |
07:12 |
wschód słońca |
session.b4WeatherSunset |
17:42 |
zachód słońca |
session.b4WeatherIcon |
ścieżka do pliku PNG | aktualna ikona pogody |
session.b4WeatherVisible |
1 albo pusta wartość |
widoczność pogody w ustawieniach |
Ciśnienie, opady, porywy, UV oraz godziny wschodu i zachodu są dostępne dla OAWeather i OpenATV/MetrixWeather. Klasyczny Weather Plugin nie udostępnia tych pól, dlatego przy tym providerze pozostają puste.
Najprostszy widget tekstowy
Źródła session.b4Weather... są obiektami StaticText i zawierają już
sformatowany tekst wraz z jednostką. Dla zwykłego tekstu nie należy dodawać
convertera. W składni Enigma2 jego znacznik nazywa się <convert>, a nie
<converter>.
<widget source="session.b4WeatherTemp"
render="Label"
position="100,100"
size="150,40"
font="Regular;30"
foregroundColor="foreground"
backgroundColor="background"
transparent="1"
halign="center"
valign="center"
noWrap="1" />
Tak samo wyświetla się pozostałe dane:
<widget source="session.b4WeatherFeelsLikeTemp" render="Label"
position="100,145" size="150,35" font="Regular;24"
transparent="1" halign="center" valign="center" noWrap="1" />
<widget source="session.b4WeatherPressure" render="Label"
position="270,100" size="180,35" font="Regular;24"
transparent="1" halign="left" valign="center" noWrap="1" />
<widget source="session.b4WeatherPrecipitation" render="Label"
position="270,140" size="180,35" font="Regular;24"
transparent="1" halign="left" valign="center" noWrap="1" />
<widget source="session.b4WeatherWindGust" render="Label"
position="270,180" size="220,35" font="Regular;24"
transparent="1" halign="left" valign="center" noWrap="1" />
<widget source="session.b4WeatherUVIndex" render="Label"
position="500,100" size="100,35" font="Regular;24"
transparent="1" halign="center" valign="center" noWrap="1" />
<widget source="session.b4WeatherSunrise" render="Label"
position="500,140" size="120,35" font="Regular;24"
transparent="1" halign="center" valign="center" noWrap="1" />
<widget source="session.b4WeatherSunset" render="Label"
position="500,180" size="120,35" font="Regular;24"
transparent="1" halign="center" valign="center" noWrap="1" />
Podpisy, takie jak „Ciśnienie”, „Opady” lub „UV”, można umieścić obok danych za
pomocą eLabel:
<eLabel text="Ciśnienie:"
position="100,100" size="150,35" font="Regular;24"
foregroundColor="foreground" backgroundColor="background"
transparent="1" />
<widget source="session.b4WeatherPressure" render="Label"
position="250,100" size="180,35" font="Regular;24"
foregroundColor="foreground" backgroundColor="background"
transparent="1" noWrap="1" />
Ikona pogody
Do ikon animowanych z fallbackiem na ikonę statyczną służy renderer
b4WeatherPixmap:
<widget source="session.b4WeatherIcon"
render="b4WeatherPixmap"
position="100,100"
size="100,100"
alphatest="blend"
transparent="1"
zPosition="8"
scale="1"
path="animated_weather_icons"
staticPath="weather_icons"
pixdelay="150" />
Renderer musi znajdować się na odbiorniku jako:
/usr/lib/enigma2/python/Components/Renderer/b4WeatherPixmap.py
Katalogi animated_weather_icons i weather_icons powinny znajdować się w
katalogu aktywnego skina. pixdelay określa czas jednej klatki animacji w
milisekundach.
Widoczność i ConditionalShowHide
Converter jest potrzebny między innymi wtedy, gdy wartość
b4WeatherVisible ma sterować widocznością konkretnego widgetu:
<widget source="session.b4WeatherVisible"
render="FixedLabel"
text=""
position="80,80"
size="560,260"
backgroundColor="background"
cornerRadius="10">
<convert type="ConditionalShowHide" />
</widget>
Ten converter steruje tylko widgetem, w którym został umieszczony. Nie ukrywa
automatycznie pozostałych widgetów pogodowych. Widoczność całego ekranu/panelu
infobarweather jest dodatkowo zarządzana przez ustawienia aplikacji.
Kompletny przykładowy panel
Poniższy fragment można wkleić do odpowiedniego ekranu w skin.xml i dopasować
pozycje, rozmiary, fonty oraz kolory:
<screen name="infobarweather" position="0,0" size="1920,1080"
flags="wfNoBorder" backgroundColor="background">
<widget source="session.b4WeatherVisible" render="FixedLabel" text=""
position="1280,700" size="600,300" backgroundColor="background"
cornerRadius="10">
<convert type="ConditionalShowHide" />
</widget>
<widget source="session.b4WeatherIcon" render="b4WeatherPixmap"
position="1300,720" size="120,120" alphatest="blend"
transparent="1" zPosition="8" scale="1"
path="animated_weather_icons" staticPath="weather_icons"
pixdelay="150" />
<widget source="session.b4WeatherCity" render="Label"
position="1440,710" size="400,38" font="Bold;28"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherCondition" render="Label"
position="1440,752" size="400,70" font="Regular;26"
transparent="1" halign="center" valign="center" wrap="1" />
<widget source="session.b4WeatherTemp" render="Label"
position="1300,850" size="120,45" font="Bold;32"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherFeelsLikeTemp" render="Label"
position="1300,900" size="120,35" font="Regular;22"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherTempHigh" render="Label"
position="1440,835" size="100,35" font="Regular;22"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherTempLow" render="Label"
position="1550,835" size="100,35" font="Regular;22"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherHumidity" render="Label"
position="1660,835" size="100,35" font="Regular;22"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherPressure" render="Label"
position="1770,835" size="100,35" font="Regular;22"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherWindCondition" render="Label"
position="1440,875" size="240,35" font="Regular;21"
transparent="1" halign="left" noWrap="1" />
<widget source="session.b4WeatherWindGust" render="Label"
position="1690,875" size="180,35" font="Regular;21"
transparent="1" halign="left" noWrap="1" />
<widget source="session.b4WeatherPrecipitation" render="Label"
position="1440,915" size="100,35" font="Regular;21"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherUVIndex" render="Label"
position="1550,915" size="80,35" font="Regular;21"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherSunrise" render="Label"
position="1640,915" size="100,35" font="Regular;21"
transparent="1" halign="center" noWrap="1" />
<widget source="session.b4WeatherSunset" render="Label"
position="1750,915" size="100,35" font="Regular;21"
transparent="1" halign="center" noWrap="1" />
</screen>
Bezpośrednie convertery OAWeather
Zalecane jest korzystanie ze źródeł session.b4Weather..., ponieważ zachowują
ten sam interfejs niezależnie od wybranego providera. Jeżeli skin ma działać
wyłącznie z zainstalowanym OAWeather, można ominąć warstwę aplikacji i używać
natywnego źródła oraz convertera OAWeather:
<widget source="session.OAWeather" render="Label"
position="100,100" size="180,35" font="Regular;24"
transparent="1">
<convert type="OAWeather">temperature_current</convert>
</widget>
<widget source="session.OAWeather" render="Label"
position="100,140" size="180,35" font="Regular;24"
transparent="1">
<convert type="OAWeather">pressure_current</convert>
</widget>
<widget source="session.OAWeather" render="Label"
position="100,180" size="180,35" font="Regular;24"
transparent="1">
<convert type="OAWeather">precipitation,current</convert>
</widget>
Przydatne wartości natywnego convertera to między innymi:
| Converter OAWeather | Dane |
|---|---|
city |
miejscowość |
temperature_current |
temperatura aktualna |
feelslike |
temperatura odczuwalna |
pressure_current |
ciśnienie |
humidity |
wilgotność |
winddisplay |
wiatr |
windgusts |
porywy wiatru |
uvindex |
indeks UV |
sunrise |
wschód słońca |
sunset |
zachód słońca |
precipitation,current |
aktualne opady |
temperature_high,day1 |
maksimum na dziś |
temperature_low,day1 |
minimum na dziś |
weathericon,current |
kod/plik ikony zależnie od renderera |
Nie należy łączyć convertera OAWeather ze źródłami
session.b4Weather.... Przykład niepoprawny:
<!-- Niepoprawne: b4WeatherTemp jest już gotowym tekstem. -->
<widget source="session.b4WeatherTemp" render="Label">
<convert type="OAWeather">temperature_current</convert>
</widget>