Merge lp:~martin-borho/ubuntu-weather-app/weather-channel-client into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Martin Borho
Status: Merged
Approved by: Martin Borho
Approved revision: 192
Merged at revision: 196
Proposed branch: lp:~martin-borho/ubuntu-weather-app/weather-channel-client
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 1266 lines (+659/-100)
17 files modified
CMakeLists.txt (+1/-0)
components/CurrentWeather.qml (+38/-16)
components/LocationTab.qml (+34/-22)
components/SettingsSheet.qml (+42/-7)
components/TabFooter.qml (+139/-0)
components/WeatherApi.js (+231/-4)
components/WeatherConditionIconComponent.qml (+6/-2)
components/WeatherTemperatureComponent.qml (+2/-1)
key.js (+1/-0)
tests/autopilot/ubuntu_weather_app/files/1.json (+1/-0)
tests/autopilot/ubuntu_weather_app/files/2.json (+1/-0)
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+16/-2)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+1/-2)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+1/-2)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+133/-27)
tests/autopilot/ubuntu_weather_app/tests/weatherdata.py (+0/-10)
ubuntu-weather-app.qml (+12/-5)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/weather-channel-client
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
David Planella Approve
Review via email: mp+205750@code.launchpad.net

Commit message

adds The Weather Channel as default weather data provider

Description of the change

* adds The Weather Channel as default weather data provider.
* adds footer bar for TWC with links to TWC website according the users locale.
* adds an option to switch the data source to the already exisiting OWM Api.

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Thanks, happy to finally see this branch unblocked for you!

A few comments inline:

60 +<<<<<<< TREE

- It seems that the branch has merge conflicts that need to be resolved before landing
- I've made a couple of minor fixes based on this branch here [1]. These should not stop this branch from landing, though.
- I've not forgotten about your question about icon codes for TWC. I've got that info now and I'll submit it as a separate MP :)
- As a further feature, we should print a message if the key.js file is empty, to let developers know what they have to do to use the key (e.g. console.log("The TWC API requires a key. Contact Alan Pope <e-mail> for developer access to the key.")). But we can do this in a separate MP

In summary, there is only one issue that needs to be addressed (the merge conflicts) before landing this.

[1] https://code.launchpad.net/~dpm/ubuntu-weather-app/minor-weather-api-improv/+merge/205753

review: Needs Fixing
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

