Merge lp:~ralsina/ubuntuone-windows-installer/add_install_option into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Natalia Bidart
Approved revision: 61
Merged at revision: 63
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/add_install_option
Merge into: lp:ubuntuone-windows-installer
Diff against target: 181 lines (+62/-12)
5 files modified
bin/ubuntuone-installer-qt (+5/-2)
ubuntuone_installer/gui/qt/gui.py (+9/-1)
ubuntuone_installer/gui/qt/main/tests/test_windows.py (+22/-0)
ubuntuone_installer/gui/qt/main/windows.py (+9/-8)
ubuntuone_installer/gui/qt/tests/test_gui.py (+17/-1)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/add_install_option
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Diego Sarmentero (community) Approve
Review via email: mp+74506@code.launchpad.net

Commit message

Add --installer option to the wizard.

Description of the change

Add --installer option to the wizard.

To test IRL:

* if you run it with --installer, you get the license page.
* if you run it without arguments, you get the "choose sign in" page.

To post a comment you must log in.
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
58. By Roberto Alsina

change name of variable from installer to installing, as suggested

59. By Roberto Alsina

merged trunk

60. By Roberto Alsina

fix test

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

- When running the installer without the --installer option, I still get the "Congratulations, Ubuntu One is installed!" legend in the first screen. I think we need to remove that?

- Also, if passing the --installer switch, I can't close the window, even if I choose 'yes I want to cancel' (on the license page).

review: Needs Fixing
61. By Roberto Alsina

