From de6dcdb75ed609ad344dc7547ca4a4bc7eae7a83 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Thu, 8 Jun 2017 17:43:19 +0200 Subject: [PATCH] updated weather-stats.qml script --- weather-stats/info.json | 2 +- weather-stats/weather-stats.qml | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/weather-stats/info.json b/weather-stats/info.json index fe125ce..dc0073b 100644 --- a/weather-stats/info.json +++ b/weather-stats/info.json @@ -2,7 +2,7 @@ "name": "Weather stats", "identifier": "weather-stats", "script": "weather-stats.qml", - "version": "0.0.1", + "version": "0.0.2", "minAppVersion": "17.06.4", "authors": ["@pbek"], "description" : "This script shows the current weather in the Scripting widget. You can configure the city in the Scripting Settings. The Yahoo weather service is used to fetch the weather. The information is updated every 10min." diff --git a/weather-stats/weather-stats.qml b/weather-stats/weather-stats.qml index 6d62dd1..25f3c76 100644 --- a/weather-stats/weather-stats.qml +++ b/weather-stats/weather-stats.qml @@ -3,6 +3,9 @@ import QOwnNotesTypes 1.0 /** * This script shows current weather statistics in a "scripting label" + * + * The Yahoo weather api is used for fetching the weather data + * https://developer.yahoo.com/weather/ */ Script { @@ -11,7 +14,6 @@ Script { property bool useFahrenheit; // register your settings variables so the user can set them in the script settings - // use this property if you don't need property variant settingsVariables: [ { "identifier": "city", @@ -41,17 +43,23 @@ Script { var weatherInfo = JSON.parse(json); var temp = weatherInfo.query.results.channel.item.condition.temp - var unit = weatherInfo.query.results.channel.units.temperature; + var tempUnit = weatherInfo.query.results.channel.units.temperature; var conditionText = weatherInfo.query.results.channel.item.condition.text + var weatherCity = weatherInfo.query.results.channel.location.city + var windSpeed = weatherInfo.query.results.channel.wind.speed + var windUnit = weatherInfo.query.results.channel.units.speed; if (!useFahrenheit) { - unit = "°" + unit; + tempUnit = "°" + tempUnit; } script.setLabelText("weather stats", - " + "
-
Weather in " + city + ": " + conditionText + " at " + temp + " " + unit + " + + Weather in " + weatherCity + ": " + conditionText + " at " + temp + " " + tempUnit + " + (" + windSpeed + " " + windUnit + " wind) +
") }