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

Proposed by Martin Borho on 2013-08-19
Status: Merged
Approved by: Raúl Yeguas on 2013-08-20
Approved revision: 100
Merged at revision: 97
Proposed branch: lp:~martin-borho/ubuntu-weather-app/SquaredWeatherItems2
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 662 lines (+346/-276)
4 files modified
components/CurrentWeather.qml (+89/-272)
components/WeatherDetailComponent.qml (+132/-0)
components/WeatherTemperatureComponent.qml (+121/-0)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+4/-4)
To merge this branch: bzr merge lp:~martin-borho/ubuntu-weather-app/SquaredWeatherItems2
Reviewer Review Type Date Requested Status
Raúl Yeguas 2013-08-19 Approve on 2013-08-20
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-08-19
Review via email: mp+180925@code.launchpad.net

Commit message

Updated the UI to make a first approximation to the final design, so it will need only the final assets and some retouches.
Added a WeatherDetailComponent and a WeatherTemperatureComponent. [Raúl Yeguas]

Description of the change

* test
* trying to fix continuous integration, merged dependency fix from trunk
* branched from https://code.launchpad.net/~neokore/ubuntu-weather-app/SquaredWeatherItems/+merge/180349

To post a comment you must log in.
100. By Martin Borho on 2013-08-19

fixed autopilot tests

Raúl Yeguas (neokore) wrote :

