Merge lp:~ahayzen/ubuntu-weather-app/uc1.3-listitems into lp:ubuntu-weather-app
- uc1.3-listitems
- Merge into reboot
Proposed by
Andrew Hayzen
Status: | Merged |
---|---|
Approved by: | Andrew Hayzen |
Approved revision: | 271 |
Merged at revision: | 271 |
Proposed branch: | lp:~ahayzen/ubuntu-weather-app/uc1.3-listitems |
Merge into: | lp:ubuntu-weather-app |
Diff against target: |
1447 lines (+246/-960) 9 files modified
app/components/HeadState/MultiSelectHeadState.qml (+6/-9) app/components/ListItemReorderComponent.qml (+0/-106) app/components/ListItemWithActions.qml (+0/-496) app/components/MultiSelectListView.qml (+33/-14) app/components/WeatherListItem.qml (+31/-111) app/ui/LocationPane.qml (+72/-74) app/ui/LocationsPage.qml (+95/-131) tests/autopilot/ubuntu_weather_app/__init__.py (+7/-17) tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py (+2/-2) |
To merge this branch: | bzr merge lp:~ahayzen/ubuntu-weather-app/uc1.3-listitems |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Sheldon (community) | Approve | ||
Jenkins Bot | continuous-integration | Approve | |
Ubuntu Weather Developers | Pending | ||
Review via email: mp+323134@code.launchpad.net |
Commit message
* Migrate remaining old style listitems to UC1.3 ListItems
Description of the change
* Migrate remaining old style listitems to UC1.3 ListItems
To post a comment you must log in.
Revision history for this message
Andrew Hayzen (ahayzen) wrote : | # |
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:271
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
review:
Approve
(continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote : | # |
Looks good :)
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'app/components/HeadState/MultiSelectHeadState.qml' | |||
2 | --- app/components/HeadState/MultiSelectHeadState.qml 2016-07-19 16:14:05 +0000 | |||
3 | +++ app/components/HeadState/MultiSelectHeadState.qml 2017-04-25 12:59:22 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | /* | 1 | /* |
7 | 2 | * Copyright (C) 2015 | 2 | * Copyright (C) 2015, 2017 |
8 | 3 | * Andrew Hayzen <ahayzen@gmail.com> | 3 | * Andrew Hayzen <ahayzen@gmail.com> |
9 | 4 | * Victor Thompson <victor.thompson@gmail.com> | 4 | * Victor Thompson <victor.thompson@gmail.com> |
10 | 5 | * | 5 | * |
11 | @@ -31,10 +31,7 @@ | |||
12 | 31 | Action { | 31 | Action { |
13 | 32 | text: i18n.tr("Cancel selection") | 32 | text: i18n.tr("Cancel selection") |
14 | 33 | iconName: "back" | 33 | iconName: "back" |
19 | 34 | onTriggered: { | 34 | onTriggered: listview.closeSelection() |
16 | 35 | listview.clearSelection() | ||
17 | 36 | listview.state = "normal" | ||
18 | 37 | } | ||
20 | 38 | } | 35 | } |
21 | 39 | ] | 36 | ] |
22 | 40 | } | 37 | } |
23 | @@ -45,7 +42,7 @@ | |||
24 | 45 | iconName: "select" | 42 | iconName: "select" |
25 | 46 | text: i18n.tr("Select All") | 43 | text: i18n.tr("Select All") |
26 | 47 | onTriggered: { | 44 | onTriggered: { |
28 | 48 | if (listview.selectedItems.length === listview.model.count) { | 45 | if (listview.getSelectedIndices().length === listview.model.count) { |
29 | 49 | listview.clearSelection() | 46 | listview.clearSelection() |
30 | 50 | } else { | 47 | } else { |
31 | 51 | listview.selectAll() | 48 | listview.selectAll() |
32 | @@ -53,13 +50,13 @@ | |||
33 | 53 | } | 50 | } |
34 | 54 | }, | 51 | }, |
35 | 55 | Action { | 52 | Action { |
37 | 56 | enabled: listview.selectedItems.length > 0 | 53 | enabled: listview.getSelectedIndices().length > 0 |
38 | 57 | iconName: "delete" | 54 | iconName: "delete" |
39 | 58 | text: i18n.tr("Delete") | 55 | text: i18n.tr("Delete") |
40 | 59 | visible: removable | 56 | visible: removable |
41 | 60 | 57 | ||
42 | 61 | onTriggered: { | 58 | onTriggered: { |
44 | 62 | removed(listview.selectedItems) | 59 | removed(listview.getSelectedIndices()) |
45 | 63 | 60 | ||
46 | 64 | listview.closeSelection() | 61 | listview.closeSelection() |
47 | 65 | } | 62 | } |
48 | @@ -74,7 +71,7 @@ | |||
49 | 74 | property bool removable: false | 71 | property bool removable: false |
50 | 75 | property Page thisPage | 72 | property Page thisPage |
51 | 76 | 73 | ||
53 | 77 | signal removed(var selectedItems) | 74 | signal removed(var selectedIndices) |
54 | 78 | 75 | ||
55 | 79 | PropertyChanges { | 76 | PropertyChanges { |
56 | 80 | target: thisPage | 77 | target: thisPage |
57 | 81 | 78 | ||
58 | === removed file 'app/components/ListItemReorderComponent.qml' | |||
59 | --- app/components/ListItemReorderComponent.qml 2015-11-02 21:28:34 +0000 | |||
60 | +++ app/components/ListItemReorderComponent.qml 1970-01-01 00:00:00 +0000 | |||
61 | @@ -1,106 +0,0 @@ | |||
62 | 1 | /* | ||
63 | 2 | * Copyright (C) 2013, 2014, 2015 | ||
64 | 3 | * Andrew Hayzen <ahayzen@gmail.com> | ||
65 | 4 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> | ||
66 | 5 | * Victor Thompson <victor.thompson@gmail.com> | ||
67 | 6 | * | ||
68 | 7 | * This program is free software; you can redistribute it and/or modify | ||
69 | 8 | * it under the terms of the GNU General Public License as published by | ||
70 | 9 | * the Free Software Foundation; version 3. | ||
71 | 10 | * | ||
72 | 11 | * This program is distributed in the hope that it will be useful, | ||
73 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
74 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
75 | 14 | * GNU General Public License for more details. | ||
76 | 15 | * | ||
77 | 16 | * You should have received a copy of the GNU General Public License | ||
78 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
79 | 18 | */ | ||
80 | 19 | |||
81 | 20 | import QtQuick 2.4 | ||
82 | 21 | import Ubuntu.Components 1.3 | ||
83 | 22 | |||
84 | 23 | |||
85 | 24 | Item { | ||
86 | 25 | id: actionReorder | ||
87 | 26 | width: units.gu(4) | ||
88 | 27 | |||
89 | 28 | Icon { | ||
90 | 29 | anchors { | ||
91 | 30 | horizontalCenter: parent.horizontalCenter | ||
92 | 31 | verticalCenter: parent.verticalCenter | ||
93 | 32 | } | ||
94 | 33 | name: "navigation-menu" // TODO: use proper image | ||
95 | 34 | height: width | ||
96 | 35 | width: units.gu(3) | ||
97 | 36 | } | ||
98 | 37 | |||
99 | 38 | MouseArea { | ||
100 | 39 | id: actionReorderMouseArea | ||
101 | 40 | anchors { | ||
102 | 41 | fill: parent | ||
103 | 42 | } | ||
104 | 43 | property int startY: 0 | ||
105 | 44 | property int startContentY: 0 | ||
106 | 45 | |||
107 | 46 | onPressed: { | ||
108 | 47 | root.parent.parent.interactive = false; // stop scrolling of listview | ||
109 | 48 | startY = root.y; | ||
110 | 49 | startContentY = root.parent.parent.contentY; | ||
111 | 50 | root.z += 10; // force ontop of other elements | ||
112 | 51 | |||
113 | 52 | console.debug("Reorder listitem pressed", root.y) | ||
114 | 53 | } | ||
115 | 54 | onMouseYChanged: root.y += mouse.y - (root.height / 2); | ||
116 | 55 | onReleased: { | ||
117 | 56 | console.debug("Reorder diff by position", getDiff()); | ||
118 | 57 | |||
119 | 58 | var diff = getDiff(); | ||
120 | 59 | |||
121 | 60 | // Remove the height of the actual item if moved down | ||
122 | 61 | if (diff > 0) { | ||
123 | 62 | diff -= 1; | ||
124 | 63 | } | ||
125 | 64 | |||
126 | 65 | root.parent.parent.interactive = true; // reenable scrolling | ||
127 | 66 | |||
128 | 67 | if (diff === 0) { | ||
129 | 68 | // Nothing has changed so reset the item | ||
130 | 69 | // z index is restored after animation | ||
131 | 70 | resetListItemYAnimation.start(); | ||
132 | 71 | } | ||
133 | 72 | else { | ||
134 | 73 | var newIndex = index + diff; | ||
135 | 74 | |||
136 | 75 | if (newIndex < 0) { | ||
137 | 76 | newIndex = 0; | ||
138 | 77 | } | ||
139 | 78 | else if (newIndex > root.parent.parent.count - 1) { | ||
140 | 79 | newIndex = root.parent.parent.count - 1; | ||
141 | 80 | } | ||
142 | 81 | |||
143 | 82 | root.z -= 10; // restore z index | ||
144 | 83 | reorder(index, newIndex) | ||
145 | 84 | } | ||
146 | 85 | } | ||
147 | 86 | |||
148 | 87 | function getDiff() { | ||
149 | 88 | // Get the amount of items that have been passed over (by centre) | ||
150 | 89 | return Math.round((((root.y - startY) + (root.parent.parent.contentY - startContentY)) / root.height) + 0.5); | ||
151 | 90 | } | ||
152 | 91 | } | ||
153 | 92 | |||
154 | 93 | SequentialAnimation { | ||
155 | 94 | id: resetListItemYAnimation | ||
156 | 95 | UbuntuNumberAnimation { | ||
157 | 96 | target: root; | ||
158 | 97 | property: "y"; | ||
159 | 98 | to: actionReorderMouseArea.startY | ||
160 | 99 | } | ||
161 | 100 | ScriptAction { | ||
162 | 101 | script: { | ||
163 | 102 | root.z -= 10; // restore z index | ||
164 | 103 | } | ||
165 | 104 | } | ||
166 | 105 | } | ||
167 | 106 | } | ||
168 | 107 | 0 | ||
169 | === removed file 'app/components/ListItemWithActions.qml' | |||
170 | --- app/components/ListItemWithActions.qml 2015-11-02 21:28:34 +0000 | |||
171 | +++ app/components/ListItemWithActions.qml 1970-01-01 00:00:00 +0000 | |||
172 | @@ -1,496 +0,0 @@ | |||
173 | 1 | /* | ||
174 | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. | ||
175 | 3 | * | ||
176 | 4 | * This program is free software; you can redistribute it and/or modify | ||
177 | 5 | * it under the terms of the GNU General Public License as published by | ||
178 | 6 | * the Free Software Foundation; version 3. | ||
179 | 7 | * | ||
180 | 8 | * This program is distributed in the hope that it will be useful, | ||
181 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
182 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
183 | 11 | * GNU General Public License for more details. | ||
184 | 12 | * | ||
185 | 13 | * You should have received a copy of the GNU General Public License | ||
186 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
187 | 15 | */ | ||
188 | 16 | |||
189 | 17 | import QtQuick 2.4 | ||
190 | 18 | import Ubuntu.Components 1.3 | ||
191 | 19 | import Ubuntu.Components.ListItems 1.0 as ListItem | ||
192 | 20 | |||
193 | 21 | |||
194 | 22 | Item { | ||
195 | 23 | id: root | ||
196 | 24 | width: parent.width | ||
197 | 25 | |||
198 | 26 | property Action leftSideAction: null | ||
199 | 27 | property list<Action> rightSideActions | ||
200 | 28 | property double defaultHeight: units.gu(8) | ||
201 | 29 | property bool locked: false | ||
202 | 30 | property Action activeAction: null | ||
203 | 31 | property var activeItem: null | ||
204 | 32 | property bool triggerActionOnMouseRelease: false | ||
205 | 33 | property color color: Theme.palette.normal.background | ||
206 | 34 | property color selectedColor: "#E6E6E6" | ||
207 | 35 | property bool selected: false | ||
208 | 36 | property bool selectionMode: false | ||
209 | 37 | property alias internalAnchors: mainContents.anchors | ||
210 | 38 | default property alias contents: mainContents.children | ||
211 | 39 | |||
212 | 40 | readonly property double actionWidth: units.gu(4) | ||
213 | 41 | readonly property double leftActionWidth: units.gu(10) | ||
214 | 42 | readonly property double actionThreshold: actionWidth * 0.4 | ||
215 | 43 | readonly property double threshold: 0.4 | ||
216 | 44 | readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft" | ||
217 | 45 | readonly property alias swipping: mainItemMoving.running | ||
218 | 46 | readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping | ||
219 | 47 | |||
220 | 48 | property alias _main: main // CUSTOM | ||
221 | 49 | property alias pressed: mouseArea.pressed // CUSTOM | ||
222 | 50 | |||
223 | 51 | /* internal */ | ||
224 | 52 | property var _visibleRightSideActions: filterVisibleActions(rightSideActions) | ||
225 | 53 | |||
226 | 54 | signal itemClicked(var mouse) | ||
227 | 55 | signal itemPressAndHold(var mouse) | ||
228 | 56 | |||
229 | 57 | function returnToBoundsRTL(direction) | ||
230 | 58 | { | ||
231 | 59 | var actionFullWidth = actionWidth + units.gu(2) | ||
232 | 60 | |||
233 | 61 | // go back to normal state if swipping reverse | ||
234 | 62 | if (direction === "LTR") { | ||
235 | 63 | updatePosition(0) | ||
236 | 64 | return | ||
237 | 65 | } else if (!triggerActionOnMouseRelease) { | ||
238 | 66 | updatePosition(-rightActionsView.width + units.gu(2)) | ||
239 | 67 | return | ||
240 | 68 | } | ||
241 | 69 | |||
242 | 70 | var xOffset = Math.abs(main.x) | ||
243 | 71 | var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length) | ||
244 | 72 | var newX = 0 | ||
245 | 73 | |||
246 | 74 | if (index === _visibleRightSideActions.length) { | ||
247 | 75 | newX = -(rightActionsView.width - units.gu(2)) | ||
248 | 76 | } else if (index >= 1) { | ||
249 | 77 | newX = -(actionFullWidth * index) | ||
250 | 78 | } | ||
251 | 79 | |||
252 | 80 | updatePosition(newX) | ||
253 | 81 | } | ||
254 | 82 | |||
255 | 83 | function returnToBoundsLTR(direction) | ||
256 | 84 | { | ||
257 | 85 | var finalX = leftActionWidth | ||
258 | 86 | if ((direction === "RTL") || (main.x <= (finalX * root.threshold))) | ||
259 | 87 | finalX = 0 | ||
260 | 88 | updatePosition(finalX) | ||
261 | 89 | } | ||
262 | 90 | |||
263 | 91 | function returnToBounds(direction) | ||
264 | 92 | { | ||
265 | 93 | if (main.x < 0) { | ||
266 | 94 | returnToBoundsRTL(direction) | ||
267 | 95 | } else if (main.x > 0) { | ||
268 | 96 | returnToBoundsLTR(direction) | ||
269 | 97 | } else { | ||
270 | 98 | updatePosition(0) | ||
271 | 99 | } | ||
272 | 100 | } | ||
273 | 101 | |||
274 | 102 | function contains(item, point, marginX) | ||
275 | 103 | { | ||
276 | 104 | var itemStartX = item.x - marginX | ||
277 | 105 | var itemEndX = item.x + item.width + marginX | ||
278 | 106 | return (point.x >= itemStartX) && (point.x <= itemEndX) && | ||
279 | 107 | (point.y >= item.y) && (point.y <= (item.y + item.height)); | ||
280 | 108 | } | ||
281 | 109 | |||
282 | 110 | function getActionAt(point) | ||
283 | 111 | { | ||
284 | 112 | if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) { | ||
285 | 113 | return leftSideAction | ||
286 | 114 | } else if (contains(rightActionsView, point, 0)) { | ||
287 | 115 | var newPoint = root.mapToItem(rightActionsView, point.x, point.y) | ||
288 | 116 | for (var i = 0; i < rightActionsRepeater.count; i++) { | ||
289 | 117 | var child = rightActionsRepeater.itemAt(i) | ||
290 | 118 | if (contains(child, newPoint, units.gu(1))) { | ||
291 | 119 | return i | ||
292 | 120 | } | ||
293 | 121 | } | ||
294 | 122 | } | ||
295 | 123 | return -1 | ||
296 | 124 | } | ||
297 | 125 | |||
298 | 126 | function updateActiveAction() | ||
299 | 127 | { | ||
300 | 128 | if (triggerActionOnMouseRelease && | ||
301 | 129 | (main.x <= -(root.actionWidth + units.gu(2))) && | ||
302 | 130 | (main.x > -(rightActionsView.width - units.gu(2)))) { | ||
303 | 131 | var actionFullWidth = actionWidth + units.gu(2) | ||
304 | 132 | var xOffset = Math.abs(main.x) | ||
305 | 133 | var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length) | ||
306 | 134 | index = index - 1 | ||
307 | 135 | if (index > -1) { | ||
308 | 136 | root.activeItem = rightActionsRepeater.itemAt(index) | ||
309 | 137 | root.activeAction = root._visibleRightSideActions[index] | ||
310 | 138 | } | ||
311 | 139 | } else { | ||
312 | 140 | root.activeAction = null | ||
313 | 141 | } | ||
314 | 142 | } | ||
315 | 143 | |||
316 | 144 | function resetSwipe() | ||
317 | 145 | { | ||
318 | 146 | updatePosition(0) | ||
319 | 147 | } | ||
320 | 148 | |||
321 | 149 | function filterVisibleActions(actions) | ||
322 | 150 | { | ||
323 | 151 | var visibleActions = [] | ||
324 | 152 | for(var i = 0; i < actions.length; i++) { | ||
325 | 153 | var action = actions[i] | ||
326 | 154 | if (action.visible) { | ||
327 | 155 | visibleActions.push(action) | ||
328 | 156 | } | ||
329 | 157 | } | ||
330 | 158 | return visibleActions | ||
331 | 159 | } | ||
332 | 160 | |||
333 | 161 | function updatePosition(pos) | ||
334 | 162 | { | ||
335 | 163 | if (!root.triggerActionOnMouseRelease && (pos !== 0)) { | ||
336 | 164 | mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight" | ||
337 | 165 | } else { | ||
338 | 166 | mouseArea.state = "" | ||
339 | 167 | } | ||
340 | 168 | main.x = pos | ||
341 | 169 | } | ||
342 | 170 | |||
343 | 171 | // CUSTOM remove animation | ||
344 | 172 | SequentialAnimation { | ||
345 | 173 | id: removeAnimation | ||
346 | 174 | |||
347 | 175 | property var action | ||
348 | 176 | |||
349 | 177 | UbuntuNumberAnimation { | ||
350 | 178 | target: root | ||
351 | 179 | duration: UbuntuAnimation.BriskDuration | ||
352 | 180 | property: "height"; | ||
353 | 181 | to: 0 | ||
354 | 182 | } | ||
355 | 183 | ScriptAction { | ||
356 | 184 | script: removeAnimation.action.trigger() | ||
357 | 185 | } | ||
358 | 186 | } | ||
359 | 187 | |||
360 | 188 | states: [ | ||
361 | 189 | State { | ||
362 | 190 | name: "select" | ||
363 | 191 | when: selectionMode || selected | ||
364 | 192 | PropertyChanges { | ||
365 | 193 | target: selectionIcon | ||
366 | 194 | source: Qt.resolvedUrl("ListItemActions/CheckBox.qml") | ||
367 | 195 | anchors.leftMargin: units.gu(2) | ||
368 | 196 | } | ||
369 | 197 | PropertyChanges { | ||
370 | 198 | target: root | ||
371 | 199 | locked: true | ||
372 | 200 | } | ||
373 | 201 | PropertyChanges { | ||
374 | 202 | target: main | ||
375 | 203 | x: 0 | ||
376 | 204 | } | ||
377 | 205 | } | ||
378 | 206 | ] | ||
379 | 207 | |||
380 | 208 | height: defaultHeight | ||
381 | 209 | //clip: height !== defaultHeight // CUSTOM | ||
382 | 210 | |||
383 | 211 | Loader { // CUSTOM | ||
384 | 212 | id: leftActionViewLoader | ||
385 | 213 | anchors { | ||
386 | 214 | top: parent.top | ||
387 | 215 | bottom: parent.bottom | ||
388 | 216 | right: main.left | ||
389 | 217 | } | ||
390 | 218 | asynchronous: true | ||
391 | 219 | sourceComponent: leftSideAction ? leftActionViewComponent : undefined | ||
392 | 220 | } | ||
393 | 221 | |||
394 | 222 | Component { // CUSTOM | ||
395 | 223 | id: leftActionViewComponent | ||
396 | 224 | |||
397 | 225 | Rectangle { | ||
398 | 226 | id: leftActionView | ||
399 | 227 | width: root.leftActionWidth + actionThreshold | ||
400 | 228 | color: UbuntuColors.red | ||
401 | 229 | |||
402 | 230 | Icon { | ||
403 | 231 | id: leftActionIcon | ||
404 | 232 | anchors { | ||
405 | 233 | centerIn: parent | ||
406 | 234 | horizontalCenterOffset: actionThreshold / 2 | ||
407 | 235 | } | ||
408 | 236 | objectName: "swipeDeleteAction" // CUSTOM | ||
409 | 237 | name: leftSideAction && _showActions ? leftSideAction.iconName : "" | ||
410 | 238 | color: Theme.palette.selected.field | ||
411 | 239 | height: units.gu(3) | ||
412 | 240 | width: units.gu(3) | ||
413 | 241 | } | ||
414 | 242 | } | ||
415 | 243 | } | ||
416 | 244 | |||
417 | 245 | //Rectangle { | ||
418 | 246 | Item { // CUSTOM | ||
419 | 247 | id: rightActionsView | ||
420 | 248 | |||
421 | 249 | anchors { | ||
422 | 250 | top: main.top | ||
423 | 251 | left: main.right | ||
424 | 252 | bottom: main.bottom | ||
425 | 253 | } | ||
426 | 254 | visible: _visibleRightSideActions.length > 0 | ||
427 | 255 | width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0 | ||
428 | 256 | // color: "white" // CUSTOM | ||
429 | 257 | |||
430 | 258 | Row { | ||
431 | 259 | anchors{ | ||
432 | 260 | top: parent.top | ||
433 | 261 | left: parent.left | ||
434 | 262 | leftMargin: units.gu(2) | ||
435 | 263 | right: parent.right | ||
436 | 264 | rightMargin: units.gu(2) | ||
437 | 265 | bottom: parent.bottom | ||
438 | 266 | } | ||
439 | 267 | spacing: units.gu(2) | ||
440 | 268 | Repeater { | ||
441 | 269 | id: rightActionsRepeater | ||
442 | 270 | |||
443 | 271 | model: _showActions ? _visibleRightSideActions : [] | ||
444 | 272 | Item { | ||
445 | 273 | property alias image: img | ||
446 | 274 | |||
447 | 275 | height: rightActionsView.height | ||
448 | 276 | width: root.actionWidth | ||
449 | 277 | |||
450 | 278 | Icon { | ||
451 | 279 | id: img | ||
452 | 280 | |||
453 | 281 | anchors.centerIn: parent | ||
454 | 282 | objectName: rightSideActions[index].objectName // CUSTOM | ||
455 | 283 | width: units.gu(3) | ||
456 | 284 | height: units.gu(3) | ||
457 | 285 | name: modelData.iconName | ||
458 | 286 | color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.coolGrey // CUSTOM | ||
459 | 287 | } | ||
460 | 288 | } | ||
461 | 289 | } | ||
462 | 290 | } | ||
463 | 291 | } | ||
464 | 292 | |||
465 | 293 | Rectangle { | ||
466 | 294 | id: main | ||
467 | 295 | objectName: "mainItem" | ||
468 | 296 | |||
469 | 297 | anchors { | ||
470 | 298 | top: parent.top | ||
471 | 299 | bottom: parent.bottom | ||
472 | 300 | } | ||
473 | 301 | |||
474 | 302 | width: parent.width | ||
475 | 303 | color: root.selected ? root.selectedColor : root.color | ||
476 | 304 | |||
477 | 305 | Loader { | ||
478 | 306 | id: selectionIcon | ||
479 | 307 | |||
480 | 308 | anchors { | ||
481 | 309 | left: main.left | ||
482 | 310 | verticalCenter: main.verticalCenter | ||
483 | 311 | } | ||
484 | 312 | asynchronous: true // CUSTOM | ||
485 | 313 | width: (status === Loader.Ready) ? item.implicitWidth : 0 | ||
486 | 314 | visible: (status === Loader.Ready) && (item.width === item.implicitWidth) | ||
487 | 315 | |||
488 | 316 | Behavior on width { | ||
489 | 317 | NumberAnimation { | ||
490 | 318 | duration: UbuntuAnimation.SnapDuration | ||
491 | 319 | } | ||
492 | 320 | } | ||
493 | 321 | } | ||
494 | 322 | |||
495 | 323 | Item { | ||
496 | 324 | id: mainContents | ||
497 | 325 | |||
498 | 326 | anchors { | ||
499 | 327 | left: selectionIcon.right | ||
500 | 328 | //leftMargin: units.gu(2) // CUSTOM | ||
501 | 329 | top: parent.top | ||
502 | 330 | //topMargin: units.gu(1) // CUSTOM | ||
503 | 331 | right: parent.right | ||
504 | 332 | //rightMargin: units.gu(2) // CUSTOM | ||
505 | 333 | bottom: parent.bottom | ||
506 | 334 | //bottomMargin: units.gu(1) // CUSTOM | ||
507 | 335 | } | ||
508 | 336 | } | ||
509 | 337 | |||
510 | 338 | Behavior on x { | ||
511 | 339 | UbuntuNumberAnimation { | ||
512 | 340 | id: mainItemMoving | ||
513 | 341 | |||
514 | 342 | easing.type: Easing.OutElastic | ||
515 | 343 | duration: UbuntuAnimation.SlowDuration | ||
516 | 344 | } | ||
517 | 345 | } | ||
518 | 346 | } | ||
519 | 347 | |||
520 | 348 | SequentialAnimation { | ||
521 | 349 | id: triggerAction | ||
522 | 350 | |||
523 | 351 | property var currentItem: root.activeItem ? root.activeItem.image : null | ||
524 | 352 | |||
525 | 353 | running: false | ||
526 | 354 | ParallelAnimation { | ||
527 | 355 | UbuntuNumberAnimation { | ||
528 | 356 | target: triggerAction.currentItem | ||
529 | 357 | property: "opacity" | ||
530 | 358 | from: 1.0 | ||
531 | 359 | to: 0.0 | ||
532 | 360 | duration: UbuntuAnimation.SlowDuration | ||
533 | 361 | easing {type: Easing.InOutBack; } | ||
534 | 362 | } | ||
535 | 363 | UbuntuNumberAnimation { | ||
536 | 364 | target: triggerAction.currentItem | ||
537 | 365 | properties: "width, height" | ||
538 | 366 | from: units.gu(3) | ||
539 | 367 | to: root.actionWidth | ||
540 | 368 | duration: UbuntuAnimation.SlowDuration | ||
541 | 369 | easing {type: Easing.InOutBack; } | ||
542 | 370 | } | ||
543 | 371 | } | ||
544 | 372 | PropertyAction { | ||
545 | 373 | target: triggerAction.currentItem | ||
546 | 374 | properties: "width, height" | ||
547 | 375 | value: units.gu(3) | ||
548 | 376 | } | ||
549 | 377 | PropertyAction { | ||
550 | 378 | target: triggerAction.currentItem | ||
551 | 379 | properties: "opacity" | ||
552 | 380 | value: 1.0 | ||
553 | 381 | } | ||
554 | 382 | ScriptAction { | ||
555 | 383 | script: { | ||
556 | 384 | root.activeAction.triggered(root) | ||
557 | 385 | mouseArea.state = "" | ||
558 | 386 | } | ||
559 | 387 | } | ||
560 | 388 | PauseAnimation { | ||
561 | 389 | duration: 500 | ||
562 | 390 | } | ||
563 | 391 | UbuntuNumberAnimation { | ||
564 | 392 | target: main | ||
565 | 393 | property: "x" | ||
566 | 394 | to: 0 | ||
567 | 395 | } | ||
568 | 396 | } | ||
569 | 397 | |||
570 | 398 | MouseArea { | ||
571 | 399 | id: mouseArea | ||
572 | 400 | |||
573 | 401 | property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM | ||
574 | 402 | property bool manual: false | ||
575 | 403 | property string direction: "None" | ||
576 | 404 | property real lastX: -1 | ||
577 | 405 | |||
578 | 406 | anchors.fill: parent | ||
579 | 407 | drag { | ||
580 | 408 | target: locked ? null : main | ||
581 | 409 | axis: Drag.XAxis | ||
582 | 410 | minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0 | ||
583 | 411 | maximumX: leftSideAction ? leftActionViewLoader.item.width : 0 | ||
584 | 412 | threshold: root.actionThreshold | ||
585 | 413 | } | ||
586 | 414 | |||
587 | 415 | states: [ | ||
588 | 416 | State { | ||
589 | 417 | name: "LeftToRight" | ||
590 | 418 | PropertyChanges { | ||
591 | 419 | target: mouseArea | ||
592 | 420 | drag.maximumX: 0 | ||
593 | 421 | } | ||
594 | 422 | }, | ||
595 | 423 | State { | ||
596 | 424 | name: "RightToLeft" | ||
597 | 425 | PropertyChanges { | ||
598 | 426 | target: mouseArea | ||
599 | 427 | drag.minimumX: 0 | ||
600 | 428 | } | ||
601 | 429 | } | ||
602 | 430 | ] | ||
603 | 431 | |||
604 | 432 | onMouseXChanged: { | ||
605 | 433 | var offset = (lastX - mouseX) | ||
606 | 434 | if (Math.abs(offset) <= root.actionThreshold) { | ||
607 | 435 | return | ||
608 | 436 | } | ||
609 | 437 | lastX = mouseX | ||
610 | 438 | direction = offset > 0 ? "RTL" : "LTR"; | ||
611 | 439 | } | ||
612 | 440 | |||
613 | 441 | onPressed: { | ||
614 | 442 | lastX = mouse.x | ||
615 | 443 | } | ||
616 | 444 | |||
617 | 445 | onReleased: { | ||
618 | 446 | if (root.triggerActionOnMouseRelease && root.activeAction) { | ||
619 | 447 | triggerAction.start() | ||
620 | 448 | } else { | ||
621 | 449 | root.returnToBounds() | ||
622 | 450 | root.activeAction = null | ||
623 | 451 | } | ||
624 | 452 | lastX = -1 | ||
625 | 453 | direction = "None" | ||
626 | 454 | } | ||
627 | 455 | onClicked: { | ||
628 | 456 | if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode | ||
629 | 457 | selected = !selected | ||
630 | 458 | return | ||
631 | 459 | } else if (main.x === 0) { | ||
632 | 460 | root.itemClicked(mouse) | ||
633 | 461 | } else if (main.x > 0) { | ||
634 | 462 | var action = getActionAt(Qt.point(mouse.x, mouse.y)) | ||
635 | 463 | if (action && action !== -1) { | ||
636 | 464 | //action.triggered(root) | ||
637 | 465 | removeAnimation.action = action // CUSTOM - use our animation instead | ||
638 | 466 | removeAnimation.start() // CUSTOM | ||
639 | 467 | } | ||
640 | 468 | } else { | ||
641 | 469 | var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y)) | ||
642 | 470 | |||
643 | 471 | if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction | ||
644 | 472 | root.activeItem = rightActionsRepeater.itemAt(actionIndex) | ||
645 | 473 | root.activeAction = root.rightSideActions[actionIndex] | ||
646 | 474 | triggerAction.start() | ||
647 | 475 | return | ||
648 | 476 | } | ||
649 | 477 | } | ||
650 | 478 | root.resetSwipe() | ||
651 | 479 | } | ||
652 | 480 | |||
653 | 481 | onPositionChanged: { | ||
654 | 482 | if (mouseArea.pressed) { | ||
655 | 483 | updateActiveAction() | ||
656 | 484 | |||
657 | 485 | listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe | ||
658 | 486 | } | ||
659 | 487 | } | ||
660 | 488 | onPressAndHold: { | ||
661 | 489 | if (main.x === 0) { | ||
662 | 490 | root.itemPressAndHold(mouse) | ||
663 | 491 | } | ||
664 | 492 | } | ||
665 | 493 | |||
666 | 494 | z: -1 | ||
667 | 495 | } | ||
668 | 496 | } | ||
669 | 497 | 0 | ||
670 | === modified file 'app/components/MultiSelectListView.qml' | |||
671 | --- app/components/MultiSelectListView.qml 2015-11-02 21:28:34 +0000 | |||
672 | +++ app/components/MultiSelectListView.qml 2017-04-25 12:59:22 +0000 | |||
673 | @@ -1,5 +1,5 @@ | |||
674 | 1 | /* | 1 | /* |
676 | 2 | * Copyright (C) 2013, 2014, 2015 | 2 | * Copyright (C) 2013, 2014, 2015, 2017 |
677 | 3 | * Andrew Hayzen <ahayzen@gmail.com> | 3 | * Andrew Hayzen <ahayzen@gmail.com> |
678 | 4 | * Daniel Holm <d.holmen@gmail.com> | 4 | * Daniel Holm <d.holmen@gmail.com> |
679 | 5 | * Victor Thompson <victor.thompson@gmail.com> | 5 | * Victor Thompson <victor.thompson@gmail.com> |
680 | @@ -20,33 +20,52 @@ | |||
681 | 20 | import QtQuick 2.4 | 20 | import QtQuick 2.4 |
682 | 21 | import Ubuntu.Components 1.3 | 21 | import Ubuntu.Components 1.3 |
683 | 22 | 22 | ||
684 | 23 | |||
685 | 24 | WeatherListView { | 23 | WeatherListView { |
687 | 25 | property var selectedItems: [] | 24 | // Can't access ViewItems externally |
688 | 25 | // so we need to expose if in multiselect mode for the header states | ||
689 | 26 | state: ViewItems.selectMode ? "multiselectable" : "default" | ||
690 | 26 | 27 | ||
691 | 27 | signal clearSelection() | 28 | signal clearSelection() |
692 | 28 | signal closeSelection() | 29 | signal closeSelection() |
693 | 30 | signal reorder(int from, int to) | ||
694 | 29 | signal selectAll() | 31 | signal selectAll() |
695 | 30 | 32 | ||
697 | 31 | onClearSelection: selectedItems = [] | 33 | onClearSelection: ViewItems.selectedIndices = [] |
698 | 32 | onCloseSelection: { | 34 | onCloseSelection: { |
699 | 33 | clearSelection() | 35 | clearSelection() |
701 | 34 | state = "normal" | 36 | ViewItems.selectMode = false |
702 | 37 | ViewItems.dragMode = false | ||
703 | 35 | } | 38 | } |
704 | 36 | onSelectAll: { | 39 | onSelectAll: { |
706 | 37 | var tmp = selectedItems | 40 | var tmp = [] |
707 | 38 | 41 | ||
708 | 39 | for (var i=0; i < model.count; i++) { | 42 | for (var i=0; i < model.count; i++) { |
712 | 40 | if (tmp.indexOf(i) === -1) { | 43 | tmp.push(i) |
710 | 41 | tmp.push(i) | ||
711 | 42 | } | ||
713 | 43 | } | 44 | } |
714 | 44 | 45 | ||
720 | 45 | selectedItems = tmp | 46 | ViewItems.selectedIndices = tmp |
721 | 46 | } | 47 | } |
722 | 47 | onVisibleChanged: { | 48 | |
723 | 48 | if (!visible) { | 49 | // Can't access ViewItems externally |
724 | 49 | closeSelection() | 50 | // so for the header actions we need to expose the selectedIndices |
725 | 51 | function getSelectedIndices() { | ||
726 | 52 | var indicies = ViewItems.selectedIndices.slice(); | ||
727 | 53 | |||
728 | 54 | indicies.sort(); // ensure indicies are in-order | ||
729 | 55 | |||
730 | 56 | return indicies; | ||
731 | 57 | } | ||
732 | 58 | |||
733 | 59 | ViewItems.selectMode: false | ||
734 | 60 | ViewItems.dragMode: false | ||
735 | 61 | ViewItems.onDragUpdated: { | ||
736 | 62 | // Only update the model when the listitem is dropped, not 'live' | ||
737 | 63 | if (event.status == ListItemDrag.Moving) { | ||
738 | 64 | event.accept = false | ||
739 | 65 | } else if (event.status == ListItemDrag.Dropped) { | ||
740 | 66 | model.move(event.from, event.to, 1); | ||
741 | 67 | |||
742 | 68 | reorder(event.from, event.to) | ||
743 | 50 | } | 69 | } |
744 | 51 | } | 70 | } |
745 | 52 | } | 71 | } |
746 | 53 | 72 | ||
747 | === modified file 'app/components/WeatherListItem.qml' | |||
748 | --- app/components/WeatherListItem.qml 2015-11-02 21:28:34 +0000 | |||
749 | +++ app/components/WeatherListItem.qml 2017-04-25 12:59:22 +0000 | |||
750 | @@ -1,5 +1,5 @@ | |||
751 | 1 | /* | 1 | /* |
753 | 2 | * Copyright (C) 2013, 2014, 2015 | 2 | * Copyright (C) 2013, 2014, 2015, 2017 |
754 | 3 | * Andrew Hayzen <ahayzen@gmail.com> | 3 | * Andrew Hayzen <ahayzen@gmail.com> |
755 | 4 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> | 4 | * Nekhelesh Ramananthan <krnekhelesh@gmail.com> |
756 | 5 | * Victor Thompson <victor.thompson@gmail.com> | 5 | * Victor Thompson <victor.thompson@gmail.com> |
757 | @@ -20,119 +20,39 @@ | |||
758 | 20 | import QtQuick 2.4 | 20 | import QtQuick 2.4 |
759 | 21 | import Ubuntu.Components 1.3 | 21 | import Ubuntu.Components 1.3 |
760 | 22 | 22 | ||
763 | 23 | ListItemWithActions { | 23 | ListItem { |
762 | 24 | id: root | ||
764 | 25 | color: "transparent" | 24 | color: "transparent" |
767 | 26 | 25 | divider { | |
768 | 27 | property int listItemIndex: index | 26 | visible: true |
769 | 27 | } | ||
770 | 28 | highlightColor: Qt.lighter(color, 1.2) | ||
771 | 29 | |||
772 | 30 | // Store the currentColor so that actions can bind to it | ||
773 | 31 | property var currentColor: highlighted ? highlightColor : color | ||
774 | 32 | |||
775 | 28 | property bool multiselectable: false | 33 | property bool multiselectable: false |
777 | 29 | property int previousListItemIndex: -1 | 34 | property bool pressAndHoldEnabled: true |
778 | 30 | property bool reorderable: false | 35 | property bool reorderable: false |
779 | 31 | 36 | ||
885 | 32 | signal reorder(int from, int to) | 37 | signal itemClicked() |
886 | 33 | 38 | ||
887 | 34 | onItemPressAndHold: { | 39 | onClicked: { |
888 | 35 | if (multiselectable) { | 40 | if (selectMode) { |
889 | 36 | selectionMode = true | 41 | selected = !selected; |
890 | 37 | } | 42 | } else { |
891 | 38 | } | 43 | itemClicked() |
892 | 39 | 44 | } | |
893 | 40 | onListItemIndexChanged: { | 45 | } |
894 | 41 | var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex) | 46 | |
895 | 42 | 47 | onPressAndHold: { | |
896 | 43 | if (i !== -1) { | 48 | if (pressAndHoldEnabled) { |
897 | 44 | parent.parent.selectedItems[i] = listItemIndex | 49 | if (reorderable) { |
898 | 45 | } | 50 | ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode |
899 | 46 | 51 | } | |
900 | 47 | previousListItemIndex = listItemIndex | 52 | |
901 | 48 | } | 53 | if (multiselectable) { |
902 | 49 | 54 | ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode | |
903 | 50 | onSelectedChanged: { | 55 | } |
904 | 51 | if (selectionMode) { | 56 | } |
800 | 52 | var tmp = parent.parent.selectedItems | ||
801 | 53 | |||
802 | 54 | if (selected) { | ||
803 | 55 | if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) { | ||
804 | 56 | tmp.push(listItemIndex) | ||
805 | 57 | parent.parent.selectedItems = tmp | ||
806 | 58 | } | ||
807 | 59 | } else { | ||
808 | 60 | tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1) | ||
809 | 61 | parent.parent.selectedItems = tmp | ||
810 | 62 | } | ||
811 | 63 | } | ||
812 | 64 | } | ||
813 | 65 | |||
814 | 66 | onSelectionModeChanged: { | ||
815 | 67 | if (reorderable && selectionMode) { | ||
816 | 68 | resetSwipe() | ||
817 | 69 | } | ||
818 | 70 | |||
819 | 71 | for (var j=0; j < _main.children.length; j++) { | ||
820 | 72 | if (_main.children[j] !== actionReorderLoader) { | ||
821 | 73 | _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0 | ||
822 | 74 | } | ||
823 | 75 | } | ||
824 | 76 | |||
825 | 77 | parent.parent.state = selectionMode ? "multiselectable" : "normal" | ||
826 | 78 | |||
827 | 79 | if (!selectionMode) { | ||
828 | 80 | selected = false | ||
829 | 81 | } | ||
830 | 82 | } | ||
831 | 83 | |||
832 | 84 | /* Highlight the listitem on press */ | ||
833 | 85 | Rectangle { | ||
834 | 86 | id: listItemBrighten | ||
835 | 87 | color: root.pressed ? UbuntuColors.coolGrey : "transparent" | ||
836 | 88 | opacity: 0.1 | ||
837 | 89 | height: root.height | ||
838 | 90 | x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions | ||
839 | 91 | width: root.width | ||
840 | 92 | } | ||
841 | 93 | |||
842 | 94 | /* Reorder Component */ | ||
843 | 95 | Loader { | ||
844 | 96 | id: actionReorderLoader | ||
845 | 97 | active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0 | ||
846 | 98 | anchors { | ||
847 | 99 | bottom: parent.bottom | ||
848 | 100 | right: parent.right | ||
849 | 101 | rightMargin: units.gu(1) | ||
850 | 102 | top: parent.top | ||
851 | 103 | } | ||
852 | 104 | asynchronous: true | ||
853 | 105 | source: "ListItemReorderComponent.qml" | ||
854 | 106 | } | ||
855 | 107 | |||
856 | 108 | Item { | ||
857 | 109 | Connections { // Only allow one ListItem to be swiping at any time | ||
858 | 110 | target: weatherApp | ||
859 | 111 | onListItemSwiping: { | ||
860 | 112 | if (i !== index) { | ||
861 | 113 | root.resetSwipe(); | ||
862 | 114 | } | ||
863 | 115 | } | ||
864 | 116 | } | ||
865 | 117 | |||
866 | 118 | Connections { // Connections from signals in the ListView | ||
867 | 119 | target: root.parent.parent | ||
868 | 120 | onClearSelection: selected = false | ||
869 | 121 | onFlickingChanged: { | ||
870 | 122 | if (root.parent.parent.flicking) { | ||
871 | 123 | root.resetSwipe() | ||
872 | 124 | } | ||
873 | 125 | } | ||
874 | 126 | onSelectAll: selected = true | ||
875 | 127 | onStateChanged: selectionMode = root.parent.parent.state === "multiselectable" | ||
876 | 128 | } | ||
877 | 129 | } | ||
878 | 130 | |||
879 | 131 | Component.onCompleted: { // reload settings as delegates are destroyed | ||
880 | 132 | if (parent.parent.selectedItems.indexOf(index) !== -1) { | ||
881 | 133 | selected = true | ||
882 | 134 | } | ||
883 | 135 | |||
884 | 136 | selectionMode = root.parent.parent.state === "multiselectable" | ||
905 | 137 | } | 57 | } |
906 | 138 | } | 58 | } |
907 | 139 | 59 | ||
908 | === modified file 'app/ui/LocationPane.qml' | |||
909 | --- app/ui/LocationPane.qml 2017-04-12 09:55:14 +0000 | |||
910 | +++ app/ui/LocationPane.qml 2017-04-25 12:59:22 +0000 | |||
911 | @@ -1,5 +1,5 @@ | |||
912 | 1 | /* | 1 | /* |
914 | 2 | * Copyright (C) 2015 Canonical Ltd | 2 | * Copyright (C) 2015, 2017 Canonical Ltd |
915 | 3 | * | 3 | * |
916 | 4 | * This file is part of Ubuntu Weather App | 4 | * This file is part of Ubuntu Weather App |
917 | 5 | * | 5 | * |
918 | @@ -18,7 +18,6 @@ | |||
919 | 18 | 18 | ||
920 | 19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
921 | 20 | import Ubuntu.Components 1.3 | 20 | import Ubuntu.Components 1.3 |
922 | 21 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
923 | 22 | import "../components" | 21 | import "../components" |
924 | 23 | import "../data/suncalc.js" as SunCalc | 22 | import "../data/suncalc.js" as SunCalc |
925 | 24 | 23 | ||
926 | @@ -55,79 +54,78 @@ | |||
927 | 55 | 54 | ||
928 | 56 | modelData: model | 55 | modelData: model |
929 | 57 | } | 56 | } |
981 | 58 | header: Column { | 57 | header: ListItem { |
982 | 59 | id: locationTop | 58 | divider { |
983 | 60 | 59 | visible: true | |
984 | 61 | anchors { | 60 | } |
985 | 62 | left: parent.left | 61 | height: locationTop.height |
986 | 63 | right: parent.right | 62 | |
987 | 64 | margins: units.gu(2) | 63 | Column { |
988 | 65 | } | 64 | id: locationTop |
989 | 66 | spacing: units.gu(1) | 65 | |
939 | 67 | |||
940 | 68 | Row { // spacing at top | ||
941 | 69 | height: units.gu(1) | ||
942 | 70 | width: parent.width | ||
943 | 71 | } | ||
944 | 72 | |||
945 | 73 | HeaderRow { | ||
946 | 74 | id: headerRow | ||
947 | 75 | locationName: mainPageWeekdayListView.name | ||
948 | 76 | } | ||
949 | 77 | |||
950 | 78 | HomeGraphic { | ||
951 | 79 | id: homeGraphic | ||
952 | 80 | icon: mainPageWeekdayListView.icon | ||
953 | 81 | visible: graphicVisible; | ||
954 | 82 | MouseArea { | ||
955 | 83 | anchors.fill: parent | ||
956 | 84 | onClicked: { | ||
957 | 85 | graphicVisible = false; | ||
958 | 86 | } | ||
959 | 87 | } | ||
960 | 88 | } | ||
961 | 89 | |||
962 | 90 | Loader { | ||
963 | 91 | id: homeHourlyLoader | ||
964 | 92 | active: !homeGraphic.visible | ||
965 | 93 | asynchronous: true | ||
966 | 94 | height: units.gu(32) | ||
967 | 95 | source: "../components/HomeHourly.qml" | ||
968 | 96 | visible: active | ||
969 | 97 | width: parent.width | ||
970 | 98 | } | ||
971 | 99 | |||
972 | 100 | HomeTempInfo { | ||
973 | 101 | id: homeTempInfo | ||
974 | 102 | modelData: todayData | ||
975 | 103 | now: mainPageWeekdayListView.currentTemp | ||
976 | 104 | updatedAt: mainPageWeekdayListView.lastFetch | ||
977 | 105 | } | ||
978 | 106 | |||
979 | 107 | // TODO: Migrate this to using the new SDK list item when possible. | ||
980 | 108 | ListItem.ThinDivider { | ||
990 | 109 | anchors { | 66 | anchors { |
1012 | 110 | leftMargin: units.gu(-2); | 67 | left: parent.left |
1013 | 111 | rightMargin: units.gu(-2) | 68 | right: parent.right |
1014 | 112 | } | 69 | margins: units.gu(2) |
1015 | 113 | } | 70 | } |
1016 | 114 | 71 | spacing: units.gu(1) | |
1017 | 115 | NumberAnimation { | 72 | |
1018 | 116 | id: scrollToTopAnimation | 73 | Row { // spacing at top |
1019 | 117 | target: mainPageWeekdayListView; | 74 | height: units.gu(1) |
1020 | 118 | property: "contentY"; | 75 | width: parent.width |
1021 | 119 | duration: 200; | 76 | } |
1022 | 120 | easing.type: Easing.InOutQuad | 77 | |
1023 | 121 | to: -height | 78 | HeaderRow { |
1024 | 122 | } | 79 | id: headerRow |
1025 | 123 | 80 | locationName: mainPageWeekdayListView.name | |
1026 | 124 | Connections { | 81 | } |
1027 | 125 | target: locationPages | 82 | |
1028 | 126 | onCurrentIndexChanged: { | 83 | HomeGraphic { |
1029 | 127 | if (locationPages.currentIndex !== index) { | 84 | id: homeGraphic |
1030 | 128 | scrollToTopAnimation.start() | 85 | icon: mainPageWeekdayListView.icon |
1031 | 129 | } else { | 86 | visible: graphicVisible; |
1032 | 130 | mainPageWeekdayListView.contentY = -locationTop.height | 87 | MouseArea { |
1033 | 88 | anchors.fill: parent | ||
1034 | 89 | onClicked: { | ||
1035 | 90 | graphicVisible = false; | ||
1036 | 91 | } | ||
1037 | 92 | } | ||
1038 | 93 | } | ||
1039 | 94 | |||
1040 | 95 | Loader { | ||
1041 | 96 | id: homeHourlyLoader | ||
1042 | 97 | active: !homeGraphic.visible | ||
1043 | 98 | asynchronous: true | ||
1044 | 99 | height: units.gu(32) | ||
1045 | 100 | source: "../components/HomeHourly.qml" | ||
1046 | 101 | visible: active | ||
1047 | 102 | width: parent.width | ||
1048 | 103 | } | ||
1049 | 104 | |||
1050 | 105 | HomeTempInfo { | ||
1051 | 106 | id: homeTempInfo | ||
1052 | 107 | modelData: todayData | ||
1053 | 108 | now: mainPageWeekdayListView.currentTemp | ||
1054 | 109 | updatedAt: mainPageWeekdayListView.lastFetch | ||
1055 | 110 | } | ||
1056 | 111 | |||
1057 | 112 | NumberAnimation { | ||
1058 | 113 | id: scrollToTopAnimation | ||
1059 | 114 | target: mainPageWeekdayListView; | ||
1060 | 115 | property: "contentY"; | ||
1061 | 116 | duration: 200; | ||
1062 | 117 | easing.type: Easing.InOutQuad | ||
1063 | 118 | to: -height | ||
1064 | 119 | } | ||
1065 | 120 | |||
1066 | 121 | Connections { | ||
1067 | 122 | target: locationPages | ||
1068 | 123 | onCurrentIndexChanged: { | ||
1069 | 124 | if (locationPages.currentIndex !== index) { | ||
1070 | 125 | scrollToTopAnimation.start() | ||
1071 | 126 | } else { | ||
1072 | 127 | mainPageWeekdayListView.contentY = -locationTop.height | ||
1073 | 128 | } | ||
1074 | 131 | } | 129 | } |
1075 | 132 | } | 130 | } |
1076 | 133 | } | 131 | } |
1077 | 134 | 132 | ||
1078 | === modified file 'app/ui/LocationsPage.qml' | |||
1079 | --- app/ui/LocationsPage.qml 2017-04-18 09:08:08 +0000 | |||
1080 | +++ app/ui/LocationsPage.qml 2017-04-25 12:59:22 +0000 | |||
1081 | @@ -1,5 +1,5 @@ | |||
1082 | 1 | /* | 1 | /* |
1084 | 2 | * Copyright (C) 2015 Canonical Ltd | 2 | * Copyright (C) 2015, 2017 Canonical Ltd |
1085 | 3 | * | 3 | * |
1086 | 4 | * This file is part of Ubuntu Weather App | 4 | * This file is part of Ubuntu Weather App |
1087 | 5 | * | 5 | * |
1088 | @@ -18,7 +18,6 @@ | |||
1089 | 18 | 18 | ||
1090 | 19 | import QtQuick 2.4 | 19 | import QtQuick 2.4 |
1091 | 20 | import Ubuntu.Components 1.3 | 20 | import Ubuntu.Components 1.3 |
1092 | 21 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
1093 | 22 | import "../components" | 21 | import "../components" |
1094 | 23 | import "../components/HeadState" | 22 | import "../components/HeadState" |
1095 | 24 | import "../components/ListItemActions" | 23 | import "../components/ListItemActions" |
1096 | @@ -37,7 +36,7 @@ | |||
1097 | 37 | removable: true | 36 | removable: true |
1098 | 38 | thisPage: locationsPage | 37 | thisPage: locationsPage |
1099 | 39 | 38 | ||
1101 | 40 | onRemoved: storage.removeMultiLocations(selectedItems.slice()); | 39 | onRemoved: storage.removeMultiLocations(selectedIndices.slice()); |
1102 | 41 | } | 40 | } |
1103 | 42 | ] | 41 | ] |
1104 | 43 | 42 | ||
1105 | @@ -65,93 +64,91 @@ | |||
1106 | 65 | left: parent.left | 64 | left: parent.left |
1107 | 66 | right: parent.right | 65 | right: parent.right |
1108 | 67 | } | 66 | } |
1110 | 68 | height: settings.addedCurrentLocation && settings.detectCurrentLocation ? units.gu(8) : units.gu(0) | 67 | height: settings.addedCurrentLocation && settings.detectCurrentLocation ? contentHeight : units.gu(0) |
1111 | 69 | interactive: false | 68 | interactive: false |
1112 | 70 | model: currentLocationModel | 69 | model: currentLocationModel |
1113 | 71 | delegate: WeatherListItem { | 70 | delegate: WeatherListItem { |
1114 | 72 | id: currentLocationListItem | 71 | id: currentLocationListItem |
1115 | 72 | height: currentListItemLayout.height + (divider.visible ? divider.height : 0) + (fakeDivider.visible ? fakeDivider.height : 0) | ||
1116 | 73 | 73 | ||
1117 | 74 | onItemClicked: { | 74 | onItemClicked: { |
1118 | 75 | settings.current = index; | 75 | settings.current = index; |
1119 | 76 | |||
1120 | 77 | // Ensure any selections are closed | ||
1121 | 78 | locationsListView.closeSelection(); | ||
1122 | 79 | |||
1123 | 76 | locationsPage.pop() | 80 | locationsPage.pop() |
1124 | 77 | } | 81 | } |
1125 | 78 | 82 | ||
1132 | 79 | Column { | 83 | ListItemLayout { |
1133 | 80 | anchors { | 84 | id: currentListItemLayout |
1134 | 81 | left: parent.left | 85 | subtitle { |
1135 | 82 | right: currentWeatherImage.left | 86 | elide: Text.ElideRight |
1136 | 83 | rightMargin: units.gu(3) | 87 | fontSize: "small" |
1137 | 84 | verticalCenter: parent.verticalCenter | 88 | text: name + ", " + (adminName1 == name ? countryName : adminName1) |
1138 | 85 | } | 89 | } |
1148 | 86 | 90 | title { | |
1140 | 87 | Label { | ||
1141 | 88 | id: currentLocationName | ||
1142 | 89 | |||
1143 | 90 | anchors { | ||
1144 | 91 | left: parent.left | ||
1145 | 92 | leftMargin: units.gu(2) | ||
1146 | 93 | } | ||
1147 | 94 | |||
1149 | 95 | elide: Text.ElideRight | 91 | elide: Text.ElideRight |
1150 | 96 | fontSize: "medium" | 92 | fontSize: "medium" |
1151 | 97 | text: i18n.tr("Current Location") | 93 | text: i18n.tr("Current Location") |
1154 | 98 | width: parent.width | 94 | } |
1155 | 99 | } | 95 | |
1156 | 96 | Icon { | ||
1157 | 97 | anchors { | ||
1158 | 98 | verticalCenter: parent.verticalCenter | ||
1159 | 99 | } | ||
1160 | 100 | height: parent.height / 2 | ||
1161 | 101 | name: icon | ||
1162 | 102 | SlotsLayout.position: SlotsLayout.Trailing | ||
1163 | 103 | SlotsLayout.overrideVerticalPositioning: true | ||
1164 | 104 | width: height | ||
1165 | 105 | } | ||
1166 | 106 | |||
1167 | 100 | Label { | 107 | Label { |
1168 | 101 | id: currentLocationName2 | ||
1169 | 102 | |||
1170 | 103 | anchors { | 108 | anchors { |
1173 | 104 | left: parent.left | 109 | verticalCenter: parent.verticalCenter |
1172 | 105 | leftMargin: units.gu(2) | ||
1174 | 106 | } | 110 | } |
1177 | 107 | 111 | color: UbuntuColors.orange | |
1176 | 108 | color: UbuntuColors.graphite | ||
1178 | 109 | elide: Text.ElideRight | 112 | elide: Text.ElideRight |
1213 | 110 | fontSize: "small" | 113 | font { |
1214 | 111 | font.weight: Font.Light | 114 | pixelSize: parent.height / 2 |
1215 | 112 | text: name + ", " + (adminName1 == name ? countryName : adminName1) | 115 | weight: Font.Light |
1216 | 113 | width: parent.width | 116 | } |
1217 | 114 | } | 117 | horizontalAlignment: Text.AlignRight |
1218 | 115 | } | 118 | SlotsLayout.position: SlotsLayout.Trailing |
1219 | 116 | 119 | SlotsLayout.overrideVerticalPositioning: true | |
1220 | 117 | Icon { | 120 | text: temp + settings.tempScale |
1221 | 118 | id: currentWeatherImage | 121 | } |
1222 | 119 | anchors { | 122 | } |
1223 | 120 | right: parent.right | 123 | |
1224 | 121 | rightMargin: units.gu(14) | 124 | // Inject extra divider when we are the last as the SDK hides it |
1225 | 122 | verticalCenter: parent.verticalCenter | 125 | // but we need one as we have another listview directly below |
1226 | 123 | } | 126 | ListItem { |
1227 | 124 | name: icon | 127 | id: fakeDivider |
1228 | 125 | height: units.gu(3) | 128 | anchors { |
1229 | 126 | width: units.gu(3) | 129 | bottom: parent.bottom |
1230 | 127 | } | 130 | } |
1231 | 128 | 131 | divider { | |
1232 | 129 | Label { | 132 | visible: true |
1233 | 130 | id: currentTemperatureLabel | 133 | } |
1234 | 131 | anchors { | 134 | height: divider.height |
1235 | 132 | left: currentWeatherImage.right | 135 | visible: currentLocationModel.count - 1 == index |
1202 | 133 | leftMargin: units.gu(1) | ||
1203 | 134 | right: parent.right | ||
1204 | 135 | rightMargin: units.gu(2) | ||
1205 | 136 | verticalCenter: parent.verticalCenter | ||
1206 | 137 | } | ||
1207 | 138 | color: UbuntuColors.orange | ||
1208 | 139 | elide: Text.ElideRight | ||
1209 | 140 | font.pixelSize: units.gu(4) | ||
1210 | 141 | font.weight: Font.Light | ||
1211 | 142 | horizontalAlignment: Text.AlignRight | ||
1212 | 143 | text: temp + settings.tempScale | ||
1236 | 144 | } | 136 | } |
1237 | 145 | } | 137 | } |
1238 | 146 | } | 138 | } |
1239 | 147 | 139 | ||
1240 | 148 | delegate: WeatherListItem { | 140 | delegate: WeatherListItem { |
1241 | 149 | id: locationsListItem | 141 | id: locationsListItem |
1242 | 142 | height: listItemLayout.height + (divider.visible ? divider.height : 0) | ||
1243 | 143 | leadingActions: ListItemActions { | ||
1244 | 144 | actions: [ | ||
1245 | 145 | Remove { | ||
1246 | 146 | onTriggered: storage.removeLocation(index) | ||
1247 | 147 | } | ||
1248 | 148 | ] | ||
1249 | 149 | } | ||
1250 | 150 | multiselectable: true | ||
1251 | 150 | objectName: "location" + index | 151 | objectName: "location" + index |
1252 | 151 | leftSideAction: Remove { | ||
1253 | 152 | onTriggered: storage.removeLocation(index) | ||
1254 | 153 | } | ||
1255 | 154 | multiselectable: true | ||
1256 | 155 | reorderable: true | 152 | reorderable: true |
1257 | 156 | 153 | ||
1258 | 157 | onItemClicked: { | 154 | onItemClicked: { |
1259 | @@ -163,89 +160,56 @@ | |||
1260 | 163 | 160 | ||
1261 | 164 | locationsPage.pop() | 161 | locationsPage.pop() |
1262 | 165 | } | 162 | } |
1308 | 166 | onReorder: { | 163 | |
1309 | 167 | console.debug("Move: ", from, to); | 164 | ListItemLayout { |
1310 | 168 | 165 | id: listItemLayout | |
1311 | 169 | storage.moveLocation(from, to); | 166 | subtitle { |
1312 | 170 | } | 167 | elide: Text.ElideRight |
1313 | 171 | 168 | fontSize: "small" | |
1314 | 172 | ListItem.ThinDivider { | 169 | text: adminName1 == name ? countryName : adminName1 |
1315 | 173 | anchors { | 170 | } |
1316 | 174 | top: parent.top | 171 | title { |
1317 | 175 | } | 172 | elide: Text.ElideRight |
1318 | 176 | visible: index == 0 | 173 | fontSize: "medium" |
1319 | 177 | } | 174 | objectName: "name" |
1320 | 178 | 175 | text: name | |
1276 | 179 | Item { | ||
1277 | 180 | anchors { | ||
1278 | 181 | fill: parent | ||
1279 | 182 | leftMargin: units.gu(2) | ||
1280 | 183 | rightMargin: units.gu(2) | ||
1281 | 184 | } | ||
1282 | 185 | |||
1283 | 186 | Column { | ||
1284 | 187 | anchors { | ||
1285 | 188 | left: parent.left | ||
1286 | 189 | right: weatherImage.visible ? weatherImage.left : parent.right | ||
1287 | 190 | rightMargin: units.gu(1) | ||
1288 | 191 | verticalCenter: parent.verticalCenter | ||
1289 | 192 | } | ||
1290 | 193 | |||
1291 | 194 | Label { | ||
1292 | 195 | id: locationName | ||
1293 | 196 | objectName: "name" | ||
1294 | 197 | elide: Text.ElideRight | ||
1295 | 198 | fontSize: "medium" | ||
1296 | 199 | text: name | ||
1297 | 200 | width: parent.width | ||
1298 | 201 | } | ||
1299 | 202 | Label { | ||
1300 | 203 | id: locationName2 | ||
1301 | 204 | color: UbuntuColors.graphite | ||
1302 | 205 | elide: Text.ElideRight | ||
1303 | 206 | fontSize: "small" | ||
1304 | 207 | font.weight: Font.Light | ||
1305 | 208 | text: adminName1 == name ? countryName : adminName1 | ||
1306 | 209 | width: parent.width | ||
1307 | 210 | } | ||
1321 | 211 | } | 176 | } |
1322 | 212 | 177 | ||
1323 | 213 | Icon { | 178 | Icon { |
1324 | 214 | id: weatherImage | ||
1325 | 215 | anchors { | 179 | anchors { |
1326 | 216 | right: parent.right | ||
1327 | 217 | rightMargin: units.gu(12) | ||
1328 | 218 | verticalCenter: parent.verticalCenter | 180 | verticalCenter: parent.verticalCenter |
1329 | 219 | } | 181 | } |
1330 | 182 | height: parent.height / 2 | ||
1331 | 220 | name: icon | 183 | name: icon |
1335 | 221 | height: units.gu(3) | 184 | SlotsLayout.position: SlotsLayout.Trailing |
1336 | 222 | width: units.gu(3) | 185 | SlotsLayout.overrideVerticalPositioning: true |
1337 | 223 | visible: locationsPage.state === "default" | 186 | width: height |
1338 | 187 | visible: locationsListView.state === "default" | ||
1339 | 224 | } | 188 | } |
1340 | 225 | 189 | ||
1341 | 226 | Label { | 190 | Label { |
1342 | 227 | id: temperatureLabel | ||
1343 | 228 | anchors { | 191 | anchors { |
1344 | 229 | left: weatherImage.right | ||
1345 | 230 | leftMargin: units.gu(1) | ||
1346 | 231 | right: parent.right | ||
1347 | 232 | verticalCenter: parent.verticalCenter | 192 | verticalCenter: parent.verticalCenter |
1348 | 233 | } | 193 | } |
1349 | 234 | color: UbuntuColors.orange | 194 | color: UbuntuColors.orange |
1350 | 235 | elide: Text.ElideRight | 195 | elide: Text.ElideRight |
1353 | 236 | font.pixelSize: units.gu(4) | 196 | font { |
1354 | 237 | font.weight: Font.Light | 197 | pixelSize: parent.height / 2 |
1355 | 198 | weight: Font.Light | ||
1356 | 199 | } | ||
1357 | 238 | horizontalAlignment: Text.AlignRight | 200 | horizontalAlignment: Text.AlignRight |
1358 | 201 | SlotsLayout.position: SlotsLayout.Trailing | ||
1359 | 202 | SlotsLayout.overrideVerticalPositioning: true | ||
1360 | 239 | text: temp + settings.tempScale | 203 | text: temp + settings.tempScale |
1370 | 240 | visible: locationsPage.state === "default" | 204 | visible: locationsListView.state === "default" |
1371 | 241 | } | 205 | } |
1372 | 242 | } | 206 | } |
1373 | 243 | 207 | } | |
1374 | 244 | ListItem.ThinDivider { | 208 | |
1375 | 245 | anchors { | 209 | onReorder: { |
1376 | 246 | bottom: parent.bottom | 210 | console.debug("Move: ", from, to); |
1377 | 247 | } | 211 | |
1378 | 248 | } | 212 | storage.moveLocation(from, to); |
1379 | 249 | } | 213 | } |
1380 | 250 | } | 214 | } |
1381 | 251 | 215 | ||
1382 | 252 | 216 | ||
1383 | === modified file 'tests/autopilot/ubuntu_weather_app/__init__.py' | |||
1384 | --- tests/autopilot/ubuntu_weather_app/__init__.py 2017-04-13 10:38:05 +0000 | |||
1385 | +++ tests/autopilot/ubuntu_weather_app/__init__.py 2017-04-25 12:59:22 +0000 | |||
1386 | @@ -1,5 +1,5 @@ | |||
1387 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1389 | 2 | # Copyright 2013, 2014, 2015 Canonical | 2 | # Copyright 2013, 2014, 2015, 2017 Canonical |
1390 | 3 | # | 3 | # |
1391 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # This program is free software: you can redistribute it and/or modify it |
1392 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
1393 | @@ -8,7 +8,7 @@ | |||
1394 | 8 | """ubuntu-weather-app tests and emulators - top level package.""" | 8 | """ubuntu-weather-app tests and emulators - top level package.""" |
1395 | 9 | from autopilot.introspection import dbus | 9 | from autopilot.introspection import dbus |
1396 | 10 | import logging | 10 | import logging |
1398 | 11 | from ubuntuuitoolkit import (MainView, QQuickListView, | 11 | from ubuntuuitoolkit import (MainView, QQuickListView, UCListItem, |
1399 | 12 | UbuntuUIToolkitCustomProxyObjectBase) | 12 | UbuntuUIToolkitCustomProxyObjectBase) |
1400 | 13 | 13 | ||
1401 | 14 | logger = logging.getLogger(__name__) | 14 | logger = logging.getLogger(__name__) |
1402 | @@ -329,20 +329,10 @@ | |||
1403 | 329 | "StandardListItem", iconVisible=showIcon) | 329 | "StandardListItem", iconVisible=showIcon) |
1404 | 330 | 330 | ||
1405 | 331 | 331 | ||
1407 | 332 | class WeatherListItem(UbuntuUIToolkitCustomProxyObjectBase): | 332 | class WeatherListItem(UCListItem): |
1408 | 333 | def click_remove_action(self): | ||
1409 | 334 | return self.trigger_leading_action("swipeDeleteAction", | ||
1410 | 335 | self.wait_until_destroyed) | ||
1411 | 336 | |||
1412 | 333 | def get_name(self): | 337 | def get_name(self): |
1413 | 334 | return self.select_single("UCLabel", objectName="name").text | 338 | return self.select_single("UCLabel", objectName="name").text |
1414 | 335 | |||
1415 | 336 | @click_object | ||
1416 | 337 | def select_remove(self): | ||
1417 | 338 | return self.select_single(objectName="swipeDeleteAction") | ||
1418 | 339 | |||
1419 | 340 | def swipe_and_select_remove(self): | ||
1420 | 341 | x, y, width, height = self.globalRect | ||
1421 | 342 | start_x = x + (width * 0.2) | ||
1422 | 343 | stop_x = x + (width * 0.8) | ||
1423 | 344 | start_y = stop_y = y + (height // 2) | ||
1424 | 345 | |||
1425 | 346 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y) | ||
1426 | 347 | |||
1427 | 348 | self.select_remove() | ||
1428 | 349 | 339 | ||
1429 | === modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py' | |||
1430 | --- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-10 03:13:48 +0000 | |||
1431 | +++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2017-04-25 12:59:22 +0000 | |||
1432 | @@ -1,5 +1,5 @@ | |||
1433 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1435 | 2 | # Copyright 2013, 2014, 2015 Canonical | 2 | # Copyright 2013, 2014, 2015, 2017 Canonical |
1436 | 3 | # | 3 | # |
1437 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # This program is free software: you can redistribute it and/or modify it |
1438 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # under the terms of the GNU General Public License version 3, as published |
1439 | @@ -48,7 +48,7 @@ | |||
1440 | 48 | self.assertThat(list_item.get_name(), Equals("London")) | 48 | self.assertThat(list_item.get_name(), Equals("London")) |
1441 | 49 | 49 | ||
1442 | 50 | # Remove the location via the list item action | 50 | # Remove the location via the list item action |
1444 | 51 | list_item.swipe_and_select_remove() | 51 | list_item.click_remove_action() |
1445 | 52 | 52 | ||
1446 | 53 | # Check that the location was removed | 53 | # Check that the location was removed |
1447 | 54 | self.assertThat(self.home_page.get_location_count, | 54 | self.assertThat(self.home_page.get_location_count, |
$ autopilot3 run ubuntu_weather_app Workspace/ Work/Canonical/ code/ubuntu- weather- app/uc1. 3-listitems/ tests/autopilot
Loading tests from: /home/andrew/
Tests running...
Ran 15 tests in 99.820s
OK
$ pep8 .
$ pyflakes .