Merge lp:~diegosarmentero/ubuntuone-windows-installer/setup-button-fix into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 51
Merged at revision: 55
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/setup-button-fix
Merge into: lp:ubuntuone-windows-installer
Diff against target: 79 lines (+32/-5)
2 files modified
ubuntuone_installer/gui/qt/setup_account.py (+6/-3)
ubuntuone_installer/gui/qt/tests/test_gui.py (+26/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/setup-button-fix
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+74118@code.launchpad.net

Commit message

Removed Setup Account button when the user move to another page.

Description of the change

Removed Setup Account button when the user move to another page.

To post a comment you must log in.
48. By Diego Sarmentero

Adding associated bug.

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

+1

review: Approve
49. By Diego Sarmentero

adding missing docstrings.

50. By Diego Sarmentero

Added initializePage.

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

I'm getting this test failures:

[FAIL]
Traceback (most recent call last):
  File "/home/nessita/canonical/u1/windows-installer/review_setup-button-fix/ubuntuone_installer/gui/qt/tests/test_gui.py", line 332, in test_overlay_connection_setup_account
    self.assertEqual(self.ui.overlay.show_counter, 1)
twisted.trial.unittest.FailTest: not equal:
a = 2
b = 1

ubuntuone_installer.gui.qt.tests.test_gui.MainWindowTestCase.test_overlay_connection_setup_account

(but not in trunk)

review: Needs Fixing
51. By Diego Sarmentero

Fixed test (to avoid double signal connection).

Revision history for this message
Natalia Bidart (nataliabidart) 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 'ubuntuone_installer/gui/qt/setup_account.py'
2--- ubuntuone_installer/gui/qt/setup_account.py 2011-09-01 11:15:49 +0000
3+++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-07 12:05:57 +0000
4@@ -178,16 +178,19 @@
5 """Set set_up_button as default button when the page is shown."""
6 # This method should stays here because if we move it to initializePage
7 # set_up_button won't take the proper style for hover and press
8+ self.set_up_button.setVisible(True)
9 self.set_up_button.setDefault(True)
10- self.set_up_button.setProperty("DisabledState", True)
11- self.set_up_button.style().unpolish(self.set_up_button)
12- self.set_up_button.style().polish(self.set_up_button)
13+ if not self.set_up_button.isEnabled():
14+ self.set_up_button.setProperty("DisabledState", True)
15+ self.set_up_button.style().unpolish(self.set_up_button)
16+ self.set_up_button.style().polish(self.set_up_button)
17 self.connect(QtGui.QApplication.instance(),
18 QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
19 self.focus_changed)
20
21 def hideEvent(self, event):
22 """Disconnect the focusChanged signal when the page change."""
23+ self.set_up_button.setVisible(False)
24 try:
25 self.disconnect(QtGui.QApplication.instance(),
26 QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
27
28=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
29--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-06 16:25:25 +0000
30+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-07 12:05:57 +0000
31@@ -150,6 +150,8 @@
32 self.patch(qt.preferences, "PreferencesPanel", FakePreferencesPanel)
33 self.patch(qt.folders, "FoldersPanel", FakeFoldersPanel)
34 super(MainWindowTestCase, self).setUp()
35+ setup_page = self.ui.page(self.ui.setup_account_page_id)
36+ setup_page.initializePage()
37
38 def test_wizard_init(self):
39 """Check the Wizard flags regarding to the context help button."""
40@@ -169,6 +171,30 @@
41 self.assertFalse(setup_page.ui.confirm_email_assistance.isVisible())
42 self.assertFalse(setup_page.ui.password_assistance.isVisible())
43
44+ def test_setup_account_show_event_enabled_false(self):
45+ """Check the proper state of the Setup Account button on shown."""
46+ setup_page = self.ui.page(self.ui.setup_account_page_id)
47+ self.ui.setStartId(self.ui.setup_account_page_id)
48+ self.ui.restart()
49+ setup_page.set_up_button.setEnabled(False)
50+ self.ui.show()
51+ self.addCleanup(self.ui.hide)
52+ self.assertTrue(setup_page.set_up_button.isVisible())
53+ self.assertTrue(setup_page.set_up_button.isDefault())
54+ self.assertFalse(setup_page.set_up_button.isEnabled())
55+ self.assertTrue(setup_page.set_up_button.property("DisabledState"))
56+
57+ def test_setup_account_hide_event_enabled_false(self):
58+ """Check the proper state of the Setup Account button on hide."""
59+ setup_page = self.ui.page(self.ui.setup_account_page_id)
60+ self.ui.setStartId(self.ui.setup_account_page_id)
61+ self.ui.restart()
62+ self.ui.show()
63+ self.ui.hide()
64+ self.addCleanup(self.ui.hide)
65+ self.assertFalse(setup_page.set_up_button.isVisible())
66+ self.assertTrue(setup_page.set_up_button.isDefault())
67+
68 def test_execute_uninstall_on_licence_cancel(self):
69 """Pressing Disagree button from license page the uninstall is exec."""
70 self.ui.setStartId(self.ui.LICENSE_PAGE_ID)
71@@ -300,8 +326,6 @@
72 """Make sure we don't lose connections to the overlay."""
73 # Show the setup account page
74 setup_page = self.ui.page(self.ui.setup_account_page_id)
75- self.ui.setStartId(self.ui.setup_account_page_id)
76- self.ui.restart()
77 self.ui.show()
78 self.addCleanup(self.ui.hide)
79 self.assertEqual(self.ui.overlay.show_counter, 0)

Subscribers

People subscribed via source and target branches