Looks good to me now, thanks!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Note I added cmake to trunk, hopefully keeping all of this intact. Sorry if it collides (don't shoot the messenger!)

https://code.launchpad.net/~nskaggs/ubuntu-weather-app/add-cmake/+merge/204349

191. By Martin Borho

merged from trunk

192. By Martin Borho

added fix from francis for keys.js to CMakeLists.txt

Revision history for this message
David Planella (dpm) wrote :

Thanks everyone for rallying around getting this landed, the branch looks good to me!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

\o/

Revision history for this message
Martin Borho (martin-borho) wrote :

*\o/*

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-02-14 09:52:57 +0000
3+++ CMakeLists.txt 2014-02-15 10:25:31 +0000
4@@ -47,6 +47,7 @@
5 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
6 *.qml *.js *.png *.js)
7 install(DIRECTORY components resources DESTINATION ${DATA_DIR})
8+install(FILES key.js DESTINATION ${DATA_DIR})
9 install(FILES ${MAIN_QML} DESTINATION ${DATA_DIR})
10
11 configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in @ONLY)
12
13=== modified file 'components/CurrentWeather.qml'
14--- components/CurrentWeather.qml 2014-02-06 18:32:20 +0000
15+++ components/CurrentWeather.qml 2014-02-15 10:25:31 +0000
16@@ -25,16 +25,18 @@
17 color: "transparent"
18
19 // For Status I take the same condition codes from OpenWeatherMap (http://openweathermap.org/wiki/API/Weather_Condition_Codes)
20- property int condition
21 property string icon
22- property int currentTemp
23- property int minTemp
24- property int maxTemp
25+ property string currentTemp
26+ property string minTemp
27+ property string maxTemp
28 property bool showMaxTemp
29 property int windSpeed
30 property string windDir
31 property int humidity
32 property real precipitation
33+ property string propPrecip
34+ property string precipType
35+ property string uvIndex
36 property int pressure
37 property variant hourly
38 property string tempScale: (mainView.settings["units"] === "imperial") ? "F" : "C"
39@@ -47,6 +49,28 @@
40 anchors.fill: parent
41 anchors.horizontalCenter: parent.horizontalCenter
42
43+ function getProcipLabel() {
44+ // show the right Label, depending on precipitation type
45+ return (precipType === "snow") ? i18n.tr("Chance of Snow") : i18n.tr("Chance of Rain")
46+ }
47+
48+ function getUvLabel() {
49+ var label = "",
50+ uvInt = parseInt(uvIndex);
51+ if(uvInt <= 2) {
52+ label = i18n.tr("Low");
53+ } else if(uvInt <= 5) {
54+ label = i18n.tr("Moderate");
55+ } else if(uvInt <= 8) {
56+ label = i18n.tr("High");
57+ } else if(uvInt <= 10) {
58+ label = i18n.tr("Very high");
59+ } else {
60+ label = i18n.tr("Extreme");
61+ }
62+ return label;
63+ }
64+
65 Flipable {
66 id: flipable
67 height: parent.height
68@@ -60,13 +84,11 @@
69 property bool wasHourlyScrolled: false
70 property int startY: 0
71 property double startTime: 0
72- property int sectionHeight: parent.height/hourly.count
73+ property int sectionHeight: flippedarea.height/hourly.count
74 property int lastIndex: -1
75- // without tab header!
76- height: parent.height-units.gu(9.5)
77- width:parent.width
78- anchors.bottom: parent.bottom
79- anchors.bottomMargin: units.gu(2)
80+ anchors.fill: parent
81+ anchors.top: parent.top
82+ anchors.topMargin: units.gu(3.5)
83 onClicked: {
84 mouse.accepted = true;
85 if(!wasHourlyScrolled) {
86@@ -199,9 +221,9 @@
87 height: units.gu(15)
88
89 Components.WeatherDetailComponent {
90- value: currentWeather.pressure
91- measure: i18n.tr("Pressure")
92- unit: i18n.tr("mbar")
93+ value: (currentWeather.propPrecip !== "") ? currentWeather.propPrecip: currentWeather.pressure
94+ measure: (currentWeather.propPrecip !== "") ? getProcipLabel(): i18n.tr("Pressure")
95+ unit: (currentWeather.propPrecip !== "") ? i18n.tr("Percent") : i18n.tr("mbar")
96 anchors.fill: parent
97 }
98 }
99@@ -215,9 +237,9 @@
100
101 Components.WeatherDetailComponent {
102 objectName: "PrecipitationValue"
103- value: currentWeather.precipitation
104- measure: i18n.tr("Precipitation")
105- unit: currentWeather.precipScale
106+ value: (currentWeather.uvIndex !== "") ? currentWeather.uvIndex : currentWeather.precipitation
107+ measure: (currentWeather.uvIndex !== "") ? i18n.tr("UV index"): i18n.tr("Precipitation")
108+ unit: (currentWeather.uvIndex !== "") ? getUvLabel() : i18n.tr("Percent");
109 anchors.fill: parent
110 }
111 }
112
113=== modified file 'components/LocationTab.qml'
114--- components/LocationTab.qml 2014-02-06 18:32:20 +0000
115+++ components/LocationTab.qml 2014-02-15 10:25:31 +0000
116@@ -68,17 +68,19 @@
117 dateRel: "",//Tomorrow",
118 date: formatTimestamp(dailyForecasts[x].date, 'dddd, dd MMMM'),
119 temp: (dailyForecasts[x]["current"] === undefined) ? dailyForecasts[x][units].tempMax :
120- dailyForecasts[x]["current"][units].temp,
121- tempMin: dailyForecasts[x][units].tempMin,
122- tempMax: (dailyForecasts[x]["current"] !== undefined) ? dailyForecasts[x][units].tempMax :
123- null,
124- cond: dailyForecasts[x].condition.id,
125+ dailyForecasts[x]["current"][units].temp,
126+ tempMin: dailyForecasts[x][units].tempMin.toString(),
127+ tempMax: (dailyForecasts[x]["current"] !== undefined
128+ && dailyForecasts[x][units].tempMax !== undefined) ? dailyForecasts[x][units].tempMax.toString() : "",
129 condIcon: dailyForecasts[x].icon,
130 wind_speed: dailyForecasts[x][wind_units].windSpeed,
131 wind_dir: dailyForecasts[x].windDir,
132 humid: dailyForecasts[x].humidity,
133 precip: +(dailyForecasts[x][precip_units].rain || dailyForecasts[x][precip_units].snow || 0).toFixed(2),
134- press: dailyForecasts[x].pressure,
135+ prop_precip: ((dailyForecasts[x].propPrecip !== undefined && ""+dailyForecasts[x].propPrecip) || ""),
136+ precip_type: dailyForecasts[x].precipType || "",
137+ uv: (dailyForecasts[x].uv !== undefined) ? dailyForecasts[x].uv.toString() : "",
138+ press: dailyForecasts[x].pressure || false,
139 hours: dailyForecasts[x]["hourly"]
140 });
141 }
142@@ -137,8 +139,8 @@
143 Rectangle {
144 id: listRectangle
145 width: parent.width
146- height: dailyForecastList.height
147- anchors.verticalCenter: parent.verticalCenter
148+ height: dailyForecastList.height-tabFooter.height
149+ anchors.top: parent.top
150 color: "transparent"
151
152 DateComponent {
153@@ -153,12 +155,14 @@
154 minTemp: tempMin
155 maxTemp: tempMax
156 icon: condIcon
157- condition: cond
158 windSpeed: wind_speed
159 windDir: wind_dir
160 humidity: humid
161 precipitation: precip
162+ propPrecip: prop_precip
163+ precipType: precip_type
164 pressure: press
165+ uvIndex: uv
166 hourly: hours
167 anchors.top: dateComponent.bottom
168 showMaxTemp: (index === 0)
169@@ -167,23 +171,17 @@
170 }
171 LastUpdatedComponent{
172 id: lastUpdatedComponent
173+ anchors.bottom: (tabFooter.visible) ? tabFooter.top : parent.bottom
174 }
175- Rectangle {
176- id: noDataAvaible
177- visible: false
178- width:parent.width-units.gu(10)
179- anchors.centerIn:parent
180- anchors.verticalCenterOffset: -units.gu(10)
181- color: "transparent"
182- Label {
183- width:parent.width
184- text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
185- fontSize: "large"
186- wrapMode: Text.WordWrap
187- }
188+ TabFooter {
189+ id:tabFooter
190+ objectName: "TabFooter"
191+ visible: !dataProviderLogo.visible
192 }
193 Image {
194 id: dataProviderLogo
195+ objectName: "DataProviderLogo"
196+ visible: (settings["service"] === "openweathermap")
197 source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
198 anchors {
199 bottom: parent.bottom
200@@ -199,6 +197,20 @@
201 onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
202 }
203 }
204+ Rectangle {
205+ id: noDataAvaible
206+ visible: false
207+ width:parent.width-units.gu(10)
208+ anchors.centerIn:parent
209+ anchors.verticalCenterOffset: -units.gu(10)
210+ color: "transparent"
211+ Label {
212+ width:parent.width
213+ text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
214+ fontSize: "large"
215+ wrapMode: Text.WordWrap
216+ }
217+ }
218 }
219
220
221
222=== modified file 'components/SettingsSheet.qml'
223--- components/SettingsSheet.qml 2013-11-06 19:40:17 +0000
224+++ components/SettingsSheet.qml 2014-02-15 10:25:31 +0000
225@@ -82,6 +82,34 @@
226 delegate: unitsSelectorDelegate
227 model: precipitationUnitsSelectorModel
228 selectedIndex: (settings["precip_units"] === "in") ? 1 : 0;
229+ // Precipitation units not available at TWC
230+ visible: (serviceSelector.selectedIndex !== 0) ? 1 : 0
231+ opacity: (serviceSelector.selectedIndex !== 0) ? 1 : 0
232+ Behavior on visible {
233+ enabled: (serviceSelector.selectedIndex === 0)
234+ NumberAnimation { duration: 1500}
235+ }
236+ Behavior on opacity {
237+ NumberAnimation {
238+ easing: UbuntuAnimation.StandardEasingReverse;
239+ duration: UbuntuAnimation.SlowDuration
240+ }
241+ }
242+ }
243+
244+ ListModel {
245+ id: serviceSelectorModel
246+ ListElement { name: "twcOption"; label: "The Weather Channel" }
247+ ListElement { name: "owmOption"; label: "Openweathermap" }
248+ }
249+
250+ OptionSelector {
251+ id: serviceSelector
252+ objectName: "ServiceSelector"
253+ text: i18n.tr("Weather Service")
254+ delegate: unitsSelectorDelegate
255+ model: serviceSelectorModel
256+ selectedIndex: (settings["service"] === "openweathermap") ? 1 : 0;
257 }
258 }
259
260@@ -90,35 +118,42 @@
261 }
262
263 onConfirmClicked: {
264- var refresh = false,
265+ var refresh_from_storage = false,
266+ refresh_from_service = false,
267 selectedUnit = (temperatureUnitsSelector.selectedIndex === 0) ? "metric" : "imperial",
268 selectedWindUnit = (windUnitsSelector.selectedIndex === 0) ? "kmh" : "mph",
269- selectedPrecipUnit = (precipitationUnitsSelector.selectedIndex === 0) ? "mm" : "in";
270+ selectedPrecipUnit = (precipitationUnitsSelector.selectedIndex === 0) ? "mm" : "in",
271+ selectedService = (serviceSelector.selectedIndex === 0) ? "weatherchannel" : "openweathermap";
272 // check if temperaure scale was changed
273 if(settings["units"] !== selectedUnit) {
274 storage.saveSetting("units", selectedUnit);
275- refresh = true;
276+ refresh_from_storage = true;
277 }
278 //
279 if(settings["wind_units"] !== selectedWindUnit) {
280 storage.saveSetting("wind_units", selectedWindUnit);
281- refresh = true;
282+ refresh_from_storage = true;
283 }
284 //
285 if(settings["precip_units"] !== selectedPrecipUnit) {
286 storage.saveSetting("precip_units", selectedPrecipUnit);
287- refresh = true;
288+ refresh_from_storage = true;
289+ }
290+ //
291+ if(settings["service"] !== selectedService) {
292+ storage.saveSetting("service", selectedService);
293+ refresh_from_service = true;
294 }
295 // handling of other settings here
296 // ....
297
298 // a setting was changed, reload settings and refresh the location tabs
299- if(refresh === true) {
300+ if(refresh_from_storage === true || refresh_from_service === true) {
301 storage.getSettings(function(storedSettings) {
302 for(var settingName in storedSettings) {
303 settings[settingName] = storedSettings[settingName];
304 }
305- refreshData(true);
306+ refreshData(refresh_from_storage, refresh_from_service);
307 });
308 }
309 Theme.palette.selected.backgroundText = "#f4f4e8"
310
311=== added file 'components/TabFooter.qml'
312--- components/TabFooter.qml 1970-01-01 00:00:00 +0000
313+++ components/TabFooter.qml 2014-02-15 10:25:31 +0000
314@@ -0,0 +1,139 @@
315+/*
316+ * Copyright (C) 2014 Canonical Ltd
317+ *
318+ * This program is free software: you can redistribute it and/or modify
319+ * it under the terms of the GNU General Public License version 3 as
320+ * published by the Free Software Foundation.
321+ *
322+ * This program is distributed in the hope that it will be useful,
323+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
324+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
325+ * GNU General Public License for more details.
326+ *
327+ * You should have received a copy of the GNU General Public License
328+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
329+ *
330+ * Authored by: Martin Borho <martin@borho.net>
331+ */
332+import QtQuick 2.0
333+import Ubuntu.Components 0.1
334+
335+Rectangle {
336+ width: parent.width
337+ height: units.gu(8)
338+ anchors.bottom: parent.bottom
339+
340+ /**
341+ * TODO
342+ *
343+ * at the moment it's unknown to the developer, in which way a link to
344+ * the weatherchannel website can be generated from wunderground-API data
345+ */
346+ function openTWCLink(type) {
347+ var serviceId = locationTab.locationData.location.services["weatherchannel"],
348+ loc_name = Qt.locale().name, url = "http://";
349+ print("Open link for "+type+" - "+loc_name)
350+ if(loc_name.search(/^de_/) > -1) {
351+ url += "de.weather.com/";
352+ if(type) url += ((type === "10day") ? "10tage/" : "stündlich/");
353+
354+ } else if(loc_name === "en_US" || loc_name === "en-CA") {
355+ url += "www.weather.com/";
356+ if(type) url += "weather/"+((type === "10day") ? "tenday/" : "hourbyhour/graph/");
357+
358+ } else if(loc_name.search(/^en_/) > -1) {
359+ url += "uk.weather.com/";
360+ if(type) url += "weather/"+((type === "10day") ? "10day-" : "hourByHour-");
361+
362+ } else if(loc_name.search(/^fr_/) > -1) {
363+ url += "fr.weather.com/";
364+ if(type) url += ((type === "10day") ? "10jours/" : "horaire/");
365+
366+ } else if(loc_name.search(/^es_/) > -1) {
367+ url += "espanol.weather.com/";
368+ if(type) url += "weather/"+((type === "10day") ? "10day-" : "hourByHour-");
369+
370+ } else if(loc_name === "ja_JP") {
371+ url += "ja.weather.com/";
372+ if(type) url += ((type === "10day") ? "10日/" : "1時間ごと/");
373+
374+ } else if(loc_name.search(/^zh_/) > -1) {
375+ url += "zh.weather.com/";
376+ if(type) url += ((type === "10day") ? "10天/" : "1時間ごと/");
377+
378+ } else if(loc_name === "pt_BR") {
379+ url += "br.weather.com/";
380+ if(type) url += ((type === "10day") ? "10dias/" : "toda_hora/");
381+
382+ } else if(loc_name.search(/^pt_/) > -1) {
383+ url += "pt.weather.com/";
384+ if(type) url += ((type === "10day") ? "10dias/" : "cadahora/");
385+
386+ } else if(loc_name === "ru_RU") {
387+ url += "ru.weather.com/";
388+ if(type) url += ((type === "10day") ? "10дней/" : "ежечасно/");
389+
390+ }
391+ if(type) url += serviceId;
392+ url += "?par=ubuntu"
393+ print(url)
394+ Qt.openUrlExternally(url);
395+ }
396+
397+ Rectangle {
398+ id: forecastLink
399+ anchors.left:parent.left
400+ anchors.leftMargin: units.gu(1)
401+ width:units.gu(14)
402+ height:parent.height
403+ Label {
404+ anchors.verticalCenter: parent.verticalCenter
405+ text: i18n.tr("10 days forecast")
406+ fontSize:"medium"
407+ color: mainView.footerColor
408+ MouseArea {
409+ anchors.fill:parent
410+ onClicked: openTWCLink("10day")
411+ }
412+ }
413+ }
414+ Rectangle {
415+ anchors.left:forecastLink.right
416+ width:units.gu(15)
417+ height:parent.height
418+ Label {
419+ anchors.verticalCenter: parent.verticalCenter
420+ text: ">> "+i18n.tr("Hourly forecast")
421+ fontSize:"medium"
422+ color: mainView.footerColor
423+ MouseArea {
424+ anchors.fill:parent
425+ onClicked: openTWCLink("hourly")
426+ }
427+ }
428+ }
429+ Rectangle {
430+ anchors.right: serviceLogo.left
431+ width:units.gu(0.25)
432+ height: parent.height
433+ color: mainView.footerColor
434+ }
435+ Rectangle {
436+ id: serviceLogo
437+ width:units.gu(9)
438+ height:parent.height
439+ anchors.right: parent.right
440+ Label {
441+ anchors.verticalCenter: parent.verticalCenter
442+ anchors.centerIn: parent
443+ fontSize: "medium"
444+ font.bold: true
445+ color:mainView.footerColor
446+ text: "The\nWeather\nChannel"
447+ }
448+ MouseArea {
449+ anchors.fill:parent
450+ onClicked: openTWCLink()
451+ }
452+ }
453+}
454
455=== modified file 'components/WeatherApi.js'
456--- components/WeatherApi.js 2013-10-01 19:51:22 +0000
457+++ components/WeatherApi.js 2014-02-15 10:25:31 +0000
458@@ -23,11 +23,15 @@
459 * Version of the response data format.
460 * Increase this number to force a refresh.
461 */
462-var RESPONSE_DATA_VERSION = 20130927;
463+var RESPONSE_DATA_VERSION = 20131207;
464
465 /**
466 * Helper functions
467 */
468+function debug(obj) {
469+ print(JSON.stringify(obj))
470+}
471+//
472 function calcFahrenheit(celsius) {
473 return celsius * 1.8 + 32;
474 }
475@@ -356,6 +360,223 @@
476
477 })();
478
479+var WeatherChannelApi = (function() {
480+ /**
481+ provides neccessary methods for requesting and preparing data from OpenWeatherMap.org
482+ */
483+ var _baseUrl = "http://wxdata.weather.com/wxdata/";
484+ //
485+ var _serviceName = "weatherchannel";
486+ //
487+ // see http://s.imwx.com/v.20131006.223722/img/wxicon/72/([0-9]+).png
488+ var _iconMap = {
489+ "1": "thunderstorm_day", // ??
490+ "2": "thunderstorm_day", // ??
491+ "3": "thunderstorm_day", // ??
492+ "4": "thunderstorm_day", //T-Storms
493+ "5": "shower_rain_day", //Rain / Snow
494+ "6": "shower_rain_day", // ??
495+ "7": "chance_snow_day", //Wintry Mix
496+ "8": "chance_snow_day", //Freezing Drizzle
497+ "9": "rain_day", //Drizzle
498+ "10": "shower_rain_day", // ??
499+ "11": "shower_rain_day", //Showers
500+ "12": "rain_day", //Rain
501+ "13": "snow_day", // ??
502+ "14": "snow_shower", //Snow shower/Light snow
503+ "15": "snow_day", //
504+ "16": "snow_day", //Snow
505+ "17": "thunderstorm_day", // Hail??
506+ "18": "shower_rain_day", // Rain / Snow ??
507+ "19": "mist_day", //Fog ??
508+ "20": "mist_day", //Fog
509+ "21": "mist_day", //Haze
510+ "22": "mist_day", // ??
511+ "23": "mist_day", // Wind ??
512+ "24": "broken_clouds_day", //Partly Cloudy / Wind
513+ "25": "broken_clouds_day", // ??
514+ "26": "broken_clouds_day",//Cloudy
515+ "27": "few_clouds_night",//Mostly Cloudy
516+ "28": "few_clouds_day", //Mostly Cloudy
517+ "29": "scattered_clouds_night", //Partly Cloudy
518+ "30": "scattered_clouds_day", //Partly Cloudy
519+ "31": "clear_night", //Clear
520+ "32": "clear_day", //Sunny
521+ "33": "few_clouds_night", //Mostly Clear
522+ "34": "few_clouds_day", //Mostly Sunny
523+ "35": "shower_rain_day", // ??
524+ "36": "clear_day", //Sunny
525+ "37": "thunderstorm_day", //Isolated T-Storms
526+ "38": "thunderstorm_day", //Scattered T-Storms
527+ "39": "rain_day", //Scattered Showers
528+ "40": "shower_rain_day", // ??
529+ "41": "snow_day", //Scattered Snow Showers
530+ "42": "snow_day", // ??
531+ "43": "snow_day", // ??
532+ "44": "mist_day", // ??
533+ "45": "rain_day", // ??
534+ "46": "snow_day", //Snow Showers Early
535+ "47": "thunderstorm_day" //Isolated T-Storms
536+ };
537+ //
538+ function _buildDataPoint(date, dataObj) {
539+ var data = dataObj["Observation"] || dataObj,
540+ result = {
541+ timestamp: data.date || data.dateTime,
542+ date: date,
543+ metric: {
544+ temp: data.temp,
545+ tempFeels: data.feelsLike,
546+ windSpeed: data.wSpeed
547+ },
548+ imperial: {
549+ temp: calcFahrenheit(data.temp),
550+ tempFeels: calcFahrenheit(data.feelsLike),
551+ windSpeed: calcMph(data.wSpeed)
552+ },
553+ precipType: data.precip_type || null,
554+ propPrecip: data.pop || null,
555+ humidity: data.humid,
556+ pressure: data.pressure,
557+ windDeg: data.wDir,
558+ windDir: data.wDirText,
559+ icon: _iconMap[(data.wxIcon||data.icon)],
560+ condition: data.text || data.wDesc,
561+ uv: data.uv
562+ };
563+ if(_iconMap[data.wxIcon||data.icon] === undefined) {
564+ print("ICON MISSING POINT: "+(data.wxIcon||data.icon)+" "+result.condition)
565+ }
566+ return result;
567+ }
568+ //
569+ function _buildDayFormat(date, data, now) {
570+ var partData = (now > data.validDate || data.day === undefined) ? data.night : data.day,
571+ result = {
572+ date: date,
573+ timestamp: data.validDate,
574+ metric: {
575+ tempMin: data.minTemp,
576+ tempMax: data.maxTemp,
577+ windSpeed: partData.wSpeed
578+ },
579+ imperial: {
580+ tempMin: calcFahrenheit(data.minTemp),
581+ tempMax: calcFahrenheit(data.maxTemp || data.minTemp),
582+ windSpeed: calcMph(partData.wSpeed)
583+ },
584+ precipType: partData.precip_type,
585+ propPrecip: partData.pop,
586+ pressure: null,
587+ humidity: partData.humid,
588+ icon: _iconMap[partData.icon],
589+ condition: partData.phrase,
590+ windDeg: partData.wDir,
591+ windDir: partData.wDirText,
592+ uv: partData.uv,
593+ hourly: []
594+ }
595+ if(_iconMap[partData.icon] === undefined) {
596+ print("ICON MISSING DAY: "+partData.icon+" "+result.condition)
597+ }
598+ return result;
599+ }
600+ //
601+ function formatResult(combinedData, location) {
602+ var tmpResult = {}, result = [],
603+ day=null, todayDate,
604+ offset=(location.timezone && location.timezone.gmtOffset) ? location.timezone.gmtOffset*60*60*1000: 0,
605+ now = new Date().getTime(),
606+ nowMs = parseInt(now/1000),
607+ localNow = getLocationTime(now+offset),
608+ data = {
609+ "location": combinedData[0]["Location"],
610+ "daily": combinedData[0]["DailyForecasts"],
611+ "forecast": combinedData[0]["HourlyForecasts"],
612+ "current": combinedData[0]["StandardObservation"],
613+ };
614+ print("["+location.name+"] "+JSON.stringify(localNow));
615+ // add openweathermap id for faster responses
616+ if(location.services && !location.services[_serviceName] && data["location"].key) {
617+ location.services[_serviceName] = data["location"].key
618+ }
619+ //
620+ data["daily"].forEach(function(dayData) {
621+ var date = getLocationTime(((dayData.validDate*1000)-1000)+offset), // minus 1 sec to handle +/-12 TZ
622+ day = date.year+"-"+date.month+"-"+date.date;
623+ if(!todayDate) {
624+ if(localNow.year+"-"+localNow.month+"-"+localNow.date > day) {
625+ // skip "yesterday"
626+ return;
627+ }
628+ todayDate = date;
629+ }
630+ tmpResult[day] = _buildDayFormat(date, dayData, nowMs);
631+ })
632+ //
633+ var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date
634+ tmpResult[today]["current"] = _buildDataPoint(todayDate, data["current"]);
635+ if(data["forecast"] !== undefined) {
636+ data["forecast"].forEach(function(hourData) {
637+ var dateData = getLocationTime((hourData.dateTime*1000)+offset),
638+ day = dateData.year+"-"+dateData.month+"-"+dateData.date;
639+ if(tmpResult[day]) {
640+ tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
641+ }
642+ })
643+ }
644+ //
645+ for(var d in tmpResult) {
646+ result.push(tmpResult[d]);
647+ }
648+ return result;
649+ }
650+ //
651+ function _getUrl(params) {
652+ var url, serviceId,
653+ units = (params.units === "metric") ? "m" : "e",
654+ baseParams = "key="+params.api_key+"&units="+units;
655+ if(params.location.services && params.location.services[_serviceName]) {
656+ serviceId = encodeURIComponent(params.location.services[_serviceName]);
657+ url = _baseUrl+"mobile/mobagg/"+serviceId+".js?"+baseParams;
658+ } else if (params.location.coord) {
659+ url = _baseUrl+"mobile/mobagg/get.js?"+baseParams+
660+ "&lat="+encodeURIComponent(params.location.coord.lat)+
661+ "&lng="+encodeURIComponent(params.location.coord.lon);
662+ }
663+ return url;
664+ }
665+ //
666+ return {
667+ getData: function(params, apiCaller, onSuccess, onError) {
668+ var url = _getUrl(params),
669+ handlerMap = {
670+ all: { type: "all", url: url}
671+ },
672+ response = {
673+ location: params.location,
674+ db: (params.db) ? params.db : null,
675+ format: RESPONSE_DATA_VERSION
676+ },
677+ addDataToResponse = (function(request, data) {
678+ var formattedResult;
679+ response["data"] = formatResult(data, params.location);
680+ onSuccess(response);
681+ }),
682+ onErrorHandler = (function(err) {
683+ onError(err);
684+ }),
685+ retryHandler = (function(err) {
686+ print(JSON.stringify(err))
687+ console.log("retry of "+err.request.url);
688+ //var retryFunc = handlerMap[err.request.type];
689+ //apiCaller(retryFunc, addDataToResponse, onErrorHandler);
690+ })
691+ apiCaller(handlerMap.all, addDataToResponse, retryHandler);
692+ }
693+ }
694+})();
695+
696 var WeatherApi = (function(_services) {
697 /**
698 proxy for requesting weather apis, the passed _services are providing the respective api endpoints
699@@ -365,7 +586,7 @@
700 if(_services[name] !== undefined) {
701 return _services[name];
702 }
703- return _services["openweathermap"];
704+ return _services["weatherchannel"];
705 }
706 //
707 function _sendRequest(request, onSuccess, onError) {
708@@ -391,6 +612,7 @@
709 }
710 }
711 } catch (e) {
712+ print("Exception: "+e)
713 onError({msg: "wrong response data format", request: request});
714 }
715 };
716@@ -416,12 +638,13 @@
717 },
718 //
719 getLocationData: function(params, onSuccess, onError) {
720- var service = _getService();
721+ var service = _getService(params.service);
722 service.getData(params, _sendRequest, onSuccess, onError);
723 },
724 }
725 })({
726 "openweathermap": OpenWeatherMapApi,
727+ "weatherchannel": WeatherChannelApi,
728 "geonames": GeonamesApi,
729 "geoip": GeoipApi
730 });
731@@ -435,6 +658,8 @@
732 WorkerScript.onMessage = function(message) {
733 // handles the response data
734 var finished = function(result) {
735+ // print result to get data for test json files
736+ // print(JSON.stringify(result));
737 WorkerScript.sendMessage({
738 action: message.action,
739 result: result
740@@ -480,7 +705,9 @@
741 params = {
742 location:loc.location,
743 db: loc.db,
744- units: 'metric'
745+ units: 'metric',
746+ service: message.params.service,
747+ api_key: message.params.api_key
748 },
749 secsFromLastFetch = (now-loc.updated)/1000;
750 //
751
752=== modified file 'components/WeatherConditionIconComponent.qml'
753--- components/WeatherConditionIconComponent.qml 2014-01-27 14:56:23 +0000
754+++ components/WeatherConditionIconComponent.qml 2014-02-15 10:25:31 +0000
755@@ -25,14 +25,18 @@
756 "scattered_clouds_night": "04",
757 "broken_clouds_day": "03",
758 "broken_clouds_night": "03",
759- "shower_rain_day": "01",
760- "shower_rain_night": "01",
761+ "mostly_cloudy": "03",
762+ "shower_rain_day": "09",
763+ "shower_rain_night": "09",
764 "rain_day": "09",
765 "rain_night": "09",
766 "thunderstorm_day": "13",
767 "thunderstorm_night": "13",
768 "snow_day": "14",
769 "snow_night": "14",
770+ "chance_snow_day": "11",
771+ "chances_now_night": "11",
772+ "snow_shower": "11",
773 "mist_day": "06",
774 "mist_night": "06"
775 }
776
777=== modified file 'components/WeatherTemperatureComponent.qml'
778--- components/WeatherTemperatureComponent.qml 2014-01-06 14:30:14 +0000
779+++ components/WeatherTemperatureComponent.qml 2014-02-15 10:25:31 +0000
780@@ -52,6 +52,7 @@
781 }
782 Text {
783 id: currentTempScale
784+ objectName: "CurrentTempScale"
785 text: String("°") + tempComponent.tempScale
786 style: Text.Raised
787 font.bold: false
788@@ -107,7 +108,7 @@
789 font.pointSize: FontUtils.sizeToPixels("small")
790 verticalAlignment: Text.AlignVCenter
791 horizontalAlignment: Text.AlignHCenter
792- visible:(dailyForecastList.currentIndex === 0)
793+ visible:(dailyForecastList.currentIndex === 0 && tempComponent.maxTemp)
794 anchors {
795 bottom: parent.bottom
796 bottomMargin: units.gu(2)
797
798=== added file 'key.js'
799--- key.js 1970-01-01 00:00:00 +0000
800+++ key.js 2014-02-15 10:25:31 +0000
801@@ -0,0 +1,1 @@
802+var twcKey = "";
803
804=== added directory 'tests/autopilot/ubuntu_weather_app/files'
805=== added file 'tests/autopilot/ubuntu_weather_app/files/1.json'
806--- tests/autopilot/ubuntu_weather_app/files/1.json 1970-01-01 00:00:00 +0000
807+++ tests/autopilot/ubuntu_weather_app/files/1.json 2014-02-15 10:25:31 +0000
808@@ -0,0 +1,1 @@
809+{"location":{"coord":{"lon":"10.01534","lat":"53.57532"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Berlin"},"areaLabel":"Hamburg, Germany","population":1739117,"adminName2":"","name":"Hamburg","country":"DE","countryName":"Germany","adminName1":"Hamburg","adminName3":"","services":{"weatherchannel":"GMXX0049","geonames":2911298}},"db":{"updated":"2014-01-23T20:43:15.724Z","id":3},"format":20131207,"data":[{"date":{"year":2014,"month":0,"date":23,"hours":18,"minutes":59},"timestamp":1390500000,"metric":{"tempMin":-6,"windSpeed":22},"imperial":{"tempMin":21.2,"tempMax":21.2,"windSpeed":49.28},"precipType":"snow","propPrecip":50,"pressure":null,"humidity":65,"icon":"snow_day","condition":"Snow Showers Early","windDeg":102,"windDir":"ESE","uv":0,"hourly":[{"timestamp":1390510800,"date":{"year":2014,"month":0,"date":23,"hours":22,"minutes":0},"metric":{"temp":-3,"tempFeels":-10,"windSpeed":22},"imperial":{"temp":26.6,"tempFeels":14,"windSpeed":49.28},"precipType":"snow","propPrecip":50,"humidity":70,"windDeg":109,"windDir":"ESE","icon":"snow_shower","condition":"Snow Shower","uv":0},{"timestamp":1390514400,"date":{"year":2014,"month":0,"date":23,"hours":23,"minutes":0},"metric":{"temp":-4,"tempFeels":-11,"windSpeed":22},"imperial":{"temp":24.8,"tempFeels":12.2,"windSpeed":49.28},"precipType":"snow","propPrecip":40,"humidity":69,"windDeg":106,"windDir":"ESE","icon":"snow_shower","condition":"Snow Shower","uv":0}],"current":{"timestamp":"1390503000","date":{"year":2014,"month":0,"date":23,"hours":18,"minutes":59},"metric":{"temp":-3,"tempFeels":-11,"windSpeed":24},"imperial":{"temp":26.6,"tempFeels":12.2,"windSpeed":53.760000000000005},"precipType":null,"propPrecip":null,"humidity":91,"pressure":"1013.88","windDeg":100,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0}},{"date":{"year":2014,"month":0,"date":24,"hours":18,"minutes":59},"timestamp":1390586400,"metric":{"tempMin":-8,"tempMax":-5,"windSpeed":19},"imperial":{"tempMin":17.6,"tempMax":23,"windSpeed":42.56},"precipType":"snow","propPrecip":20,"pressure":null,"humidity":61,"icon":"broken_clouds_day","condition":"AM Clouds / PM Sun","windDeg":96,"windDir":"E","uv":1,"hourly":[{"timestamp":1390518000,"date":{"year":2014,"month":0,"date":24,"hours":0,"minutes":0},"metric":{"temp":-4,"tempFeels":-11,"windSpeed":20},"imperial":{"temp":24.8,"tempFeels":12.2,"windSpeed":44.800000000000004},"precipType":"snow","propPrecip":20,"humidity":66,"windDeg":102,"windDir":"ESE","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390521600,"date":{"year":2014,"month":0,"date":24,"hours":1,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":20},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":44.800000000000004},"precipType":"snow","propPrecip":20,"humidity":66,"windDeg":98,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390525200,"date":{"year":2014,"month":0,"date":24,"hours":2,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":20},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":44.800000000000004},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":95,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390528800,"date":{"year":2014,"month":0,"date":24,"hours":3,"minutes":0},"metric":{"temp":-5,"tempFeels":-12,"windSpeed":20},"imperial":{"temp":23,"tempFeels":10.399999999999999,"windSpeed":44.800000000000004},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":94,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390532400,"date":{"year":2014,"month":0,"date":24,"hours":4,"minutes":0},"metric":{"temp":-5,"tempFeels":-12,"windSpeed":20},"imperial":{"temp":23,"tempFeels":10.399999999999999,"windSpeed":44.800000000000004},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":93,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390536000,"date":{"year":2014,"month":0,"date":24,"hours":5,"minutes":0},"metric":{"temp":-5,"tempFeels":-12,"windSpeed":19},"imperial":{"temp":23,"tempFeels":10.399999999999999,"windSpeed":42.56},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":93,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390539600,"date":{"year":2014,"month":0,"date":24,"hours":6,"minutes":0},"metric":{"temp":-6,"tempFeels":-12,"windSpeed":19},"imperial":{"temp":21.2,"tempFeels":10.399999999999999,"windSpeed":42.56},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":92,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390543200,"date":{"year":2014,"month":0,"date":24,"hours":7,"minutes":0},"metric":{"temp":-6,"tempFeels":-12,"windSpeed":17},"imperial":{"temp":21.2,"tempFeels":10.399999999999999,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":92,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390546800,"date":{"year":2014,"month":0,"date":24,"hours":8,"minutes":0},"metric":{"temp":-6,"tempFeels":-13,"windSpeed":17},"imperial":{"temp":21.2,"tempFeels":8.599999999999998,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":20,"humidity":62,"windDeg":91,"windDir":"E","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390550400,"date":{"year":2014,"month":0,"date":24,"hours":9,"minutes":0},"metric":{"temp":-6,"tempFeels":-13,"windSpeed":19},"imperial":{"temp":21.2,"tempFeels":8.599999999999998,"windSpeed":42.56},"precipType":"snow","propPrecip":10,"humidity":62,"windDeg":90,"windDir":"E","icon":"broken_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390554000,"date":{"year":2014,"month":0,"date":24,"hours":10,"minutes":0},"metric":{"temp":-6,"tempFeels":-13,"windSpeed":19},"imperial":{"temp":21.2,"tempFeels":8.599999999999998,"windSpeed":42.56},"precipType":"snow","propPrecip":10,"humidity":62,"windDeg":91,"windDir":"E","icon":"broken_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390557600,"date":{"year":2014,"month":0,"date":24,"hours":11,"minutes":0},"metric":{"temp":-6,"tempFeels":-12,"windSpeed":19},"imperial":{"temp":21.2,"tempFeels":10.399999999999999,"windSpeed":42.56},"precipType":"snow","propPrecip":null,"humidity":62,"windDeg":93,"windDir":"E","icon":"broken_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390561200,"date":{"year":2014,"month":0,"date":24,"hours":12,"minutes":0},"metric":{"temp":-5,"tempFeels":-12,"windSpeed":19},"imperial":{"temp":23,"tempFeels":10.399999999999999,"windSpeed":42.56},"precipType":"snow","propPrecip":null,"humidity":62,"windDeg":96,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Sunny","uv":1},{"timestamp":1390564800,"date":{"year":2014,"month":0,"date":24,"hours":13,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":19},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":42.56},"precipType":"snow","propPrecip":null,"humidity":62,"windDeg":98,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Sunny","uv":1},{"timestamp":1390568400,"date":{"year":2014,"month":0,"date":24,"hours":14,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":17},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":null,"humidity":62,"windDeg":98,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Sunny","uv":0},{"timestamp":1390572000,"date":{"year":2014,"month":0,"date":24,"hours":15,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":17},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":null,"humidity":62,"windDeg":98,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Sunny","uv":0},{"timestamp":1390575600,"date":{"year":2014,"month":0,"date":24,"hours":16,"minutes":0},"metric":{"temp":-5,"tempFeels":-10,"windSpeed":16},"imperial":{"temp":23,"tempFeels":14,"windSpeed":35.84},"precipType":"snow","propPrecip":null,"humidity":59,"windDeg":97,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Sunny","uv":0},{"timestamp":1390579200,"date":{"year":2014,"month":0,"date":24,"hours":17,"minutes":0},"metric":{"temp":-5,"tempFeels":-10,"windSpeed":16},"imperial":{"temp":23,"tempFeels":14,"windSpeed":35.84},"precipType":"snow","propPrecip":null,"humidity":59,"windDeg":97,"windDir":"E","icon":"few_clouds_day","condition":"Mostly Clear","uv":0},{"timestamp":1390582800,"date":{"year":2014,"month":0,"date":24,"hours":18,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":17},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":null,"humidity":59,"windDeg":98,"windDir":"E","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390586400,"date":{"year":2014,"month":0,"date":24,"hours":19,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":17},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":null,"humidity":59,"windDeg":100,"windDir":"E","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390590000,"date":{"year":2014,"month":0,"date":24,"hours":20,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":17},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":38.080000000000005},"precipType":"snow","propPrecip":null,"humidity":59,"windDeg":103,"windDir":"ESE","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390593600,"date":{"year":2014,"month":0,"date":24,"hours":21,"minutes":0},"metric":{"temp":-5,"tempFeels":-11,"windSpeed":16},"imperial":{"temp":23,"tempFeels":12.2,"windSpeed":35.84},"precipType":"snow","propPrecip":null,"humidity":56,"windDeg":105,"windDir":"ESE","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0}]},{"date":{"year":2014,"month":0,"date":25,"hours":18,"minutes":59},"timestamp":1390672800,"metric":{"tempMin":-8,"tempMax":-5,"windSpeed":24},"imperial":{"tempMin":17.6,"tempMax":23,"windSpeed":53.760000000000005},"precipType":"snow","propPrecip":10,"pressure":null,"humidity":58,"icon":"broken_clouds_day","condition":"Cloudy","windDeg":124,"windDir":"SE","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":26,"hours":18,"minutes":59},"timestamp":1390759200,"metric":{"tempMin":-8,"tempMax":-6,"windSpeed":19},"imperial":{"tempMin":17.6,"tempMax":21.2,"windSpeed":42.56},"precipType":"snow","propPrecip":10,"pressure":null,"humidity":60,"icon":"broken_clouds_day","condition":"Partly Cloudy","windDeg":112,"windDir":"ESE","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":27,"hours":18,"minutes":59},"timestamp":1390845600,"metric":{"tempMin":-2,"tempMax":-1,"windSpeed":27},"imperial":{"tempMin":28.4,"tempMax":30.2,"windSpeed":60.480000000000004},"precipType":"snow","propPrecip":90,"pressure":null,"humidity":78,"icon":"snow_day","condition":"Snow","windDeg":131,"windDir":"SE","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":28,"hours":18,"minutes":59},"timestamp":1390932000,"metric":{"tempMin":-3,"tempMax":2,"windSpeed":20},"imperial":{"tempMin":26.6,"tempMax":35.6,"windSpeed":44.800000000000004},"precipType":"precip","propPrecip":70,"pressure":null,"humidity":61,"icon":"shower_rain_day","condition":"Rain / Snow","windDeg":171,"windDir":"S","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":29,"hours":18,"minutes":59},"timestamp":1391018400,"metric":{"tempMin":-5,"tempMax":-1,"windSpeed":24},"imperial":{"tempMin":23,"tempMax":30.2,"windSpeed":53.760000000000005},"precipType":"precip","propPrecip":20,"pressure":null,"humidity":94,"icon":"broken_clouds_day","condition":"Cloudy","windDeg":108,"windDir":"ESE","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":30,"hours":18,"minutes":59},"timestamp":1391104800,"metric":{"tempMin":-5,"tempMax":-1,"windSpeed":16},"imperial":{"tempMin":23,"tempMax":30.2,"windSpeed":35.84},"precipType":"precip","propPrecip":10,"pressure":null,"humidity":93,"icon":"broken_clouds_day","condition":"Partly Cloudy","windDeg":78,"windDir":"ENE","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":31,"hours":18,"minutes":59},"timestamp":1391191200,"metric":{"tempMin":-2,"tempMax":0,"windSpeed":16},"imperial":{"tempMin":28.4,"tempMax":28.4,"windSpeed":35.84},"precipType":"precip","propPrecip":20,"pressure":null,"humidity":93,"icon":"broken_clouds_day","condition":"Partly Cloudy","windDeg":147,"windDir":"SSE","uv":1,"hourly":[]},{"date":{"year":2014,"month":1,"date":1,"hours":18,"minutes":59},"timestamp":1391277600,"metric":{"tempMin":-3,"tempMax":0,"windSpeed":14},"imperial":{"tempMin":26.6,"tempMax":26.6,"windSpeed":31.360000000000003},"precipType":"snow","propPrecip":30,"pressure":null,"humidity":92,"icon":"snow_shower","condition":"Snow Shower","windDeg":163,"windDir":"SSE","uv":0,"hourly":[]}],"save":true,"updated":1390509857882}
810
811=== added file 'tests/autopilot/ubuntu_weather_app/files/2.json'
812--- tests/autopilot/ubuntu_weather_app/files/2.json 1970-01-01 00:00:00 +0000
813+++ tests/autopilot/ubuntu_weather_app/files/2.json 2014-02-15 10:25:31 +0000
814@@ -0,0 +1,1 @@
815+{"location":{"coord":{"lon":"-0.12574","lat":"51.50853"},"timezone":{"gmtOffset":0,"dstOffset":1,"timeZoneId":"Europe/London"},"areaLabel":"England, Greater London, United Kingdom","population":7556900,"adminName2":"Greater London","name":"London","country":"GB","countryName":"United Kingdom","adminName1":"England","adminName3":"","dbId":0,"services":{"weatherchannel":"UKXX0085","geonames":2643743}},"db":{"updated":"2014-01-23T20:46:03.554Z","id":4},"format":20131207,"data":[{"date":{"year":2014,"month":0,"date":23,"hours":18,"minutes":59},"timestamp":1390503600,"metric":{"tempMin":3,"windSpeed":17},"imperial":{"tempMin":37.4,"tempMax":37.4,"windSpeed":38.080000000000005},"precipType":"precip","propPrecip":20,"pressure":null,"humidity":79,"icon":"few_clouds_day","condition":"Mostly Cloudy","windDeg":260,"windDir":"W","uv":0,"hourly":[{"timestamp":1390510800,"date":{"year":2014,"month":0,"date":23,"hours":21,"minutes":0},"metric":{"temp":4,"tempFeels":1,"windSpeed":16},"imperial":{"temp":39.2,"tempFeels":33.8,"windSpeed":35.84},"precipType":"rain","propPrecip":10,"humidity":76,"windDeg":284,"windDir":"WNW","icon":"few_clouds_day","condition":"Mostly Clear","uv":0},{"timestamp":1390514400,"date":{"year":2014,"month":0,"date":23,"hours":22,"minutes":0},"metric":{"temp":4,"tempFeels":1,"windSpeed":14},"imperial":{"temp":39.2,"tempFeels":33.8,"windSpeed":31.360000000000003},"precipType":"rain","propPrecip":null,"humidity":76,"windDeg":284,"windDir":"WNW","icon":"few_clouds_day","condition":"Mostly Clear","uv":0},{"timestamp":1390518000,"date":{"year":2014,"month":0,"date":23,"hours":23,"minutes":0},"metric":{"temp":3,"tempFeels":0,"windSpeed":12},"imperial":{"temp":37.4,"tempFeels":32,"windSpeed":26.880000000000003},"precipType":"precip","propPrecip":null,"humidity":79,"windDeg":284,"windDir":"WNW","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0}],"current":{"timestamp":"1390508400","date":{"year":2014,"month":0,"date":23,"hours":18,"minutes":59},"metric":{"temp":6,"tempFeels":2,"windSpeed":22},"imperial":{"temp":42.8,"tempFeels":35.6,"windSpeed":49.28},"precipType":null,"propPrecip":null,"humidity":66,"pressure":"1013.88","windDeg":290,"windDir":"WNW","icon":"few_clouds_day","condition":"Fair","uv":0}},{"date":{"year":2014,"month":0,"date":24,"hours":18,"minutes":59},"timestamp":1390590000,"metric":{"tempMin":7,"tempMax":7,"windSpeed":20},"imperial":{"tempMin":44.6,"tempMax":44.6,"windSpeed":44.800000000000004},"precipType":"rain","propPrecip":90,"pressure":null,"humidity":88,"icon":"shower_rain_day","condition":"Light Rain","windDeg":162,"windDir":"SSE","uv":0,"hourly":[{"timestamp":1390521600,"date":{"year":2014,"month":0,"date":24,"hours":0,"minutes":0},"metric":{"temp":3,"tempFeels":1,"windSpeed":11},"imperial":{"temp":37.4,"tempFeels":33.8,"windSpeed":24.64},"precipType":"precip","propPrecip":10,"humidity":79,"windDeg":280,"windDir":"W","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390525200,"date":{"year":2014,"month":0,"date":24,"hours":1,"minutes":0},"metric":{"temp":3,"tempFeels":1,"windSpeed":9},"imperial":{"temp":37.4,"tempFeels":33.8,"windSpeed":20.160000000000004},"precipType":"precip","propPrecip":10,"humidity":79,"windDeg":271,"windDir":"W","icon":"scattered_clouds_day","condition":"Partly Cloudy","uv":0},{"timestamp":1390528800,"date":{"year":2014,"month":0,"date":24,"hours":2,"minutes":0},"metric":{"temp":3,"tempFeels":1,"windSpeed":8},"imperial":{"temp":37.4,"tempFeels":33.8,"windSpeed":17.92},"precipType":"precip","propPrecip":10,"humidity":79,"windDeg":259,"windDir":"W","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390532400,"date":{"year":2014,"month":0,"date":24,"hours":3,"minutes":0},"metric":{"temp":3,"tempFeels":2,"windSpeed":6},"imperial":{"temp":37.4,"tempFeels":35.6,"windSpeed":13.440000000000001},"precipType":"precip","propPrecip":20,"humidity":82,"windDeg":244,"windDir":"WSW","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390536000,"date":{"year":2014,"month":0,"date":24,"hours":4,"minutes":0},"metric":{"temp":3,"tempFeels":2,"windSpeed":6},"imperial":{"temp":37.4,"tempFeels":35.6,"windSpeed":13.440000000000001},"precipType":"precip","propPrecip":20,"humidity":86,"windDeg":228,"windDir":"SW","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390539600,"date":{"year":2014,"month":0,"date":24,"hours":5,"minutes":0},"metric":{"temp":4,"tempFeels":2,"windSpeed":8},"imperial":{"temp":39.2,"tempFeels":35.6,"windSpeed":17.92},"precipType":"rain","propPrecip":20,"humidity":82,"windDeg":210,"windDir":"SSW","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390543200,"date":{"year":2014,"month":0,"date":24,"hours":6,"minutes":0},"metric":{"temp":4,"tempFeels":2,"windSpeed":8},"imperial":{"temp":39.2,"tempFeels":35.6,"windSpeed":17.92},"precipType":"rain","propPrecip":20,"humidity":86,"windDeg":194,"windDir":"SSW","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390546800,"date":{"year":2014,"month":0,"date":24,"hours":7,"minutes":0},"metric":{"temp":4,"tempFeels":2,"windSpeed":9},"imperial":{"temp":39.2,"tempFeels":35.6,"windSpeed":20.160000000000004},"precipType":"rain","propPrecip":20,"humidity":86,"windDeg":179,"windDir":"S","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390550400,"date":{"year":2014,"month":0,"date":24,"hours":8,"minutes":0},"metric":{"temp":5,"tempFeels":2,"windSpeed":12},"imperial":{"temp":41,"tempFeels":35.6,"windSpeed":26.880000000000003},"precipType":"rain","propPrecip":20,"humidity":86,"windDeg":168,"windDir":"SSE","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390554000,"date":{"year":2014,"month":0,"date":24,"hours":9,"minutes":0},"metric":{"temp":5,"tempFeels":1,"windSpeed":14},"imperial":{"temp":41,"tempFeels":33.8,"windSpeed":31.360000000000003},"precipType":"rain","propPrecip":20,"humidity":86,"windDeg":160,"windDir":"SSE","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390557600,"date":{"year":2014,"month":0,"date":24,"hours":10,"minutes":0},"metric":{"temp":5,"tempFeels":1,"windSpeed":16},"imperial":{"temp":41,"tempFeels":33.8,"windSpeed":35.84},"precipType":"rain","propPrecip":20,"humidity":89,"windDeg":159,"windDir":"SSE","icon":"broken_clouds_day","condition":"Cloudy","uv":0},{"timestamp":1390561200,"date":{"year":2014,"month":0,"date":24,"hours":11,"minutes":0},"metric":{"temp":5,"tempFeels":2,"windSpeed":17},"imperial":{"temp":41,"tempFeels":35.6,"windSpeed":38.080000000000005},"precipType":"rain","propPrecip":50,"humidity":89,"windDeg":161,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390564800,"date":{"year":2014,"month":0,"date":24,"hours":12,"minutes":0},"metric":{"temp":6,"tempFeels":2,"windSpeed":19},"imperial":{"temp":42.8,"tempFeels":35.6,"windSpeed":42.56},"precipType":"rain","propPrecip":70,"humidity":89,"windDeg":163,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390568400,"date":{"year":2014,"month":0,"date":24,"hours":13,"minutes":0},"metric":{"temp":6,"tempFeels":3,"windSpeed":19},"imperial":{"temp":42.8,"tempFeels":37.4,"windSpeed":42.56},"precipType":"rain","propPrecip":80,"humidity":89,"windDeg":163,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390572000,"date":{"year":2014,"month":0,"date":24,"hours":14,"minutes":0},"metric":{"temp":7,"tempFeels":3,"windSpeed":20},"imperial":{"temp":44.6,"tempFeels":37.4,"windSpeed":44.800000000000004},"precipType":"rain","propPrecip":80,"humidity":89,"windDeg":161,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390575600,"date":{"year":2014,"month":0,"date":24,"hours":15,"minutes":0},"metric":{"temp":7,"tempFeels":4,"windSpeed":20},"imperial":{"temp":44.6,"tempFeels":39.2,"windSpeed":44.800000000000004},"precipType":"rain","propPrecip":70,"humidity":86,"windDeg":158,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390579200,"date":{"year":2014,"month":0,"date":24,"hours":16,"minutes":0},"metric":{"temp":7,"tempFeels":4,"windSpeed":19},"imperial":{"temp":44.6,"tempFeels":39.2,"windSpeed":42.56},"precipType":"rain","propPrecip":80,"humidity":86,"windDeg":155,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390582800,"date":{"year":2014,"month":0,"date":24,"hours":17,"minutes":0},"metric":{"temp":7,"tempFeels":4,"windSpeed":19},"imperial":{"temp":44.6,"tempFeels":39.2,"windSpeed":42.56},"precipType":"rain","propPrecip":80,"humidity":89,"windDeg":154,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390586400,"date":{"year":2014,"month":0,"date":24,"hours":18,"minutes":0},"metric":{"temp":7,"tempFeels":5,"windSpeed":17},"imperial":{"temp":44.6,"tempFeels":41,"windSpeed":38.080000000000005},"precipType":"rain","propPrecip":90,"humidity":89,"windDeg":153,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390590000,"date":{"year":2014,"month":0,"date":24,"hours":19,"minutes":0},"metric":{"temp":7,"tempFeels":5,"windSpeed":16},"imperial":{"temp":44.6,"tempFeels":41,"windSpeed":35.84},"precipType":"rain","propPrecip":90,"humidity":93,"windDeg":154,"windDir":"SSE","icon":"shower_rain_day","condition":"Light Rain","uv":0},{"timestamp":1390593600,"date":{"year":2014,"month":0,"date":24,"hours":20,"minutes":0},"metric":{"temp":8,"tempFeels":5,"windSpeed":16},"imperial":{"temp":46.4,"tempFeels":41,"windSpeed":35.84},"precipType":"rain","propPrecip":90,"humidity":93,"windDeg":156,"windDir":"SSE","icon":"rain_day","condition":"Rain","uv":0}]},{"date":{"year":2014,"month":0,"date":25,"hours":18,"minutes":59},"timestamp":1390676400,"metric":{"tempMin":2,"tempMax":11,"windSpeed":27},"imperial":{"tempMin":35.6,"tempMax":51.8,"windSpeed":60.480000000000004},"precipType":"rain","propPrecip":80,"pressure":null,"humidity":83,"icon":"shower_rain_day","condition":"Showers","windDeg":256,"windDir":"WSW","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":26,"hours":18,"minutes":59},"timestamp":1390762800,"metric":{"tempMin":2,"tempMax":8,"windSpeed":27},"imperial":{"tempMin":35.6,"tempMax":46.4,"windSpeed":60.480000000000004},"precipType":"rain","propPrecip":100,"pressure":null,"humidity":80,"icon":"rain_day","condition":"Rain","windDeg":227,"windDir":"SW","uv":0,"hourly":[]},{"date":{"year":2014,"month":0,"date":27,"hours":18,"minutes":59},"timestamp":1390849200,"metric":{"tempMin":3,"tempMax":7,"windSpeed":30},"imperial":{"tempMin":37.4,"tempMax":44.6,"windSpeed":67.2},"precipType":"rain","propPrecip":40,"pressure":null,"humidity":74,"icon":"shower_rain_day","condition":"Showers","windDeg":247,"windDir":"WSW","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":28,"hours":18,"minutes":59},"timestamp":1390935600,"metric":{"tempMin":3,"tempMax":7,"windSpeed":22},"imperial":{"tempMin":37.4,"tempMax":44.6,"windSpeed":49.28},"precipType":"rain","propPrecip":80,"pressure":null,"humidity":82,"icon":"shower_rain_day","condition":"Light Rain","windDeg":193,"windDir":"SSW","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":29,"hours":18,"minutes":59},"timestamp":1391022000,"metric":{"tempMin":2,"tempMax":5,"windSpeed":24},"imperial":{"tempMin":35.6,"tempMax":41,"windSpeed":53.760000000000005},"precipType":"rain","propPrecip":40,"pressure":null,"humidity":85,"icon":"rain_day","condition":"Scattered Showers","windDeg":346,"windDir":"NNW","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":30,"hours":18,"minutes":59},"timestamp":1391108400,"metric":{"tempMin":1,"tempMax":5,"windSpeed":16},"imperial":{"tempMin":33.8,"tempMax":41,"windSpeed":35.84},"precipType":"rain","propPrecip":30,"pressure":null,"humidity":82,"icon":"rain_day","condition":"Scattered Showers","windDeg":332,"windDir":"NNW","uv":1,"hourly":[]},{"date":{"year":2014,"month":0,"date":31,"hours":18,"minutes":59},"timestamp":1391194800,"metric":{"tempMin":2,"tempMax":6,"windSpeed":16},"imperial":{"tempMin":35.6,"tempMax":42.8,"windSpeed":35.84},"precipType":"rain","propPrecip":60,"pressure":null,"humidity":81,"icon":"shower_rain_day","condition":"Rain / Snow Showers","windDeg":225,"windDir":"SW","uv":1,"hourly":[]},{"date":{"year":2014,"month":1,"date":1,"hours":18,"minutes":59},"timestamp":1391281200,"metric":{"tempMin":2,"tempMax":6,"windSpeed":16},"imperial":{"tempMin":35.6,"tempMax":42.8,"windSpeed":35.84},"precipType":"rain","propPrecip":40,"pressure":null,"humidity":80,"icon":"shower_rain_day","condition":"Showers","windDeg":241,"windDir":"WSW","uv":1,"hourly":[]}],"save":true,"updated":1390510095272}
816
817=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
818--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-01-31 21:06:15 +0000
819+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-02-15 10:25:31 +0000
820@@ -134,6 +134,8 @@
821 db_file = "34e1e542f2f083ff18f537b07a380071.sqlite"
822 db_path = os.path.join(db_dir, db_file)
823
824+ json_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..', 'files'))
825+
826 def _execute_sql(self, statement):
827 conn = sqlite3.connect(self.db_path)
828 cursor = conn.cursor()
829@@ -174,7 +176,18 @@
830 self._execute_sql("CREATE TABLE IF NOT EXISTS settings(key TEXT "
831 "UNIQUE, value TEXT)")
832
833- def add_locations_to_database(self, locations):
834+ def get_locations_data(self):
835+ result = []
836+ json_files = [self.json_path+'/1.json', self.json_path+'/2.json']
837+ for path in json_files:
838+ with open(path) as fh:
839+ json_str = fh.read()
840+ result.append(json_str.strip())
841+ fh.close()
842+ return result
843+
844+ def add_locations_to_database(self, limit=None):
845+ locations = self.get_locations_data()
846 conn = sqlite3.connect(self.db_path)
847 cursor = conn.cursor()
848 logger.debug("Adding locations to database")
849@@ -190,4 +203,5 @@
850 self._execute_sql("INSERT INTO settings(key, value) "
851 "VALUES('units', 'metric'), "
852 "('wind_units', 'kmh'), "
853- "('precip_units', 'mm')")
854+ "('precip_units', 'mm'),"
855+ "('service', 'weatherchannel')")
856
857=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
858--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-01-01 03:14:56 +0000
859+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-02-15 10:25:31 +0000
860@@ -13,7 +13,6 @@
861 from autopilot.matchers import Eventually
862
863 from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin
864-from ubuntu_weather_app.tests.weatherdata import locations_data
865
866 from time import sleep
867 import logging
868@@ -37,7 +36,7 @@
869 self.create_blank_db()
870 # add locations to storage
871 logger.debug("Adding fake data to new database")
872- self.add_locations_to_database(locations_data)
873+ self.add_locations_to_database()
874 logger.debug("Re-Launching app to introspect")
875 super(TestLocationManager, self).setUp()
876 self.assertThat(
877
878=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
879--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-12-17 18:52:10 +0000
880+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-02-15 10:25:31 +0000
881@@ -17,7 +17,6 @@
882 import logging
883
884 from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin
885-from ubuntu_weather_app.tests.weatherdata import locations_data
886
887 logger = logging.getLogger(__name__)
888
889@@ -30,7 +29,7 @@
890 #we want to start with fake location data
891 self.create_blank_db()
892 logger.debug("Adding fake data to new database")
893- self.add_locations_to_database(locations_data)
894+ self.add_locations_to_database()
895 logger.debug("Re-Launching app to introspect")
896 super(TestMainView, self).setUp()
897 self.assertThat(
898
899=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
900--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-12-17 18:52:10 +0000
901+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-02-15 10:25:31 +0000
902@@ -9,12 +9,12 @@
903
904 from __future__ import absolute_import
905
906+from unittest import skip
907 from testtools.matchers import Equals, Is, Not
908 from autopilot.matchers import Eventually
909 import logging
910
911 from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin
912-from ubuntu_weather_app.tests.weatherdata import locations_data
913
914 logger = logging.getLogger(__name__)
915
916@@ -23,7 +23,7 @@
917 #we want to start with fake settings data
918 self.create_blank_db()
919 logger.debug("Adding fake data to new database")
920- self.add_locations_to_database(locations_data)
921+ self.add_locations_to_database()
922 self.add_units_to_database()
923 super(TestSettings, self).setUp()
924 self.assertThat(
925@@ -35,69 +35,101 @@
926
927 def _move_pointer_around(self):
928 """Helper method to move the pointer around, to assure selector is opened"""
929- self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'), Eventually(Not(Is(None))))
930+ self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'),
931+ Eventually(Not(Is(None))))
932 sheet = self.main_window.select_single('ComposerSheet', objectName='SettingsSheet')
933 self.pointing_device.move_to_object(sheet)
934
935 def _check_units(self, units):
936 """Checks selected units by values from the first location tab"""
937- self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'), Eventually(Not(Is(None))))
938+ self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'),
939+ Eventually(Not(Is(None))))
940 current_location_tab = self.main_window.select_single(
941 'LocationTab', visible=True)
942 today_item = current_location_tab.select_single(
943 'QQuickItem', focus=True)
944 today_temp = today_item.select_single(
945 'QQuickText', objectName='CurrentTempText')
946+ today_temp_scale = today_item.select_single(
947+ 'QQuickText', objectName='CurrentTempScale')
948 tomorrow_item = today_item.get_parent().get_children_by_type(
949 'QQuickItem', focus=False, z=1)
950 tomorrow_temp = tomorrow_item[0].select_single(
951 'QQuickText', objectName='CurrentTempText')
952 if units == "imperial":
953- self.assertThat(today_temp.text, Eventually(Equals(u'57')))
954- self.assertThat(tomorrow_temp.text, Eventually(Equals(u'69')))
955+ self.assertThat(today_temp_scale.text, Eventually(Equals(u'°F')))
956+ self.assertThat(today_temp.text, Eventually(Equals(u'26')))
957+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'23')))
958 else:
959- self.assertThat(today_temp.text, Eventually(Equals(u'14')))
960- self.assertThat(tomorrow_temp.text, Eventually(Equals(u'21')))
961+ self.assertThat(today_temp_scale.text, Eventually(Equals(u'°C')))
962+ self.assertThat(today_temp.text, Eventually(Equals(u'-3')))
963+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'-5')))
964
965 def _check_wind_units(self, wind_units):
966 """Checks selected units by values from the first location tab"""
967- self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], Eventually(Not(Is(None))))
968+ self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0],
969+ Eventually(Not(Is(None))))
970 current_location_tab = self.main_window.select_single(
971 'LocationTab', visible=True)
972 focused_item = current_location_tab.select_single(
973 'QQuickItem', focus=True)
974 wind_component = focused_item.select_single(
975 'WeatherDetailComponent', objectName='WindSpeedValue')
976- self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
977+ self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'),
978+ Eventually(Not(Is(None))))
979 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')
980- self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
981+ self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'),
982+ Eventually(Not(Is(None))))
983 wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')
984 if wind_units == "mph":
985- self.assertThat(wind_unit.text, Eventually(Equals(u'mph SE')))
986- self.assertThat(wind_value.text, Eventually(Equals(u'9')))
987+ self.assertThat(wind_unit.text, Eventually(Equals(u'mph ESE')))
988+ self.assertThat(wind_value.text, Eventually(Equals(u'49')))
989 else:
990- self.assertThat(wind_unit.text, Eventually(Equals(u'km/h SE')))
991- self.assertThat(wind_value.text, Eventually(Equals(u'15')))
992+ self.assertThat(wind_unit.text, Eventually(Equals(u'km/h ESE')))
993+ self.assertThat(wind_value.text, Eventually(Equals(u'22')))
994
995 def _check_precipitation_units(self, pre_units):
996 """Checks selected units by values from the first location tab"""
997- self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], Eventually(Not(Is(None))))
998+ self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0],
999+ Eventually(Not(Is(None))))
1000 current_location_tab = self.main_window.select_single(
1001 'LocationTab', visible=True)
1002 focused_item = current_location_tab.select_single(
1003 'QQuickItem', focus=True)
1004 component = focused_item.select_single(
1005 'WeatherDetailComponent', objectName='PrecipitationValue')
1006- self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
1007+ self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'),
1008+ Eventually(Not(Is(None))))
1009 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
1010- self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
1011+ self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'),
1012+ Eventually(Not(Is(None))))
1013 value = component.select_single('QQuickText', objectName='WeatherDetailValue')
1014 if pre_units == "in":
1015 self.assertThat(unit.text, Eventually(Equals(u'in')))
1016 self.assertThat(value.text, Eventually(Equals(u'0.18')))
1017 else:
1018 self.assertThat(unit.text, Eventually(Equals(u'mm')))
1019- self.assertThat(value.text, Eventually(Equals(u'4.5')))
1020+ self.assertThat(value.text, Eventually(Equals(u'0.5')))
1021+
1022+ def _check_service(self, service):
1023+ """Checks selected units weather data service from the first location tab"""
1024+ self.assertThat(lambda: self.main_window.select_many('TabFooter', objectName='TabFooter')[0],
1025+ Eventually(Not(Is(None))))
1026+ current_location_tab = self.main_window.select_single('LocationTab', visible=True)
1027+ self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'),
1028+ Eventually(Not(Is(None))))
1029+ self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'),
1030+ Eventually(Not(Is(None))))
1031+
1032+ focused_item = current_location_tab.select_single('QQuickItem', focus=True)
1033+ tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter')
1034+ provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo')
1035+ if service == "weatherchannel":
1036+ self.assertThat(tab_footer.visible, Eventually(Equals(True)))
1037+ self.assertThat(provider_logo.visible, Eventually(Equals(False)))
1038+ elif service == "openweathermap":
1039+ self.assertThat(tab_footer.visible, Eventually(Equals(False)))
1040+ self.assertThat(provider_logo.visible, Eventually(Equals(True)))
1041
1042 def test_switch_scale(self):
1043 """Tests switching the scale in the settings"""
1044@@ -106,7 +138,8 @@
1045 self._open_settings_sheet()
1046
1047 # open the value selector
1048- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))
1049+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
1050+ Eventually(Not(Is(None))))
1051 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
1052 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1053 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1054@@ -128,7 +161,8 @@
1055
1056 # switch back to metric values again
1057 self._open_settings_sheet()
1058- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))
1059+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
1060+ Eventually(Not(Is(None))))
1061 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
1062 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1063 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
1064@@ -161,7 +195,8 @@
1065 self._open_settings_sheet()
1066
1067 # open the temp value selector
1068- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))
1069+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
1070+ Eventually(Not(Is(None))))
1071 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
1072 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1073 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1074@@ -176,7 +211,8 @@
1075 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1076
1077 # open the wind value selector
1078- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))
1079+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
1080+ Eventually(Not(Is(None))))
1081 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
1082 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1083 self.pointing_device.click_object(units_selector)
1084@@ -200,7 +236,8 @@
1085 self._open_settings_sheet()
1086
1087 # open the wind value selector
1088- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))
1089+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
1090+ Eventually(Not(Is(None))))
1091 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
1092 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1093 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1094@@ -222,7 +259,8 @@
1095
1096 # switch back to kmh values again
1097 self._open_settings_sheet()
1098- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))
1099+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
1100+ Eventually(Not(Is(None))))
1101 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
1102 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1103 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
1104@@ -247,6 +285,7 @@
1105 self.assertThat(load_indicator.running, Eventually(Equals(False)))
1106 self._check_wind_units('kmh')
1107
1108+ @skip("data not available")
1109 def test_switch_precipitation_scale(self):
1110 """Tests switching the precipition scale in the settings"""
1111 # first check metric values and open the settings sheet
1112@@ -254,7 +293,8 @@
1113 self._open_settings_sheet()
1114
1115 # open the precipitation value selector
1116- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
1117+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
1118+ Eventually(Not(Is(None))))
1119 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
1120 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1121 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1122@@ -276,7 +316,8 @@
1123
1124 # switch back to mm values again
1125 self._open_settings_sheet()
1126- self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
1127+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
1128+ Eventually(Not(Is(None))))
1129 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
1130 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1131 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
1132@@ -303,3 +344,68 @@
1133 self.assertThat(load_indicator.running, Eventually(Equals(False)))
1134 self._check_precipitation_units('mm')
1135
1136+ def test_switch_service(self):
1137+ """Tests switching the scale in the settings"""
1138+ # first check metric values and open the settings sheet
1139+ self._check_service('weatherchannel')
1140+ self._open_settings_sheet()
1141+
1142+ # open the value selector
1143+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
1144+ units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")
1145+ self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1146+ self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1147+ current_option = units_selector.select_many('ShapeItem')[1]
1148+ self.pointing_device.click_object(current_option)
1149+
1150+ # choose second option, openweathermap
1151+ self._move_pointer_around()
1152+ self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
1153+ second_option = units_selector.select_many('ShapeItem')[2]
1154+ self.pointing_device.click_object(second_option)
1155+ self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1156+
1157+ # check if precipitation units selector appears
1158+ self.assertThat(lambda: self.main_window.select_single('OptionSelector',
1159+ objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
1160+ units_selector = self.main_window.select_single('OptionSelector',
1161+ objectName="PrecipitationUnitsSelector")
1162+ self.assertThat(units_selector.visible, Eventually(Equals(1)))
1163+ self._click_sheet_confirm()
1164+
1165+ # wait for reload and check the used service
1166+ load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')
1167+ self.assertThat(load_indicator.running, Eventually(Equals(False)))
1168+ self._check_service('openweathermap')
1169+
1170+ # switch back to metric values again
1171+ self._open_settings_sheet()
1172+ self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
1173+ units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")
1174+ self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
1175+ self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
1176+ current_option = units_selector.select_many('ShapeItem')[2]
1177+ self.pointing_device.click_object(current_option)
1178+ # while it's opened, units_selector returns false
1179+ # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
1180+
1181+ # click twc option
1182+ self._move_pointer_around()
1183+ self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
1184+ first_option = units_selector.select_single(
1185+ 'OptionSelectorDelegate', objectName='twcOption')
1186+ self.pointing_device.click_object(first_option)
1187+ self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
1188+
1189+ # check if precipitation units selector disappears and confirm
1190+ self.assertThat(lambda: self.main_window.select_single('OptionSelector',
1191+ objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
1192+ units_selector = self.main_window.select_single('OptionSelector',
1193+ objectName="PrecipitationUnitsSelector")
1194+ self.assertThat(units_selector.visible, Eventually(Equals(0)))
1195+ self._click_sheet_confirm()
1196+
1197+ # wait for reload and check the metric values again
1198+ load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')
1199+ self.assertThat(load_indicator.running, Eventually(Equals(False)))
1200+ self._check_service('weatherchannel')
1201
1202=== removed file 'tests/autopilot/ubuntu_weather_app/tests/weatherdata.py'
1203--- tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 2013-09-29 14:26:37 +0000
1204+++ tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 1970-01-01 00:00:00 +0000
1205@@ -1,10 +0,0 @@
1206-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1207-# Copyright 2013 Canonical
1208-#
1209-# This program is free software: you can redistribute it and/or modify it
1210-# under the terms of the GNU General Public License version 3, as published
1211-# by the Free Software Foundation.
1212-locations_data = []
1213-
1214-locations_data.append("""{"updated":1380365253015,"save":false,"db":{"updated":"2013-09-28T10:47:33.015Z","id":4},"data":[{"icon":"few_clouds_day","windDir":"SE","timestamp":1380366000,"hourly":[{"icon":"clear_night","windDir":"?","timestamp":1380326400,"pressure":1028.65,"metric":{"rain":0,"temp":14,"snow":0,"windSpeed":null},"date":{"hours":1,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"01n","description":"sky is clear","id":800,"main":"Clear"},"humidity":85,"imperial":{"rain":0,"temp":57.2,"snow":0,"windSpeed":null}},{"icon":"few_clouds_day","windDir":"?","timestamp":1380369600,"pressure":1028.49,"metric":{"rain":0,"temp":23.85,"snow":0,"windSpeed":null},"date":{"hours":13,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"02d","description":"few clouds","id":801,"main":"Clouds"},"humidity":88,"imperial":{"rain":0,"temp":74.93,"snow":0,"windSpeed":null}},{"icon":"few_clouds_day","windDir":"?","timestamp":1380380400,"pressure":1027.9,"metric":{"rain":0,"temp":23.67,"snow":0,"windSpeed":null},"date":{"hours":16,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"02d","description":"few clouds","id":801,"main":"Clouds"},"humidity":77,"imperial":{"rain":0,"temp":74.606,"snow":0,"windSpeed":null}},{"icon":"few_clouds_night","windDir":"?","timestamp":1380391200,"pressure":1028.23,"metric":{"rain":0,"temp":19.09,"snow":0,"windSpeed":null},"date":{"hours":19,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"02n","description":"sky is clear","id":800,"main":"Clear"},"humidity":79,"imperial":{"rain":0,"temp":66.362,"snow":0,"windSpeed":null}},{"icon":"few_clouds_night","windDir":"?","timestamp":1380402000,"pressure":1028.46,"metric":{"rain":0,"temp":16.22,"snow":0,"windSpeed":null},"date":{"hours":22,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"02n","description":"sky is clear","id":800,"main":"Clear"},"humidity":89,"imperial":{"rain":0,"temp":61.196,"snow":0,"windSpeed":null}}],"windDeg":126,"pressure":1028.49,"current":{"icon":"scattered_clouds_day","windDir":"?","timestamp":1380363600,"pressure":1017,"service_id":2901791,"metric":{"rain":0,"temp":14,"snow":0,"windSpeed":null},"date":{"hours":11,"year":2013,"month":8,"date":28,"minutes":59},"condition":{"icon":"03d","description":"scattered clouds","id":802,"main":"Clouds"},"humidity":54,"imperial":{"rain":0,"temp":57.2,"snow":0,"windSpeed":null},"service":"openweathermap"},"metric":{"rain":4.5,"tempMin":14,"snow":0,"windSpeed":14.940000000000001,"tempMax":23.85},"date":{"hours":11,"year":2013,"month":8,"date":27,"minutes":59},"condition":{"icon":"02d","description":"few clouds","id":801,"main":"Clouds"},"humidity":88,"imperial":{"rain":0.18,"tempMin":57.2,"snow":0,"windSpeed":9.296000000000001,"tempMax":74.93}},{"icon":"broken_clouds_day","windDir":"E","timestamp":1380452400,"hourly":[{"icon":"broken_clouds_day","windDir":"?","timestamp":1380445200,"pressure":1026.6,"metric":{"rain":0,"temp":18.53,"snow":0,"windSpeed":null},"date":{"hours":10,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"broken clouds","id":803,"main":"Clouds"},"humidity":86,"imperial":{"rain":0,"temp":65.35400000000001,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380456000,"pressure":1025.07,"metric":{"rain":0,"temp":20.5,"snow":0,"windSpeed":null},"date":{"hours":13,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":80,"imperial":{"rain":0,"temp":68.9,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380466800,"pressure":1023.89,"metric":{"rain":0,"temp":20.31,"snow":0,"windSpeed":null},"date":{"hours":16,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":76,"imperial":{"rain":0,"temp":68.55799999999999,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380477600,"pressure":1022.89,"metric":{"rain":0,"temp":18.92,"snow":0,"windSpeed":null},"date":{"hours":19,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":75,"imperial":{"rain":0,"temp":66.05600000000001,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380488400,"pressure":1022.73,"metric":{"rain":0,"temp":17.72,"snow":0,"windSpeed":null},"date":{"hours":22,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":80,"imperial":{"rain":0,"temp":63.896,"snow":0,"windSpeed":null}}],"windDeg":112,"pressure":1025.07,"metric":{"rain":0,"tempMin":16.31,"snow":0,"windSpeed":22.14,"tempMax":20.5},"date":{"hours":11,"year":2013,"month":8,"date":29,"minutes":59},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":80,"imperial":{"rain":0,"tempMin":61.358,"snow":0,"windSpeed":13.776000000000002,"tempMax":68.9}},{"icon":"clear_day","windDir":"E","timestamp":1380538800,"hourly":[{"icon":"broken_clouds_night","windDir":"?","timestamp":1380499200,"pressure":1022.13,"metric":{"rain":0,"temp":16.31,"snow":0,"windSpeed":null},"date":{"hours":1,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":88,"imperial":{"rain":0,"temp":61.358,"snow":0,"windSpeed":null}},{"icon":"clear_day","windDir":"?","timestamp":1380520800,"pressure":1021.33,"metric":{"rain":0,"temp":12.73,"snow":0,"windSpeed":null},"date":{"hours":7,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":95,"imperial":{"rain":0,"temp":54.914,"snow":0,"windSpeed":null}},{"icon":"clear_day","windDir":"?","timestamp":1380542400,"pressure":1020.95,"metric":{"rain":0,"temp":20.18,"snow":0,"windSpeed":null},"date":{"hours":13,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":81,"imperial":{"rain":0,"temp":68.324,"snow":0,"windSpeed":null}},{"icon":"clear_day","windDir":"?","timestamp":1380553200,"pressure":1020.58,"metric":{"rain":0,"temp":20.07,"snow":0,"windSpeed":null},"date":{"hours":16,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":73,"imperial":{"rain":0,"temp":68.126,"snow":0,"windSpeed":null}},{"icon":"clear_night","windDir":"?","timestamp":1380564000,"pressure":1021.41,"metric":{"rain":0,"temp":16.35,"snow":0,"windSpeed":null},"date":{"hours":19,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"01n","description":"sky is clear","id":800,"main":"Clear"},"humidity":73,"imperial":{"rain":0,"temp":61.43000000000001,"snow":0,"windSpeed":null}},{"icon":"clear_night","windDir":"?","timestamp":1380574800,"pressure":1022.26,"metric":{"rain":0,"temp":13.65,"snow":0,"windSpeed":null},"date":{"hours":22,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"01n","description":"sky is clear","id":800,"main":"Clear"},"humidity":88,"imperial":{"rain":0,"temp":56.57,"snow":0,"windSpeed":null}}],"windDeg":90,"pressure":1020.95,"metric":{"rain":0,"tempMin":12.73,"snow":0,"windSpeed":19.836,"tempMax":20.18},"date":{"hours":11,"year":2013,"month":8,"date":30,"minutes":59},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":81,"imperial":{"rain":0,"tempMin":54.914,"snow":0,"windSpeed":12.342400000000001,"tempMax":68.324}},{"icon":"rain_day","windDir":"SE","timestamp":1380625200,"hourly":[{"icon":"clear_night","windDir":"?","timestamp":1380585600,"pressure":1023.05,"metric":{"rain":0,"temp":11.61,"snow":0,"windSpeed":null},"date":{"hours":1,"year":2013,"month":9,"date":1,"minutes":0},"condition":{"icon":"01n","description":"sky is clear","id":800,"main":"Clear"},"humidity":93,"imperial":{"rain":0,"temp":52.897999999999996,"snow":0,"windSpeed":null}}],"windDeg":126,"pressure":1021.34,"metric":{"rain":3.8,"tempMin":12.35,"snow":0,"windSpeed":26.28,"tempMax":14.4},"date":{"hours":11,"year":2013,"month":9,"date":1,"minutes":59},"condition":{"icon":"10d","description":"moderate rain","id":501,"main":"Rain"},"humidity":0,"imperial":{"rain":0.14960629921259844,"tempMin":54.230000000000004,"snow":0,"windSpeed":16.352,"tempMax":57.92}},{"icon":"rain_day","windDir":"S","timestamp":1380711600,"hourly":[],"windDeg":157,"pressure":1020.34,"metric":{"rain":4.5,"tempMin":14.4,"snow":0,"windSpeed":27.684,"tempMax":19.5},"date":{"hours":11,"year":2013,"month":9,"date":2,"minutes":59},"condition":{"icon":"10d","description":"moderate rain","id":501,"main":"Rain"},"humidity":0,"imperial":{"rain":0.17716535433070868,"tempMin":57.92,"snow":0,"windSpeed":17.225600000000004,"tempMax":67.1}},{"icon":"rain_day","windDir":"W","timestamp":1380798000,"hourly":[],"windDeg":275,"pressure":1031.07,"metric":{"rain":1.98,"tempMin":8.5,"snow":0,"windSpeed":18.144000000000002,"tempMax":16.47},"date":{"hours":11,"year":2013,"month":9,"date":3,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.07795275590551182,"tempMin":47.3,"snow":0,"windSpeed":11.289600000000002,"tempMax":61.646}},{"icon":"rain_day","windDir":"SE","timestamp":1380884400,"hourly":[],"windDeg":148,"pressure":1035.38,"metric":{"rain":0.45,"tempMin":8.11,"snow":0,"windSpeed":12.204,"tempMax":16.12},"date":{"hours":11,"year":2013,"month":9,"date":4,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.017716535433070866,"tempMin":46.598,"snow":0,"windSpeed":7.593600000000001,"tempMax":61.016000000000005}},{"icon":"rain_day","windDir":"S","timestamp":1380970800,"hourly":[],"windDeg":207,"pressure":1029.73,"metric":{"rain":0.27,"tempMin":11.04,"snow":0,"windSpeed":12.420000000000002,"tempMax":18.91},"date":{"hours":11,"year":2013,"month":9,"date":5,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.010629921259842521,"tempMin":51.872,"snow":0,"windSpeed":7.7280000000000015,"tempMax":66.03800000000001}},{"icon":"rain_day","windDir":"NW","timestamp":1381057200,"hourly":[],"windDeg":321,"pressure":1033.6,"metric":{"rain":0.88,"tempMin":10.94,"snow":0,"windSpeed":2.52,"tempMax":18.08},"date":{"hours":11,"year":2013,"month":9,"date":6,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.03464566929133858,"tempMin":51.692,"snow":0,"windSpeed":1.568,"tempMax":64.544}},{"icon":"rain_day","windDir":"S","timestamp":1381143600,"hourly":[],"windDeg":158,"pressure":1033.92,"metric":{"rain":0,"tempMin":12.05,"snow":0,"windSpeed":17.496000000000002,"tempMax":17.5},"date":{"hours":11,"year":2013,"month":9,"date":7,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0,"tempMin":53.69,"snow":0,"windSpeed":10.886400000000002,"tempMax":63.5}}],"format":20130927,"location":{"coord":{"lon":"10.01534","lat":"53.57532"},"timezone":{"gmtOffset":1,"dstOffset":2,"timeZoneId":"Europe/Berlin"},"areaLabel":"Hamburg, Germany","population":1739117,"adminName2":"","name":"Hamburg","country":"DE","countryName":"Germany","adminName1":"Hamburg","adminName3":"","services":{"geonames":2911298,"openweathermap":2901791}}}""")
1215-locations_data.append("""{"updated":1380365252972,"save":false,"db":{"updated":"2013-09-28T10:47:32.972Z","id":3},"data":[{"icon":"rain_day","windDir":"E","timestamp":1380366000,"hourly":[{"icon":"few_clouds_night","windDir":"?","timestamp":1380326400,"pressure":1016.82,"metric":{"rain":0,"temp":17.47,"snow":0,"windSpeed":null},"date":{"hours":0,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"02n","description":"few clouds","id":801,"main":"Clouds"},"humidity":98,"imperial":{"rain":0,"temp":63.446,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380369600,"pressure":1014.95,"metric":{"rain":0,"temp":22.62,"snow":0,"windSpeed":null},"date":{"hours":12,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"04d","description":"broken clouds","id":803,"main":"Clouds"},"humidity":90,"imperial":{"rain":0,"temp":72.71600000000001,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380380400,"pressure":1014.61,"metric":{"rain":0,"temp":23.06,"snow":0,"windSpeed":null},"date":{"hours":15,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":86,"imperial":{"rain":0,"temp":73.508,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380391200,"pressure":1014.53,"metric":{"rain":0,"temp":21.94,"snow":0,"windSpeed":null},"date":{"hours":18,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":79,"imperial":{"rain":0,"temp":71.492,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380402000,"pressure":1014.68,"metric":{"rain":0,"temp":21.24,"snow":0,"windSpeed":null},"date":{"hours":21,"year":2013,"month":8,"date":28,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":76,"imperial":{"rain":0,"temp":70.232,"snow":0,"windSpeed":null}}],"windDeg":110,"pressure":1014.95,"current":{"icon":"clear_day","windDir":"?","timestamp":1380363600,"pressure":1010,"service_id":2643743,"metric":{"rain":0,"temp":17.47,"snow":0,"windSpeed":null},"date":{"hours":10,"year":2013,"month":8,"date":28,"minutes":59},"condition":{"icon":"01d","description":"Sky is Clear","id":800,"main":"Clear"},"humidity":72,"imperial":{"rain":0,"temp":63.446,"snow":0,"windSpeed":null},"service":"openweathermap"},"metric":{"rain":1,"tempMin":17.47,"snow":0,"windSpeed":8.82,"tempMax":23.06},"date":{"hours":10,"year":2013,"month":8,"date":27,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":90,"imperial":{"rain":0.03937007874015748,"tempMin":63.446,"snow":0,"windSpeed":5.488000000000001,"tempMax":73.508}},{"icon":"rain_day","windDir":"E","timestamp":1380452400,"hourly":[{"icon":"rain_night","windDir":"?","timestamp":1380412800,"pressure":1014.7,"metric":{"rain":0,"temp":19.59,"snow":0,"windSpeed":null},"date":{"hours":0,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"10n","description":"light rain","id":500,"main":"Rain"},"humidity":92,"imperial":{"rain":0,"temp":67.262,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380445200,"pressure":1011.94,"metric":{"rain":0,"temp":19.14,"snow":0,"windSpeed":null},"date":{"hours":9,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":95,"imperial":{"rain":0,"temp":66.452,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380456000,"pressure":1011.13,"metric":{"rain":0,"temp":21.65,"snow":0,"windSpeed":null},"date":{"hours":12,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":93,"imperial":{"rain":0,"temp":70.97,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380466800,"pressure":1010.19,"metric":{"rain":0,"temp":22.25,"snow":0,"windSpeed":null},"date":{"hours":15,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04d","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":89,"imperial":{"rain":0,"temp":72.05000000000001,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380477600,"pressure":1010.16,"metric":{"rain":0,"temp":20.69,"snow":0,"windSpeed":null},"date":{"hours":18,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":91,"imperial":{"rain":0,"temp":69.242,"snow":0,"windSpeed":null}},{"icon":"rain_night","windDir":"?","timestamp":1380488400,"pressure":1010.33,"metric":{"rain":0,"temp":19.22,"snow":0,"windSpeed":null},"date":{"hours":21,"year":2013,"month":8,"date":29,"minutes":0},"condition":{"icon":"10n","description":"light rain","id":500,"main":"Rain"},"humidity":94,"imperial":{"rain":0,"temp":66.596,"snow":0,"windSpeed":null}}],"windDeg":62,"pressure":1011.13,"metric":{"rain":1,"tempMin":18.61,"snow":0,"windSpeed":6.48,"tempMax":22.25},"date":{"hours":10,"year":2013,"month":8,"date":29,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":93,"imperial":{"rain":0.03937007874015748,"tempMin":65.49799999999999,"snow":0,"windSpeed":4.032000000000001,"tempMax":72.05000000000001}},{"icon":"rain_day","windDir":"S","timestamp":1380538800,"hourly":[{"icon":"broken_clouds_night","windDir":"?","timestamp":1380499200,"pressure":1009.97,"metric":{"rain":0,"temp":18.61,"snow":0,"windSpeed":null},"date":{"hours":0,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":97,"imperial":{"rain":0,"temp":65.49799999999999,"snow":0,"windSpeed":null}},{"icon":"rain_night","windDir":"?","timestamp":1380520800,"pressure":1009,"metric":{"rain":0,"temp":17.98,"snow":0,"windSpeed":null},"date":{"hours":6,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"10n","description":"moderate rain","id":501,"main":"Rain"},"humidity":99,"imperial":{"rain":0,"temp":64.364,"snow":0,"windSpeed":null}},{"icon":"rain_day","windDir":"?","timestamp":1380542400,"pressure":1009.12,"metric":{"rain":0,"temp":19.96,"snow":0,"windSpeed":null},"date":{"hours":12,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":99,"imperial":{"rain":0,"temp":67.928,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_day","windDir":"?","timestamp":1380553200,"pressure":1008.74,"metric":{"rain":0,"temp":20.27,"snow":0,"windSpeed":null},"date":{"hours":15,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"04d","description":"broken clouds","id":803,"main":"Clouds"},"humidity":97,"imperial":{"rain":0,"temp":68.48599999999999,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380564000,"pressure":1008.43,"metric":{"rain":0,"temp":19.13,"snow":0,"windSpeed":null},"date":{"hours":18,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"04n","description":"broken clouds","id":803,"main":"Clouds"},"humidity":97,"imperial":{"rain":0,"temp":66.434,"snow":0,"windSpeed":null}},{"icon":"broken_clouds_night","windDir":"?","timestamp":1380574800,"pressure":1008.32,"metric":{"rain":0,"temp":17.73,"snow":0,"windSpeed":null},"date":{"hours":21,"year":2013,"month":8,"date":30,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":98,"imperial":{"rain":0,"temp":63.914,"snow":0,"windSpeed":null}}],"windDeg":163,"pressure":1009.12,"metric":{"rain":6,"tempMin":17.73,"snow":0,"windSpeed":5.256,"tempMax":20.27},"date":{"hours":10,"year":2013,"month":8,"date":30,"minutes":59},"condition":{"icon":"10d","description":"moderate rain","id":501,"main":"Rain"},"humidity":99,"imperial":{"rain":0.2362204724409449,"tempMin":63.914,"snow":0,"windSpeed":3.2704000000000004,"tempMax":68.48599999999999}},{"icon":"rain_day","windDir":"S","timestamp":1380625200,"hourly":[{"icon":"broken_clouds_night","windDir":"?","timestamp":1380585600,"pressure":1008.86,"metric":{"rain":0,"temp":17,"snow":0,"windSpeed":null},"date":{"hours":0,"year":2013,"month":9,"date":1,"minutes":0},"condition":{"icon":"04n","description":"overcast clouds","id":804,"main":"Clouds"},"humidity":98,"imperial":{"rain":0,"temp":62.6,"snow":0,"windSpeed":null}}],"windDeg":163,"pressure":1005.32,"metric":{"rain":7.01,"tempMin":16,"snow":0,"windSpeed":17.568,"tempMax":17.28},"date":{"hours":10,"year":2013,"month":9,"date":1,"minutes":59},"condition":{"icon":"10d","description":"moderate rain","id":501,"main":"Rain"},"humidity":0,"imperial":{"rain":0.27598425196850396,"tempMin":60.8,"snow":0,"windSpeed":10.9312,"tempMax":63.104}},{"icon":"rain_day","windDir":"SW","timestamp":1380711600,"hourly":[],"windDeg":215,"pressure":1004.53,"metric":{"rain":4.74,"tempMin":12.11,"snow":0,"windSpeed":32.976,"tempMax":17.7},"date":{"hours":10,"year":2013,"month":9,"date":2,"minutes":59},"condition":{"icon":"10d","description":"moderate rain","id":501,"main":"Rain"},"humidity":0,"imperial":{"rain":0.18661417322834647,"tempMin":53.798,"snow":0,"windSpeed":20.518400000000003,"tempMax":63.86}},{"icon":"rain_day","windDir":"S","timestamp":1380798000,"hourly":[],"windDeg":202,"pressure":1026.21,"metric":{"rain":1.13,"tempMin":11.77,"snow":0,"windSpeed":21.888,"tempMax":17.19},"date":{"hours":10,"year":2013,"month":9,"date":3,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.04448818897637795,"tempMin":53.186,"snow":0,"windSpeed":13.619200000000001,"tempMax":62.94200000000001}},{"icon":"rain_day","windDir":"S","timestamp":1380884400,"hourly":[],"windDeg":183,"pressure":1024.03,"metric":{"rain":0.97,"tempMin":12.61,"snow":0,"windSpeed":19.44,"tempMax":16.92},"date":{"hours":10,"year":2013,"month":9,"date":4,"minutes":59},"condition":{"icon":"10d","description":"light rain","id":500,"main":"Rain"},"humidity":0,"imperial":{"rain":0.03818897637795276,"tempMin":54.698,"snow":0,"windSpeed":12.096000000000002,"tempMax":62.456}},{"icon":"rain_day","windDir":"W","timestamp":1380970800,"hourly":[],"windDeg":247,"pressure":1023.65,"metric":{"rain":47.45,"tempMin":11.19,"snow":0,"windSpeed":12.78,"tempMax":18.46},"date":{"hours":10,"year":2013,"month":9,"date":5,"minutes":59},"condition":{"icon":"10d","description":"heavy intensity rain","id":502,"main":"Rain"},"humidity":0,"imperial":{"rain":1.8681102362204727,"tempMin":52.141999999999996,"snow":0,"windSpeed":7.952,"tempMax":65.22800000000001}},{"icon":"clear_day","windDir":"E","timestamp":1381057200,"hourly":[],"windDeg":63,"pressure":1028.73,"metric":{"rain":0,"tempMin":7.49,"snow":0,"windSpeed":7.272,"tempMax":16.08},"date":{"hours":10,"year":2013,"month":9,"date":6,"minutes":59},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":0,"imperial":{"rain":0,"tempMin":45.482,"snow":0,"windSpeed":4.524800000000001,"tempMax":60.944}},{"icon":"clear_day","windDir":"S","timestamp":1381143600,"hourly":[],"windDeg":168,"pressure":1022.17,"metric":{"rain":0,"tempMin":11.9,"snow":0,"windSpeed":11.988000000000001,"tempMax":17.65},"date":{"hours":10,"year":2013,"month":9,"date":7,"minutes":59},"condition":{"icon":"01d","description":"sky is clear","id":800,"main":"Clear"},"humidity":0,"imperial":{"rain":0,"tempMin":53.42,"snow":0,"windSpeed":7.459200000000001,"tempMax":63.769999999999996}}],"format":20130927,"location":{"coord":{"lon":"-0.12574","lat":"51.50853"},"timezone":{"gmtOffset":0,"dstOffset":1,"timeZoneId":"Europe/London"},"areaLabel":"England, Greater London, United Kingdom","population":7556900,"adminName2":"Greater London","name":"London","country":"GB","countryName":"United Kingdom","adminName1":"England","adminName3":"","services":{"geonames":2643743,"openweathermap":2643743}}}""")
1216
1217=== modified file 'ubuntu-weather-app.qml'
1218--- ubuntu-weather-app.qml 2013-10-08 19:26:12 +0000
1219+++ ubuntu-weather-app.qml 2014-02-15 10:25:31 +0000
1220@@ -21,6 +21,7 @@
1221 import Ubuntu.Components 0.1
1222 import "components" as Components
1223 import "components/GradientsMap.js" as Gradients
1224+import "key.js" as Key
1225 import Ubuntu.Components.Popups 0.1
1226
1227 MainView {
1228@@ -49,7 +50,8 @@
1229 property var settings: {
1230 "units": Qt.locale().measurementSystem === Locale.MetricSystem ? "metric" : "imperial",
1231 "wind_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "kmh" : "mph",
1232- "precip_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "mm" : "in"
1233+ "precip_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "mm" : "in",
1234+ "service": "weatherchannel"
1235 }
1236
1237 WorkerScript {
1238@@ -149,11 +151,16 @@
1239 refresh.visible = true;
1240 if(from_storage === true && force_refresh !== true) {
1241 storage.getLocations(buildTabs);
1242- } else {
1243- storage.getLocations(function(locations) {
1244+ } else {
1245+ storage.getLocations(function(locations) {
1246 locationDataWorker.sendMessage({
1247 action: "updateData",
1248- params: {locations:locations, force: force_refresh}
1249+ params: {
1250+ locations:locations,
1251+ force:force_refresh,
1252+ service:settings["service"],
1253+ api_key: Key.twcKey
1254+ }
1255 })
1256 });
1257 }
1258@@ -174,7 +181,7 @@
1259 //Theme.palette.selected.backgroundText = "#000000";
1260 Theme.palette.normal.backgroundText = "#55FFFFFF";
1261
1262- storage.getSettings(function(storedSettings) {
1263+ storage.getSettings(function(storedSettings) {
1264 for(var settingName in storedSettings) {
1265 settings[settingName] = storedSettings[settingName];
1266 }

Subscribers

People subscribed via source and target branches