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