83 lines
2.0 KiB
Plaintext
83 lines
2.0 KiB
Plaintext
/*
|
|
in property <string> : "--";
|
|
in property <string> : "HIGH --";
|
|
in property <string> : "CONNECTING";
|
|
in property <string> : "cloud";
|
|
*/
|
|
|
|
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
|
export struct WeatherData {
|
|
kind: string,
|
|
label: string,
|
|
temperature: float,
|
|
dew_point: float,
|
|
temperature_unit: string,
|
|
humidity: int,
|
|
cloud_coverage: int,
|
|
uv_index: float,
|
|
pressure: float,
|
|
pressure_unit: string,
|
|
wind_bearing: float,
|
|
wind_speed: float,
|
|
wind_speed_unit: string,
|
|
visibility_unit: string,
|
|
precipitation_unit: string,
|
|
attribution: string,
|
|
friendly_name: string,
|
|
supported_features: int,
|
|
}
|
|
|
|
export component Climate inherits Rectangle {
|
|
in property <WeatherData> weather;
|
|
in property <bool> is-night;
|
|
|
|
property <[image]> icons: [
|
|
@image-url("icons/sun.svg"),
|
|
@image-url("icons/cloud-sun.svg"),
|
|
@image-url("icons/cloud-moon.svg")
|
|
];
|
|
|
|
VerticalLayout {
|
|
HorizontalLayout {
|
|
Rectangle { }
|
|
|
|
VerticalBox {
|
|
Text {
|
|
text: "\{weather.temperature}\{weather.temperature-unit}";
|
|
font-size: 36px;
|
|
font-weight: 700;
|
|
vertical-alignment: center;
|
|
horizontal-alignment: right;
|
|
}
|
|
|
|
Text {
|
|
text: weather.label;
|
|
font-size: 24px;
|
|
font-weight: 500;
|
|
vertical-alignment: center;
|
|
horizontal-alignment: right;
|
|
}
|
|
}
|
|
|
|
Image {
|
|
colorize: Palette.foreground;
|
|
width: 120px;
|
|
height: 105px;
|
|
source: icons[0];
|
|
image-fit: contain;
|
|
}
|
|
}
|
|
|
|
Rectangle { }
|
|
}
|
|
|
|
// Text {
|
|
// width: 150px;
|
|
// height: 32px;
|
|
// text: weather.outside-high;
|
|
// font-size: 20px;
|
|
// font-weight: 700;
|
|
// vertical-alignment: center;
|
|
// }
|
|
}
|