Don't show 'is installed' message if not installing

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
=== modified file 'bin/ubuntuone-installer-qt'
--- bin/ubuntuone-installer-qt 2011-07-29 18:30:21 +0000
+++ bin/ubuntuone-installer-qt 2011-09-14 15:15:47 +0000
@@ -38,11 +38,14 @@
38 """Parse command line parameters."""38 """Parse command line parameters."""
39 usage = "Usage: %prog [option]"39 usage = "Usage: %prog [option]"
40 result = OptionParser(usage=usage)40 result = OptionParser(usage=usage)
41 # There are no options currently41 result.add_option("-i", "--installer", dest="installer",
42 action="store_true",
43 default=False, help="To be used by the installer: "
44 "Show license page, offer uninstall on cancel.")
42 return result45 return result
4346
4447
45if __name__ == "__main__":48if __name__ == "__main__":
46 parser = parser_options()49 parser = parser_options()
47 (options, args) = parser.parse_args(sys.argv)50 (options, args) = parser.parse_args(sys.argv)
48 main.main()51 main.main(installing=options.installer)
4952
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-09-12 18:48:09 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-09-14 15:15:47 +0000
@@ -265,7 +265,7 @@
265 registrationSuccess = QtCore.pyqtSignal('QString', 'QString')265 registrationSuccess = QtCore.pyqtSignal('QString', 'QString')
266 userCancellation = QtCore.pyqtSignal('QString')266 userCancellation = QtCore.pyqtSignal('QString')
267267
268 def __init__(self, close_callback=None):268 def __init__(self, close_callback=None, installing=False):
269 """Initialize this instance."""269 """Initialize this instance."""
270 # Used to decide the next page dynamically270 # Used to decide the next page dynamically
271 self._next_id = None271 self._next_id = None
@@ -313,6 +313,8 @@
313 ui=choose_sign_in_ui.Ui_ChooseSignInPage(),313 ui=choose_sign_in_ui.Ui_ChooseSignInPage(),
314 controller=self.sign_in_controller,314 controller=self.sign_in_controller,
315 parent=self)315 parent=self)
316 if not installing:
317 self.sign_in_page.ui.message_label.setText("")
316318
317 self.setup_controller = SetUpAccountController(message_box=self)319 self.setup_controller = SetUpAccountController(message_box=self)
318 self.setup_account = SetupAccountPage(320 self.setup_account = SetupAccountPage(
@@ -381,6 +383,12 @@
381 # Set Wizard buttons style383 # Set Wizard buttons style
382 self.button(QtGui.QWizard.NextButton).setDefault(True)384 self.button(QtGui.QWizard.NextButton).setDefault(True)
383385
386 if installing:
387 self.setStartId(self.LICENSE_PAGE_ID)
388 else:
389 self.setStartId(self.SIGNIN_PAGE)
390 self.restart()
391
384 # Invalid name "closeEvent"392 # Invalid name "closeEvent"
385 # pylint: disable=C0103393 # pylint: disable=C0103
386394
387395
=== modified file 'ubuntuone_installer/gui/qt/main/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-08-29 12:41:02 +0000
+++ ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-09-14 15:15:47 +0000
@@ -126,3 +126,25 @@
126 self.assertEqual(self._called, ((), {}))126 self.assertEqual(self._called, ((), {}))
127 # Should stop the app127 # Should stop the app
128 self.assertTrue(self.stopped)128 self.assertTrue(self.stopped)
129
130 @defer.inlineCallbacks
131 def test_without_installed_flag(self):
132 """Test behaviour without the installer flag."""
133 logger = FakeLogger()
134 self.patch(windows, "success_cb", self._set_called)
135 yield windows.check_credentials(
136 FakeCredentialsManagementTool,
137 gui, logger)
138 self.assertEqual(self._called, (('Something not false',
139 gui, False), {}))
140
141 @defer.inlineCallbacks
142 def test_with_installed_flag(self):
143 """Test behaviour without the installer flag."""
144 logger = FakeLogger()
145 self.patch(windows, "success_cb", self._set_called)
146 yield windows.check_credentials(
147 FakeCredentialsManagementTool,
148 gui, logger, installer=True)
149 self.assertEqual(self._called, (('Something not false',
150 gui, True), {}))
129151
=== modified file 'ubuntuone_installer/gui/qt/main/windows.py'
--- ubuntuone_installer/gui/qt/main/windows.py 2011-09-08 14:18:30 +0000
+++ ubuntuone_installer/gui/qt/main/windows.py 2011-09-14 15:15:47 +0000
@@ -1,6 +1,7 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
22
3# Authors: Manuel de la Pena <manuel@canonical.com>3# Authors: Manuel de la Pena <manuel@canonical.com>
4# Roberto Alsina <roberto.alsina@canonical.com>
4#5#
5# Copyright 2011 Canonical Ltd.6# Copyright 2011 Canonical Ltd.
6#7#
@@ -43,14 +44,14 @@
43 stop()44 stop()
4445
4546
46def success_cb(creds, gui):47def success_cb(creds, gui, installing):
47 """Handle credentials success."""48 """Handle credentials success."""
48 if creds: # Have credentials already49 if creds: # Have credentials already
49 from ubuntuone_installer.gui.qt import utils50 from ubuntuone_installer.gui.qt import utils
50 utils.start_control_panel()51 utils.start_control_panel()
51 stop()52 stop()
52 else: # No credentials53 else: # No credentials
53 window = gui.MainWindow(close_callback=stop)54 window = gui.MainWindow(close_callback=stop, installing=installing)
54 # Set Application Style Sheet55 # Set Application Style Sheet
55 app = QtGui.QApplication.instance()56 app = QtGui.QApplication.instance()
56 qss = QtCore.QResource(":/ubuntuone.qss")57 qss = QtCore.QResource(":/ubuntuone.qss")
@@ -64,7 +65,7 @@
6465
6566
66@defer.inlineCallbacks67@defer.inlineCallbacks
67def check_credentials(credentials_tool, gui, logger):68def check_credentials(credentials_tool, gui, logger, installer=False):
68 """Check credentials and either start u1cp or show the wizard."""69 """Check credentials and either start u1cp or show the wizard."""
69 credtool = credentials_tool()70 credtool = credentials_tool()
70 # pylint: disable=W070371 # pylint: disable=W0703
@@ -73,10 +74,10 @@
73 except Exception, exc:74 except Exception, exc:
74 error_cb(exc, logger)75 error_cb(exc, logger)
75 else:76 else:
76 success_cb(creds, gui)77 success_cb(creds, gui, installer)
7778
7879
79def main():80def main(installing=False):
80 """Perform a client request to be logged in."""81 """Perform a client request to be logged in."""
81 # pylint: disable=W061282 # pylint: disable=W0612
82 app = QtGui.QApplication(sys.argv)83 app = QtGui.QApplication(sys.argv)
@@ -89,5 +90,5 @@
89 from ubuntuone.platform.credentials import CredentialsManagementTool90 from ubuntuone.platform.credentials import CredentialsManagementTool
90 from ubuntuone_installer.logger import setup_logging91 from ubuntuone_installer.logger import setup_logging
91 logger = setup_logging('qt.gui')92 logger = setup_logging('qt.gui')
92 check_credentials(CredentialsManagementTool, gui, logger)93 check_credentials(CredentialsManagementTool, gui, logger, installing)
93 reactor.run()94 reactor.run()
9495
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-12 18:49:40 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-14 15:15:47 +0000
@@ -161,6 +161,19 @@
161 QtCore.Qt.WindowContextHelpButtonHint)161 QtCore.Qt.WindowContextHelpButtonHint)
162 self.assertEqual(flag, 0)162 self.assertEqual(flag, 0)
163163
164 def test_with_flag(self):
165 """test with flag activated."""
166 win = gui.MainWindow(installing=True)
167 self.assertEqual(win.startId(), win.LICENSE_PAGE_ID)
168 self.assertEqual(
169 unicode(self.ui.sign_in_page.ui.message_label.text()),
170 u"")
171
172 def test_without_flag(self):
173 """test with flag activated."""
174 win = gui.MainWindow()
175 self.assertEqual(win.startId(), win.SIGNIN_PAGE)
176
164 def test_initialize_page(self):177 def test_initialize_page(self):
165 """Check the initializePage to ensure proper widgets visibility."""178 """Check the initializePage to ensure proper widgets visibility."""
166 setup_page = self.ui.page(self.ui.setup_account_page_id)179 setup_page = self.ui.page(self.ui.setup_account_page_id)
@@ -472,7 +485,10 @@
472485
473 def test_continue_cancels_cancel(self):486 def test_continue_cancels_cancel(self):
474 """Clicking 'Continue' cancels cancellation."""487 """Clicking 'Continue' cancels cancellation."""
475 gui.AreYouSure.result = 1488 # Must not be LICENSE_PAGE not CONGRATULATIONS_PAGE
489 self.patch(self.ui, 'currentId', lambda: self.ui.SIGNIN_PAGE)
490 # Make AreYouSure say the user is "not sure"
491 gui.AreYouSure.result = 0
476 self.patch(subprocess, "Popen", self._set_called)492 self.patch(subprocess, "Popen", self._set_called)
477 self.ui.show()493 self.ui.show()
478 self.addCleanup(self.ui.hide)494 self.addCleanup(self.ui.hide)

Subscribers

People subscribed via source and target branches