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

Proposed by Diego Sarmentero on 2012-01-02
Status: Merged
Approved by: Diego Sarmentero on 2012-01-04
Approved revision: 102
Merged at revision: 100
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/default-agree
Merge into: lp:ubuntuone-windows-installer
Diff against target: 114 lines (+59/-2)
3 files modified
ubuntuone_installer/gui/qt/gui.py (+6/-0)
ubuntuone_installer/gui/qt/tests/__init__.py (+33/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+20/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/default-agree
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2012-01-04
Roberto Alsina (community) 2012-01-02 Approve on 2012-01-02
Review via email: mp+87282@code.launchpad.net

Commit Message

Agree button modified to look as a default button.

Description of the Change

Agree button modified to look as a default button.

To post a comment you must log in.
100. By Diego Sarmentero on 2012-01-02

The agree button in the license page doesn't have the proper style

Roberto Alsina (ralsina) wrote :

+1 pretty!

review: Approve
101. By Diego Sarmentero on 2012-01-03

Removed some unnecessary lines in the test

102. By Diego Sarmentero on 2012-01-03

Improves in tests

Manuel de la Peña (mandel) wrote :

Much better! this way we know that we forced the repaint! Approving!

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-12-13 12:40:25 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2012-01-03 15:04:23 +0000
4@@ -155,6 +155,7 @@
5 super(LicensePage, self).__init__(license_ui.Ui_Form(), None, parent)
6 self.header.setVisible(False)
7 self.ui.textBrowser.setHtml(qt.LICENSE_CONTENT)
8+ self.agree_button = None
9
10 # Invalid names of Qt-inherited methods
11 # pylint: disable=C0103
12@@ -181,6 +182,11 @@
13 QtGui.QWizard.NextButton,
14 QtGui.QWizard.FinishButton])
15
16+ self.agree_button = self.wizard().button(QtGui.QWizard.NextButton)
17+ self.agree_button.setDefault(True)
18+ self.agree_button.style().unpolish(self.agree_button)
19+ self.agree_button.style().polish(self.agree_button)
20+
21 def nextId(self):
22 """Return next page's ID."""
23 if self._next_id is None:
24
25=== modified file 'ubuntuone_installer/gui/qt/tests/__init__.py'
26--- ubuntuone_installer/gui/qt/tests/__init__.py 2011-11-10 13:57:33 +0000
27+++ ubuntuone_installer/gui/qt/tests/__init__.py 2012-01-03 15:04:23 +0000
28@@ -175,6 +175,39 @@
29 return self.buttons.setdefault(button_id, QtGui.QPushButton())
30
31
32+class FakeWizardButtonStyle(FakeWizard):
33+
34+ def __init__(self):
35+ super(FakeWizardButtonStyle, self).__init__()
36+ self.data = {}
37+
38+ # pylint: disable=C0103
39+ def setDefault(self, value):
40+ """Fake setDefault for button."""
41+ self.data['default'] = value
42+
43+ def isDefault(self):
44+ """Fake isDefault."""
45+ return self.data['default']
46+ # pylint: enable=C0103
47+
48+ def button(self, button_id):
49+ """Fake the functionality of button on QWizard class."""
50+ return self
51+
52+ def style(self):
53+ """Fake button style."""
54+ return self
55+
56+ def polish(self, button):
57+ """Fake polish."""
58+ self.data['polish'] = button
59+
60+ def unpolish(self, button):
61+ """Fake unpolish."""
62+ self.data['unpolish'] = button
63+
64+
65 class FakeWizardPage(object):
66
67 """A fake wizard page."""
68
69=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
70--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-12-13 16:16:56 +0000
71+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2012-01-03 15:04:23 +0000
72@@ -39,6 +39,7 @@
73 FakeController,
74 FakeOverlay,
75 FakeSignal,
76+ FakeWizardButtonStyle,
77 FakeWizardPage,
78 NO_OP,
79 )
80@@ -224,7 +225,24 @@
81 self.assertFalse(setup_page.set_up_button.isVisible())
82 self.assertTrue(setup_page.set_up_button.isDefault())
83
84- def test_execute_uninstall_on_licence_cancel(self):
85+ def test_license_page_agree_button_style(self):
86+ """Check that License Page shows agree button with the proper style."""
87+ license_page = self.ui.page(self.ui.LICENSE_PAGE)
88+ self.ui.setStartId(self.ui.LICENSE_PAGE)
89+ self.ui.restart()
90+ self.ui.show()
91+ self.addCleanup(self.ui.hide)
92+ self.patch(license_page, "wizard", FakeWizardButtonStyle)
93+ license_page.initializePage()
94+ self.assertTrue(license_page.agree_button.isDefault())
95+ self.assertTrue('polish' in license_page.agree_button.data)
96+ self.assertTrue('unpolish' in license_page.agree_button.data)
97+ self.assertEqual(license_page.agree_button.data['polish'],
98+ license_page.agree_button)
99+ self.assertEqual(license_page.agree_button.data['unpolish'],
100+ license_page.agree_button)
101+
102+ def test_execute_uninstall_on_license_cancel(self):
103 """Pressing Disagree button from license page the uninstall is exec."""
104 self.ui.setStartId(self.ui.LICENSE_PAGE)
105 self.ui.restart()
106@@ -235,7 +253,7 @@
107 self.ui.done(result=0)
108 self.assertTrue(self._called)
109
110- def test_execute_uninstall_on_licence_cancel_frozen(self):
111+ def test_execute_uninstall_on_license_cancel_frozen(self):
112 """Pressing Disagree button from license page the uninstall is exec."""
113 self.ui.setStartId(self.ui.LICENSE_PAGE)
114 self.ui.restart()

Subscribers

People subscribed via source and target branches