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
=== modified file 'ubuntuone/controlpanel/gui/__init__.py'
--- ubuntuone/controlpanel/gui/__init__.py 2012-03-19 20:55:52 +0000
+++ ubuntuone/controlpanel/gui/__init__.py 2012-03-20 15:18:18 +0000
@@ -179,6 +179,17 @@
179INSTALL_PLUGIN = _('Install the %(plugin_name)s for the sync service: '179INSTALL_PLUGIN = _('Install the %(plugin_name)s for the sync service: '
180 '%(service_name)s')180 '%(service_name)s')
181INSTALLING = _('Installation of <i>%(package_name)s</i> in progress')181INSTALLING = _('Installation of <i>%(package_name)s</i> in progress')
182LICENSE_AGREE = _('Agree and continue')
183LICENSE_AGREEMENT = _('License Agreement')
184LICENSE_BASIC = _('Ubuntu One Basic is free, while additional service add-ons '
185 'may be paid for services.')
186LICENSE_DISAGREE = _('Disagree and uninstall')
187LICENSE_GPL3 = _('This program is free software: you can redistribute it '
188 'and/or modify it under the terms of the GNU General Public License '
189 'version 3, as published by the Free Software Foundation.')
190LICENSE_LINK = _('As free software, this programme is distributed without '
191 'warranty. See the GNU General Public License for more details at '
192 '{license_link}')
182LOADING = _('Loading...')193LOADING = _('Loading...')
183LOADING_OVERLAY = _('Getting information, please wait...')194LOADING_OVERLAY = _('Getting information, please wait...')
184LOCAL_FOLDERS_CALCULATING = _('Calculating...')195LOCAL_FOLDERS_CALCULATING = _('Calculating...')
185196
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-19 20:51:26 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-20 15:18:18 +0000
@@ -95,6 +95,19 @@
95 self.assertFalse(self.ui.isFinalPage())95 self.assertFalse(self.ui.isFinalPage())
9696
9797
98class LicensePageTestCase(UbuntuOnePageTestCase):
99 """Test the LicensePage wizard page."""
100
101 class_ui = gui.LicensePage
102 panel_class = gui.QtGui.QTextBrowser
103
104 def test_content(self):
105 """The page content is correct."""
106 expected = gui.QtGui.QTextBrowser()
107 expected.setHtml(gui.LICENSE_CONTENT)
108 self.assertEqual(self.ui.panel.toHtml(), expected.toHtml())
109
110
98class SignInPageTestCase(UbuntuOnePageTestCase):111class SignInPageTestCase(UbuntuOnePageTestCase):
99 """Test the SignInPage wizard page."""112 """Test the SignInPage wizard page."""
100113
@@ -140,9 +153,11 @@
140153
141 class_ui = gui.UbuntuOneWizard154 class_ui = gui.UbuntuOneWizard
142 confirm_response = gui.QtGui.QDialog.Accepted155 confirm_response = gui.QtGui.QDialog.Accepted
156 show_license = False
143157
144 @defer.inlineCallbacks158 @defer.inlineCallbacks
145 def setUp(self):159 def setUp(self):
160 self.patch(self.class_ui, 'show_license', self.show_license)
146 yield super(UbuntuOneWizardTestCase, self).setUp()161 yield super(UbuntuOneWizardTestCase, self).setUp()
147 self.patch(self.ui.confirm_dialog, 'exec_',162 self.patch(self.ui.confirm_dialog, 'exec_',
148 lambda: self.confirm_response)163 lambda: self.confirm_response)
@@ -171,7 +186,11 @@
171186
172 def test_first_page(self):187 def test_first_page(self):
173 """The first page is the correct one."""188 """The first page is the correct one."""
174 expected = self.ui.pages[self.ui.signin_page]189 if self.show_license:
190 expected = self.ui.pages[self.ui.license_page]
191 else:
192 expected = self.ui.pages[self.ui.signin_page]
193
175 self.assertEqual(self.ui.startId(), expected)194 self.assertEqual(self.ui.startId(), expected)
176195
177 def test_done_accepted(self):196 def test_done_accepted(self):
@@ -183,6 +202,12 @@
183 self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {}))202 self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {}))
184203
185204
205class LicensedUbuntuOneWizardTestCase(UbuntuOneWizardTestCase):
206 """Test the LicensedUbuntuOneWizard."""
207
208 show_license = True
209
210
186class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase):211class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase):
187 """Test the SignInPage wizard page."""212 """Test the SignInPage wizard page."""
188213
@@ -312,6 +337,18 @@
312 # does not apply to this page337 # does not apply to this page
313338
314339
340class UbuntuOneWizardLicensePage(UbuntuOneWizardSignInTestCase):
341 """Test the LicensePage wizard page."""
342
343 buttons = {
344 'NextButton': (gui.LICENSE_AGREE, 'currentIdChanged', (1,)),
345 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()),
346 }
347 page_name = 'license'
348 show_license = True
349 stage_name = 'install'
350
351
315class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):352class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):
316 """Test the login through the wizard."""353 """Test the login through the wizard."""
317354
318355
=== modified file 'ubuntuone/controlpanel/gui/qt/wizard.py'
--- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-19 17:16:43 +0000
+++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-20 15:18:18 +0000
@@ -36,6 +36,12 @@
36 CLOUD_TO_COMPUTER_TITLE,36 CLOUD_TO_COMPUTER_TITLE,
37 COMPUTER_TO_CLOUD_SUBTITLE,37 COMPUTER_TO_CLOUD_SUBTITLE,
38 COMPUTER_TO_CLOUD_TITLE,38 COMPUTER_TO_CLOUD_TITLE,
39 LICENSE_AGREE,
40 LICENSE_AGREEMENT,
41 LICENSE_BASIC,
42 LICENSE_DISAGREE,
43 LICENSE_GPL3,
44 LICENSE_LINK,
39 UBUNTUONE_LINK,45 UBUNTUONE_LINK,
40)46)
41from ubuntuone.controlpanel.gui.qt.folders import (47from ubuntuone.controlpanel.gui.qt.folders import (
@@ -51,6 +57,21 @@
51logger = setup_logging('qt.wizard')57logger = setup_logging('qt.wizard')
5258
5359
60GPL_URL = u'http://www.gnu.org/licenses'
61GPL_LINK = LINK_STYLE.format(link_url=GPL_URL, link_text=GPL_URL)
62LICENSE_CONTENT = u"""<html>
63 <body style="font-family:Ubuntu">
64 <h2>{license_agreement}</h2>
65 <p>{license_gpl3}</p>
66 <p>{license_basic}</p>
67 <p>{license_link}</p>
68 </body>
69<html>""".format(license_agreement=LICENSE_AGREEMENT,
70 license_gpl3=LICENSE_GPL3, license_basic=LICENSE_BASIC,
71 license_link=LICENSE_LINK.format(license_link=GPL_LINK),
72)
73
74
54class AreYouSure(QtGui.QDialog):75class AreYouSure(QtGui.QDialog):
5576
56 """A 'Are you sure?' dialog."""77 """A 'Are you sure?' dialog."""
@@ -100,6 +121,16 @@
100 self.setFinalPage(self.is_final)121 self.setFinalPage(self.is_final)
101122
102123
124class LicensePage(UbuntuOnePage):
125 """The page to show the license."""
126
127 panel_class = QtGui.QTextBrowser
128
129 def __init__(self, *args, **kwargs):
130 super(LicensePage, self).__init__(*args, **kwargs)
131 self.panel.setHtml(LICENSE_CONTENT)
132
133
103class SignInPage(UbuntuOnePage):134class SignInPage(UbuntuOnePage):
104 """The page to signin to Ubuntu One."""135 """The page to signin to Ubuntu One."""
105136
@@ -152,6 +183,12 @@
152 self.side_widget.stage = self.side_widget.signin_stage183 self.side_widget.stage = self.side_widget.signin_stage
153 self.setSideWidget(self.side_widget)184 self.setSideWidget(self.side_widget)
154185
186 # license
187 self.license_page = LicensePage()
188 self.next_button_text = self.button(self.NextButton).text()
189 if self.show_license:
190 self.addPage(self.license_page)
191
155 # sign in192 # sign in
156 self.signin_page = SignInPage()193 self.signin_page = SignInPage()
157 self.addPage(self.signin_page)194 self.addPage(self.signin_page)
@@ -193,15 +230,28 @@
193230
194 button_layout = button_to = button = stage = None231 button_layout = button_to = button = stage = None
195232
196 if page is self.signin_page:233 if page is self.license_page:
197 self.setButtonText(self.CancelButton, CLOSE_AND_SETUP_LATER)234 button_layout = [self.Stretch, self.CancelButton, self.NextButton]
198235 button = self.button(self.NextButton)
236 button_to = self.button(self.CancelButton)
237 stage = self.side_widget.install_stage
238
239 self.setButtonText(self.NextButton, LICENSE_AGREE)
240 self.setButtonText(self.CancelButton, LICENSE_DISAGREE)
241
242 elif page is self.signin_page:
199 button_layout = [self.Stretch, self.CancelButton]243 button_layout = [self.Stretch, self.CancelButton]
200 button = self.signin_page.panel.ui.register_button244 button = self.signin_page.panel.ui.register_button
201 button_to = self.button(self.CancelButton)245 button_to = self.button(self.CancelButton)
202 stage = self.side_widget.signin_stage246 stage = self.side_widget.signin_stage
203 self._next_id = self.pages[self.cloud_folders_page]247 self._next_id = self.pages[self.cloud_folders_page]
248
249 self.setButtonText(self.CancelButton, CLOSE_AND_SETUP_LATER)
250 self.setTabOrder(self.signin_page.panel.ui.login_button, button)
251
204 elif page is self.cloud_folders_page:252 elif page is self.cloud_folders_page:
253 self.setButtonText(self.NextButton, self.next_button_text)
254
205 button_layout = [self.Stretch, self.NextButton]255 button_layout = [self.Stretch, self.NextButton]
206 button = self.cloud_folders_page.panel.ui.check_settings_button256 button = self.cloud_folders_page.panel.ui.check_settings_button
207 button_to = self.button(self.NextButton)257 button_to = self.button(self.NextButton)
@@ -289,5 +339,13 @@
289 if response == QtGui.QDialog.Accepted:339 if response == QtGui.QDialog.Accepted:
290 logger.warning('UbuntuOneWizard: user canceled setup.')340 logger.warning('UbuntuOneWizard: user canceled setup.')
291 self.rejected.emit()341 self.rejected.emit()
342 elif (self.show_license and
343 self.currentId() == self.pages[self.license_page]):
344 response = self.confirm_dialog.exec_()
345 if response == QtGui.QDialog.Accepted:
346 logger.warning('UbuntuOneWizard: user wants to uninstall.')
347 # TODO: needs implementation in this project
348 ##qt.utils.uninstall_application()
349 self.rejected.emit()
292 else:350 else:
293 super(UbuntuOneWizard, self).done(result)351 super(UbuntuOneWizard, self).done(result)

Subscribers

People subscribed via source and target branches