Merge lp:~ralsina/ubuntuone-control-panel/installer-option into lp:ubuntuone-control-panel
- installer-option
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Roberto Alsina |
Approved revision: | 308 |
Merged at revision: | 295 |
Proposed branch: | lp:~ralsina/ubuntuone-control-panel/installer-option |
Merge into: | lp:ubuntuone-control-panel |
Prerequisite: | lp:~nataliabidart/ubuntuone-control-panel/license-page |
Diff against target: |
335 lines (+62/-45) 8 files modified
ubuntuone/controlpanel/gui/qt/controlpanel.py (+8/-0) ubuntuone/controlpanel/gui/qt/gui.py (+8/-4) ubuntuone/controlpanel/gui/qt/main/__init__.py (+6/-1) ubuntuone/controlpanel/gui/qt/main/tests/test_main.py (+9/-3) ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+10/-0) ubuntuone/controlpanel/gui/qt/tests/test_start.py (+1/-1) ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+11/-23) ubuntuone/controlpanel/gui/qt/wizard.py (+9/-13) |
To merge this branch: | bzr merge lp:~ralsina/ubuntuone-control-panel/installer-option |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Diego Sarmentero (community) | Approve | ||
Review via email: mp+98503@code.launchpad.net |
Commit message
- Made the license page from the wizard be shown (only when called with --installer) (LP: #933697).
Description of the change
- Added the license page to the wizard (only when called with --installer) (LP: #933697).
To test IRL:
* remove credentials
* If you start u1cp, you will get the "sign in/sign up" page
* Start u1cp again with the --installer option, and you should get a license page, for which the "next" page is "signin / signup"
Natalia Bidart (nataliabidart) wrote : | # |
* I wonder why you added a new method start_from_license instead of redefining setStartId in the QWizard. Any reason not to do that?
* I think that the test_first_page should not be removed, it may need some tweaks so it remains as:
def test_first_
"""The first page is the correct one."""
expected = self.ui.
* Can you please fix the indentation of test_start_
def test_start_
"""Test the start_from_license method."""
# Before, we start on sign_in
assert self.ui.startId() == self.ui.
# After calling start_from_license, we start on license_page
* Why did you need to change the page_id of the buttons dict in UbuntuOneWizard
* Why the test_buttons_
* If we're leaving the license 'next' button to be a commit button, we don't need to store the string text of the Next button, so that can be safely removed.
Roberto Alsina (ralsina) wrote : | # |
> * I wonder why you added a new method start_from_license instead of redefining
> setStartId in the QWizard. Any reason not to do that?
Moed start_from_license into the controlpanel as suggested.
>
> * I think that the test_first_page should not be removed, it may need some
> tweaks so it remains as:
>
> def test_first_
> """The first page is the correct one."""
> expected = self.ui.
> self.assertEqua
That was already covered by the new test_start_
Readded this test now since start_from_license moved, and moved the test for start_from_license
to control panel tests.
> * Can you please fix the indentation of test_start_
> 79-columns width are used? Something like (the following may need tweaking if
> we move to setStartId):
>
> def test_start_
> """Test the start_from_license method."""
> # Before, we start on sign_in
> assert self.ui.startId() == self.ui.
>
> # After calling start_from_license, we start on license_page
> self.ui.
> self.assertEqua
> self.ui.
Ermmmm I like the way I wrote it? It's wider now anyway because the names are longer.
>
> * Why did you need to change the page_id of the buttons dict in
> UbuntuOneWizard
> and UbuntuOneWizard
Because they didn't work. Those are page IDs, and since now the license page is
added as first page, all those tests failed because they IDs moved.
> * Why the test_buttons_
> see the comment you added but that does not explain to me why you need to
> redefine/skip it instead of making it pass. Also, why does the NextButton need
> to be a CommitButton?
It has to be a CommitButton so the user can't go back to the license page.
The CommitButton doesn't trigger the same signals as NextButton, and can't find
anywhere in the docs what we may expect there. I changed the test slightly so that
we can check the text of the buttons even if they don't trigger anything by
passing None as signal name.
> * If we're leaving the license 'next' button to be a commit button, we don't
> need to store the string text of the Next button, so that can be safely
> removed.
Can't remove it, causes errors later on. Moved it so it doesn't appear to be part
of the license_page setup.
Natalia Bidart (nataliabidart) wrote : | # |
> > * If we're leaving the license 'next' button to be a commit button, we don't
> > need to store the string text of the Next button, so that can be safely
> > removed.
>
> Can't remove it, causes errors later on. Moved it so it doesn't appear to be
> part
> of the license_page setup.
The line:
self.next_
was added by me so we could restore the text in the NextButton in another page, since before we were cutomizing the text in the NextButton for the license page.
As how this branch is, the NextButton text is never changed, so there is no need to keep that hack in place. You can indeed remove it, but you have to removed from all the methods that is being used on (I tried this myself).
Thanks!
Roberto Alsina (ralsina) wrote : | # |
> As how this branch is, the NextButton text is never changed, so there is no
> need to keep that hack in place. You can indeed remove it, but you have to
> removed from all the methods that is being used on (I tried this myself).
Ok, removing it everywhere in revno 308
Natalia Bidart (nataliabidart) wrote : | # |
Looks great! Also works as expected.
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~ralsina/ubuntuone-control-panel/installer-option into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.
*** Running test suite for ubuntuone/
ubuntuone.
ExceptionHand
test_
test_
GetDataFileTe
test_
GetProjectDir
test_
test_
GetProjectDir
test_
test_
test_
ubuntuone.
TestCase
runTest ... [OK]
ubuntuone.
AutoupdaterTe
test_
test_
DefaultFolder
test_
test_
test_
test_
test_
test_
test_
ubuntuone.
TestCase
runTest ... [OK]
ubuntuone.
ReplicationsT
test_exclude ... [OK]
test_
test_
test_
test_
test_
test_replicate ... [OK]
test_
test_
ubuntuone.
TestCase
runTest ... [OK]
ubuntuone.
AutoconnectTe
test_disable ... [OK]
test_
Preview Diff
1 | === modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py' | |||
2 | --- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-19 20:55:52 +0000 | |||
3 | +++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-22 12:49:18 +0000 | |||
4 | @@ -170,3 +170,11 @@ | |||
5 | 170 | def on_wizard_finished(self, status): | 170 | def on_wizard_finished(self, status): |
6 | 171 | """Move to controlpanel if wizard ended successfully.""" | 171 | """Move to controlpanel if wizard ended successfully.""" |
7 | 172 | self.on_credentials_found() | 172 | self.on_credentials_found() |
8 | 173 | |||
9 | 174 | @log_call(logger.info) | ||
10 | 175 | def start_from_license(self): | ||
11 | 176 | """Use the license page as first page.""" | ||
12 | 177 | # license | ||
13 | 178 | self.ui.wizard.setStartId(self.ui.wizard.pages[ | ||
14 | 179 | self.ui.wizard.license_page]) | ||
15 | 180 | self.ui.wizard.restart() | ||
16 | 173 | 181 | ||
17 | === modified file 'ubuntuone/controlpanel/gui/qt/gui.py' | |||
18 | --- ubuntuone/controlpanel/gui/qt/gui.py 2012-03-06 21:33:23 +0000 | |||
19 | +++ ubuntuone/controlpanel/gui/qt/gui.py 2012-03-22 12:49:18 +0000 | |||
20 | @@ -35,7 +35,7 @@ | |||
21 | 35 | class MainWindow(QtGui.QMainWindow): | 35 | class MainWindow(QtGui.QMainWindow): |
22 | 36 | """The Main Window of the Control Panel.""" | 36 | """The Main Window of the Control Panel.""" |
23 | 37 | 37 | ||
25 | 38 | def __init__(self, close_callback=None): | 38 | def __init__(self, close_callback=None, installer=False): |
26 | 39 | """Initialize this instance with the UI layout.""" | 39 | """Initialize this instance with the UI layout.""" |
27 | 40 | super(MainWindow, self).__init__() | 40 | super(MainWindow, self).__init__() |
28 | 41 | self.ui = mainwindow_ui.Ui_MainWindow() | 41 | self.ui = mainwindow_ui.Ui_MainWindow() |
29 | @@ -46,6 +46,9 @@ | |||
30 | 46 | triggered=self.close) | 46 | triggered=self.close) |
31 | 47 | self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"]) | 47 | self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"]) |
32 | 48 | self.addAction(self.quit_action) | 48 | self.addAction(self.quit_action) |
33 | 49 | self.installer = installer | ||
34 | 50 | if installer: | ||
35 | 51 | self.ui.control_panel.start_from_license() | ||
36 | 49 | if USE_LIBUNITY: | 52 | if USE_LIBUNITY: |
37 | 50 | self.entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP) | 53 | self.entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP) |
38 | 51 | else: | 54 | else: |
39 | @@ -84,14 +87,15 @@ | |||
40 | 84 | # pylint: enable=C0103 | 87 | # pylint: enable=C0103 |
41 | 85 | 88 | ||
42 | 86 | 89 | ||
44 | 87 | def start(close_callback, minimized=False, with_icon=False): | 90 | def start(close_callback, minimized=False, with_icon=False, installer=False): |
45 | 88 | """Show the UI elements.""" | 91 | """Show the UI elements.""" |
46 | 89 | # pylint: disable=W0404, F0401 | 92 | # pylint: disable=W0404, F0401 |
47 | 90 | if not minimized: | 93 | if not minimized: |
48 | 91 | if with_icon or minimized: | 94 | if with_icon or minimized: |
50 | 92 | window = MainWindow() | 95 | window = MainWindow(installer=installer) |
51 | 93 | else: | 96 | else: |
53 | 94 | window = MainWindow(close_callback=close_callback) | 97 | window = MainWindow(close_callback=close_callback, |
54 | 98 | installer=installer) | ||
55 | 95 | app = QtGui.QApplication.instance() | 99 | app = QtGui.QApplication.instance() |
56 | 96 | style = QtGui.QStyle.alignedRect( | 100 | style = QtGui.QStyle.alignedRect( |
57 | 97 | QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter, | 101 | QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter, |
58 | 98 | 102 | ||
59 | === modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py' | |||
60 | --- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-03-16 21:09:40 +0000 | |||
61 | +++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-03-22 12:49:18 +0000 | |||
62 | @@ -55,6 +55,9 @@ | |||
63 | 55 | default=False, | 55 | default=False, |
64 | 56 | help="Start Ubuntu One " | 56 | help="Start Ubuntu One " |
65 | 57 | "with an icon in the notification area.") | 57 | "with an icon in the notification area.") |
66 | 58 | result.add_argument("--installer", dest="installer", action="store_true", | ||
67 | 59 | default=False, | ||
68 | 60 | help="Show the license agreement page first.") | ||
69 | 58 | return result | 61 | return result |
70 | 59 | 62 | ||
71 | 60 | 63 | ||
72 | @@ -82,6 +85,7 @@ | |||
73 | 82 | switch_to = args.switch_to | 85 | switch_to = args.switch_to |
74 | 83 | minimized = args.minimized | 86 | minimized = args.minimized |
75 | 84 | with_icon = args.with_icon | 87 | with_icon = args.with_icon |
76 | 88 | installer = args.installer | ||
77 | 85 | source.main(app) | 89 | source.main(app) |
78 | 86 | 90 | ||
79 | 87 | data = [] | 91 | data = [] |
80 | @@ -92,7 +96,8 @@ | |||
81 | 92 | 96 | ||
82 | 93 | # Unused variable 'window', 'icon', pylint: disable=W0612 | 97 | # Unused variable 'window', 'icon', pylint: disable=W0612 |
83 | 94 | icon, window = start(lambda: source.main_quit(app), | 98 | icon, window = start(lambda: source.main_quit(app), |
85 | 95 | minimized=minimized, with_icon=with_icon) | 99 | minimized=minimized, with_icon=with_icon, |
86 | 100 | installer=installer) | ||
87 | 96 | window.switch_to(switch_to) | 101 | window.switch_to(switch_to) |
88 | 97 | # pylint: enable=W0612 | 102 | # pylint: enable=W0612 |
89 | 98 | if icon: | 103 | if icon: |
90 | 99 | 104 | ||
91 | === modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py' | |||
92 | --- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-03-16 21:14:20 +0000 | |||
93 | +++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-03-22 12:49:18 +0000 | |||
94 | @@ -132,19 +132,19 @@ | |||
95 | 132 | """Ensure the binary name is not given to argparse.""" | 132 | """Ensure the binary name is not given to argparse.""" |
96 | 133 | main.main(["foo", "bar", sys.argv[0], "--minimized"]) | 133 | main.main(["foo", "bar", sys.argv[0], "--minimized"]) |
97 | 134 | self.assertEqual(self.start.args[1], | 134 | self.assertEqual(self.start.args[1], |
99 | 135 | {'minimized': True, 'with_icon': False}) | 135 | {'minimized': True, 'with_icon': False, 'installer': False}) |
100 | 136 | 136 | ||
101 | 137 | def test_minimized_option(self): | 137 | def test_minimized_option(self): |
102 | 138 | """Ensure the --minimized option is parsed and passed correctly.""" | 138 | """Ensure the --minimized option is parsed and passed correctly.""" |
103 | 139 | main.main([sys.argv[0], "--minimized"]) | 139 | main.main([sys.argv[0], "--minimized"]) |
104 | 140 | self.assertEqual(self.start.args[1], | 140 | self.assertEqual(self.start.args[1], |
106 | 141 | {'minimized': True, 'with_icon': False}) | 141 | {'minimized': True, 'with_icon': False, 'installer': False}) |
107 | 142 | 142 | ||
108 | 143 | def test_with_icon_option(self): | 143 | def test_with_icon_option(self): |
109 | 144 | """Ensure the --minimized option is parsed and passed correctly.""" | 144 | """Ensure the --minimized option is parsed and passed correctly.""" |
110 | 145 | main.main([sys.argv[0], "--with-icon"]) | 145 | main.main([sys.argv[0], "--with-icon"]) |
111 | 146 | self.assertEqual(self.start.args[1], | 146 | self.assertEqual(self.start.args[1], |
113 | 147 | {'minimized': False, 'with_icon': True}) | 147 | {'minimized': False, 'with_icon': True, 'installer': False}) |
114 | 148 | 148 | ||
115 | 149 | def test_all_styles_load(self): | 149 | def test_all_styles_load(self): |
116 | 150 | """Ensure the platform style is loaded.""" | 150 | """Ensure the platform style is loaded.""" |
117 | @@ -160,6 +160,12 @@ | |||
118 | 160 | main.main([sys.argv[0], "--switch-to", "folders"]) | 160 | main.main([sys.argv[0], "--switch-to", "folders"]) |
119 | 161 | self.assertEqual(self.start.window.tabname, "folders") | 161 | self.assertEqual(self.start.window.tabname, "folders") |
120 | 162 | 162 | ||
121 | 163 | def test_installer_option(self): | ||
122 | 164 | """Ensure the --installer option is parsed and passed correctly.""" | ||
123 | 165 | main.main([sys.argv[0], "--installer"]) | ||
124 | 166 | self.assertEqual(self.start.args[1], | ||
125 | 167 | {'minimized': False, 'with_icon': False, 'installer': True}) | ||
126 | 168 | |||
127 | 163 | def test_translator(self): | 169 | def test_translator(self): |
128 | 164 | """Ensure the Qt translator is loaded.""" | 170 | """Ensure the Qt translator is loaded.""" |
129 | 165 | main.main([sys.argv[0]]) | 171 | main.main([sys.argv[0]]) |
130 | 166 | 172 | ||
131 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py' | |||
132 | --- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-19 15:50:31 +0000 | |||
133 | +++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-22 12:49:18 +0000 | |||
134 | @@ -186,6 +186,16 @@ | |||
135 | 186 | remote = self.ui.ui.folders_tab.remote_folders | 186 | remote = self.ui.ui.folders_tab.remote_folders |
136 | 187 | self.assertFalse(remote) | 187 | self.assertFalse(remote) |
137 | 188 | 188 | ||
138 | 189 | def test_start_from_license(self): | ||
139 | 190 | """Ensure we change the starting page correctly.""" | ||
140 | 191 | # Before, we start on sign_in | ||
141 | 192 | self.assertEqual(self.ui.ui.wizard.startId(), | ||
142 | 193 | self.ui.ui.wizard.pages[self.ui.ui.wizard.signin_page]) | ||
143 | 194 | # After, we start on license_page | ||
144 | 195 | self.ui.start_from_license() | ||
145 | 196 | self.assertEqual(self.ui.ui.wizard.startId(), | ||
146 | 197 | self.ui.ui.wizard.pages[self.ui.ui.wizard.license_page]) | ||
147 | 198 | |||
148 | 189 | 199 | ||
149 | 190 | class ExternalLinkButtonsTestCase(ControlPanelTestCase): | 200 | class ExternalLinkButtonsTestCase(ControlPanelTestCase): |
150 | 191 | """The link in the go-to-web buttons are correct.""" | 201 | """The link in the go-to-web buttons are correct.""" |
151 | 192 | 202 | ||
152 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_start.py' | |||
153 | --- ubuntuone/controlpanel/gui/qt/tests/test_start.py 2012-02-17 14:42:57 +0000 | |||
154 | +++ ubuntuone/controlpanel/gui/qt/tests/test_start.py 2012-03-22 12:49:18 +0000 | |||
155 | @@ -78,7 +78,7 @@ | |||
156 | 78 | gui.start(close_callback=self.close_cb, | 78 | gui.start(close_callback=self.close_cb, |
157 | 79 | with_icon=True, minimized=False) | 79 | with_icon=True, minimized=False) |
158 | 80 | kwargs = {'close_callback': self.close_cb, 'window': self.main_window} | 80 | kwargs = {'close_callback': self.close_cb, 'window': self.main_window} |
160 | 81 | self.assertEqual(self.main_window.args, [((), {})]) | 81 | self.assertEqual(self.main_window.args, [((), {'installer': False})]) |
161 | 82 | self.assertEqual(self.tray_icon.args, [((), kwargs)]) | 82 | self.assertEqual(self.tray_icon.args, [((), kwargs)]) |
162 | 83 | 83 | ||
163 | 84 | def test_both_false(self): | 84 | def test_both_false(self): |
164 | 85 | 85 | ||
165 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py' | |||
166 | --- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-20 15:14:24 +0000 | |||
167 | +++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-22 12:49:18 +0000 | |||
168 | @@ -153,11 +153,9 @@ | |||
169 | 153 | 153 | ||
170 | 154 | class_ui = gui.UbuntuOneWizard | 154 | class_ui = gui.UbuntuOneWizard |
171 | 155 | confirm_response = gui.QtGui.QDialog.Accepted | 155 | confirm_response = gui.QtGui.QDialog.Accepted |
172 | 156 | show_license = False | ||
173 | 157 | 156 | ||
174 | 158 | @defer.inlineCallbacks | 157 | @defer.inlineCallbacks |
175 | 159 | def setUp(self): | 158 | def setUp(self): |
176 | 160 | self.patch(self.class_ui, 'show_license', self.show_license) | ||
177 | 161 | yield super(UbuntuOneWizardTestCase, self).setUp() | 159 | yield super(UbuntuOneWizardTestCase, self).setUp() |
178 | 162 | self.patch(self.ui.confirm_dialog, 'exec_', | 160 | self.patch(self.ui.confirm_dialog, 'exec_', |
179 | 163 | lambda: self.confirm_response) | 161 | lambda: self.confirm_response) |
180 | @@ -186,11 +184,7 @@ | |||
181 | 186 | 184 | ||
182 | 187 | def test_first_page(self): | 185 | def test_first_page(self): |
183 | 188 | """The first page is the correct one.""" | 186 | """The first page is the correct one.""" |
189 | 189 | if self.show_license: | 187 | expected = self.ui.pages[self.ui.signin_page] |
185 | 190 | expected = self.ui.pages[self.ui.license_page] | ||
186 | 191 | else: | ||
187 | 192 | expected = self.ui.pages[self.ui.signin_page] | ||
188 | 193 | |||
190 | 194 | self.assertEqual(self.ui.startId(), expected) | 188 | self.assertEqual(self.ui.startId(), expected) |
191 | 195 | 189 | ||
192 | 196 | def test_done_accepted(self): | 190 | def test_done_accepted(self): |
193 | @@ -202,12 +196,6 @@ | |||
194 | 202 | self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {})) | 196 | self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {})) |
195 | 203 | 197 | ||
196 | 204 | 198 | ||
197 | 205 | class LicensedUbuntuOneWizardTestCase(UbuntuOneWizardTestCase): | ||
198 | 206 | """Test the LicensedUbuntuOneWizard.""" | ||
199 | 207 | |||
200 | 208 | show_license = True | ||
201 | 209 | |||
202 | 210 | |||
203 | 211 | class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase): | 199 | class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase): |
204 | 212 | """Test the SignInPage wizard page.""" | 200 | """Test the SignInPage wizard page.""" |
205 | 213 | 201 | ||
206 | @@ -267,12 +255,13 @@ | |||
207 | 267 | if text is not None: | 255 | if text is not None: |
208 | 268 | self.assertEqual(unicode(button.text()), text) | 256 | self.assertEqual(unicode(button.text()), text) |
209 | 269 | 257 | ||
212 | 270 | getattr(self.ui, signal).connect(self._set_called) | 258 | if signal: |
213 | 271 | button.click() | 259 | getattr(self.ui, signal).connect(self._set_called) |
214 | 260 | button.click() | ||
215 | 272 | 261 | ||
219 | 273 | self.assertEqual(self._called, (signal_args, {}), | 262 | self.assertEqual(self._called, (signal_args, {}), |
220 | 274 | msg % (name, signal, signal_args)) | 263 | msg % (name, signal, signal_args)) |
221 | 275 | self._called = False | 264 | self._called = False |
222 | 276 | 265 | ||
223 | 277 | def test_done_rejected(self): | 266 | def test_done_rejected(self): |
224 | 278 | """When the wizard was cancelled and user confirmed, finish.""" | 267 | """When the wizard was cancelled and user confirmed, finish.""" |
225 | @@ -300,7 +289,7 @@ | |||
226 | 300 | class UbuntuOneWizardCloudToComputerTestCase(UbuntuOneWizardSignInTestCase): | 289 | class UbuntuOneWizardCloudToComputerTestCase(UbuntuOneWizardSignInTestCase): |
227 | 301 | """Test the CloudToComputerPage wizard page.""" | 290 | """Test the CloudToComputerPage wizard page.""" |
228 | 302 | 291 | ||
230 | 303 | buttons = {'NextButton': (None, 'currentIdChanged', (3,))} | 292 | buttons = {'NextButton': (None, 'currentIdChanged', (4,))} |
231 | 304 | page_name = 'cloud_folders' | 293 | page_name = 'cloud_folders' |
232 | 305 | stage_name = 'folders' | 294 | stage_name = 'folders' |
233 | 306 | 295 | ||
234 | @@ -308,7 +297,7 @@ | |||
235 | 308 | class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase): | 297 | class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase): |
236 | 309 | """Test the CloudToComputerPage wizard page.""" | 298 | """Test the CloudToComputerPage wizard page.""" |
237 | 310 | 299 | ||
239 | 311 | buttons = {'BackButton': (None, 'currentIdChanged', (0,))} | 300 | buttons = {'BackButton': (None, 'currentIdChanged', (1,))} |
240 | 312 | page_name = 'settings' | 301 | page_name = 'settings' |
241 | 313 | stage_name = 'folders' | 302 | stage_name = 'folders' |
242 | 314 | 303 | ||
243 | @@ -318,7 +307,7 @@ | |||
244 | 318 | 307 | ||
245 | 319 | buttons = { | 308 | buttons = { |
246 | 320 | 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)), | 309 | 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)), |
248 | 321 | 'BackButton': (None, 'currentIdChanged', (0,)), | 310 | 'BackButton': (None, 'currentIdChanged', (1,)), |
249 | 322 | } | 311 | } |
250 | 323 | page_name = 'local_folders' | 312 | page_name = 'local_folders' |
251 | 324 | stage_name = 'sync' | 313 | stage_name = 'sync' |
252 | @@ -341,11 +330,10 @@ | |||
253 | 341 | """Test the LicensePage wizard page.""" | 330 | """Test the LicensePage wizard page.""" |
254 | 342 | 331 | ||
255 | 343 | buttons = { | 332 | buttons = { |
257 | 344 | 'NextButton': (gui.LICENSE_AGREE, 'currentIdChanged', (1,)), | 333 | 'CommitButton': (gui.LICENSE_AGREE, None, ()), |
258 | 345 | 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()), | 334 | 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()), |
259 | 346 | } | 335 | } |
260 | 347 | page_name = 'license' | 336 | page_name = 'license' |
261 | 348 | show_license = True | ||
262 | 349 | stage_name = 'install' | 337 | stage_name = 'install' |
263 | 350 | 338 | ||
264 | 351 | 339 | ||
265 | 352 | 340 | ||
266 | === modified file 'ubuntuone/controlpanel/gui/qt/wizard.py' | |||
267 | --- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-20 15:11:56 +0000 | |||
268 | +++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-22 12:49:18 +0000 | |||
269 | @@ -167,8 +167,6 @@ | |||
270 | 167 | class UbuntuOneWizard(cache.Cache, QtGui.QWizard): | 167 | class UbuntuOneWizard(cache.Cache, QtGui.QWizard): |
271 | 168 | """The Ubuntu One wizard.""" | 168 | """The Ubuntu One wizard.""" |
272 | 169 | 169 | ||
273 | 170 | show_license = False # do not change unless you know what you're doing | ||
274 | 171 | |||
275 | 172 | def __init__(self, *args, **kwargs): | 170 | def __init__(self, *args, **kwargs): |
276 | 173 | super(UbuntuOneWizard, self).__init__(*args, **kwargs) | 171 | super(UbuntuOneWizard, self).__init__(*args, **kwargs) |
277 | 174 | self.pages = {} | 172 | self.pages = {} |
278 | @@ -185,9 +183,8 @@ | |||
279 | 185 | 183 | ||
280 | 186 | # license | 184 | # license |
281 | 187 | self.license_page = LicensePage() | 185 | self.license_page = LicensePage() |
285 | 188 | self.next_button_text = self.button(self.NextButton).text() | 186 | self.license_page.setCommitPage(True) |
286 | 189 | if self.show_license: | 187 | self.addPage(self.license_page) |
284 | 190 | self.addPage(self.license_page) | ||
287 | 191 | 188 | ||
288 | 192 | # sign in | 189 | # sign in |
289 | 193 | self.signin_page = SignInPage() | 190 | self.signin_page = SignInPage() |
290 | @@ -213,7 +210,7 @@ | |||
291 | 213 | self.addPage(self.local_folders_page) | 210 | self.addPage(self.local_folders_page) |
292 | 214 | 211 | ||
293 | 215 | self._next_id = self.pages[self.signin_page] | 212 | self._next_id = self.pages[self.signin_page] |
295 | 216 | self.next() | 213 | self.setStartId(self._next_id) |
296 | 217 | 214 | ||
297 | 218 | # pylint: disable=C0103 | 215 | # pylint: disable=C0103 |
298 | 219 | 216 | ||
299 | @@ -231,12 +228,14 @@ | |||
300 | 231 | button_layout = button_to = button = stage = None | 228 | button_layout = button_to = button = stage = None |
301 | 232 | 229 | ||
302 | 233 | if page is self.license_page: | 230 | if page is self.license_page: |
305 | 234 | button_layout = [self.Stretch, self.CancelButton, self.NextButton] | 231 | button_layout = [self.Stretch, self.CancelButton, |
306 | 235 | button = self.button(self.NextButton) | 232 | self.CommitButton] |
307 | 233 | button = self.button(self.CommitButton) | ||
308 | 236 | button_to = self.button(self.CancelButton) | 234 | button_to = self.button(self.CancelButton) |
309 | 237 | stage = self.side_widget.install_stage | 235 | stage = self.side_widget.install_stage |
310 | 236 | self._next_id = self.pages[self.signin_page] | ||
311 | 238 | 237 | ||
313 | 239 | self.setButtonText(self.NextButton, LICENSE_AGREE) | 238 | self.setButtonText(self.CommitButton, LICENSE_AGREE) |
314 | 240 | self.setButtonText(self.CancelButton, LICENSE_DISAGREE) | 239 | self.setButtonText(self.CancelButton, LICENSE_DISAGREE) |
315 | 241 | 240 | ||
316 | 242 | elif page is self.signin_page: | 241 | elif page is self.signin_page: |
317 | @@ -250,8 +249,6 @@ | |||
318 | 250 | self.setTabOrder(self.signin_page.panel.ui.login_button, button) | 249 | self.setTabOrder(self.signin_page.panel.ui.login_button, button) |
319 | 251 | 250 | ||
320 | 252 | elif page is self.cloud_folders_page: | 251 | elif page is self.cloud_folders_page: |
321 | 253 | self.setButtonText(self.NextButton, self.next_button_text) | ||
322 | 254 | |||
323 | 255 | button_layout = [self.Stretch, self.NextButton] | 252 | button_layout = [self.Stretch, self.NextButton] |
324 | 256 | button = self.cloud_folders_page.panel.ui.check_settings_button | 253 | button = self.cloud_folders_page.panel.ui.check_settings_button |
325 | 257 | button_to = self.button(self.NextButton) | 254 | button_to = self.button(self.NextButton) |
326 | @@ -339,8 +336,7 @@ | |||
327 | 339 | if response == QtGui.QDialog.Accepted: | 336 | if response == QtGui.QDialog.Accepted: |
328 | 340 | logger.warning('UbuntuOneWizard: user canceled setup.') | 337 | logger.warning('UbuntuOneWizard: user canceled setup.') |
329 | 341 | self.rejected.emit() | 338 | self.rejected.emit() |
332 | 342 | elif (self.show_license and | 339 | elif (self.currentId() == self.pages[self.license_page]): |
331 | 343 | self.currentId() == self.pages[self.license_page]): | ||
333 | 344 | response = self.confirm_dialog.exec_() | 340 | response = self.confirm_dialog.exec_() |
334 | 345 | if response == QtGui.QDialog.Accepted: | 341 | if response == QtGui.QDialog.Accepted: |
335 | 346 | logger.warning('UbuntuOneWizard: user wants to uninstall.') | 342 | logger.warning('UbuntuOneWizard: user wants to uninstall.') |
+1