Merge lp:~ahayzen/ubuntu-weather-app/reboot-fix-no-settings-button-empty-state into lp:ubuntu-weather-app

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 76
Merged at revision: 75
Proposed branch: lp:~ahayzen/ubuntu-weather-app/reboot-fix-no-settings-button-empty-state
Merge into: lp:ubuntu-weather-app
Diff against target: 388 lines (+186/-65)
10 files modified
app/components/EmptyStateComponent.qml (+67/-0)
app/components/HeaderRow.qml (+1/-19)
app/components/SettingsButton.qml (+43/-0)
app/ubuntu-weather-app.qml (+0/-24)
app/ui/HomePage.qml (+10/-0)
app/ui/LocationsPage.qml (+1/-0)
debian/changelog (+5/-0)
po/com.ubuntu.weather.pot (+13/-9)
tests/autopilot/ubuntu_weather_app/__init__.py (+36/-5)
tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py (+10/-8)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-weather-app/reboot-fix-no-settings-button-empty-state
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+266044@code.launchpad.net

Commit message

* Show settings button on empty state page
* Fix empty state page so that bottom edge animation is ontop

Description of the change

* Show settings button on empty state page
* Fix empty state page so that bottom edge animation is ontop

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

So I know these two things weren't introduced by this MP, but they are probably worth discussing and fixing here:

1. In the Empty State when location detection is off, the phrase "Searching for current location" is inaccurate. When location detection is off, we should probably say "Cannot determine your location" or similar.
2. Ideally we should also display the above when the user denies the request to share location with the app. But I'm not going to require that you do so under this MP.
3. IMO "Add a manual location" doesn't make a whole lot of sense. I think we should change this to "Manually add a location" or maybe even "Search for a location"

For the first two, I think eventually we should add a graphic to the Empty State to make this view more friendly. Something fun like this: http://i.imgur.com/XJC58qk.jpg

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

One more thing, I've suggested this before--but I think we should disable the bottom edge hint when the empty state is visible. One more reason why I think we should is that otherwise we'll want another empty state for that view. There's no additional actions the user can take from the bottom edge when the empty state is shown that they can't do from the empty state. So why have duplicate entry points and excessive empty states?

Or--and this is contradictory in a sense from what I just said-- maybe we should remove the button on this empty state and instead instruct the user how to use the bottom edge? Then we'd eventually want to add an empty state to that view as well.

I'm inclined to think that instructing the user to use the bottom edge in this case is the best option.

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

I agree that the best option is to tell them to use the bottom edge, then we only have 1 single way to add locations.

73. By Andrew Hayzen

* Remove add location button
* Change phrasing of manual add location
* Conditionally show searching location from detectCurrentLocation setting
* Fix padding and responsive views

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
74. By Andrew Hayzen

* Fix autopilot tests

75. By Andrew Hayzen

* Merge of trunk

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

1) Updated the text
2) We can investigate in a future mp
3) Updated the text

Removed add location button and text now states to use bottom edge.

I'm going to rebase the other AP branches to be based on this, so this should land before them please :-)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
76. By Andrew Hayzen

* Fix changelog phrasing

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

