Merge lp:~ralsina/ubuntuone-windows-installer/back-is-wrong into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Natalia Bidart
Approved revision: 74
Merged at revision: 57
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/back-is-wrong
Merge into: lp:ubuntuone-windows-installer
Diff against target: 264 lines (+93/-23)
7 files modified
ubuntuone_installer/gui/qt/folders.py (+3/-2)
ubuntuone_installer/gui/qt/local_folders.py (+14/-3)
ubuntuone_installer/gui/qt/preferences.py (+1/-4)
ubuntuone_installer/gui/qt/sync_now_or_later.py (+5/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+31/-4)
ubuntuone_installer/gui/qt/tests/test_local_folders.py (+37/-10)
ubuntuone_installer/gui/qt/tests/test_sync_now_or_later.py (+2/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/back-is-wrong
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Diego Sarmentero (community) Approve
Review via email: mp+74818@code.launchpad.net

Commit message

* Enable the back buttons in cloud-to-computer and computer-to-cloud in the right circumstances
* Set the correct title/subtitle for cloud-to-computer
* Fix the workflow for the "preferences" page

Description of the change

* Enable the back buttons in cloud-to-computer and computer-to-cloud in the right circumstances
* Set the correct title/subtitle for cloud-to-computer

To post a comment you must log in.
66. By Roberto Alsina

de-lint

67. By Roberto Alsina

pep8

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

So, I made this test:

* ran installer
* login with existent account
* chose nothing in the cloud to computer page, clicked next
* computer to cloud computer appeared, chose nothing, clicked back
* got cloud-to-computer page again (which is ok), I chose to sync a existent udf, clicked next
* I expected to have the computer-to-cloud again, but I got the IMAGE GOES HERE instead.

review: Needs Fixing
68. By Roberto Alsina

handle 'back' better

69. By Roberto Alsina

useless import

70. By Roberto Alsina

lint

Revision history for this message
Roberto Alsina (ralsina) wrote :

> So, I made this test:
>
> * ran installer
> * login with existent account
> * chose nothing in the cloud to computer page, clicked next
> * computer to cloud computer appeared, chose nothing, clicked back
> * got cloud-to-computer page again (which is ok), I chose to sync a existent
> udf, clicked next
> * I expected to have the computer-to-cloud again, but I got the IMAGE GOES
> HERE instead.

Fixed in latest revno, along with a similar problem when you clicked on "Settings" on cloud-to-computer

71. By Roberto Alsina

link bug

72. By Roberto Alsina

test fixes

73. By Roberto Alsina

added test

74. By Roberto Alsina

lint

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good. I noticed some buggy behaviors, but they should be fixed in a separated branch (I filed bug #847847).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone_installer/gui/qt/folders.py'
--- ubuntuone_installer/gui/qt/folders.py 2011-09-07 15:25:01 +0000
+++ ubuntuone_installer/gui/qt/folders.py 2011-09-10 01:59:23 +0000
@@ -36,7 +36,9 @@
3636
37 def __init__(self, parent=None):37 def __init__(self, parent=None):
38 super(FoldersPage, self).__init__(folders_ui.Ui_Form(), None, parent)38 super(FoldersPage, self).__init__(folders_ui.Ui_Form(), None, parent)
39 self.setTitle(_("Syncing your computer with the cloud"))39 self.setTitle(_("Syncing the cloud to your computer"))
40 self.setSubTitle(_("These are your folders in your cloud. "
41 "Select the ones you want to sync with this computer."))
40 self.folders_widget = folders.FoldersPanel()42 self.folders_widget = folders.FoldersPanel()
41 self.layout().insertWidget(43 self.layout().insertWidget(
42 self.layout().count() - 1, self.folders_widget)44 self.layout().count() - 1, self.folders_widget)
@@ -53,7 +55,6 @@
53 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)55 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)
54 self.wizard().setOption(QtGui.QWizard.HaveCustomButton2, False)56 self.wizard().setOption(QtGui.QWizard.HaveCustomButton2, False)
55 self.wizard().setButtonLayout([57 self.wizard().setButtonLayout([
56 QtGui.QWizard.BackButton,
57 QtGui.QWizard.Stretch,58 QtGui.QWizard.Stretch,
58 QtGui.QWizard.NextButton])59 QtGui.QWizard.NextButton])
59 self.wizard().setButtonText(QtGui.QWizard.NextButton,60 self.wizard().setButtonText(QtGui.QWizard.NextButton,
6061
=== modified file 'ubuntuone_installer/gui/qt/local_folders.py'
--- ubuntuone_installer/gui/qt/local_folders.py 2011-09-07 15:25:01 +0000
+++ ubuntuone_installer/gui/qt/local_folders.py 2011-09-10 01:59:23 +0000
@@ -102,15 +102,22 @@
102 self.items = {}102 self.items = {}
103 self.folders_info = None103 self.folders_info = None
104 self.account_info = None104 self.account_info = None
105 self.has_back_button = True
105 self.cp_backend = backend.ControlBackend()106 self.cp_backend = backend.ControlBackend()
106107
107 # initializePage is inherited108 # initializePage is inherited
108 # pylint: disable=C0103109 # pylint: disable=C0103
109 def initializePage(self):110 def initializePage(self):
110 """UI details."""111 """UI details."""
111 self.wizard().setButtonLayout([112 if self.has_back_button:
112 QtGui.QWizard.Stretch,113 self.wizard().setButtonLayout([
113 QtGui.QWizard.NextButton])114 QtGui.QWizard.BackButton,
115 QtGui.QWizard.Stretch,
116 QtGui.QWizard.NextButton])
117 else:
118 self.wizard().setButtonLayout([
119 QtGui.QWizard.Stretch,
120 QtGui.QWizard.NextButton])
114 self.wizard().setButtonText(QtGui.QWizard.NextButton,121 self.wizard().setButtonText(QtGui.QWizard.NextButton,
115 NEXT)122 NEXT)
116 self.wizard()._next_id = self.wizard().CONGRATULATIONS_PAGE123 self.wizard()._next_id = self.wizard().CONGRATULATIONS_PAGE
@@ -120,6 +127,10 @@
120 self.wizard().overlay.show()127 self.wizard().overlay.show()
121 self.get_info()128 self.get_info()
122129
130 def cleanupPage(self):
131 """Initialize previous page when going back."""
132 self.wizard().folders_page.initializePage()
133
123 @inlineCallbacks134 @inlineCallbacks
124 def get_info(self):135 def get_info(self):
125 """Get information from CP backend and fill folder list."""136 """Get information from CP backend and fill folder list."""
126137
=== modified file 'ubuntuone_installer/gui/qt/preferences.py'
--- ubuntuone_installer/gui/qt/preferences.py 2011-08-11 15:02:49 +0000
+++ ubuntuone_installer/gui/qt/preferences.py 2011-09-10 01:59:23 +0000
@@ -85,7 +85,6 @@
8585
86 # Invalid name "cleanupPage"86 # Invalid name "cleanupPage"
87 # pylint: disable=C010387 # pylint: disable=C0103
88
89 def cleanupPage(self):88 def cleanupPage(self):
90 """Execute this cleanup function when the back button is pressed."""89 """Execute this cleanup function when the back button is pressed."""
91 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)90 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)
@@ -94,7 +93,5 @@
94 QtGui.QWizard.BackButton,93 QtGui.QWizard.BackButton,
95 QtGui.QWizard.Stretch,94 QtGui.QWizard.Stretch,
96 QtGui.QWizard.NextButton])95 QtGui.QWizard.NextButton])
97 self.wizard().setButtonText(QtGui.QWizard.NextButton, _("Sync Now!"))96 self.wizard().folders_page.initializePage()
98 self.wizard()._next_id = self.wizard().CONGRATULATIONS_PAGE
99
100 # pylint: enable=C010397 # pylint: enable=C0103
10198
=== modified file 'ubuntuone_installer/gui/qt/sync_now_or_later.py'
--- ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-09-07 16:25:32 +0000
+++ ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-09-10 01:59:23 +0000
@@ -50,13 +50,18 @@
50 self.wizard().overlay.show()50 self.wizard().overlay.show()
51 self.wizard().setButtonText(QtGui.QWizard.NextButton,51 self.wizard().setButtonText(QtGui.QWizard.NextButton,
52 NEXT)52 NEXT)
53 self.wizard().setButtonLayout([
54 QtGui.QWizard.Stretch,
55 QtGui.QWizard.NextButton])
53 self.get_info()56 self.get_info()
5457
55 def nextId(self):58 def nextId(self):
56 """Go to the next page depending on the select field."""59 """Go to the next page depending on the select field."""
57 if self.has_cloud_folders:60 if self.has_cloud_folders:
61 self.wizard().local_folders_page.has_back_button = True
58 return self.wizard().folders_page_id62 return self.wizard().folders_page_id
59 else:63 else:
64 self.wizard().local_folders_page.has_back_button = False
60 return self.wizard().local_folders_page_id65 return self.wizard().local_folders_page_id
6166
62 @inlineCallbacks67 @inlineCallbacks
6368
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-09 13:20:23 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-10 01:59:23 +0000
@@ -28,6 +28,7 @@
28from ubuntuone.platform.credentials import APP_NAME28from ubuntuone.platform.credentials import APP_NAME
29from ubuntuone.controlpanel.gui import qt29from ubuntuone.controlpanel.gui import qt
3030
31from ubuntuone_installer.gui import NEXT
31from ubuntuone_installer.gui.qt import gui, forgotten, utils32from ubuntuone_installer.gui.qt import gui, forgotten, utils
32from ubuntuone_installer.gui.qt.tests import BaseTestCase33from ubuntuone_installer.gui.qt.tests import BaseTestCase
3334
@@ -269,12 +270,21 @@
269 preferences_page.preferences_widget.apply_button_clicked, True)270 preferences_page.preferences_widget.apply_button_clicked, True)
270 # for Cleanup271 # for Cleanup
271 btn_pref = preferences_page.wizard().button(QtGui.QWizard.NextButton)272 btn_pref = preferences_page.wizard().button(QtGui.QWizard.NextButton)
272 self.assertEqual(btn_pref.text(), "Sync Now!")273 self.assertEqual(btn_pref.text(), NEXT)
273 self.assertEqual(self.ui._next_id, self.ui.CONGRATULATIONS_PAGE)274 self.assertEqual(self.ui._next_id, self.ui.local_folders_page_id)
274275
275 def test_folders_page(self):276 def test_preferences_cleanup_page(self):
277 """cleanupPage should call folders.initializePage()."""
278 preferences_page = self.ui.page(self.ui.preferences_page_id)
279 self.patch(self.ui.folders_page,
280 "initializePage", self._set_called)
281 preferences_page.cleanupPage()
282 self.assertEqual(self._called, ((), {}))
283
284 def test_folders_page_with_back(self):
276 """Check Folders Page UI."""285 """Check Folders Page UI."""
277 folders_page = self.ui.page(self.ui.folders_page_id)286 folders_page = self.ui.page(self.ui.folders_page_id)
287 self.patch(self.ui, "setButtonLayout", self._set_called)
278288
279 # Show the preferences page289 # Show the preferences page
280 self.ui.setStartId(self.ui.folders_page_id)290 self.ui.setStartId(self.ui.folders_page_id)
@@ -292,6 +302,9 @@
292 self.assertEqual(tree_folders.isColumnHidden(2), True)302 self.assertEqual(tree_folders.isColumnHidden(2), True)
293 # pylint: disable=W0212303 # pylint: disable=W0212
294 self.assertEqual(self.ui._next_id, self.ui.local_folders_page_id)304 self.assertEqual(self.ui._next_id, self.ui.local_folders_page_id)
305 self.assertEqual(self._called,
306 (([QtGui.QWizard.Stretch,
307 QtGui.QWizard.NextButton],), {}))
295308
296 def test_folders_page_next_id(self):309 def test_folders_page_next_id(self):
297 """Check Folders Page UI."""310 """Check Folders Page UI."""
@@ -571,6 +584,18 @@
571 self.target(*args)584 self.target(*args)
572585
573586
587class FakeWizardPage(object):
588
589 """A fake wizard page."""
590
591 def __init__(self, *args, **kwargs):
592 self.has_back_button = True
593
594 # pylint: disable=C0103
595 def initializePage(self):
596 """Fake initializePage."""
597
598
574class FakeMainWindow(object):599class FakeMainWindow(object):
575600
576 """A fake MainWindow."""601 """A fake MainWindow."""
@@ -590,6 +615,8 @@
590 self.button_layout = None615 self.button_layout = None
591 self.options = []616 self.options = []
592 self.overlay = FakeOverlay()617 self.overlay = FakeOverlay()
618 self.local_folders_page = FakeWizardPage()
619 self.folders_page = FakeWizardPage()
593620
594 def show(self):621 def show(self):
595 """Fake method."""622 """Fake method."""
596623
=== modified file 'ubuntuone_installer/gui/qt/tests/test_local_folders.py'
--- ubuntuone_installer/gui/qt/tests/test_local_folders.py 2011-09-08 12:56:33 +0000
+++ ubuntuone_installer/gui/qt/tests/test_local_folders.py 2011-09-10 01:59:23 +0000
@@ -235,16 +235,36 @@
235 self.assertEqual(self.ui.items, {})235 self.assertEqual(self.ui.items, {})
236 self.assertEqual(self.ui.ui.folder_list.topLevelItemCount(), 0)236 self.assertEqual(self.ui.ui.folder_list.topLevelItemCount(), 0)
237237
238 def test_status_after_initialize(self):238 def test_status_after_initialize_with_back(self):
239 """Test status of page components after initializePage()."""239 """Test status of page components after initializePage()."""
240 self.patch(self.ui, "get_info", self._set_called)240 self.patch(self.ui, "get_info", self._set_called)
241 self.ui.initializePage()241 self.ui.has_back_button = True
242 self.assertEqual(self.ui.wizard().overlay.show_counter, 1)242 self.ui.initializePage()
243 self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)243 self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
244 self.assertFalse(self.ui.ui.offer_frame.isVisible())244 self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)
245 self.assertEqual(self._called, ((), {}))245 self.assertFalse(self.ui.ui.offer_frame.isVisible())
246 self.assertEqual(self.ui.wizard().button_texts,246 self.assertEqual(self._called, ((), {}))
247 [(QtGui.QWizard.NextButton, NEXT)])247 self.assertEqual(self.ui.wizard().button_texts,
248 [(QtGui.QWizard.NextButton, NEXT)])
249 self.assertEqual(self.ui.wizard().button_layout,
250 [QtGui.QWizard.BackButton,
251 QtGui.QWizard.Stretch,
252 QtGui.QWizard.NextButton])
253
254 def test_status_after_initialize_without_back(self):
255 """Test status of page components after initializePage()."""
256 self.patch(self.ui, "get_info", self._set_called)
257 self.ui.has_back_button = False
258 self.ui.initializePage()
259 self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
260 self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)
261 self.assertFalse(self.ui.ui.offer_frame.isVisible())
262 self.assertEqual(self._called, ((), {}))
263 self.assertEqual(self.ui.wizard().button_texts,
264 [(QtGui.QWizard.NextButton, NEXT)])
265 self.assertEqual(self.ui.wizard().button_layout,
266 [QtGui.QWizard.Stretch,
267 QtGui.QWizard.NextButton])
248268
249 @defer.inlineCallbacks269 @defer.inlineCallbacks
250 def test_status_after_get_info(self):270 def test_status_after_get_info(self):
@@ -549,3 +569,10 @@
549 'options': local_folders.QtGui.QFileDialog.DontUseNativeDialog,569 'options': local_folders.QtGui.QFileDialog.DontUseNativeDialog,
550 'parent': self.ui,570 'parent': self.ui,
551 }))571 }))
572
573 def test_cleanup_page(self):
574 """cleanupPage should call folders.initializePage()."""
575 self.patch(self.ui.wizard().folders_page,
576 "initializePage", self._set_called)
577 self.ui.cleanupPage()
578 self.assertEqual(self._called, ((), {}))
552579
=== modified file 'ubuntuone_installer/gui/qt/tests/test_sync_now_or_later.py'
--- ubuntuone_installer/gui/qt/tests/test_sync_now_or_later.py 2011-09-07 16:52:36 +0000
+++ ubuntuone_installer/gui/qt/tests/test_sync_now_or_later.py 2011-09-10 01:59:23 +0000
@@ -76,12 +76,14 @@
76 """With cloud folders, next page is folders."""76 """With cloud folders, next page is folders."""
77 self.ui.has_cloud_folders = True77 self.ui.has_cloud_folders = True
78 self.assertEqual(self.ui.nextId(), FakeMainWindow.folders_page_id)78 self.assertEqual(self.ui.nextId(), FakeMainWindow.folders_page_id)
79 self.assertTrue(self.main_window.local_folders_page.has_back_button)
7980
80 def test_has_no_cloud_folders_next(self):81 def test_has_no_cloud_folders_next(self):
81 """With cloud folders, next page is folders."""82 """With cloud folders, next page is folders."""
82 self.ui.has_cloud_folders = False83 self.ui.has_cloud_folders = False
83 self.assertEqual(self.ui.nextId(),84 self.assertEqual(self.ui.nextId(),
84 FakeMainWindow.local_folders_page_id)85 FakeMainWindow.local_folders_page_id)
86 self.assertFalse(self.main_window.local_folders_page.has_back_button)
8587
86 def test_status_after_initialize(self):88 def test_status_after_initialize(self):
87 """Test that everything is initialized correctly."""89 """Test that everything is initialized correctly."""

Subscribers

People subscribed via source and target branches