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
1=== modified file 'components/CurrentWeather.qml'
2--- components/CurrentWeather.qml 2013-08-05 18:53:33 +0000
3+++ components/CurrentWeather.qml 2013-08-19 18:58:54 +0000
4@@ -38,286 +38,103 @@
5 anchors.fill: parent
6 color: "transparent"
7
8- Components.WeatherConditionIconComponent {
9- id: currentCondition2
10- width: units.gu(20)
11- height: units.gu(20)
12- anchors.horizontalCenter: parent.horizontalCenter
13- anchors.horizontalCenterOffset: units.gu(-6)
14- condition: currentWeather.icon
15-
16- NumberAnimation on opacity {
17- id: createAnimation2
18- easing.type: Easing.Linear
19- from: 0
20- to: 1
21- duration: 1000
22- }
23-
24- Component.onCompleted: {
25- createAnimation2.start()
26- }
27- }
28-
29- Rectangle {
30- id: rectangle12
31- width: units.gu(50)
32- height: units.gu(10)
33- anchors.horizontalCenter: parent.horizontalCenter
34- anchors.top: currentCondition2.bottom
35- anchors.topMargin: 0
36- color: "transparent"
37-
38- Column {
39- id: column12
40- width: units.gu(5)
41- height: units.gu(5)
42- anchors.rightMargin: units.gu(2)
43- anchors.verticalCenter: parent.verticalCenter
44- anchors.right: tempCurrent2.left
45- visible: showMaxTemp
46-
47- Label {
48- text: i18n.tr("Max.")
49- anchors.horizontalCenter: parent.horizontalCenter
50- font.pixelSize: FontUtils.sizeToPixels("small")
51- horizontalAlignment: Text.AlignHCenter
52- }
53-
54- Label {
55- id: tempMax2
56- text: maxTemp+"°"+currentWeather.tempScale
57- anchors.horizontalCenter: parent.horizontalCenter
58- font.pixelSize: FontUtils.sizeToPixels("large")
59- horizontalAlignment: Text.AlignHCenter
60- color: Theme.palette.normal.baseText
61- }
62- }
63-
64- Text {
65- width: units.gu(17)
66- height: units.gu(10)
67- id: tempCurrent2
68- objectName: "CurrentTempText"
69- text: currentTemp+String("°")+currentWeather.tempScale
70- style: Text.Normal
71- font.bold: false
72- font.family: "Ubuntu"
73- verticalAlignment: Text.AlignVCenter
74- anchors.horizontalCenter: parent.horizontalCenter
75- anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4)
76- anchors.verticalCenter: parent.verticalCenter
77- font.pointSize: 52
78- horizontalAlignment: Text.AlignHCenter
79- color: Theme.palette.normal.baseText
80- }
81-
82- Column {
83- id: column22
84- width: units.gu(5)
85- height: units.gu(5)
86- anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4)
87- anchors.verticalCenter: parent.verticalCenter
88- anchors.left: tempCurrent2.right
89-
90- Label {
91- text: i18n.tr("Min.")
92- horizontalAlignment: Text.AlignHCenter
93- anchors.horizontalCenter: parent.horizontalCenter
94- font.pixelSize: FontUtils.sizeToPixels("small")
95- color: Theme.palette.normal.baseText
96- }
97-
98- Label {
99- id: tempMin2
100- text: minTemp+"°"+currentWeather.tempScale
101- horizontalAlignment: Text.AlignHCenter
102- anchors.horizontalCenter: parent.horizontalCenter
103- font.pixelSize: FontUtils.sizeToPixels("large")
104- color: Theme.palette.normal.baseText
105- }
106- }
107- }
108-
109- Column {
110- id: windColumn
111- anchors.left: currentCondition2.right
112- anchors.leftMargin: units.gu(3)
113- height: childrenRect.height
114- width: childrenRect.width
115-
116- Label {
117- id: windLabel
118- text: i18n.tr("Wind")
119- horizontalAlignment: Text.AlignLeft
120- font.pixelSize: FontUtils.sizeToPixels("small")
121- color: Theme.palette.normal.baseText
122- }
123- Label {
124- id: windValue
125- text: currentWeather.windSpeed+" "+currentWeather.speedScale+" "+currentWeather.windDir
126- horizontalAlignment: Text.AlignLeft
127- font.pixelSize: FontUtils.sizeToPixels("large")
128- color: Theme.palette.normal.baseText
129- }
130- }
131-
132- Column {
133- id: humidityColumn
134- anchors.left: currentCondition2.right
135- anchors.leftMargin: units.gu(3)
136- anchors.top: windColumn.bottom
137- anchors.topMargin: units.gu(2)
138- height: childrenRect.height
139- width: childrenRect.width
140-
141- Label {
142- id: humidityLabel
143- text: i18n.tr("Humidity")
144- horizontalAlignment: Text.AlignLeft
145- font.pixelSize: FontUtils.sizeToPixels("small")
146- color: Theme.palette.normal.baseText
147- }
148- Label {
149- id: humidityValue
150- text: currentWeather.humidity+"%"
151- horizontalAlignment: Text.AlignLeft
152- font.pixelSize: FontUtils.sizeToPixels("large")
153- color: Theme.palette.normal.baseText
154- }
155- }
156-
157- Column {
158- id: precipitationColumn
159- anchors.left: currentCondition2.right
160- anchors.leftMargin: units.gu(3)
161- anchors.top: humidityColumn.bottom
162- anchors.topMargin: units.gu(2)
163- height: childrenRect.height
164- width: childrenRect.width
165-
166- Label {
167- id: precipitationLabel
168- text: i18n.tr("Precipitation")
169- horizontalAlignment: Text.AlignLeft
170- font.pixelSize: FontUtils.sizeToPixels("small")
171- color: Theme.palette.normal.baseText
172- }
173- Label {
174- id: precipitationValue
175- text: currentWeather.precipitation.toFixed(1)+" "+currentWeather.precipScale
176- horizontalAlignment: Text.AlignLeft
177- font.pixelSize: FontUtils.sizeToPixels("large")
178- color: Theme.palette.normal.baseText
179+ Column {
180+ id: leftColumn
181+ anchors {
182+ horizontalCenter: parent.horizontalCenter
183+ horizontalCenterOffset: units.gu(-16)
184+ verticalCenter: parent.verticalCenter
185+ }
186+ spacing: units.gu(1)
187+
188+ Components.WeatherDetailComponent {
189+ value: currentWeather.humidity
190+ measure: i18n.tr("Humidity")
191+ unit: i18n.tr('%')
192+ width: units.gu(15)
193+ }
194+
195+ Components.WeatherDetailComponent {
196+ value: currentWeather.windSpeed
197+ measure: i18n.tr("Wind speed")
198+ unit: currentWeather.speedScale + " " + currentWeather.windDir
199+ }
200+ }
201+
202+ Column {
203+ id: rightColumn
204+ anchors {
205+ horizontalCenter: parent.horizontalCenter
206+ horizontalCenterOffset: units.gu(0)
207+ verticalCenter: parent.verticalCenter
208+ }
209+ spacing: units.gu(1)
210+
211+ Components.WeatherDetailComponent {
212+ value: 1004
213+ measure: i18n.tr("Pressure")
214+ unit: i18n.tr("mbar")
215+ }
216+
217+ Components.WeatherDetailComponent {
218+ value: currentWeather.precipitation
219+ measure: i18n.tr("Precipitation")
220+ unit: currentWeather.precipScale
221 }
222 }
223 }
224
225 front:
226 Rectangle {
227+ color: "transparent"
228 anchors.fill: parent
229- color: "transparent"
230-
231- Components.WeatherConditionIconComponent {
232+
233+
234+ UbuntuShape {
235 id: currentCondition
236- width: units.gu(30)
237- height: units.gu(30)
238- anchors.horizontalCenter: parent.horizontalCenter
239- condition: currentWeather.icon
240-
241- NumberAnimation on opacity {
242- id: createAnimation
243- easing.type: Easing.Linear
244- from: 0
245- to: 1
246- duration: 1000
247- }
248-
249- Component.onCompleted: {
250- createAnimation.start()
251- }
252- }
253-
254- Rectangle {
255- id: rectangle1
256- width: units.gu(50)
257- height: units.gu(10)
258- anchors.horizontalCenter: parent.horizontalCenter
259- anchors.top: currentCondition.bottom
260- anchors.topMargin: 0
261- color: "transparent"
262-
263- Column {
264- id: column1
265- width: units.gu(5)
266- height: units.gu(5)
267- anchors.rightMargin: units.gu(2)
268- anchors.verticalCenter: parent.verticalCenter
269- anchors.right: tempCurrent.left
270- visible: showMaxTemp
271-
272- Label {
273- text: i18n.tr("Max.")
274- anchors.horizontalCenter: parent.horizontalCenter
275- font.pixelSize: FontUtils.sizeToPixels("small")
276- horizontalAlignment: Text.AlignHCenter
277- }
278-
279- Label {
280- id: tempMax
281- text: maxTemp+"°"+currentWeather.tempScale
282- anchors.horizontalCenter: parent.horizontalCenter
283- font.pixelSize: FontUtils.sizeToPixels("large")
284- horizontalAlignment: Text.AlignHCenter
285- color: Theme.palette.normal.baseText
286- }
287- }
288-
289- Text {
290- width: units.gu(17)
291- height: units.gu(10)
292- id: tempCurrent
293- objectName: "CurrentTempText"
294- text: currentTemp+String("°")+currentWeather.tempScale
295- style: Text.Normal
296- font.bold: false
297- font.family: "Ubuntu"
298- verticalAlignment: Text.AlignVCenter
299- anchors.horizontalCenter: parent.horizontalCenter
300- anchors.horizontalCenterOffset: (showMaxTemp) ? 0 : -units.gu(4)
301- anchors.verticalCenter: parent.verticalCenter
302- font.pointSize: 52
303- horizontalAlignment: Text.AlignHCenter
304- color: Theme.palette.normal.baseText
305- }
306-
307- Column {
308- id: column2
309- width: units.gu(5)
310- height: units.gu(5)
311- anchors.leftMargin: (showMaxTemp) ? units.gu(2) : units.gu(4)
312- anchors.verticalCenter: parent.verticalCenter
313- anchors.left: tempCurrent.right
314-
315- Label {
316- text: i18n.tr("Min.")
317- horizontalAlignment: Text.AlignHCenter
318- anchors.horizontalCenter: parent.horizontalCenter
319- font.pixelSize: FontUtils.sizeToPixels("small")
320- color: Theme.palette.normal.baseText
321- }
322-
323- Label {
324- id: tempMin
325- text: minTemp+"°"+currentWeather.tempScale
326- horizontalAlignment: Text.AlignHCenter
327- anchors.horizontalCenter: parent.horizontalCenter
328- font.pixelSize: FontUtils.sizeToPixels("large")
329- color: Theme.palette.normal.baseText
330- }
331- }
332- }
333- }
334+ color: "#20FFFFFF"
335+ radius: "medium"
336+
337+ width: units.gu(15)
338+ height: units.gu(15)
339+ anchors {
340+ horizontalCenter: parent.horizontalCenter
341+ horizontalCenterOffset: units.gu(-8)
342+ verticalCenter: parent.verticalCenter
343+ }
344+
345+ Components.WeatherConditionIconComponent {
346+
347+ anchors.fill: parent
348+ anchors.margins: units.gu(1)
349+ condition: currentWeather.icon
350+
351+ NumberAnimation on opacity {
352+ id: createAnimation
353+ easing.type: Easing.Linear
354+ from: 0
355+ to: 1
356+ duration: 1000
357+ }
358+
359+ Component.onCompleted: {
360+ createAnimation.start()
361+ }
362+ }
363+ }
364+
365+ Components.WeatherTemperatureComponent {
366+ currentTemp: currentWeather.currentTemp
367+ minTemp: currentWeather.minTemp
368+ maxTemp: currentWeather.maxTemp
369+
370+ anchors {
371+ horizontalCenter: parent.horizontalCenter
372+ horizontalCenterOffset: units.gu(8)
373+ verticalCenter: parent.verticalCenter
374+ }
375+ }
376+ }
377
378 transform: Rotation {
379 id: rotation
380
381=== added file 'components/WeatherDetailComponent.qml'
382--- components/WeatherDetailComponent.qml 1970-01-01 00:00:00 +0000
383+++ components/WeatherDetailComponent.qml 2013-08-19 18:58:54 +0000
384@@ -0,0 +1,132 @@
385+import QtQuick 2.0
386+import QtGraphicalEffects 1.0
387+import Ubuntu.Components 0.1
388+
389+UbuntuShape {
390+ id: infoComponent
391+ color: "#20FFFFFF"
392+ radius: "medium"
393+
394+ width: units.gu(15)
395+ height: units.gu(15)
396+ anchors {
397+ horizontalCenter: parent.horizontalCenter
398+ horizontalCenterOffset: units.gu(8)
399+ }
400+
401+ property real value: 99.99
402+ property string measure: "Wind speed"
403+ property string unit: "kmph SE"
404+
405+ Text {
406+ id: measure
407+ text: infoComponent.measure
408+ color: Theme.palette.normal.baseText
409+ style: Text.Raised
410+ font.bold: false
411+ font.family: "Ubuntu"
412+ font.pointSize: FontUtils.sizeToPixels("x-small") //9
413+ fontSizeMode: Text.Fit
414+ verticalAlignment: Text.AlignVCenter
415+ horizontalAlignment: Text.AlignHCenter
416+ anchors {
417+ left: parent.left
418+ leftMargin: units.gu(2)
419+ top: parent.top
420+ topMargin: units.gu(2)
421+ }
422+ }
423+
424+ Rectangle {
425+ id:line1
426+ color: "#55000000"
427+ anchors {
428+ top: measure.bottom
429+ topMargin: units.gu(0.5)
430+ left: parent.left
431+ leftMargin: units.gu(2)
432+ right: parent.right
433+ rightMargin: units.gu(2)
434+ }
435+ height: 1
436+ width: units.gu(10)
437+ }
438+ Rectangle {
439+ color: "#55FFFFFF"
440+ anchors {
441+ top: line1.bottom
442+ bottomMargin: 1
443+ left: line1.left
444+ right: line1.right
445+ }
446+ height: 1
447+ width: units.gu(10)
448+
449+ }
450+
451+ Text {
452+ id: value
453+ objectName: "CurrentTempText"
454+ text: infoComponent.value.toPrecision()
455+ color: Theme.palette.normal.baseText
456+ style: Text.Raised
457+ font.bold: false
458+ font.family: "Ubuntu"
459+ font.pointSize: FontUtils.sizeToPixels("x-large") //36
460+ fontSizeMode: Text.Fit
461+ verticalAlignment: Text.AlignVCenter
462+ horizontalAlignment: Text.AlignLeft
463+ anchors {
464+ verticalCenter: parent.verticalCenter
465+ left: parent.left
466+ leftMargin: units.gu(2)
467+ right: parent.right
468+ rightMargin: units.gu(2)
469+ }
470+ }
471+
472+ Rectangle {
473+ id: line2
474+ color: "#55000000"
475+ anchors {
476+ bottom: unit.top
477+ bottomMargin: units.gu(0.5)
478+ left: parent.left
479+ leftMargin: units.gu(2)
480+ right: parent.right
481+ rightMargin: units.gu(2)
482+ }
483+ height: 1
484+ width: units.gu(10)
485+
486+ }
487+ Rectangle {
488+ color: "#55FFFFFF"
489+ anchors {
490+ top: line2.bottom
491+ bottomMargin: 1
492+ left: line2.left
493+ right: line2.right
494+ }
495+ height: 1
496+ width: units.gu(10)
497+ }
498+
499+ Text {
500+ id: unit
501+ text: infoComponent.unit
502+ color: Theme.palette.normal.baseText
503+ style: Text.Raised
504+ font.bold: false
505+ font.family: "Ubuntu"
506+ font.pointSize: FontUtils.sizeToPixels("x-small") //9
507+ verticalAlignment: Text.AlignVCenter
508+ horizontalAlignment: Text.AlignHCenter
509+ anchors {
510+ bottom: parent.bottom
511+ bottomMargin: units.gu(2)
512+ left: parent.left
513+ leftMargin: units.gu(2)
514+ }
515+ }
516+}
517
518=== added file 'components/WeatherTemperatureComponent.qml'
519--- components/WeatherTemperatureComponent.qml 1970-01-01 00:00:00 +0000
520+++ components/WeatherTemperatureComponent.qml 2013-08-19 18:58:54 +0000
521@@ -0,0 +1,121 @@
522+import QtQuick 2.0
523+import QtGraphicalEffects 1.0
524+import Ubuntu.Components 0.1
525+
526+UbuntuShape {
527+ id: tempComponent
528+ color: "#20FFFFFF"
529+ radius: "medium"
530+
531+ width: units.gu(15)
532+ height: units.gu(15)
533+
534+ property int currentTemp: 27
535+ property int maxTemp: 35
536+ property int minTemp: 27
537+
538+ Text {
539+ id: value
540+ objectName: "CurrentTempText"
541+ text: tempComponent.currentTemp
542+ color: Theme.palette.normal.baseText
543+ style: Text.Raised
544+ font.bold: false
545+ font.family: "Ubuntu"
546+ font.pointSize: 64 //FontUtils.sizeToPixels("x-large")
547+ font.letterSpacing: -2
548+ fontSizeMode: Text.Fit
549+ verticalAlignment: Text.AlignTop
550+ horizontalAlignment: Text.AlignRight
551+ height: units.gu(9)
552+ width: units.gu(9)
553+ anchors {
554+ top: parent.top
555+ topMargin: units.gu(1)
556+ left: parent.left
557+ leftMargin: units.gu(1)
558+ }
559+ }
560+ Text {
561+ id: currentTempScale
562+ text: String("°")
563+ style: Text.Raised
564+ font.bold: false
565+ font.family: "Ubuntu"
566+ font.pointSize: FontUtils.sizeToPixels("x-large") //32
567+ verticalAlignment: Text.AlignTop
568+ horizontalAlignment: Text.AlignLeft
569+ color: Theme.palette.normal.baseText
570+ height: units.gu(9)
571+ anchors {
572+ top: value.top
573+ topMargin: units.gu(0.5)
574+ left: value.right
575+ }
576+ }
577+
578+ Rectangle {
579+ id: line2
580+ color: "#55000000"
581+ anchors {
582+ top: value.bottom
583+ left: parent.left
584+ leftMargin: units.gu(2)
585+ right: parent.right
586+ rightMargin: units.gu(2)
587+ }
588+ height: 1
589+ width: units.gu(10)
590+
591+ }
592+ Rectangle {
593+ color: "#55FFFFFF"
594+ anchors {
595+ top: line2.bottom
596+ bottomMargin: 1
597+ left: line2.left
598+ right: line2.right
599+ }
600+ height: 1
601+ width: units.gu(10)
602+
603+ }
604+
605+
606+ Text {
607+ id: max
608+ text: i18n.tr("H: ")+tempComponent.maxTemp
609+ color: Theme.palette.normal.baseText
610+ style: Text.Raised
611+ font.bold: false
612+ font.family: "Ubuntu"
613+ font.pointSize: FontUtils.sizeToPixels("small")
614+ verticalAlignment: Text.AlignVCenter
615+ horizontalAlignment: Text.AlignHCenter
616+ anchors {
617+ bottom: parent.bottom
618+ bottomMargin: units.gu(2)
619+ left: parent.left
620+ leftMargin: units.gu(2)
621+ }
622+ }
623+
624+ Text {
625+ id: min
626+ text: i18n.tr("L: ")+tempComponent.minTemp
627+ color: Theme.palette.normal.baseText
628+ style: Text.Raised
629+ font.bold: false
630+ font.family: "Ubuntu"
631+ font.pointSize: FontUtils.sizeToPixels("small")
632+ fontSizeMode: Text.Fit
633+ verticalAlignment: Text.AlignVCenter
634+ horizontalAlignment: Text.AlignHCenter
635+ anchors {
636+ bottom: parent.bottom
637+ bottomMargin: units.gu(2)
638+ right: parent.right
639+ rightMargin: units.gu(2)
640+ }
641+ }
642+}
643
644=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
645--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-08-14 20:28:56 +0000
646+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-08-19 18:58:54 +0000
647@@ -38,11 +38,11 @@
648 """Checks selected units by values from the first location tab"""
649 current_temps = self.main_window.get_objects('QQuickText', 'CurrentTempText')
650 if units == "imperial":
651- self.assertThat(current_temps[0].text, Eventually(Equals(u'70°F')))
652- self.assertThat(current_temps[2].text, Eventually(Equals(u'73°F')))
653+ self.assertThat(current_temps[0].text, Eventually(Equals(u'70')))
654+ self.assertThat(current_temps[1].text, Eventually(Equals(u'73')))
655 else:
656- self.assertThat(current_temps[0].text, Eventually(Equals(u'21°C')))
657- self.assertThat(current_temps[2].text, Eventually(Equals(u'23°C')))
658+ self.assertThat(current_temps[0].text, Eventually(Equals(u'21')))
659+ self.assertThat(current_temps[1].text, Eventually(Equals(u'23')))
660
661 def test_switch_scale(self):
662 """Tests switching the scale in the settings"""

Subscribers

People subscribed via source and target branches