Great work, Martin! Sorry for the delay. Thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components/CurrentWeather.qml'
--- components/CurrentWeather.qml 2013-08-05 18:53:33 +0000
+++ components/CurrentWeather.qml 2013-08-19 18:58:54 +0000
@@ -38,286 +38,103 @@
38 anchors.fill: parent38 anchors.fill: parent
39 color: "transparent"39 color: "transparent"
4040
41 Components.WeatherConditionIconComponent {41 Column {
42 id: currentCondition242 id: leftColumn
43 width: units.gu(20)43 anchors {
44 height: units.gu(20)44 horizontalCenter: parent.horizontalCenter
45 anchors.horizontalCenter: parent.horizontalCenter45 horizontalCenterOffset: units.gu(-16)
46 anchors.horizontalCenterOffset: units.gu(-6)46 verticalCenter: parent.verticalCenter
47 condition: currentWeather.icon47 }
4848 spacing: units.gu(1)
49 NumberAnimation on opacity {49
50 id: createAnimation250 Components.WeatherDetailComponent {
51 easing.type: Easing.Linear51 value: currentWeather.humidity
52 from: 052 measure: i18n.tr("Humidity")
53 to: 153 unit: i18n.tr('%')
54 duration: 100054 width: units.gu(15)
55 }55 }
5656
57 Component.onCompleted: {57 Components.WeatherDetailComponent {
58 createAnimation2.start()58 value: currentWeather.windSpeed
59 }59 measure: i18n.tr("Wind speed")
60 }60 unit: currentWeather.speedScale + " " + currentWeather.windDir
6161 }
62 Rectangle {62 }
63 id: rectangle1263
64 width: units.gu(50)64 Column {
65 height: units.gu(10)65 id: rightColumn
66 anchors.horizontalCenter: parent.horizontalCenter66 anchors {
67 anchors.top: currentCondition2.bottom67 horizontalCenter: parent.horizontalCenter
68 anchors.topMargin: 068 horizontalCenterOffset: units.gu(0)
69 color: "transparent"69 verticalCenter: parent.verticalCenter
7070 }
71 Column {71 spacing: units.gu(1)
72 id: column1272
73 width: units.gu(5)73 Components.WeatherDetailComponent {
74 height: units.gu(5)74 value: 1004
75 anchors.rightMargin: units.gu(2)75 measure: i18n.tr("Pressure")
76 anchors.verticalCenter: parent.verticalCenter76 unit: i18n.tr("mbar")
77 anchors.right: tempCurrent2.left77 }
78 visible: showMaxTemp78
7979 Components.WeatherDetailComponent {
80 Label {80 value: currentWeather.precipitation
81 text: i18n.tr("Max.")81 measure: i18n.tr("Precipitation")
82 anchors.horizontalCenter: parent.horizontalCenter82 unit: currentWeather.precipScale
83 font.pixelSize: FontUtils.sizeToPixels("small")
84 horizontalAlignment: Text.AlignHCenter
85 }
86
87 Label {
88 id: tempMax2
89 text: maxTemp+"°"+currentWeather.tempScale
90 anchors.horizontalCenter: parent.horizontalCenter
91 font.pixelSize: FontUtils.sizeToPixels("large")
92 horizontalAlignment: Text.AlignHCenter
93 color: Theme.palette.normal.baseText
94 }
95 }
96
97 Text {
98 width: units.gu(17)
99 height: units.gu(10)
100 id: tempCurrent2
101 objectName: "CurrentTempText"
102 text: currentTemp+String("°")+currentWeather.tempScale
103 style: Text.Normal
104 font.bold: false
105 font.family: "Ubuntu"
106 verticalAlignment: Text.AlignVCenter
107 anchors.horizontalCenter: parent.horizontalCenter
108 anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4)
109 anchors.verticalCenter: parent.verticalCenter
110 font.pointSize: 52
111 horizontalAlignment: Text.AlignHCenter
112 color: Theme.palette.normal.baseText
113 }
114
115 Column {
116 id: column22
117 width: units.gu(5)
118 height: units.gu(5)
119 anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4)
120 anchors.verticalCenter: parent.verticalCenter
121 anchors.left: tempCurrent2.right
122
123 Label {
124 text: i18n.tr("Min.")
125 horizontalAlignment: Text.AlignHCenter
126 anchors.horizontalCenter: parent.horizontalCenter
127 font.pixelSize: FontUtils.sizeToPixels("small")
128 color: Theme.palette.normal.baseText
129 }
130
131 Label {
132 id: tempMin2
133 text: minTemp+"°"+currentWeather.tempScale
134 horizontalAlignment: Text.AlignHCenter
135 anchors.horizontalCenter: parent.horizontalCenter
136 font.pixelSize: FontUtils.sizeToPixels("large")
137 color: Theme.palette.normal.baseText
138 }
139 }
140 }
141
142 Column {
143 id: windColumn
144 anchors.left: currentCondition2.right
145 anchors.leftMargin: units.gu(3)
146 height: childrenRect.height
147 width: childrenRect.width
148
149 Label {
150 id: windLabel
151 text: i18n.tr("Wind")
152 horizontalAlignment: Text.AlignLeft
153 font.pixelSize: FontUtils.sizeToPixels("small")
154 color: Theme.palette.normal.baseText
155 }
156 Label {
157 id: windValue
158 text: currentWeather.windSpeed+" "+currentWeather.speedScale+" "+currentWeather.windDir
159 horizontalAlignment: Text.AlignLeft
160 font.pixelSize: FontUtils.sizeToPixels("large")
161 color: Theme.palette.normal.baseText
162 }
163 }
164
165 Column {
166 id: humidityColumn
167 anchors.left: currentCondition2.right
168 anchors.leftMargin: units.gu(3)
169 anchors.top: windColumn.bottom
170 anchors.topMargin: units.gu(2)
171 height: childrenRect.height
172 width: childrenRect.width
173
174 Label {
175 id: humidityLabel
176 text: i18n.tr("Humidity")
177 horizontalAlignment: Text.AlignLeft
178 font.pixelSize: FontUtils.sizeToPixels("small")
179 color: Theme.palette.normal.baseText
180 }
181 Label {
182 id: humidityValue
183 text: currentWeather.humidity+"%"
184 horizontalAlignment: Text.AlignLeft
185 font.pixelSize: FontUtils.sizeToPixels("large")
186 color: Theme.palette.normal.baseText
187 }
188 }
189
190 Column {
191 id: precipitationColumn
192 anchors.left: currentCondition2.right
193 anchors.leftMargin: units.gu(3)
194 anchors.top: humidityColumn.bottom
195 anchors.topMargin: units.gu(2)
196 height: childrenRect.height
197 width: childrenRect.width
198
199 Label {
200 id: precipitationLabel
201 text: i18n.tr("Precipitation")
202 horizontalAlignment: Text.AlignLeft
203 font.pixelSize: FontUtils.sizeToPixels("small")
204 color: Theme.palette.normal.baseText
205 }
206 Label {
207 id: precipitationValue
208 text: currentWeather.precipitation.toFixed(1)+" "+currentWeather.precipScale
209 horizontalAlignment: Text.AlignLeft
210 font.pixelSize: FontUtils.sizeToPixels("large")
211 color: Theme.palette.normal.baseText
212 }83 }
213 }84 }
214 }85 }
21586
216 front:87 front:
217 Rectangle {88 Rectangle {
89 color: "transparent"
218 anchors.fill: parent90 anchors.fill: parent
219 color: "transparent"91
22092
221 Components.WeatherConditionIconComponent {93 UbuntuShape {
222 id: currentCondition94 id: currentCondition
223 width: units.gu(30)95 color: "#20FFFFFF"
224 height: units.gu(30)96 radius: "medium"
225 anchors.horizontalCenter: parent.horizontalCenter97
226 condition: currentWeather.icon98 width: units.gu(15)
22799 height: units.gu(15)
228 NumberAnimation on opacity {100 anchors {
229 id: createAnimation101 horizontalCenter: parent.horizontalCenter
230 easing.type: Easing.Linear102 horizontalCenterOffset: units.gu(-8)
231 from: 0103 verticalCenter: parent.verticalCenter
232 to: 1104 }
233 duration: 1000105
234 }106 Components.WeatherConditionIconComponent {
235107
236 Component.onCompleted: {108 anchors.fill: parent
237 createAnimation.start()109 anchors.margins: units.gu(1)
238 }110 condition: currentWeather.icon
239 }111
240112 NumberAnimation on opacity {
241 Rectangle {113 id: createAnimation
242 id: rectangle1114 easing.type: Easing.Linear
243 width: units.gu(50)115 from: 0
244 height: units.gu(10)116 to: 1
245 anchors.horizontalCenter: parent.horizontalCenter117 duration: 1000
246 anchors.top: currentCondition.bottom118 }
247 anchors.topMargin: 0119
248 color: "transparent"120 Component.onCompleted: {
249121 createAnimation.start()
250 Column {122 }
251 id: column1123 }
252 width: units.gu(5)124 }
253 height: units.gu(5)125
254 anchors.rightMargin: units.gu(2)126 Components.WeatherTemperatureComponent {
255 anchors.verticalCenter: parent.verticalCenter127 currentTemp: currentWeather.currentTemp
256 anchors.right: tempCurrent.left128 minTemp: currentWeather.minTemp
257 visible: showMaxTemp129 maxTemp: currentWeather.maxTemp
258130
259 Label {131 anchors {
260 text: i18n.tr("Max.")132 horizontalCenter: parent.horizontalCenter
261 anchors.horizontalCenter: parent.horizontalCenter133 horizontalCenterOffset: units.gu(8)
262 font.pixelSize: FontUtils.sizeToPixels("small")134 verticalCenter: parent.verticalCenter
263 horizontalAlignment: Text.AlignHCenter135 }
264 }136 }
265137 }
266 Label {
267 id: tempMax
268 text: maxTemp+"°"+currentWeather.tempScale
269 anchors.horizontalCenter: parent.horizontalCenter
270 font.pixelSize: FontUtils.sizeToPixels("large")
271 horizontalAlignment: Text.AlignHCenter
272 color: Theme.palette.normal.baseText
273 }
274 }
275
276 Text {
277 width: units.gu(17)
278 height: units.gu(10)
279 id: tempCurrent
280 objectName: "CurrentTempText"
281 text: currentTemp+String("°")+currentWeather.tempScale
282 style: Text.Normal
283 font.bold: false
284 font.family: "Ubuntu"
285 verticalAlignment: Text.AlignVCenter
286 anchors.horizontalCenter: parent.horizontalCenter
287 anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4)
288 anchors.verticalCenter: parent.verticalCenter
289 font.pointSize: 52
290 horizontalAlignment: Text.AlignHCenter
291 color: Theme.palette.normal.baseText
292 }
293
294 Column {
295 id: column2
296 width: units.gu(5)
297 height: units.gu(5)
298 anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4)
299 anchors.verticalCenter: parent.verticalCenter
300 anchors.left: tempCurrent.right
301
302 Label {
303 text: i18n.tr("Min.")
304 horizontalAlignment: Text.AlignHCenter
305 anchors.horizontalCenter: parent.horizontalCenter
306 font.pixelSize: FontUtils.sizeToPixels("small")
307 color: Theme.palette.normal.baseText
308 }
309
310 Label {
311 id: tempMin
312 text: minTemp+"°"+currentWeather.tempScale
313 horizontalAlignment: Text.AlignHCenter
314 anchors.horizontalCenter: parent.horizontalCenter
315 font.pixelSize: FontUtils.sizeToPixels("large")
316 color: Theme.palette.normal.baseText
317 }
318 }
319 }
320 }
321138
322 transform: Rotation {139 transform: Rotation {
323 id: rotation140 id: rotation
324141
=== added file 'components/WeatherDetailComponent.qml'
--- components/WeatherDetailComponent.qml 1970-01-01 00:00:00 +0000
+++ components/WeatherDetailComponent.qml 2013-08-19 18:58:54 +0000
@@ -0,0 +1,132 @@
1import QtQuick 2.0
2import QtGraphicalEffects 1.0
3import Ubuntu.Components 0.1
4
5UbuntuShape {
6 id: infoComponent
7 color: "#20FFFFFF"
8 radius: "medium"
9
10 width: units.gu(15)
11 height: units.gu(15)
12 anchors {
13 horizontalCenter: parent.horizontalCenter
14 horizontalCenterOffset: units.gu(8)
15 }
16
17 property real value: 99.99
18 property string measure: "Wind speed"
19 property string unit: "kmph SE"
20
21 Text {
22 id: measure
23 text: infoComponent.measure
24 color: Theme.palette.normal.baseText
25 style: Text.Raised
26 font.bold: false
27 font.family: "Ubuntu"
28 font.pointSize: FontUtils.sizeToPixels("x-small") //9
29 fontSizeMode: Text.Fit
30 verticalAlignment: Text.AlignVCenter
31 horizontalAlignment: Text.AlignHCenter
32 anchors {
33 left: parent.left
34 leftMargin: units.gu(2)
35 top: parent.top
36 topMargin: units.gu(2)
37 }
38 }
39
40 Rectangle {
41 id:line1
42 color: "#55000000"
43 anchors {
44 top: measure.bottom
45 topMargin: units.gu(0.5)
46 left: parent.left
47 leftMargin: units.gu(2)
48 right: parent.right
49 rightMargin: units.gu(2)
50 }
51 height: 1
52 width: units.gu(10)
53 }
54 Rectangle {
55 color: "#55FFFFFF"
56 anchors {
57 top: line1.bottom
58 bottomMargin: 1
59 left: line1.left
60 right: line1.right
61 }
62 height: 1
63 width: units.gu(10)
64
65 }
66
67 Text {
68 id: value
69 objectName: "CurrentTempText"
70 text: infoComponent.value.toPrecision()
71 color: Theme.palette.normal.baseText
72 style: Text.Raised
73 font.bold: false
74 font.family: "Ubuntu"
75 font.pointSize: FontUtils.sizeToPixels("x-large") //36
76 fontSizeMode: Text.Fit
77 verticalAlignment: Text.AlignVCenter
78 horizontalAlignment: Text.AlignLeft
79 anchors {
80 verticalCenter: parent.verticalCenter
81 left: parent.left
82 leftMargin: units.gu(2)
83 right: parent.right
84 rightMargin: units.gu(2)
85 }
86 }
87
88 Rectangle {
89 id: line2
90 color: "#55000000"
91 anchors {
92 bottom: unit.top
93 bottomMargin: units.gu(0.5)
94 left: parent.left
95 leftMargin: units.gu(2)
96 right: parent.right
97 rightMargin: units.gu(2)
98 }
99 height: 1
100 width: units.gu(10)
101
102 }
103 Rectangle {
104 color: "#55FFFFFF"
105 anchors {
106 top: line2.bottom
107 bottomMargin: 1
108 left: line2.left
109 right: line2.right
110 }
111 height: 1
112 width: units.gu(10)
113 }
114
115 Text {
116 id: unit
117 text: infoComponent.unit
118 color: Theme.palette.normal.baseText
119 style: Text.Raised
120 font.bold: false
121 font.family: "Ubuntu"
122 font.pointSize: FontUtils.sizeToPixels("x-small") //9
123 verticalAlignment: Text.AlignVCenter
124 horizontalAlignment: Text.AlignHCenter
125 anchors {
126 bottom: parent.bottom
127 bottomMargin: units.gu(2)
128 left: parent.left
129 leftMargin: units.gu(2)
130 }
131 }
132}
0133
=== added file 'components/WeatherTemperatureComponent.qml'
--- components/WeatherTemperatureComponent.qml 1970-01-01 00:00:00 +0000
+++ components/WeatherTemperatureComponent.qml 2013-08-19 18:58:54 +0000
@@ -0,0 +1,121 @@
1import QtQuick 2.0
2import QtGraphicalEffects 1.0
3import Ubuntu.Components 0.1
4
5UbuntuShape {
6 id: tempComponent
7 color: "#20FFFFFF"
8 radius: "medium"
9
10 width: units.gu(15)
11 height: units.gu(15)
12
13 property int currentTemp: 27
14 property int maxTemp: 35
15 property int minTemp: 27
16
17 Text {
18 id: value
19 objectName: "CurrentTempText"
20 text: tempComponent.currentTemp
21 color: Theme.palette.normal.baseText
22 style: Text.Raised
23 font.bold: false
24 font.family: "Ubuntu"
25 font.pointSize: 64 //FontUtils.sizeToPixels("x-large")
26 font.letterSpacing: -2
27 fontSizeMode: Text.Fit
28 verticalAlignment: Text.AlignTop
29 horizontalAlignment: Text.AlignRight
30 height: units.gu(9)
31 width: units.gu(9)
32 anchors {
33 top: parent.top
34 topMargin: units.gu(1)
35 left: parent.left
36 leftMargin: units.gu(1)
37 }
38 }
39 Text {
40 id: currentTempScale
41 text: String("°")
42 style: Text.Raised
43 font.bold: false
44 font.family: "Ubuntu"
45 font.pointSize: FontUtils.sizeToPixels("x-large") //32
46 verticalAlignment: Text.AlignTop
47 horizontalAlignment: Text.AlignLeft
48 color: Theme.palette.normal.baseText
49 height: units.gu(9)
50 anchors {
51 top: value.top
52 topMargin: units.gu(0.5)
53 left: value.right
54 }
55 }
56
57 Rectangle {
58 id: line2
59 color: "#55000000"
60 anchors {
61 top: value.bottom
62 left: parent.left
63 leftMargin: units.gu(2)
64 right: parent.right
65 rightMargin: units.gu(2)
66 }
67 height: 1
68 width: units.gu(10)
69
70 }
71 Rectangle {
72 color: "#55FFFFFF"
73 anchors {
74 top: line2.bottom
75 bottomMargin: 1
76 left: line2.left
77 right: line2.right
78 }
79 height: 1
80 width: units.gu(10)
81
82 }
83
84
85 Text {
86 id: max
87 text: i18n.tr("H: ")+tempComponent.maxTemp
88 color: Theme.palette.normal.baseText
89 style: Text.Raised
90 font.bold: false
91 font.family: "Ubuntu"
92 font.pointSize: FontUtils.sizeToPixels("small")
93 verticalAlignment: Text.AlignVCenter
94 horizontalAlignment: Text.AlignHCenter
95 anchors {
96 bottom: parent.bottom
97 bottomMargin: units.gu(2)
98 left: parent.left
99 leftMargin: units.gu(2)
100 }
101 }
102
103 Text {
104 id: min
105 text: i18n.tr("L: ")+tempComponent.minTemp
106 color: Theme.palette.normal.baseText
107 style: Text.Raised
108 font.bold: false
109 font.family: "Ubuntu"
110 font.pointSize: FontUtils.sizeToPixels("small")
111 fontSizeMode: Text.Fit
112 verticalAlignment: Text.AlignVCenter
113 horizontalAlignment: Text.AlignHCenter
114 anchors {
115 bottom: parent.bottom
116 bottomMargin: units.gu(2)
117 right: parent.right
118 rightMargin: units.gu(2)
119 }
120 }
121}
0122
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-08-14 20:28:56 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-08-19 18:58:54 +0000
@@ -38,11 +38,11 @@
38 """Checks selected units by values from the first location tab"""38 """Checks selected units by values from the first location tab"""
39 current_temps = self.main_window.get_objects('QQuickText', 'CurrentTempText')39 current_temps = self.main_window.get_objects('QQuickText', 'CurrentTempText')
40 if units == "imperial":40 if units == "imperial":
41 self.assertThat(current_temps[0].text, Eventually(Equals(u'70°F')))41 self.assertThat(current_temps[0].text, Eventually(Equals(u'70')))
42 self.assertThat(current_temps[2].text, Eventually(Equals(u'73°F')))42 self.assertThat(current_temps[1].text, Eventually(Equals(u'73')))
43 else:43 else:
44 self.assertThat(current_temps[0].text, Eventually(Equals(u'21°C')))44 self.assertThat(current_temps[0].text, Eventually(Equals(u'21')))
45 self.assertThat(current_temps[2].text, Eventually(Equals(u'23°C')))45 self.assertThat(current_temps[1].text, Eventually(Equals(u'23')))
4646
47 def test_switch_scale(self):47 def test_switch_scale(self):
48 """Tests switching the scale in the settings"""48 """Tests switching the scale in the settings"""

Subscribers

People subscribed via source and target branches