Merge lp:~nataliabidart/ubuntuone-control-panel/license-page into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 293
Merged at revision: 292
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/license-page
Merge into: lp:ubuntuone-control-panel
Diff against target: 217 lines (+110/-4)
3 files modified
ubuntuone/controlpanel/gui/__init__.py (+11/-0)
ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+38/-1)
ubuntuone/controlpanel/gui/qt/wizard.py (+61/-3)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/license-page
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+98432@code.launchpad.net

Commit message

- Added the "License" page to the wizard (part of LP: #933697). So far is not visible from a regular run, will be enabled for windows only in another branch.

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
Diego Sarmentero (diegosarmentero) wrote :

+1

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/__init__.py'
2--- ubuntuone/controlpanel/gui/__init__.py 2012-03-19 20:55:52 +0000
3+++ ubuntuone/controlpanel/gui/__init__.py 2012-03-20 15:18:18 +0000
4@@ -179,6 +179,17 @@
5 INSTALL_PLUGIN = _('Install the %(plugin_name)s for the sync service: '
6 '%(service_name)s')
7 INSTALLING = _('Installation of <i>%(package_name)s</i> in progress')
8+LICENSE_AGREE = _('Agree and continue')
9+LICENSE_AGREEMENT = _('License Agreement')
10+LICENSE_BASIC = _('Ubuntu One Basic is free, while additional service add-ons '
11+ 'may be paid for services.')
12+LICENSE_DISAGREE = _('Disagree and uninstall')
13+LICENSE_GPL3 = _('This program is free software: you can redistribute it '
14+ 'and/or modify it under the terms of the GNU General Public License '
15+ 'version 3, as published by the Free Software Foundation.')
16+LICENSE_LINK = _('As free software, this programme is distributed without '
17+ 'warranty. See the GNU General Public License for more details at '
18+ '{license_link}')
19 LOADING = _('Loading...')
20 LOADING_OVERLAY = _('Getting information, please wait...')
21 LOCAL_FOLDERS_CALCULATING = _('Calculating...')
22
23=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
24--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-19 20:51:26 +0000
25+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-20 15:18:18 +0000
26@@ -95,6 +95,19 @@
27 self.assertFalse(self.ui.isFinalPage())
28
29
30+class LicensePageTestCase(UbuntuOnePageTestCase):
31+ """Test the LicensePage wizard page."""
32+
33+ class_ui = gui.LicensePage
34+ panel_class = gui.QtGui.QTextBrowser
35+
36+ def test_content(self):
37+ """The page content is correct."""
38+ expected = gui.QtGui.QTextBrowser()
39+ expected.setHtml(gui.LICENSE_CONTENT)
40+ self.assertEqual(self.ui.panel.toHtml(), expected.toHtml())
41+
42+
43 class SignInPageTestCase(UbuntuOnePageTestCase):
44 """Test the SignInPage wizard page."""
45
46@@ -140,9 +153,11 @@
47
48 class_ui = gui.UbuntuOneWizard
49 confirm_response = gui.QtGui.QDialog.Accepted
50+ show_license = False
51
52 @defer.inlineCallbacks
53 def setUp(self):
54+ self.patch(self.class_ui, 'show_license', self.show_license)
55 yield super(UbuntuOneWizardTestCase, self).setUp()
56 self.patch(self.ui.confirm_dialog, 'exec_',
57 lambda: self.confirm_response)
58@@ -171,7 +186,11 @@
59
60 def test_first_page(self):
61 """The first page is the correct one."""
62- expected = self.ui.pages[self.ui.signin_page]
63+ if self.show_license:
64+ expected = self.ui.pages[self.ui.license_page]
65+ else:
66+ expected = self.ui.pages[self.ui.signin_page]
67+
68 self.assertEqual(self.ui.startId(), expected)
69
70 def test_done_accepted(self):
71@@ -183,6 +202,12 @@
72 self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {}))
73
74
75+class LicensedUbuntuOneWizardTestCase(UbuntuOneWizardTestCase):
76+ """Test the LicensedUbuntuOneWizard."""
77+
78+ show_license = True
79+
80+
81 class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase):
82 """Test the SignInPage wizard page."""
83
84@@ -312,6 +337,18 @@
85 # does not apply to this page
86
87
88+class UbuntuOneWizardLicensePage(UbuntuOneWizardSignInTestCase):
89+ """Test the LicensePage wizard page."""
90+
91+ buttons = {
92+ 'NextButton': (gui.LICENSE_AGREE, 'currentIdChanged', (1,)),
93+ 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()),
94+ }
95+ page_name = 'license'
96+ show_license = True
97+ stage_name = 'install'
98+
99+
100 class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):
101 """Test the login through the wizard."""
102
103
104=== modified file 'ubuntuone/controlpanel/gui/qt/wizard.py'
105--- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-19 17:16:43 +0000
106+++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-20 15:18:18 +0000
107@@ -36,6 +36,12 @@
108 CLOUD_TO_COMPUTER_TITLE,
109 COMPUTER_TO_CLOUD_SUBTITLE,
110 COMPUTER_TO_CLOUD_TITLE,
111+ LICENSE_AGREE,
112+ LICENSE_AGREEMENT,
113+ LICENSE_BASIC,
114+ LICENSE_DISAGREE,
115+ LICENSE_GPL3,
116+ LICENSE_LINK,
117 UBUNTUONE_LINK,
118 )
119 from ubuntuone.controlpanel.gui.qt.folders import (
120@@ -51,6 +57,21 @@
121 logger = setup_logging('qt.wizard')
122
123
124+GPL_URL = u'http://www.gnu.org/licenses'
125+GPL_LINK = LINK_STYLE.format(link_url=GPL_URL, link_text=GPL_URL)
126+LICENSE_CONTENT = u"""<html>
127+ <body style="font-family:Ubuntu">
128+ <h2>{license_agreement}</h2>
129+ <p>{license_gpl3}</p>
130+ <p>{license_basic}</p>
131+ <p>{license_link}</p>
132+ </body>
133+<html>""".format(license_agreement=LICENSE_AGREEMENT,
134+ license_gpl3=LICENSE_GPL3, license_basic=LICENSE_BASIC,
135+ license_link=LICENSE_LINK.format(license_link=GPL_LINK),
136+)
137+
138+
139 class AreYouSure(QtGui.QDialog):
140
141 """A 'Are you sure?' dialog."""
142@@ -100,6 +121,16 @@
143 self.setFinalPage(self.is_final)
144
145
146+class LicensePage(UbuntuOnePage):
147+ """The page to show the license."""
148+
149+ panel_class = QtGui.QTextBrowser
150+
151+ def __init__(self, *args, **kwargs):
152+ super(LicensePage, self).__init__(*args, **kwargs)
153+ self.panel.setHtml(LICENSE_CONTENT)
154+
155+
156 class SignInPage(UbuntuOnePage):
157 """The page to signin to Ubuntu One."""
158
159@@ -152,6 +183,12 @@
160 self.side_widget.stage = self.side_widget.signin_stage
161 self.setSideWidget(self.side_widget)
162
163+ # license
164+ self.license_page = LicensePage()
165+ self.next_button_text = self.button(self.NextButton).text()
166+ if self.show_license:
167+ self.addPage(self.license_page)
168+
169 # sign in
170 self.signin_page = SignInPage()
171 self.addPage(self.signin_page)
172@@ -193,15 +230,28 @@
173
174 button_layout = button_to = button = stage = None
175
176- if page is self.signin_page:
177- self.setButtonText(self.CancelButton, CLOSE_AND_SETUP_LATER)
178-
179+ if page is self.license_page:
180+ button_layout = [self.Stretch, self.CancelButton, self.NextButton]
181+ button = self.button(self.NextButton)
182+ button_to = self.button(self.CancelButton)
183+ stage = self.side_widget.install_stage
184+
185+ self.setButtonText(self.NextButton, LICENSE_AGREE)
186+ self.setButtonText(self.CancelButton, LICENSE_DISAGREE)
187+
188+ elif page is self.signin_page:
189 button_layout = [self.Stretch, self.CancelButton]
190 button = self.signin_page.panel.ui.register_button
191 button_to = self.button(self.CancelButton)
192 stage = self.side_widget.signin_stage
193 self._next_id = self.pages[self.cloud_folders_page]
194+
195+ self.setButtonText(self.CancelButton, CLOSE_AND_SETUP_LATER)
196+ self.setTabOrder(self.signin_page.panel.ui.login_button, button)
197+
198 elif page is self.cloud_folders_page:
199+ self.setButtonText(self.NextButton, self.next_button_text)
200+
201 button_layout = [self.Stretch, self.NextButton]
202 button = self.cloud_folders_page.panel.ui.check_settings_button
203 button_to = self.button(self.NextButton)
204@@ -289,5 +339,13 @@
205 if response == QtGui.QDialog.Accepted:
206 logger.warning('UbuntuOneWizard: user canceled setup.')
207 self.rejected.emit()
208+ elif (self.show_license and
209+ self.currentId() == self.pages[self.license_page]):
210+ response = self.confirm_dialog.exec_()
211+ if response == QtGui.QDialog.Accepted:
212+ logger.warning('UbuntuOneWizard: user wants to uninstall.')
213+ # TODO: needs implementation in this project
214+ ##qt.utils.uninstall_application()
215+ self.rejected.emit()
216 else:
217 super(UbuntuOneWizard, self).done(result)

Subscribers

People subscribed via source and target branches