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
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-09-29 13:26:44 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-10-07 20:11:29 +0000
@@ -160,7 +160,9 @@
160 QtGui.QWizard.Stretch,160 QtGui.QWizard.Stretch,
161 QtGui.QWizard.NextButton])161 QtGui.QWizard.NextButton])
162162
163 # Set existing_account_button as default when the page is shown.163 def showEvent(self, event):
164 """Set existing_account_button as default when the page is shown."""
165 super(SignInPage, self).showEvent(event)
164 self.ui.existing_account_button.setDefault(True)166 self.ui.existing_account_button.setDefault(True)
165 self.ui.existing_account_button.style().unpolish(167 self.ui.existing_account_button.style().unpolish(
166 self.ui.existing_account_button)168 self.ui.existing_account_button)
@@ -225,6 +227,13 @@
225 SKIP_TOUR)227 SKIP_TOUR)
226 self.wizard().setButtonText(QtGui.QWizard.NextButton,228 self.wizard().setButtonText(QtGui.QWizard.NextButton,
227 START_SETUP)229 START_SETUP)
230 self.finish_button = self.wizard().button(QtGui.QWizard.FinishButton)
231 self.next_button = self.wizard().button(QtGui.QWizard.NextButton)
232 self.finish_button.style().unpolish(self.finish_button)
233 self.finish_button.style().polish(self.finish_button)
234 self.next_button.setDefault(True)
235 self.next_button.style().unpolish(self.next_button)
236 self.next_button.style().polish(self.next_button)
228237
229 def nextId(self):238 def nextId(self):
230 """Provide the next id."""239 """Provide the next id."""
231240
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-29 13:26:44 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-10-07 20:11:29 +0000
@@ -634,6 +634,10 @@
634 """Fake setButtonText."""634 """Fake setButtonText."""
635 self.button_layout = layout635 self.button_layout = layout
636636
637 def button(self, button):
638 """Fake button method to obtain the wizard buttons."""
639 return QtGui.QPushButton()
640
637 def setOption(self, *args):641 def setOption(self, *args):
638 """Fake setOption."""642 """Fake setOption."""
639 self.options.append(args)643 self.options.append(args)
@@ -641,6 +645,9 @@
641 def next(self):645 def next(self):
642 """Fake next."""646 """Fake next."""
643647
648 def reject(self):
649 """Fake reject."""
650
644651
645class SuccesPageTestCase(BaseTestCase):652class SuccesPageTestCase(BaseTestCase):
646 """Test the SuccessPage code."""653 """Test the SuccessPage code."""
@@ -663,6 +670,27 @@
663 [QtGui.QWizard.Stretch,670 [QtGui.QWizard.Stretch,
664 QtGui.QWizard.FinishButton,671 QtGui.QWizard.FinishButton,
665 QtGui.QWizard.NextButton])672 QtGui.QWizard.NextButton])
673 self.assertTrue(self.ui.next_button.isDefault())
674 self.assertFalse(self.ui.finish_button.isDefault())
675
676
677class SignInPageTestCase(BaseTestCase):
678 """Test the SuccessPage code."""
679
680 def setUp(self):
681 """Initialize this test instance."""
682 super(SignInPageTestCase, self).setUp()
683 self.ui = gui.SignInPage(gui.choose_sign_in_ui.Ui_ChooseSignInPage(),
684 None, None)
685
686 def test_show_event(self):
687 """Check the page is initialized correctly."""
688 wizard = FakeMainWindow()
689 self.patch(self.ui, 'wizard', lambda *args: wizard)
690 self.ui.initializePage()
691 self.ui.show()
692 self.addCleanup(self.ui.hide)
693 self.assertTrue(self.ui.ui.existing_account_button.isDefault())
666694
667695
668class UpgradeQuestion(BaseTestCase):696class UpgradeQuestion(BaseTestCase):

Subscribers

People subscribed via source and target branches