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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-02-14 09:52:57 +0000
+++ CMakeLists.txt 2014-02-15 10:25:31 +0000
@@ -47,6 +47,7 @@
47 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}47 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
48 *.qml *.js *.png *.js)48 *.qml *.js *.png *.js)
49install(DIRECTORY components resources DESTINATION ${DATA_DIR})49install(DIRECTORY components resources DESTINATION ${DATA_DIR})
50install(FILES key.js DESTINATION ${DATA_DIR})
50install(FILES ${MAIN_QML} DESTINATION ${DATA_DIR})51install(FILES ${MAIN_QML} DESTINATION ${DATA_DIR})
5152
52configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in @ONLY)53configure_file(${DESKTOP_FILE}.in.in ${DESKTOP_FILE}.in @ONLY)
5354
=== modified file 'components/CurrentWeather.qml'
--- components/CurrentWeather.qml 2014-02-06 18:32:20 +0000
+++ components/CurrentWeather.qml 2014-02-15 10:25:31 +0000
@@ -25,16 +25,18 @@
25 color: "transparent"25 color: "transparent"
2626
27 // For Status I take the same condition codes from OpenWeatherMap (http://openweathermap.org/wiki/API/Weather_Condition_Codes)27 // For Status I take the same condition codes from OpenWeatherMap (http://openweathermap.org/wiki/API/Weather_Condition_Codes)
28 property int condition
29 property string icon28 property string icon
30 property int currentTemp29 property string currentTemp
31 property int minTemp30 property string minTemp
32 property int maxTemp31 property string maxTemp
33 property bool showMaxTemp32 property bool showMaxTemp
34 property int windSpeed33 property int windSpeed
35 property string windDir34 property string windDir
36 property int humidity35 property int humidity
37 property real precipitation36 property real precipitation
37 property string propPrecip
38 property string precipType
39 property string uvIndex
38 property int pressure40 property int pressure
39 property variant hourly41 property variant hourly
40 property string tempScale: (mainView.settings["units"] === "imperial") ? "F" : "C"42 property string tempScale: (mainView.settings["units"] === "imperial") ? "F" : "C"
@@ -47,6 +49,28 @@
47 anchors.fill: parent49 anchors.fill: parent
48 anchors.horizontalCenter: parent.horizontalCenter50 anchors.horizontalCenter: parent.horizontalCenter
4951
52 function getProcipLabel() {
53 // show the right Label, depending on precipitation type
54 return (precipType === "snow") ? i18n.tr("Chance of Snow") : i18n.tr("Chance of Rain")
55 }
56
57 function getUvLabel() {
58 var label = "",
59 uvInt = parseInt(uvIndex);
60 if(uvInt <= 2) {
61 label = i18n.tr("Low");
62 } else if(uvInt <= 5) {
63 label = i18n.tr("Moderate");
64 } else if(uvInt <= 8) {
65 label = i18n.tr("High");
66 } else if(uvInt <= 10) {
67 label = i18n.tr("Very high");
68 } else {
69 label = i18n.tr("Extreme");
70 }
71 return label;
72 }
73
50 Flipable {74 Flipable {
51 id: flipable75 id: flipable
52 height: parent.height76 height: parent.height
@@ -60,13 +84,11 @@
60 property bool wasHourlyScrolled: false84 property bool wasHourlyScrolled: false
61 property int startY: 085 property int startY: 0
62 property double startTime: 086 property double startTime: 0
63 property int sectionHeight: parent.height/hourly.count87 property int sectionHeight: flippedarea.height/hourly.count
64 property int lastIndex: -188 property int lastIndex: -1
65 // without tab header!89 anchors.fill: parent
66 height: parent.height-units.gu(9.5)90 anchors.top: parent.top
67 width:parent.width91 anchors.topMargin: units.gu(3.5)
68 anchors.bottom: parent.bottom
69 anchors.bottomMargin: units.gu(2)
70 onClicked: {92 onClicked: {
71 mouse.accepted = true;93 mouse.accepted = true;
72 if(!wasHourlyScrolled) {94 if(!wasHourlyScrolled) {
@@ -199,9 +221,9 @@
199 height: units.gu(15)221 height: units.gu(15)
200222
201 Components.WeatherDetailComponent {223 Components.WeatherDetailComponent {
202 value: currentWeather.pressure224 value: (currentWeather.propPrecip !== "") ? currentWeather.propPrecip: currentWeather.pressure
203 measure: i18n.tr("Pressure")225 measure: (currentWeather.propPrecip !== "") ? getProcipLabel(): i18n.tr("Pressure")
204 unit: i18n.tr("mbar")226 unit: (currentWeather.propPrecip !== "") ? i18n.tr("Percent") : i18n.tr("mbar")
205 anchors.fill: parent227 anchors.fill: parent
206 }228 }
207 }229 }
@@ -215,9 +237,9 @@
215237
216 Components.WeatherDetailComponent {238 Components.WeatherDetailComponent {
217 objectName: "PrecipitationValue"239 objectName: "PrecipitationValue"
218 value: currentWeather.precipitation240 value: (currentWeather.uvIndex !== "") ? currentWeather.uvIndex : currentWeather.precipitation
219 measure: i18n.tr("Precipitation")241 measure: (currentWeather.uvIndex !== "") ? i18n.tr("UV index"): i18n.tr("Precipitation")
220 unit: currentWeather.precipScale242 unit: (currentWeather.uvIndex !== "") ? getUvLabel() : i18n.tr("Percent");
221 anchors.fill: parent243 anchors.fill: parent
222 }244 }
223 }245 }
224246
=== modified file 'components/LocationTab.qml'
--- components/LocationTab.qml 2014-02-06 18:32:20 +0000
+++ components/LocationTab.qml 2014-02-15 10:25:31 +0000
@@ -68,17 +68,19 @@
68 dateRel: "",//Tomorrow",68 dateRel: "",//Tomorrow",
69 date: formatTimestamp(dailyForecasts[x].date, 'dddd, dd MMMM'),69 date: formatTimestamp(dailyForecasts[x].date, 'dddd, dd MMMM'),
70 temp: (dailyForecasts[x]["current"] === undefined) ? dailyForecasts[x][units].tempMax :70 temp: (dailyForecasts[x]["current"] === undefined) ? dailyForecasts[x][units].tempMax :
71 dailyForecasts[x]["current"][units].temp,71 dailyForecasts[x]["current"][units].temp,
72 tempMin: dailyForecasts[x][units].tempMin,72 tempMin: dailyForecasts[x][units].tempMin.toString(),
73 tempMax: (dailyForecasts[x]["current"] !== undefined) ? dailyForecasts[x][units].tempMax :73 tempMax: (dailyForecasts[x]["current"] !== undefined
74 null,74 && dailyForecasts[x][units].tempMax !== undefined) ? dailyForecasts[x][units].tempMax.toString() : "",
75 cond: dailyForecasts[x].condition.id,
76 condIcon: dailyForecasts[x].icon,75 condIcon: dailyForecasts[x].icon,
77 wind_speed: dailyForecasts[x][wind_units].windSpeed,76 wind_speed: dailyForecasts[x][wind_units].windSpeed,
78 wind_dir: dailyForecasts[x].windDir,77 wind_dir: dailyForecasts[x].windDir,
79 humid: dailyForecasts[x].humidity,78 humid: dailyForecasts[x].humidity,
80 precip: +(dailyForecasts[x][precip_units].rain || dailyForecasts[x][precip_units].snow || 0).toFixed(2),79 precip: +(dailyForecasts[x][precip_units].rain || dailyForecasts[x][precip_units].snow || 0).toFixed(2),
81 press: dailyForecasts[x].pressure,80 prop_precip: ((dailyForecasts[x].propPrecip !== undefined && ""+dailyForecasts[x].propPrecip) || ""),
81 precip_type: dailyForecasts[x].precipType || "",
82 uv: (dailyForecasts[x].uv !== undefined) ? dailyForecasts[x].uv.toString() : "",
83 press: dailyForecasts[x].pressure || false,
82 hours: dailyForecasts[x]["hourly"]84 hours: dailyForecasts[x]["hourly"]
83 });85 });
84 }86 }
@@ -137,8 +139,8 @@
137 Rectangle {139 Rectangle {
138 id: listRectangle140 id: listRectangle
139 width: parent.width141 width: parent.width
140 height: dailyForecastList.height142 height: dailyForecastList.height-tabFooter.height
141 anchors.verticalCenter: parent.verticalCenter143 anchors.top: parent.top
142 color: "transparent"144 color: "transparent"
143145
144 DateComponent {146 DateComponent {
@@ -153,12 +155,14 @@
153 minTemp: tempMin155 minTemp: tempMin
154 maxTemp: tempMax156 maxTemp: tempMax
155 icon: condIcon157 icon: condIcon
156 condition: cond
157 windSpeed: wind_speed158 windSpeed: wind_speed
158 windDir: wind_dir159 windDir: wind_dir
159 humidity: humid160 humidity: humid
160 precipitation: precip161 precipitation: precip
162 propPrecip: prop_precip
163 precipType: precip_type
161 pressure: press164 pressure: press
165 uvIndex: uv
162 hourly: hours166 hourly: hours
163 anchors.top: dateComponent.bottom167 anchors.top: dateComponent.bottom
164 showMaxTemp: (index === 0)168 showMaxTemp: (index === 0)
@@ -167,23 +171,17 @@
167 }171 }
168 LastUpdatedComponent{172 LastUpdatedComponent{
169 id: lastUpdatedComponent173 id: lastUpdatedComponent
174 anchors.bottom: (tabFooter.visible) ? tabFooter.top : parent.bottom
170 }175 }
171 Rectangle {176 TabFooter {
172 id: noDataAvaible177 id:tabFooter
173 visible: false178 objectName: "TabFooter"
174 width:parent.width-units.gu(10)179 visible: !dataProviderLogo.visible
175 anchors.centerIn:parent
176 anchors.verticalCenterOffset: -units.gu(10)
177 color: "transparent"
178 Label {
179 width:parent.width
180 text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
181 fontSize: "large"
182 wrapMode: Text.WordWrap
183 }
184 }180 }
185 Image {181 Image {
186 id: dataProviderLogo182 id: dataProviderLogo
183 objectName: "DataProviderLogo"
184 visible: (settings["service"] === "openweathermap")
187 source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")185 source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
188 anchors {186 anchors {
189 bottom: parent.bottom187 bottom: parent.bottom
@@ -199,6 +197,20 @@
199 onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)197 onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
200 }198 }
201 }199 }
200 Rectangle {
201 id: noDataAvaible
202 visible: false
203 width:parent.width-units.gu(10)
204 anchors.centerIn:parent
205 anchors.verticalCenterOffset: -units.gu(10)
206 color: "transparent"
207 Label {
208 width:parent.width
209 text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
210 fontSize: "large"
211 wrapMode: Text.WordWrap
212 }
213 }
202 }214 }
203215
204216
205217
=== modified file 'components/SettingsSheet.qml'
--- components/SettingsSheet.qml 2013-11-06 19:40:17 +0000
+++ components/SettingsSheet.qml 2014-02-15 10:25:31 +0000
@@ -82,6 +82,34 @@
82 delegate: unitsSelectorDelegate82 delegate: unitsSelectorDelegate
83 model: precipitationUnitsSelectorModel83 model: precipitationUnitsSelectorModel
84 selectedIndex: (settings["precip_units"] === "in") ? 1 : 0;84 selectedIndex: (settings["precip_units"] === "in") ? 1 : 0;
85 // Precipitation units not available at TWC
86 visible: (serviceSelector.selectedIndex !== 0) ? 1 : 0
87 opacity: (serviceSelector.selectedIndex !== 0) ? 1 : 0
88 Behavior on visible {
89 enabled: (serviceSelector.selectedIndex === 0)
90 NumberAnimation { duration: 1500}
91 }
92 Behavior on opacity {
93 NumberAnimation {
94 easing: UbuntuAnimation.StandardEasingReverse;
95 duration: UbuntuAnimation.SlowDuration
96 }
97 }
98 }
99
100 ListModel {
101 id: serviceSelectorModel
102 ListElement { name: "twcOption"; label: "The Weather Channel" }
103 ListElement { name: "owmOption"; label: "Openweathermap" }
104 }
105
106 OptionSelector {
107 id: serviceSelector
108 objectName: "ServiceSelector"
109 text: i18n.tr("Weather Service")
110 delegate: unitsSelectorDelegate
111 model: serviceSelectorModel
112 selectedIndex: (settings["service"] === "openweathermap") ? 1 : 0;
85 }113 }
86 }114 }
87115
@@ -90,35 +118,42 @@
90 }118 }
91119
92 onConfirmClicked: {120 onConfirmClicked: {
93 var refresh = false,121 var refresh_from_storage = false,
122 refresh_from_service = false,
94 selectedUnit = (temperatureUnitsSelector.selectedIndex === 0) ? "metric" : "imperial",123 selectedUnit = (temperatureUnitsSelector.selectedIndex === 0) ? "metric" : "imperial",
95 selectedWindUnit = (windUnitsSelector.selectedIndex === 0) ? "kmh" : "mph",124 selectedWindUnit = (windUnitsSelector.selectedIndex === 0) ? "kmh" : "mph",
96 selectedPrecipUnit = (precipitationUnitsSelector.selectedIndex === 0) ? "mm" : "in";125 selectedPrecipUnit = (precipitationUnitsSelector.selectedIndex === 0) ? "mm" : "in",
126 selectedService = (serviceSelector.selectedIndex === 0) ? "weatherchannel" : "openweathermap";
97 // check if temperaure scale was changed127 // check if temperaure scale was changed
98 if(settings["units"] !== selectedUnit) {128 if(settings["units"] !== selectedUnit) {
99 storage.saveSetting("units", selectedUnit);129 storage.saveSetting("units", selectedUnit);
100 refresh = true;130 refresh_from_storage = true;
101 }131 }
102 //132 //
103 if(settings["wind_units"] !== selectedWindUnit) {133 if(settings["wind_units"] !== selectedWindUnit) {
104 storage.saveSetting("wind_units", selectedWindUnit);134 storage.saveSetting("wind_units", selectedWindUnit);
105 refresh = true;135 refresh_from_storage = true;
106 }136 }
107 //137 //
108 if(settings["precip_units"] !== selectedPrecipUnit) {138 if(settings["precip_units"] !== selectedPrecipUnit) {
109 storage.saveSetting("precip_units", selectedPrecipUnit);139 storage.saveSetting("precip_units", selectedPrecipUnit);
110 refresh = true;140 refresh_from_storage = true;
141 }
142 //
143 if(settings["service"] !== selectedService) {
144 storage.saveSetting("service", selectedService);
145 refresh_from_service = true;
111 }146 }
112 // handling of other settings here147 // handling of other settings here
113 // ....148 // ....
114149
115 // a setting was changed, reload settings and refresh the location tabs150 // a setting was changed, reload settings and refresh the location tabs
116 if(refresh === true) {151 if(refresh_from_storage === true || refresh_from_service === true) {
117 storage.getSettings(function(storedSettings) {152 storage.getSettings(function(storedSettings) {
118 for(var settingName in storedSettings) {153 for(var settingName in storedSettings) {
119 settings[settingName] = storedSettings[settingName];154 settings[settingName] = storedSettings[settingName];
120 }155 }
121 refreshData(true);156 refreshData(refresh_from_storage, refresh_from_service);
122 });157 });
123 }158 }
124 Theme.palette.selected.backgroundText = "#f4f4e8"159 Theme.palette.selected.backgroundText = "#f4f4e8"
125160
=== added file 'components/TabFooter.qml'
--- components/TabFooter.qml 1970-01-01 00:00:00 +0000
+++ components/TabFooter.qml 2014-02-15 10:25:31 +0000
@@ -0,0 +1,139 @@
1/*
2 * Copyright (C) 2014 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Martin Borho <martin@borho.net>
17 */
18import QtQuick 2.0
19import Ubuntu.Components 0.1
20
21Rectangle {
22 width: parent.width
23 height: units.gu(8)
24 anchors.bottom: parent.bottom
25
26 /**
27 * TODO
28 *
29 * at the moment it's unknown to the developer, in which way a link to
30 * the weatherchannel website can be generated from wunderground-API data
31 */
32 function openTWCLink(type) {
33 var serviceId = locationTab.locationData.location.services["weatherchannel"],
34 loc_name = Qt.locale().name, url = "http://";
35 print("Open link for "+type+" - "+loc_name)
36 if(loc_name.search(/^de_/) > -1) {
37 url += "de.weather.com/";
38 if(type) url += ((type === "10day") ? "10tage/" : "stündlich/");
39
40 } else if(loc_name === "en_US" || loc_name === "en-CA") {
41 url += "www.weather.com/";
42 if(type) url += "weather/"+((type === "10day") ? "tenday/" : "hourbyhour/graph/");
43
44 } else if(loc_name.search(/^en_/) > -1) {
45 url += "uk.weather.com/";
46 if(type) url += "weather/"+((type === "10day") ? "10day-" : "hourByHour-");
47
48 } else if(loc_name.search(/^fr_/) > -1) {
49 url += "fr.weather.com/";
50 if(type) url += ((type === "10day") ? "10jours/" : "horaire/");
51
52 } else if(loc_name.search(/^es_/) > -1) {
53 url += "espanol.weather.com/";
54 if(type) url += "weather/"+((type === "10day") ? "10day-" : "hourByHour-");
55
56 } else if(loc_name === "ja_JP") {
57 url += "ja.weather.com/";
58 if(type) url += ((type === "10day") ? "10日/" : "1時間ごと/");
59
60 } else if(loc_name.search(/^zh_/) > -1) {
61 url += "zh.weather.com/";
62 if(type) url += ((type === "10day") ? "10天/" : "1時間ごと/");
63
64 } else if(loc_name === "pt_BR") {
65 url += "br.weather.com/";
66 if(type) url += ((type === "10day") ? "10dias/" : "toda_hora/");
67
68 } else if(loc_name.search(/^pt_/) > -1) {
69 url += "pt.weather.com/";
70 if(type) url += ((type === "10day") ? "10dias/" : "cadahora/");
71
72 } else if(loc_name === "ru_RU") {
73 url += "ru.weather.com/";
74 if(type) url += ((type === "10day") ? "10дней/" : "ежечасно/");
75
76 }
77 if(type) url += serviceId;
78 url += "?par=ubuntu"
79 print(url)
80 Qt.openUrlExternally(url);
81 }
82
83 Rectangle {
84 id: forecastLink
85 anchors.left:parent.left
86 anchors.leftMargin: units.gu(1)
87 width:units.gu(14)
88 height:parent.height
89 Label {
90 anchors.verticalCenter: parent.verticalCenter
91 text: i18n.tr("10 days forecast")
92 fontSize:"medium"
93 color: mainView.footerColor
94 MouseArea {
95 anchors.fill:parent
96 onClicked: openTWCLink("10day")
97 }
98 }
99 }
100 Rectangle {
101 anchors.left:forecastLink.right
102 width:units.gu(15)
103 height:parent.height
104 Label {
105 anchors.verticalCenter: parent.verticalCenter
106 text: ">> "+i18n.tr("Hourly forecast")
107 fontSize:"medium"
108 color: mainView.footerColor
109 MouseArea {
110 anchors.fill:parent
111 onClicked: openTWCLink("hourly")
112 }
113 }
114 }
115 Rectangle {
116 anchors.right: serviceLogo.left
117 width:units.gu(0.25)
118 height: parent.height
119 color: mainView.footerColor
120 }
121 Rectangle {
122 id: serviceLogo
123 width:units.gu(9)
124 height:parent.height
125 anchors.right: parent.right
126 Label {
127 anchors.verticalCenter: parent.verticalCenter
128 anchors.centerIn: parent
129 fontSize: "medium"
130 font.bold: true
131 color:mainView.footerColor
132 text: "The\nWeather\nChannel"
133 }
134 MouseArea {
135 anchors.fill:parent
136 onClicked: openTWCLink()
137 }
138 }
139}
0140
=== modified file 'components/WeatherApi.js'
--- components/WeatherApi.js 2013-10-01 19:51:22 +0000
+++ components/WeatherApi.js 2014-02-15 10:25:31 +0000
@@ -23,11 +23,15 @@
23* Version of the response data format.23* Version of the response data format.
24* Increase this number to force a refresh.24* Increase this number to force a refresh.
25*/25*/
26var RESPONSE_DATA_VERSION = 20130927;26var RESPONSE_DATA_VERSION = 20131207;
2727
28/**28/**
29* Helper functions29* Helper functions
30*/30*/
31function debug(obj) {
32 print(JSON.stringify(obj))
33}
34//
31function calcFahrenheit(celsius) {35function calcFahrenheit(celsius) {
32 return celsius * 1.8 + 32;36 return celsius * 1.8 + 32;
33}37}
@@ -356,6 +360,223 @@
356360
357})();361})();
358362
363var WeatherChannelApi = (function() {
364 /**
365 provides neccessary methods for requesting and preparing data from OpenWeatherMap.org
366 */
367 var _baseUrl = "http://wxdata.weather.com/wxdata/";
368 //
369 var _serviceName = "weatherchannel";
370 //
371 // see http://s.imwx.com/v.20131006.223722/img/wxicon/72/([0-9]+).png
372 var _iconMap = {
373 "1": "thunderstorm_day", // ??
374 "2": "thunderstorm_day", // ??
375 "3": "thunderstorm_day", // ??
376 "4": "thunderstorm_day", //T-Storms
377 "5": "shower_rain_day", //Rain / Snow
378 "6": "shower_rain_day", // ??
379 "7": "chance_snow_day", //Wintry Mix
380 "8": "chance_snow_day", //Freezing Drizzle
381 "9": "rain_day", //Drizzle
382 "10": "shower_rain_day", // ??
383 "11": "shower_rain_day", //Showers
384 "12": "rain_day", //Rain
385 "13": "snow_day", // ??
386 "14": "snow_shower", //Snow shower/Light snow
387 "15": "snow_day", //
388 "16": "snow_day", //Snow
389 "17": "thunderstorm_day", // Hail??
390 "18": "shower_rain_day", // Rain / Snow ??
391 "19": "mist_day", //Fog ??
392 "20": "mist_day", //Fog
393 "21": "mist_day", //Haze
394 "22": "mist_day", // ??
395 "23": "mist_day", // Wind ??
396 "24": "broken_clouds_day", //Partly Cloudy / Wind
397 "25": "broken_clouds_day", // ??
398 "26": "broken_clouds_day",//Cloudy
399 "27": "few_clouds_night",//Mostly Cloudy
400 "28": "few_clouds_day", //Mostly Cloudy
401 "29": "scattered_clouds_night", //Partly Cloudy
402 "30": "scattered_clouds_day", //Partly Cloudy
403 "31": "clear_night", //Clear
404 "32": "clear_day", //Sunny
405 "33": "few_clouds_night", //Mostly Clear
406 "34": "few_clouds_day", //Mostly Sunny
407 "35": "shower_rain_day", // ??
408 "36": "clear_day", //Sunny
409 "37": "thunderstorm_day", //Isolated T-Storms
410 "38": "thunderstorm_day", //Scattered T-Storms
411 "39": "rain_day", //Scattered Showers
412 "40": "shower_rain_day", // ??
413 "41": "snow_day", //Scattered Snow Showers
414 "42": "snow_day", // ??
415 "43": "snow_day", // ??
416 "44": "mist_day", // ??
417 "45": "rain_day", // ??
418 "46": "snow_day", //Snow Showers Early
419 "47": "thunderstorm_day" //Isolated T-Storms
420 };
421 //
422 function _buildDataPoint(date, dataObj) {
423 var data = dataObj["Observation"] || dataObj,
424 result = {
425 timestamp: data.date || data.dateTime,
426 date: date,
427 metric: {
428 temp: data.temp,
429 tempFeels: data.feelsLike,
430 windSpeed: data.wSpeed
431 },
432 imperial: {
433 temp: calcFahrenheit(data.temp),
434 tempFeels: calcFahrenheit(data.feelsLike),
435 windSpeed: calcMph(data.wSpeed)
436 },
437 precipType: data.precip_type || null,
438 propPrecip: data.pop || null,
439 humidity: data.humid,
440 pressure: data.pressure,
441 windDeg: data.wDir,
442 windDir: data.wDirText,
443 icon: _iconMap[(data.wxIcon||data.icon)],
444 condition: data.text || data.wDesc,
445 uv: data.uv
446 };
447 if(_iconMap[data.wxIcon||data.icon] === undefined) {
448 print("ICON MISSING POINT: "+(data.wxIcon||data.icon)+" "+result.condition)
449 }
450 return result;
451 }
452 //
453 function _buildDayFormat(date, data, now) {
454 var partData = (now > data.validDate || data.day === undefined) ? data.night : data.day,
455 result = {
456 date: date,
457 timestamp: data.validDate,
458 metric: {
459 tempMin: data.minTemp,
460 tempMax: data.maxTemp,
461 windSpeed: partData.wSpeed
462 },
463 imperial: {
464 tempMin: calcFahrenheit(data.minTemp),
465 tempMax: calcFahrenheit(data.maxTemp || data.minTemp),
466 windSpeed: calcMph(partData.wSpeed)
467 },
468 precipType: partData.precip_type,
469 propPrecip: partData.pop,
470 pressure: null,
471 humidity: partData.humid,
472 icon: _iconMap[partData.icon],
473 condition: partData.phrase,
474 windDeg: partData.wDir,
475 windDir: partData.wDirText,
476 uv: partData.uv,
477 hourly: []
478 }
479 if(_iconMap[partData.icon] === undefined) {
480 print("ICON MISSING DAY: "+partData.icon+" "+result.condition)
481 }
482 return result;
483 }
484 //
485 function formatResult(combinedData, location) {
486 var tmpResult = {}, result = [],
487 day=null, todayDate,
488 offset=(location.timezone && location.timezone.gmtOffset) ? location.timezone.gmtOffset*60*60*1000: 0,
489 now = new Date().getTime(),
490 nowMs = parseInt(now/1000),
491 localNow = getLocationTime(now+offset),
492 data = {
493 "location": combinedData[0]["Location"],
494 "daily": combinedData[0]["DailyForecasts"],
495 "forecast": combinedData[0]["HourlyForecasts"],
496 "current": combinedData[0]["StandardObservation"],
497 };
498 print("["+location.name+"] "+JSON.stringify(localNow));
499 // add openweathermap id for faster responses
500 if(location.services && !location.services[_serviceName] && data["location"].key) {
501 location.services[_serviceName] = data["location"].key
502 }
503 //
504 data["daily"].forEach(function(dayData) {
505 var date = getLocationTime(((dayData.validDate*1000)-1000)+offset), // minus 1 sec to handle +/-12 TZ
506 day = date.year+"-"+date.month+"-"+date.date;
507 if(!todayDate) {
508 if(localNow.year+"-"+localNow.month+"-"+localNow.date > day) {
509 // skip "yesterday"
510 return;
511 }
512 todayDate = date;
513 }
514 tmpResult[day] = _buildDayFormat(date, dayData, nowMs);
515 })
516 //
517 var today = todayDate.year+"-"+todayDate.month+"-"+todayDate.date
518 tmpResult[today]["current"] = _buildDataPoint(todayDate, data["current"]);
519 if(data["forecast"] !== undefined) {
520 data["forecast"].forEach(function(hourData) {
521 var dateData = getLocationTime((hourData.dateTime*1000)+offset),
522 day = dateData.year+"-"+dateData.month+"-"+dateData.date;
523 if(tmpResult[day]) {
524 tmpResult[day]["hourly"].push(_buildDataPoint(dateData, hourData));
525 }
526 })
527 }
528 //
529 for(var d in tmpResult) {
530 result.push(tmpResult[d]);
531 }
532 return result;
533 }
534 //
535 function _getUrl(params) {
536 var url, serviceId,
537 units = (params.units === "metric") ? "m" : "e",
538 baseParams = "key="+params.api_key+"&units="+units;
539 if(params.location.services && params.location.services[_serviceName]) {
540 serviceId = encodeURIComponent(params.location.services[_serviceName]);
541 url = _baseUrl+"mobile/mobagg/"+serviceId+".js?"+baseParams;
542 } else if (params.location.coord) {
543 url = _baseUrl+"mobile/mobagg/get.js?"+baseParams+
544 "&lat="+encodeURIComponent(params.location.coord.lat)+
545 "&lng="+encodeURIComponent(params.location.coord.lon);
546 }
547 return url;
548 }
549 //
550 return {
551 getData: function(params, apiCaller, onSuccess, onError) {
552 var url = _getUrl(params),
553 handlerMap = {
554 all: { type: "all", url: url}
555 },
556 response = {
557 location: params.location,
558 db: (params.db) ? params.db : null,
559 format: RESPONSE_DATA_VERSION
560 },
561 addDataToResponse = (function(request, data) {
562 var formattedResult;
563 response["data"] = formatResult(data, params.location);
564 onSuccess(response);
565 }),
566 onErrorHandler = (function(err) {
567 onError(err);
568 }),
569 retryHandler = (function(err) {
570 print(JSON.stringify(err))
571 console.log("retry of "+err.request.url);
572 //var retryFunc = handlerMap[err.request.type];
573 //apiCaller(retryFunc, addDataToResponse, onErrorHandler);
574 })
575 apiCaller(handlerMap.all, addDataToResponse, retryHandler);
576 }
577 }
578})();
579
359var WeatherApi = (function(_services) {580var WeatherApi = (function(_services) {
360 /**581 /**
361 proxy for requesting weather apis, the passed _services are providing the respective api endpoints582 proxy for requesting weather apis, the passed _services are providing the respective api endpoints
@@ -365,7 +586,7 @@
365 if(_services[name] !== undefined) {586 if(_services[name] !== undefined) {
366 return _services[name];587 return _services[name];
367 }588 }
368 return _services["openweathermap"];589 return _services["weatherchannel"];
369 }590 }
370 //591 //
371 function _sendRequest(request, onSuccess, onError) {592 function _sendRequest(request, onSuccess, onError) {
@@ -391,6 +612,7 @@
391 }612 }
392 }613 }
393 } catch (e) {614 } catch (e) {
615 print("Exception: "+e)
394 onError({msg: "wrong response data format", request: request});616 onError({msg: "wrong response data format", request: request});
395 }617 }
396 };618 };
@@ -416,12 +638,13 @@
416 },638 },
417 //639 //
418 getLocationData: function(params, onSuccess, onError) {640 getLocationData: function(params, onSuccess, onError) {
419 var service = _getService();641 var service = _getService(params.service);
420 service.getData(params, _sendRequest, onSuccess, onError);642 service.getData(params, _sendRequest, onSuccess, onError);
421 },643 },
422 }644 }
423})({645})({
424 "openweathermap": OpenWeatherMapApi,646 "openweathermap": OpenWeatherMapApi,
647 "weatherchannel": WeatherChannelApi,
425 "geonames": GeonamesApi,648 "geonames": GeonamesApi,
426 "geoip": GeoipApi649 "geoip": GeoipApi
427});650});
@@ -435,6 +658,8 @@
435 WorkerScript.onMessage = function(message) {658 WorkerScript.onMessage = function(message) {
436 // handles the response data659 // handles the response data
437 var finished = function(result) {660 var finished = function(result) {
661 // print result to get data for test json files
662 // print(JSON.stringify(result));
438 WorkerScript.sendMessage({663 WorkerScript.sendMessage({
439 action: message.action,664 action: message.action,
440 result: result665 result: result
@@ -480,7 +705,9 @@
480 params = {705 params = {
481 location:loc.location,706 location:loc.location,
482 db: loc.db,707 db: loc.db,
483 units: 'metric'708 units: 'metric',
709 service: message.params.service,
710 api_key: message.params.api_key
484 },711 },
485 secsFromLastFetch = (now-loc.updated)/1000;712 secsFromLastFetch = (now-loc.updated)/1000;
486 //713 //
487714
=== modified file 'components/WeatherConditionIconComponent.qml'
--- components/WeatherConditionIconComponent.qml 2014-01-27 14:56:23 +0000
+++ components/WeatherConditionIconComponent.qml 2014-02-15 10:25:31 +0000
@@ -25,14 +25,18 @@
25 "scattered_clouds_night": "04",25 "scattered_clouds_night": "04",
26 "broken_clouds_day": "03",26 "broken_clouds_day": "03",
27 "broken_clouds_night": "03",27 "broken_clouds_night": "03",
28 "shower_rain_day": "01",28 "mostly_cloudy": "03",
29 "shower_rain_night": "01",29 "shower_rain_day": "09",
30 "shower_rain_night": "09",
30 "rain_day": "09",31 "rain_day": "09",
31 "rain_night": "09",32 "rain_night": "09",
32 "thunderstorm_day": "13",33 "thunderstorm_day": "13",
33 "thunderstorm_night": "13",34 "thunderstorm_night": "13",
34 "snow_day": "14",35 "snow_day": "14",
35 "snow_night": "14",36 "snow_night": "14",
37 "chance_snow_day": "11",
38 "chances_now_night": "11",
39 "snow_shower": "11",
36 "mist_day": "06",40 "mist_day": "06",
37 "mist_night": "06"41 "mist_night": "06"
38 }42 }
3943
=== modified file 'components/WeatherTemperatureComponent.qml'
--- components/WeatherTemperatureComponent.qml 2014-01-06 14:30:14 +0000
+++ components/WeatherTemperatureComponent.qml 2014-02-15 10:25:31 +0000
@@ -52,6 +52,7 @@
52 }52 }
53 Text {53 Text {
54 id: currentTempScale54 id: currentTempScale
55 objectName: "CurrentTempScale"
55 text: String("°") + tempComponent.tempScale56 text: String("°") + tempComponent.tempScale
56 style: Text.Raised57 style: Text.Raised
57 font.bold: false58 font.bold: false
@@ -107,7 +108,7 @@
107 font.pointSize: FontUtils.sizeToPixels("small")108 font.pointSize: FontUtils.sizeToPixels("small")
108 verticalAlignment: Text.AlignVCenter109 verticalAlignment: Text.AlignVCenter
109 horizontalAlignment: Text.AlignHCenter110 horizontalAlignment: Text.AlignHCenter
110 visible:(dailyForecastList.currentIndex === 0)111 visible:(dailyForecastList.currentIndex === 0 && tempComponent.maxTemp)
111 anchors {112 anchors {
112 bottom: parent.bottom113 bottom: parent.bottom
113 bottomMargin: units.gu(2)114 bottomMargin: units.gu(2)
114115
=== added file 'key.js'
--- key.js 1970-01-01 00:00:00 +0000
+++ key.js 2014-02-15 10:25:31 +0000
@@ -0,0 +1,1 @@
1var twcKey = "";
02
=== added directory 'tests/autopilot/ubuntu_weather_app/files'
=== added file 'tests/autopilot/ubuntu_weather_app/files/1.json'
--- tests/autopilot/ubuntu_weather_app/files/1.json 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_weather_app/files/1.json 2014-02-15 10:25:31 +0000
@@ -0,0 +1,1 @@
1{"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}
02
=== added file 'tests/autopilot/ubuntu_weather_app/files/2.json'
--- tests/autopilot/ubuntu_weather_app/files/2.json 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_weather_app/files/2.json 2014-02-15 10:25:31 +0000
@@ -0,0 +1,1 @@
1{"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}
02
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-01-31 21:06:15 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2014-02-15 10:25:31 +0000
@@ -134,6 +134,8 @@
134 db_file = "34e1e542f2f083ff18f537b07a380071.sqlite"134 db_file = "34e1e542f2f083ff18f537b07a380071.sqlite"
135 db_path = os.path.join(db_dir, db_file)135 db_path = os.path.join(db_dir, db_file)
136136
137 json_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..', 'files'))
138
137 def _execute_sql(self, statement):139 def _execute_sql(self, statement):
138 conn = sqlite3.connect(self.db_path)140 conn = sqlite3.connect(self.db_path)
139 cursor = conn.cursor()141 cursor = conn.cursor()
@@ -174,7 +176,18 @@
174 self._execute_sql("CREATE TABLE IF NOT EXISTS settings(key TEXT "176 self._execute_sql("CREATE TABLE IF NOT EXISTS settings(key TEXT "
175 "UNIQUE, value TEXT)")177 "UNIQUE, value TEXT)")
176178
177 def add_locations_to_database(self, locations):179 def get_locations_data(self):
180 result = []
181 json_files = [self.json_path+'/1.json', self.json_path+'/2.json']
182 for path in json_files:
183 with open(path) as fh:
184 json_str = fh.read()
185 result.append(json_str.strip())
186 fh.close()
187 return result
188
189 def add_locations_to_database(self, limit=None):
190 locations = self.get_locations_data()
178 conn = sqlite3.connect(self.db_path)191 conn = sqlite3.connect(self.db_path)
179 cursor = conn.cursor()192 cursor = conn.cursor()
180 logger.debug("Adding locations to database")193 logger.debug("Adding locations to database")
@@ -190,4 +203,5 @@
190 self._execute_sql("INSERT INTO settings(key, value) "203 self._execute_sql("INSERT INTO settings(key, value) "
191 "VALUES('units', 'metric'), "204 "VALUES('units', 'metric'), "
192 "('wind_units', 'kmh'), "205 "('wind_units', 'kmh'), "
193 "('precip_units', 'mm')")206 "('precip_units', 'mm'),"
207 "('service', 'weatherchannel')")
194208
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-01-01 03:14:56 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2014-02-15 10:25:31 +0000
@@ -13,7 +13,6 @@
13from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
1414
15from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin15from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin, LocationManagerMixin
16from ubuntu_weather_app.tests.weatherdata import locations_data
1716
18from time import sleep17from time import sleep
19import logging18import logging
@@ -37,7 +36,7 @@
37 self.create_blank_db()36 self.create_blank_db()
38 # add locations to storage37 # add locations to storage
39 logger.debug("Adding fake data to new database")38 logger.debug("Adding fake data to new database")
40 self.add_locations_to_database(locations_data)39 self.add_locations_to_database()
41 logger.debug("Re-Launching app to introspect")40 logger.debug("Re-Launching app to introspect")
42 super(TestLocationManager, self).setUp()41 super(TestLocationManager, self).setUp()
43 self.assertThat(42 self.assertThat(
4443
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-12-17 18:52:10 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2014-02-15 10:25:31 +0000
@@ -17,7 +17,6 @@
17import logging17import logging
1818
19from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin19from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin
20from ubuntu_weather_app.tests.weatherdata import locations_data
2120
22logger = logging.getLogger(__name__)21logger = logging.getLogger(__name__)
2322
@@ -30,7 +29,7 @@
30 #we want to start with fake location data29 #we want to start with fake location data
31 self.create_blank_db()30 self.create_blank_db()
32 logger.debug("Adding fake data to new database")31 logger.debug("Adding fake data to new database")
33 self.add_locations_to_database(locations_data)32 self.add_locations_to_database()
34 logger.debug("Re-Launching app to introspect")33 logger.debug("Re-Launching app to introspect")
35 super(TestMainView, self).setUp()34 super(TestMainView, self).setUp()
36 self.assertThat(35 self.assertThat(
3736
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-12-17 18:52:10 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2014-02-15 10:25:31 +0000
@@ -9,12 +9,12 @@
99
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12from unittest import skip
12from testtools.matchers import Equals, Is, Not13from testtools.matchers import Equals, Is, Not
13from autopilot.matchers import Eventually14from autopilot.matchers import Eventually
14import logging15import logging
1516
16from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin17from ubuntu_weather_app.tests import WeatherTestCase, DatabaseMixin, SheetMixin
17from ubuntu_weather_app.tests.weatherdata import locations_data
1818
19logger = logging.getLogger(__name__)19logger = logging.getLogger(__name__)
2020
@@ -23,7 +23,7 @@
23 #we want to start with fake settings data23 #we want to start with fake settings data
24 self.create_blank_db()24 self.create_blank_db()
25 logger.debug("Adding fake data to new database")25 logger.debug("Adding fake data to new database")
26 self.add_locations_to_database(locations_data)26 self.add_locations_to_database()
27 self.add_units_to_database()27 self.add_units_to_database()
28 super(TestSettings, self).setUp()28 super(TestSettings, self).setUp()
29 self.assertThat(29 self.assertThat(
@@ -35,69 +35,101 @@
3535
36 def _move_pointer_around(self):36 def _move_pointer_around(self):
37 """Helper method to move the pointer around, to assure selector is opened"""37 """Helper method to move the pointer around, to assure selector is opened"""
38 self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'), Eventually(Not(Is(None))))38 self.assertThat(lambda: self.main_window.select_single('ComposerSheet', objectName='SettingsSheet'),
39 Eventually(Not(Is(None))))
39 sheet = self.main_window.select_single('ComposerSheet', objectName='SettingsSheet')40 sheet = self.main_window.select_single('ComposerSheet', objectName='SettingsSheet')
40 self.pointing_device.move_to_object(sheet)41 self.pointing_device.move_to_object(sheet)
4142
42 def _check_units(self, units):43 def _check_units(self, units):
43 """Checks selected units by values from the first location tab"""44 """Checks selected units by values from the first location tab"""
44 self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'), Eventually(Not(Is(None))))45 self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'),
46 Eventually(Not(Is(None))))
45 current_location_tab = self.main_window.select_single(47 current_location_tab = self.main_window.select_single(
46 'LocationTab', visible=True)48 'LocationTab', visible=True)
47 today_item = current_location_tab.select_single(49 today_item = current_location_tab.select_single(
48 'QQuickItem', focus=True)50 'QQuickItem', focus=True)
49 today_temp = today_item.select_single(51 today_temp = today_item.select_single(
50 'QQuickText', objectName='CurrentTempText')52 'QQuickText', objectName='CurrentTempText')
53 today_temp_scale = today_item.select_single(
54 'QQuickText', objectName='CurrentTempScale')
51 tomorrow_item = today_item.get_parent().get_children_by_type(55 tomorrow_item = today_item.get_parent().get_children_by_type(
52 'QQuickItem', focus=False, z=1)56 'QQuickItem', focus=False, z=1)
53 tomorrow_temp = tomorrow_item[0].select_single(57 tomorrow_temp = tomorrow_item[0].select_single(
54 'QQuickText', objectName='CurrentTempText')58 'QQuickText', objectName='CurrentTempText')
55 if units == "imperial":59 if units == "imperial":
56 self.assertThat(today_temp.text, Eventually(Equals(u'57')))60 self.assertThat(today_temp_scale.text, Eventually(Equals(u'°F')))
57 self.assertThat(tomorrow_temp.text, Eventually(Equals(u'69')))61 self.assertThat(today_temp.text, Eventually(Equals(u'26')))
62 self.assertThat(tomorrow_temp.text, Eventually(Equals(u'23')))
58 else:63 else:
59 self.assertThat(today_temp.text, Eventually(Equals(u'14')))64 self.assertThat(today_temp_scale.text, Eventually(Equals(u'°C')))
60 self.assertThat(tomorrow_temp.text, Eventually(Equals(u'21')))65 self.assertThat(today_temp.text, Eventually(Equals(u'-3')))
66 self.assertThat(tomorrow_temp.text, Eventually(Equals(u'-5')))
6167
62 def _check_wind_units(self, wind_units):68 def _check_wind_units(self, wind_units):
63 """Checks selected units by values from the first location tab"""69 """Checks selected units by values from the first location tab"""
64 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], Eventually(Not(Is(None))))70 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0],
71 Eventually(Not(Is(None))))
65 current_location_tab = self.main_window.select_single(72 current_location_tab = self.main_window.select_single(
66 'LocationTab', visible=True)73 'LocationTab', visible=True)
67 focused_item = current_location_tab.select_single(74 focused_item = current_location_tab.select_single(
68 'QQuickItem', focus=True)75 'QQuickItem', focus=True)
69 wind_component = focused_item.select_single(76 wind_component = focused_item.select_single(
70 'WeatherDetailComponent', objectName='WindSpeedValue')77 'WeatherDetailComponent', objectName='WindSpeedValue')
71 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))78 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'),
79 Eventually(Not(Is(None))))
72 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')80 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')
73 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))81 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'),
82 Eventually(Not(Is(None))))
74 wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')83 wind_value = wind_component.select_single('QQuickText', objectName='WeatherDetailValue')
75 if wind_units == "mph":84 if wind_units == "mph":
76 self.assertThat(wind_unit.text, Eventually(Equals(u'mph SE')))85 self.assertThat(wind_unit.text, Eventually(Equals(u'mph ESE')))
77 self.assertThat(wind_value.text, Eventually(Equals(u'9')))86 self.assertThat(wind_value.text, Eventually(Equals(u'49')))
78 else:87 else:
79 self.assertThat(wind_unit.text, Eventually(Equals(u'km/h SE')))88 self.assertThat(wind_unit.text, Eventually(Equals(u'km/h ESE')))
80 self.assertThat(wind_value.text, Eventually(Equals(u'15')))89 self.assertThat(wind_value.text, Eventually(Equals(u'22')))
8190
82 def _check_precipitation_units(self, pre_units):91 def _check_precipitation_units(self, pre_units):
83 """Checks selected units by values from the first location tab"""92 """Checks selected units by values from the first location tab"""
84 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], Eventually(Not(Is(None))))93 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0],
94 Eventually(Not(Is(None))))
85 current_location_tab = self.main_window.select_single(95 current_location_tab = self.main_window.select_single(
86 'LocationTab', visible=True)96 'LocationTab', visible=True)
87 focused_item = current_location_tab.select_single(97 focused_item = current_location_tab.select_single(
88 'QQuickItem', focus=True)98 'QQuickItem', focus=True)
89 component = focused_item.select_single(99 component = focused_item.select_single(
90 'WeatherDetailComponent', objectName='PrecipitationValue')100 'WeatherDetailComponent', objectName='PrecipitationValue')
91 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))101 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'),
102 Eventually(Not(Is(None))))
92 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')103 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
93 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))104 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'),
105 Eventually(Not(Is(None))))
94 value = component.select_single('QQuickText', objectName='WeatherDetailValue')106 value = component.select_single('QQuickText', objectName='WeatherDetailValue')
95 if pre_units == "in":107 if pre_units == "in":
96 self.assertThat(unit.text, Eventually(Equals(u'in')))108 self.assertThat(unit.text, Eventually(Equals(u'in')))
97 self.assertThat(value.text, Eventually(Equals(u'0.18')))109 self.assertThat(value.text, Eventually(Equals(u'0.18')))
98 else:110 else:
99 self.assertThat(unit.text, Eventually(Equals(u'mm')))111 self.assertThat(unit.text, Eventually(Equals(u'mm')))
100 self.assertThat(value.text, Eventually(Equals(u'4.5')))112 self.assertThat(value.text, Eventually(Equals(u'0.5')))
113
114 def _check_service(self, service):
115 """Checks selected units weather data service from the first location tab"""
116 self.assertThat(lambda: self.main_window.select_many('TabFooter', objectName='TabFooter')[0],
117 Eventually(Not(Is(None))))
118 current_location_tab = self.main_window.select_single('LocationTab', visible=True)
119 self.assertThat(lambda: current_location_tab.select_single('TabFooter', objectName='TabFooter'),
120 Eventually(Not(Is(None))))
121 self.assertThat(lambda: current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo'),
122 Eventually(Not(Is(None))))
123
124 focused_item = current_location_tab.select_single('QQuickItem', focus=True)
125 tab_footer = current_location_tab.select_single('TabFooter', objectName='TabFooter')
126 provider_logo = current_location_tab.select_single('QQuickImage', objectName='DataProviderLogo')
127 if service == "weatherchannel":
128 self.assertThat(tab_footer.visible, Eventually(Equals(True)))
129 self.assertThat(provider_logo.visible, Eventually(Equals(False)))
130 elif service == "openweathermap":
131 self.assertThat(tab_footer.visible, Eventually(Equals(False)))
132 self.assertThat(provider_logo.visible, Eventually(Equals(True)))
101133
102 def test_switch_scale(self):134 def test_switch_scale(self):
103 """Tests switching the scale in the settings"""135 """Tests switching the scale in the settings"""
@@ -106,7 +138,8 @@
106 self._open_settings_sheet()138 self._open_settings_sheet()
107139
108 # open the value selector140 # open the value selector
109 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))141 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
142 Eventually(Not(Is(None))))
110 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")143 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
111 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))144 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
112 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))145 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
@@ -128,7 +161,8 @@
128161
129 # switch back to metric values again162 # switch back to metric values again
130 self._open_settings_sheet()163 self._open_settings_sheet()
131 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))164 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
165 Eventually(Not(Is(None))))
132 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")166 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
133 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))167 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
134 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))168 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
@@ -161,7 +195,8 @@
161 self._open_settings_sheet()195 self._open_settings_sheet()
162196
163 # open the temp value selector197 # open the temp value selector
164 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'), Eventually(Not(Is(None))))198 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='TemperatureUnitsSelector'),
199 Eventually(Not(Is(None))))
165 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")200 units_selector = self.main_window.select_single('OptionSelector', objectName="TemperatureUnitsSelector")
166 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))201 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
167 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))202 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
@@ -176,7 +211,8 @@
176 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))211 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
177212
178 # open the wind value selector213 # open the wind value selector
179 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))214 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
215 Eventually(Not(Is(None))))
180 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")216 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
181 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))217 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
182 self.pointing_device.click_object(units_selector)218 self.pointing_device.click_object(units_selector)
@@ -200,7 +236,8 @@
200 self._open_settings_sheet()236 self._open_settings_sheet()
201237
202 # open the wind value selector238 # open the wind value selector
203 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))239 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
240 Eventually(Not(Is(None))))
204 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")241 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
205 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))242 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
206 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))243 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
@@ -222,7 +259,8 @@
222259
223 # switch back to kmh values again260 # switch back to kmh values again
224 self._open_settings_sheet()261 self._open_settings_sheet()
225 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'), Eventually(Not(Is(None))))262 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='WindUnitsSelector'),
263 Eventually(Not(Is(None))))
226 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")264 units_selector = self.main_window.select_single('OptionSelector', objectName="WindUnitsSelector")
227 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))265 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
228 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))266 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
@@ -247,6 +285,7 @@
247 self.assertThat(load_indicator.running, Eventually(Equals(False)))285 self.assertThat(load_indicator.running, Eventually(Equals(False)))
248 self._check_wind_units('kmh')286 self._check_wind_units('kmh')
249287
288 @skip("data not available")
250 def test_switch_precipitation_scale(self):289 def test_switch_precipitation_scale(self):
251 """Tests switching the precipition scale in the settings"""290 """Tests switching the precipition scale in the settings"""
252 # first check metric values and open the settings sheet291 # first check metric values and open the settings sheet
@@ -254,7 +293,8 @@
254 self._open_settings_sheet()293 self._open_settings_sheet()
255294
256 # open the precipitation value selector295 # open the precipitation value selector
257 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))296 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
297 Eventually(Not(Is(None))))
258 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")298 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
259 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))299 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
260 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))300 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
@@ -276,7 +316,8 @@
276316
277 # switch back to mm values again317 # switch back to mm values again
278 self._open_settings_sheet()318 self._open_settings_sheet()
279 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))319 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='PrecipitationUnitsSelector'),
320 Eventually(Not(Is(None))))
280 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")321 units_selector = self.main_window.select_single('OptionSelector', objectName="PrecipitationUnitsSelector")
281 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))322 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
282 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))323 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
@@ -303,3 +344,68 @@
303 self.assertThat(load_indicator.running, Eventually(Equals(False)))344 self.assertThat(load_indicator.running, Eventually(Equals(False)))
304 self._check_precipitation_units('mm')345 self._check_precipitation_units('mm')
305346
347 def test_switch_service(self):
348 """Tests switching the scale in the settings"""
349 # first check metric values and open the settings sheet
350 self._check_service('weatherchannel')
351 self._open_settings_sheet()
352
353 # open the value selector
354 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
355 units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")
356 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
357 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
358 current_option = units_selector.select_many('ShapeItem')[1]
359 self.pointing_device.click_object(current_option)
360
361 # choose second option, openweathermap
362 self._move_pointer_around()
363 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
364 second_option = units_selector.select_many('ShapeItem')[2]
365 self.pointing_device.click_object(second_option)
366 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
367
368 # check if precipitation units selector appears
369 self.assertThat(lambda: self.main_window.select_single('OptionSelector',
370 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
371 units_selector = self.main_window.select_single('OptionSelector',
372 objectName="PrecipitationUnitsSelector")
373 self.assertThat(units_selector.visible, Eventually(Equals(1)))
374 self._click_sheet_confirm()
375
376 # wait for reload and check the used service
377 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')
378 self.assertThat(load_indicator.running, Eventually(Equals(False)))
379 self._check_service('openweathermap')
380
381 # switch back to metric values again
382 self._open_settings_sheet()
383 self.assertThat(lambda: self.main_window.select_single('OptionSelector', objectName='ServiceSelector'), Eventually(Not(Is(None))))
384 units_selector = self.main_window.select_single('OptionSelector', objectName="ServiceSelector")
385 self.assertThat(units_selector.selectedIndex, Eventually(Equals(1)))
386 self.assertThat(lambda: units_selector.select_many('ShapeItem')[2], Eventually(Not(Is(None))))
387 current_option = units_selector.select_many('ShapeItem')[2]
388 self.pointing_device.click_object(current_option)
389 # while it's opened, units_selector returns false
390 # self.assertThat(units_selector.expanded, Eventually(Equals(True)))
391
392 # click twc option
393 self._move_pointer_around()
394 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
395 first_option = units_selector.select_single(
396 'OptionSelectorDelegate', objectName='twcOption')
397 self.pointing_device.click_object(first_option)
398 self.assertThat(units_selector.selectedIndex, Eventually(Equals(0)))
399
400 # check if precipitation units selector disappears and confirm
401 self.assertThat(lambda: self.main_window.select_single('OptionSelector',
402 objectName='PrecipitationUnitsSelector'), Eventually(Not(Is(None))))
403 units_selector = self.main_window.select_single('OptionSelector',
404 objectName="PrecipitationUnitsSelector")
405 self.assertThat(units_selector.visible, Eventually(Equals(0)))
406 self._click_sheet_confirm()
407
408 # wait for reload and check the metric values again
409 load_indicator = self.main_window.select_single('ActivityIndicator', objectName='LoadingSpinner')
410 self.assertThat(load_indicator.running, Eventually(Equals(False)))
411 self._check_service('weatherchannel')
306412
=== removed file 'tests/autopilot/ubuntu_weather_app/tests/weatherdata.py'
--- tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 2013-09-29 14:26:37 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/weatherdata.py 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2013 Canonical
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7locations_data = []
8
9locations_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}}}""")
10locations_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}}}""")
110
=== modified file 'ubuntu-weather-app.qml'
--- ubuntu-weather-app.qml 2013-10-08 19:26:12 +0000
+++ ubuntu-weather-app.qml 2014-02-15 10:25:31 +0000
@@ -21,6 +21,7 @@
21import Ubuntu.Components 0.121import Ubuntu.Components 0.1
22import "components" as Components22import "components" as Components
23import "components/GradientsMap.js" as Gradients23import "components/GradientsMap.js" as Gradients
24import "key.js" as Key
24import Ubuntu.Components.Popups 0.125import Ubuntu.Components.Popups 0.1
2526
26MainView {27MainView {
@@ -49,7 +50,8 @@
49 property var settings: {50 property var settings: {
50 "units": Qt.locale().measurementSystem === Locale.MetricSystem ? "metric" : "imperial",51 "units": Qt.locale().measurementSystem === Locale.MetricSystem ? "metric" : "imperial",
51 "wind_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "kmh" : "mph",52 "wind_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "kmh" : "mph",
52 "precip_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "mm" : "in"53 "precip_units": Qt.locale().measurementSystem === Locale.MetricSystem ? "mm" : "in",
54 "service": "weatherchannel"
53 }55 }
5456
55 WorkerScript {57 WorkerScript {
@@ -149,11 +151,16 @@
149 refresh.visible = true;151 refresh.visible = true;
150 if(from_storage === true && force_refresh !== true) {152 if(from_storage === true && force_refresh !== true) {
151 storage.getLocations(buildTabs);153 storage.getLocations(buildTabs);
152 } else {154 } else {
153 storage.getLocations(function(locations) {155 storage.getLocations(function(locations) {
154 locationDataWorker.sendMessage({156 locationDataWorker.sendMessage({
155 action: "updateData",157 action: "updateData",
156 params: {locations:locations, force: force_refresh}158 params: {
159 locations:locations,
160 force:force_refresh,
161 service:settings["service"],
162 api_key: Key.twcKey
163 }
157 })164 })
158 });165 });
159 }166 }
@@ -174,7 +181,7 @@
174 //Theme.palette.selected.backgroundText = "#000000";181 //Theme.palette.selected.backgroundText = "#000000";
175 Theme.palette.normal.backgroundText = "#55FFFFFF";182 Theme.palette.normal.backgroundText = "#55FFFFFF";
176183
177 storage.getSettings(function(storedSettings) {184 storage.getSettings(function(storedSettings) {
178 for(var settingName in storedSettings) {185 for(var settingName in storedSettings) {
179 settings[settingName] = storedSettings[settingName];186 settings[settingName] = storedSettings[settingName];
180 }187 }

Subscribers

People subscribed via source and target branches