Merge lp:~ralsina/ubuntuone-control-panel/switch-baby-switch into lp:ubuntuone-control-panel

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 365
Merged at revision: 363
Proposed branch: lp:~ralsina/ubuntuone-control-panel/switch-baby-switch
Merge into: lp:ubuntuone-control-panel
Diff against target: 46 lines (+17/-6)
2 files modified
ubuntuone/controlpanel/gui/qt/controlpanel.py (+9/-6)
ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+8/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/switch-baby-switch
Reviewer Review Type Date Requested Status
Brian Curtin (community) Approve
Diego Sarmentero (community) Approve
Review via email: mp+128559@code.launchpad.net

Commit message

- Switch to folders tab only hen credentials are not found (Fixes lp:1063904).

Description of the change

This branch fixes the --switch-to option. To test IRL, run u1cp with the "--switch-to=devices" option (or any other tabname) and it should work.

Also important is that it should not break the following behaviour: when you remove your device and login again, you should end in the "folders" tab, not in the "devices" tab.

To test that: start u1cp, remove your device, then login again (without exiting u1cp) and you should end in the folders tab.

To post a comment you must log in.
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
Brian Curtin (brian.curtin) wrote :

Looks ok to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py'
2--- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-08-20 17:51:54 +0000
3+++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-10-08 18:17:23 +0000
4@@ -99,14 +99,17 @@
5 """Credentials are not found or were removed."""
6 self.ui.wizard.restart()
7 self.ui.switcher.setCurrentWidget(self.ui.wizard)
8- self.is_processing = False
9-
10- @defer.inlineCallbacks
11- @log_call(logger.debug)
12- def on_credentials_found(self):
13- """Credentials are not found or were removed."""
14+ # By design request, when the user logs in, he has to end
15+ # in the folders tab, so setting that up for after the wizard is
16+ # done.
17 folders_tab_idx = self.ui.tab_widget.indexOf(self.ui.folders_tab)
18 self.ui.tab_widget.setCurrentIndex(folders_tab_idx)
19+ self.is_processing = False
20+
21+ @defer.inlineCallbacks
22+ @log_call(logger.debug)
23+ def on_credentials_found(self):
24+ """Credentials are not found or were removed."""
25 self.ui.switcher.setCurrentWidget(self.ui.management)
26 self.connect_file_sync()
27 self.is_processing = False
28
29=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py'
30--- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-04-10 19:15:11 +0000
31+++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-10-08 18:17:23 +0000
32@@ -74,6 +74,14 @@
33 self.assertIs(self.ui.ui.switcher.currentWidget(), self.ui.ui.wizard)
34 self.assertEqual(self._called, ((), {}))
35
36+ def test_on_credentials_not_found_sets_folder_tab(self):
37+ """Credentials_not_found should switch to the folder tab."""
38+ unexpected = self.ui.ui.tab_widget.indexOf(self.ui.ui.devices_tab)
39+ expected = self.ui.ui.tab_widget.indexOf(self.ui.ui.folders_tab)
40+ self.ui.ui.tab_widget.setCurrentIndex(unexpected)
41+ self.ui.on_credentials_not_found()
42+ self.assertEqual(self.ui.ui.tab_widget.currentIndex(), expected)
43+
44 @defer.inlineCallbacks
45 def test_on_credentials_found_called(self):
46 """If credentials, on_credentials_not_found is called."""

Subscribers

People subscribed via source and target branches