lgtm and the tests pass. Thanks! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'app/components/EmptyStateComponent.qml'
2--- app/components/EmptyStateComponent.qml 1970-01-01 00:00:00 +0000
3+++ app/components/EmptyStateComponent.qml 2015-07-29 22:23:49 +0000
4@@ -0,0 +1,67 @@
5+/*
6+ * Copyright (C) 2015 Canonical Ltd
7+ *
8+ * This file is part of Ubuntu Weather App
9+ *
10+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License version 3 as
12+ * published by the Free Software Foundation.
13+ *
14+ * Ubuntu Weather App is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU General Public License
20+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21+ */
22+
23+import QtQuick 2.4
24+import Ubuntu.Components 1.2
25+import "../components"
26+
27+
28+Item {
29+ anchors {
30+ fill: parent
31+ margins: units.gu(2)
32+ }
33+
34+ SettingsButton {
35+ anchors {
36+ right: parent.right
37+ top: parent.top
38+ }
39+ }
40+
41+ Column {
42+ anchors {
43+ centerIn: parent
44+ }
45+ spacing: units.gu(4)
46+ width: parent.width - units.gu(4)
47+
48+ Label {
49+ id: emptyStateLabel
50+ anchors {
51+ horizontalCenter: parent.horizontalCenter
52+ }
53+ horizontalAlignment: Text.AlignHCenter
54+ text: settings.detectCurrentLoaction
55+ ? i18n.tr("Searching for current location...")
56+ : i18n.tr("Cannot determine your location")
57+ width: parent.width
58+ wrapMode: Text.WordWrap
59+ }
60+
61+ Label {
62+ anchors {
63+ horizontalCenter: parent.horizontalCenter
64+ }
65+ horizontalAlignment: Text.AlignHCenter
66+ text: i18n.tr("Manually add a location by swiping up from the bottom of the display")
67+ width: parent.width
68+ wrapMode: Text.WordWrap
69+ }
70+ }
71+}
72
73=== modified file 'app/components/HeaderRow.qml'
74--- app/components/HeaderRow.qml 2015-06-18 01:42:03 +0000
75+++ app/components/HeaderRow.qml 2015-07-29 22:23:49 +0000
76@@ -38,25 +38,7 @@
77 verticalAlignment: Text.AlignVCenter
78 }
79
80- AbstractButton {
81+ SettingsButton {
82 id: settingsButton
83- height: width
84- width: units.gu(4)
85-
86- onClicked: mainPageStack.push(Qt.resolvedUrl("../ui/SettingsPage.qml"))
87-
88- Rectangle {
89- anchors.fill: parent
90- color: Theme.palette.selected.background
91- visible: parent.pressed
92- }
93-
94- Icon {
95- anchors.centerIn: parent
96- color: UbuntuColors.darkGrey
97- height: width
98- name: "settings"
99- width: units.gu(2.5)
100- }
101 }
102 }
103
104=== added file 'app/components/SettingsButton.qml'
105--- app/components/SettingsButton.qml 1970-01-01 00:00:00 +0000
106+++ app/components/SettingsButton.qml 2015-07-29 22:23:49 +0000
107@@ -0,0 +1,43 @@
108+/*
109+ * Copyright (C) 2015 Canonical Ltd
110+ *
111+ * This file is part of Ubuntu Weather App
112+ *
113+ * Ubuntu Weather App is free software: you can redistribute it and/or modify
114+ * it under the terms of the GNU General Public License version 3 as
115+ * published by the Free Software Foundation.
116+ *
117+ * Ubuntu Weather App is distributed in the hope that it will be useful,
118+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
119+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120+ * GNU General Public License for more details.
121+ *
122+ * You should have received a copy of the GNU General Public License
123+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
124+ */
125+
126+import QtQuick 2.4
127+import Ubuntu.Components 1.2
128+
129+
130+AbstractButton {
131+ id: settingsButton
132+ height: width
133+ width: units.gu(4)
134+
135+ onClicked: mainPageStack.push(Qt.resolvedUrl("../ui/SettingsPage.qml"))
136+
137+ Rectangle {
138+ anchors.fill: parent
139+ color: Theme.palette.selected.background
140+ visible: parent.pressed
141+ }
142+
143+ Icon {
144+ anchors.centerIn: parent
145+ color: UbuntuColors.darkGrey
146+ height: width
147+ name: "settings"
148+ width: units.gu(2.5)
149+ }
150+}
151
152=== modified file 'app/ubuntu-weather-app.qml'
153--- app/ubuntu-weather-app.qml 2015-07-27 00:57:57 +0000
154+++ app/ubuntu-weather-app.qml 2015-07-29 22:23:49 +0000
155@@ -172,30 +172,6 @@
156 }
157 }
158
159- Column {
160- anchors.centerIn: parent
161- spacing: units.gu(4)
162- visible: (locationsList == null || locationsList.length == 0) && mainPageStack.depth == 1
163- z: 1000
164-
165- Label {
166- id: emptyStateLabel
167- anchors.horizontalCenter: parent.horizontalCenter
168- text: i18n.tr("Searching for current location...")
169- }
170-
171- Button {
172- id: emptyStateButton
173- objectName: "emptyStateButton"
174-
175- anchors.horizontalCenter: parent.horizontalCenter
176-
177- text: i18n.tr("Add a manual location")
178-
179- onTriggered: mainPageStack.push(Qt.resolvedUrl("ui/AddLocationPage.qml"));
180- }
181- }
182-
183 Data.Storage {
184 id: storage
185
186
187=== modified file 'app/ui/HomePage.qml'
188--- app/ui/HomePage.qml 2015-07-27 22:03:24 +0000
189+++ app/ui/HomePage.qml 2015-07-29 22:23:49 +0000
190@@ -185,4 +185,14 @@
191 LoadingIndicator {
192 id: loadingIndicator
193 }
194+
195+ Loader {
196+ active: (locationsList === null || locationsList.length === 0) && mainPageStack.depth === 1
197+ anchors {
198+ fill: parent
199+ }
200+ asynchronous: true
201+ source: "../components/EmptyStateComponent.qml"
202+ visible: status === Loader.Ready && active
203+ }
204 }
205
206=== modified file 'app/ui/LocationsPage.qml'
207--- app/ui/LocationsPage.qml 2015-07-27 00:57:57 +0000
208+++ app/ui/LocationsPage.qml 2015-07-29 22:23:49 +0000
209@@ -25,6 +25,7 @@
210
211 Page {
212 id: locationsPage
213+ objectName: "locationsPage"
214 // Set to null otherwise the first delegate appears +header.height down the page
215 flickable: null
216 title: i18n.tr("Locations")
217
218=== modified file 'debian/changelog'
219--- debian/changelog 2015-07-27 21:53:41 +0000
220+++ debian/changelog 2015-07-29 22:23:49 +0000
221@@ -13,6 +13,11 @@
222 * Add setting to disable auto detecting location
223 * When running under autopilot do not auto detect location
224 * Fix for console error on startup if there are no locations
225+ * Show settings button on empty state page
226+ * Fix empty state page so that bottom edge animation is ontop
227+ * Remove add location button
228+ * Change phrasing of manual add location
229+ * Conditionally show "searching for current location" depending on the detectCurrentLocation setting
230
231 -- Victor Thompson <victor.thompson@gmail.com> Mon, 01 Jun 2015 20:11:23 -0500
232
233
234=== modified file 'po/com.ubuntu.weather.pot'
235--- po/com.ubuntu.weather.pot 2015-07-27 00:57:57 +0000
236+++ po/com.ubuntu.weather.pot 2015-07-29 22:23:49 +0000
237@@ -8,7 +8,7 @@
238 msgstr ""
239 "Project-Id-Version: ubuntu-weather-app\n"
240 "Report-Msgid-Bugs-To: \n"
241-"POT-Creation-Date: 2015-07-27 01:55+0100\n"
242+"POT-Creation-Date: 2015-07-29 21:25+0100\n"
243 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
244 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
245 "Language-Team: LANGUAGE <LL@li.org>\n"
246@@ -46,6 +46,18 @@
247 msgid "Sunset"
248 msgstr ""
249
250+#: ../app/components/EmptyStateComponent.qml:51
251+msgid "Searching for current location..."
252+msgstr ""
253+
254+#: ../app/components/EmptyStateComponent.qml:52
255+msgid "Cannot determine your location"
256+msgstr ""
257+
258+#: ../app/components/EmptyStateComponent.qml:62
259+msgid "Manually add a location by swiping up from the bottom of the display"
260+msgstr ""
261+
262 #: ../app/components/HomeTempInfo.qml:38
263 msgid "Today"
264 msgstr ""
265@@ -66,14 +78,6 @@
266 msgid "Cancel selection"
267 msgstr ""
268
269-#: ../app/ubuntu-weather-app.qml:184
270-msgid "Searching for current location..."
271-msgstr ""
272-
273-#: ../app/ubuntu-weather-app.qml:193
274-msgid "Add a manual location"
275-msgstr ""
276-
277 #: ../app/ui/AddLocationPage.qml:29
278 msgid "Select a city"
279 msgstr ""
280
281=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
282--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-07-23 00:36:06 +0000
283+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-07-29 22:23:49 +0000
284@@ -6,9 +6,14 @@
285 # by the Free Software Foundation.
286
287 """ubuntu-weather-app tests and emulators - top level package."""
288+from autopilot.introspection import dbus
289+import logging
290 from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase
291
292
293+logger = logging.getLogger(__name__)
294+
295+
296 class UbuntuWeatherAppException(Exception):
297 """Exception raised when there's an error in the Weather App."""
298
299@@ -39,10 +44,9 @@
300 return self.main_view.wait_select_single(
301 HomePage, objectName="homePage")
302
303- def click_add_location_button(self):
304- add_location_button = self.main_view.wait_select_single(
305- "Button", objectName="emptyStateButton")
306- self.app.pointing_device.click_object(add_location_button)
307+ def get_locations_page(self):
308+ return self.main_view.wait_select_single(
309+ LocationsPage, objectName="locationsPage")
310
311
312 class Page(UbuntuUIToolkitCustomProxyObjectBase):
313@@ -56,6 +60,27 @@
314 def __init__(self, *args):
315 super(PageWithBottomEdge, self).__init__(*args)
316
317+ def reveal_bottom_edge_page(self):
318+ """Bring the bottom edge page to the screen"""
319+
320+ self.bottomEdgePageLoaded.wait_for(True)
321+
322+ try:
323+ action_item = self.wait_select_single(objectName='bottomEdgeTip')
324+ action_item.visible.wait_for(True)
325+ start_x = (action_item.globalRect.x +
326+ (action_item.globalRect.width * 0.5))
327+ start_y = (action_item.globalRect.y +
328+ (action_item.height * 0.5))
329+ stop_y = start_y - (self.height * 0.7)
330+
331+ self.pointing_device.drag(start_x, start_y,
332+ start_x, stop_y, rate=2)
333+ self.isReady.wait_for(True)
334+ except dbus.StateNotFoundError:
335+ logger.error('BottomEdge element not found.')
336+ raise
337+
338
339 class AddLocationPage(Page):
340 """Autopilot helper for AddLocationPage."""
341@@ -63,7 +88,7 @@
342 super(AddLocationPage, self).__init__(*args)
343
344
345-class HomePage(Page):
346+class HomePage(PageWithBottomEdge):
347 """Autopilot helper for HomePage."""
348 def __init__(self, *args):
349 super(HomePage, self).__init__(*args)
350@@ -73,6 +98,12 @@
351 "QQuickListView", objectName="locationPages").count
352
353
354+class LocationsPage(Page):
355+ """Autopilot helper for LocationsPage."""
356+ def __init__(self, *args, **kwargs):
357+ super(LocationsPage, self).__init__(*args, **kwargs)
358+
359+
360 class MainView(MainView):
361 """Autopilot custom proxy object for the MainView."""
362 retry_delay = 0.2
363
364=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py'
365--- tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py 2015-07-18 19:08:21 +0000
366+++ tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py 2015-07-29 22:23:49 +0000
367@@ -25,11 +25,13 @@
368 super(TestEmptyState, self).setUp()
369
370 def test_add_location_button(self):
371- """ tests that the add location page is shown after the Add Location
372- button is clicked """
373-
374- self.app.click_add_location_button()
375-
376- add_location_page = self.app.get_add_location_page()
377-
378- self.assertThat(add_location_page.visible, Eventually(Equals(True)))
379+ """ tests that the add location page is shown after swiping up
380+ the bottom edge"""
381+
382+ home_page = self.app.get_home_page()
383+ home_page.visible.wait_for(True)
384+ home_page.reveal_bottom_edge_page()
385+
386+ locations_page = self.app.get_locations_page()
387+
388+ self.assertThat(locations_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches

to all changes: