Merge lp:~diegosarmentero/ubuntuone-windows-installer/default-wrong-buttons into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Merged
Approved by: Diego Sarmentero
Approved revision: 77
Merged at revision: 79
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/default-wrong-buttons
Merge into: lp:ubuntuone-windows-installer
Diff against target: 81 lines (+38/-1)
2 files modified
ubuntuone_installer/gui/qt/gui.py (+10/-1)
ubuntuone_installer/gui/qt/tests/test_gui.py (+28/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/default-wrong-buttons
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+78663@code.launchpad.net

Commit message

Fixed: When running the wizard from the bundle, the "Skip tour" is the default button (LP: #845778).
Fixed: When running the wizard from the bundle, there is no default button in the first screen (LP: #848016).

Description of the change

Fixed: When running the wizard from the bundle, the "Skip tour" is the default button (LP: #845778).
Fixed: When running the wizard from the bundle, there is no default button in the first screen (LP: #848016).

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

Looks good and tests pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone_installer/gui/qt/gui.py'
2--- ubuntuone_installer/gui/qt/gui.py 2011-09-29 13:26:44 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2011-10-07 20:11:29 +0000
4@@ -160,7 +160,9 @@
5 QtGui.QWizard.Stretch,
6 QtGui.QWizard.NextButton])
7
8- # Set existing_account_button as default when the page is shown.
9+ def showEvent(self, event):
10+ """Set existing_account_button as default when the page is shown."""
11+ super(SignInPage, self).showEvent(event)
12 self.ui.existing_account_button.setDefault(True)
13 self.ui.existing_account_button.style().unpolish(
14 self.ui.existing_account_button)
15@@ -225,6 +227,13 @@
16 SKIP_TOUR)
17 self.wizard().setButtonText(QtGui.QWizard.NextButton,
18 START_SETUP)
19+ self.finish_button = self.wizard().button(QtGui.QWizard.FinishButton)
20+ self.next_button = self.wizard().button(QtGui.QWizard.NextButton)
21+ self.finish_button.style().unpolish(self.finish_button)
22+ self.finish_button.style().polish(self.finish_button)
23+ self.next_button.setDefault(True)
24+ self.next_button.style().unpolish(self.next_button)
25+ self.next_button.style().polish(self.next_button)
26
27 def nextId(self):
28 """Provide the next id."""
29
30=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
31--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-29 13:26:44 +0000
32+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-10-07 20:11:29 +0000
33@@ -634,6 +634,10 @@
34 """Fake setButtonText."""
35 self.button_layout = layout
36
37+ def button(self, button):
38+ """Fake button method to obtain the wizard buttons."""
39+ return QtGui.QPushButton()
40+
41 def setOption(self, *args):
42 """Fake setOption."""
43 self.options.append(args)
44@@ -641,6 +645,9 @@
45 def next(self):
46 """Fake next."""
47
48+ def reject(self):
49+ """Fake reject."""
50+
51
52 class SuccesPageTestCase(BaseTestCase):
53 """Test the SuccessPage code."""
54@@ -663,6 +670,27 @@
55 [QtGui.QWizard.Stretch,
56 QtGui.QWizard.FinishButton,
57 QtGui.QWizard.NextButton])
58+ self.assertTrue(self.ui.next_button.isDefault())
59+ self.assertFalse(self.ui.finish_button.isDefault())
60+
61+
62+class SignInPageTestCase(BaseTestCase):
63+ """Test the SuccessPage code."""
64+
65+ def setUp(self):
66+ """Initialize this test instance."""
67+ super(SignInPageTestCase, self).setUp()
68+ self.ui = gui.SignInPage(gui.choose_sign_in_ui.Ui_ChooseSignInPage(),
69+ None, None)
70+
71+ def test_show_event(self):
72+ """Check the page is initialized correctly."""
73+ wizard = FakeMainWindow()
74+ self.patch(self.ui, 'wizard', lambda *args: wizard)
75+ self.ui.initializePage()
76+ self.ui.show()
77+ self.addCleanup(self.ui.hide)
78+ self.assertTrue(self.ui.ui.existing_account_button.isDefault())
79
80
81 class UpgradeQuestion(BaseTestCase):

Subscribers

People subscribed via source and target branches