1786192981
This commit is contained in:
@@ -31,81 +31,16 @@ export component Climate inherits Rectangle {
|
|||||||
in property <WeatherData> weather;
|
in property <WeatherData> weather;
|
||||||
in property <bool> is-night;
|
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 {
|
VerticalLayout {
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
Rectangle { }
|
Rectangle { }
|
||||||
|
|
||||||
if weather.kind == "sun": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/sun.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-sun" && !is-night: Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-sun.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-sun" && is-night: Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-moon.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-rain": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-rain.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-rain-wind": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-rain-wind.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-lightning": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-lightning.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "snowflake": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/snowflake.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "cloud-fog": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/cloud-fog.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
if weather.kind == "moon": Image {
|
|
||||||
colorize: Palette.foreground;
|
|
||||||
width: 120px;
|
|
||||||
height: 105px;
|
|
||||||
source: @image-url("icons/moon.svg");
|
|
||||||
image-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: "\{weather.temperature}\{weather.temperature-unit}";
|
text: "\{weather.temperature}\{weather.temperature-unit}";
|
||||||
@@ -123,6 +58,14 @@ export component Climate inherits Rectangle {
|
|||||||
horizontal-alignment: right;
|
horizontal-alignment: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
colorize: Palette.foreground;
|
||||||
|
width: 120px;
|
||||||
|
height: 105px;
|
||||||
|
source: icons[0];
|
||||||
|
image-fit: contain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { }
|
Rectangle { }
|
||||||
|
|||||||
Reference in New Issue
Block a user