Merge lp:~ralsina/ubuntuone-windows-installer/fix_803929 into lp:ubuntuone-windows-installer
- fix_803929
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Natalia Bidart | ||||
Approved revision: | 27 | ||||
Merged at revision: | 16 | ||||
Proposed branch: | lp:~ralsina/ubuntuone-windows-installer/fix_803929 | ||||
Merge into: | lp:ubuntuone-windows-installer | ||||
Diff against target: |
722 lines (+390/-41) 9 files modified
data/qt/side_widget.ui (+94/-0) ubuntuone_installer/gui/__init__.py (+7/-0) ubuntuone_installer/gui/qt/gui.py (+16/-0) ubuntuone_installer/gui/qt/local_folders.py (+20/-12) ubuntuone_installer/gui/qt/setup_account.py (+17/-12) ubuntuone_installer/gui/qt/side_widget.py (+49/-0) ubuntuone_installer/gui/qt/tests/test_gui.py (+80/-15) ubuntuone_installer/gui/qt/tests/test_side_widget.py (+100/-0) ubuntuone_installer/gui/qt/tos.py (+7/-2) |
||||
To merge this branch: | bzr merge lp:~ralsina/ubuntuone-windows-installer/fix_803929 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Review via email:
|
Commit message
Add sidewidget as specced.
Description of the change
Add sidewidget as specced.
Wireframe:
Implementation:
This doesn't look correct in all pages because theya re not all using title/subtitle, and that really breaks the look, so there is going to be another branch for that.
To test IRL (Windows):
On one terminal start SSO:
set PYTHONPATH=.
python bin\ubuntu-
On another terminal, start the installer:
set PYTHONPATH=
python bin\ubuntuone-
You should see a series of labels on the left side that show what stage of the installation/setup you are at.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
The branch looks great. Some lint issues:
C0111: 85:SetupAccount
C0111: 93:SetupAccount
C0111:101:
C0111:110:
C0111:399:
W0612: 57:CalculateSiz
C0103: 84:LocalFolders
C0111: 84:LocalFolders
W0612:149:
C0103:152:
C0111: 30:TosPage: Missing docstring
W0201:293:
W0201:294:
nessita@
./build/
./ubuntuone_
./ubuntuone_
./ubuntuone_
./ubuntuone_
./ubuntuone_
./ubuntuone_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
Voting does not meet specified criteria. Required: Approve >= 1, Disapprove == 0, Needs Fixing == 0, Needs Information == 0, Resubmit == 0, Pending == 0. Got: 1 Needs Fixing.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Looks great, thanks!
Preview Diff
1 | === added file 'data/qt/side_widget.ui' |
2 | --- data/qt/side_widget.ui 1970-01-01 00:00:00 +0000 |
3 | +++ data/qt/side_widget.ui 2011-07-07 20:33:35 +0000 |
4 | @@ -0,0 +1,94 @@ |
5 | +<?xml version="1.0" encoding="UTF-8"?> |
6 | +<ui version="4.0"> |
7 | + <class>Form</class> |
8 | + <widget class="QWidget" name="Form"> |
9 | + <property name="geometry"> |
10 | + <rect> |
11 | + <x>0</x> |
12 | + <y>0</y> |
13 | + <width>185</width> |
14 | + <height>511</height> |
15 | + </rect> |
16 | + </property> |
17 | + <property name="windowTitle"> |
18 | + <string>Form</string> |
19 | + </property> |
20 | + <layout class="QVBoxLayout" name="verticalLayout"> |
21 | + <property name="spacing"> |
22 | + <number>20</number> |
23 | + </property> |
24 | + <item> |
25 | + <widget class="QLabel" name="label"> |
26 | + <property name="text"> |
27 | + <string>Ubuntu One logo</string> |
28 | + </property> |
29 | + </widget> |
30 | + </item> |
31 | + <item> |
32 | + <widget class="QLabel" name="install_label"> |
33 | + <property name="enabled"> |
34 | + <bool>true</bool> |
35 | + </property> |
36 | + <property name="text"> |
37 | + <string>Install</string> |
38 | + </property> |
39 | + </widget> |
40 | + </item> |
41 | + <item> |
42 | + <widget class="QLabel" name="sign_in_label"> |
43 | + <property name="enabled"> |
44 | + <bool>true</bool> |
45 | + </property> |
46 | + <property name="text"> |
47 | + <string>Sign In</string> |
48 | + </property> |
49 | + </widget> |
50 | + </item> |
51 | + <item> |
52 | + <widget class="QLabel" name="choose_services_label"> |
53 | + <property name="enabled"> |
54 | + <bool>true</bool> |
55 | + </property> |
56 | + <property name="text"> |
57 | + <string>Choose services</string> |
58 | + </property> |
59 | + </widget> |
60 | + </item> |
61 | + <item> |
62 | + <widget class="QLabel" name="select_folders_label"> |
63 | + <property name="enabled"> |
64 | + <bool>true</bool> |
65 | + </property> |
66 | + <property name="text"> |
67 | + <string>Select sync folders</string> |
68 | + </property> |
69 | + </widget> |
70 | + </item> |
71 | + <item> |
72 | + <widget class="QLabel" name="sync_label"> |
73 | + <property name="enabled"> |
74 | + <bool>true</bool> |
75 | + </property> |
76 | + <property name="text"> |
77 | + <string>Sync, stream, share!</string> |
78 | + </property> |
79 | + </widget> |
80 | + </item> |
81 | + <item> |
82 | + <spacer name="verticalSpacer"> |
83 | + <property name="orientation"> |
84 | + <enum>Qt::Vertical</enum> |
85 | + </property> |
86 | + <property name="sizeHint" stdset="0"> |
87 | + <size> |
88 | + <width>20</width> |
89 | + <height>292</height> |
90 | + </size> |
91 | + </property> |
92 | + </spacer> |
93 | + </item> |
94 | + </layout> |
95 | + </widget> |
96 | + <resources/> |
97 | + <connections/> |
98 | +</ui> |
99 | |
100 | === modified file 'ubuntuone_installer/gui/__init__.py' |
101 | --- ubuntuone_installer/gui/__init__.py 2011-06-21 16:16:27 +0000 |
102 | +++ ubuntuone_installer/gui/__init__.py 2011-07-07 20:33:35 +0000 |
103 | @@ -21,3 +21,10 @@ |
104 | import gettext |
105 | |
106 | _ = gettext.gettext |
107 | + |
108 | +LOCAL_FOLDERS_TITLE = _("Syncing your computer with the cloud") |
109 | +LOCAL_FOLDERS_SPACE_HEADER = _("Space (%s)") |
110 | +LOCAL_FOLDERS_OFFER_LABEL = _("The folders you have selected to sync " |
111 | + "take over your %(quota)s space. You can remove some folders or add " |
112 | + "some extra space") |
113 | +LOCAL_FOLDERS_CALCULATING = _("Calculating") |
114 | |
115 | === modified file 'ubuntuone_installer/gui/qt/gui.py' |
116 | --- ubuntuone_installer/gui/qt/gui.py 2011-07-05 13:40:00 +0000 |
117 | +++ ubuntuone_installer/gui/qt/gui.py 2011-07-07 20:33:35 +0000 |
118 | @@ -72,6 +72,7 @@ |
119 | from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage |
120 | from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage |
121 | from ubuntuone_installer.gui.qt.setup_account import SetupAccountPage |
122 | +from ubuntuone_installer.gui.qt.side_widget import SideWidget |
123 | from ubuntuone_installer.gui.qt.tos import TosPage |
124 | |
125 | _ = gettext.gettext |
126 | @@ -290,6 +291,8 @@ |
127 | self.setWizardStyle(self.ModernStyle) |
128 | self.close_callback = close_callback |
129 | |
130 | + self.setSideWidget(SideWidget()) |
131 | + |
132 | self.creds = Credentials( |
133 | app_name=self.app_name, |
134 | ui_module="ubuntuone_installer.gui.qt.embedded_sso", |
135 | @@ -361,6 +364,8 @@ |
136 | self.SYNC_NOW_OR_LATER_PAGE = self.addPage(SyncNowOrLaterPage()) |
137 | self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage()) |
138 | |
139 | + self.currentIdChanged.connect(self.on_currentIdChanged) |
140 | + |
141 | # Invalid name "closeEvent" |
142 | # pylint: disable=C0103 |
143 | |
144 | @@ -390,3 +395,14 @@ |
145 | if self.close_callback is not None: |
146 | self.close_callback() |
147 | QtGui.QWizard.done(self, result) |
148 | + |
149 | + def on_currentIdChanged(self, page_id): |
150 | + """The current page changed.""" |
151 | + if page_id < self.SIGNIN_PAGE: |
152 | + self.sideWidget().set_stage(0) |
153 | + elif page_id < self.local_folders_page_id: |
154 | + self.sideWidget().set_stage(1) |
155 | + elif page_id < self.CONGRATULATIONS_PAGE: |
156 | + self.sideWidget().set_stage(3) |
157 | + else: |
158 | + self.sideWidget().set_stage(4) |
159 | |
160 | === modified file 'ubuntuone_installer/gui/qt/local_folders.py' |
161 | --- ubuntuone_installer/gui/qt/local_folders.py 2011-06-30 21:31:01 +0000 |
162 | +++ ubuntuone_installer/gui/qt/local_folders.py 2011-07-07 20:33:35 +0000 |
163 | @@ -19,7 +19,6 @@ |
164 | """Widget to create UDFs in the Windows Install Wizard.""" |
165 | |
166 | import ctypes |
167 | -import gettext |
168 | import os |
169 | import threading |
170 | import Queue |
171 | @@ -29,8 +28,12 @@ |
172 | from ubuntuone.controlpanel.gui import humanize |
173 | |
174 | from ubuntuone_installer.gui.qt.ui import local_folders_ui |
175 | - |
176 | -_ = gettext.gettext |
177 | +from ubuntuone_installer.gui import ( |
178 | + LOCAL_FOLDERS_TITLE, |
179 | + LOCAL_FOLDERS_SPACE_HEADER, |
180 | + LOCAL_FOLDERS_OFFER_LABEL, |
181 | + LOCAL_FOLDERS_CALCULATING, |
182 | +) |
183 | |
184 | |
185 | class FolderItem(QtGui.QTreeWidgetItem): |
186 | @@ -54,7 +57,7 @@ |
187 | |
188 | def run(self): |
189 | total_size = 0 |
190 | - for dirpath, dirnames, filenames in os.walk(self.path_name): |
191 | + for dirpath, _, filenames in os.walk(self.path_name): |
192 | for f in filenames: |
193 | fp = os.path.join(dirpath, f) |
194 | total_size += os.path.getsize(fp) |
195 | @@ -65,7 +68,7 @@ |
196 | """Wizard page to create UDFs in the Windows Installer.""" |
197 | def __init__(self, parent=None): |
198 | super(LocalFoldersPage, self).__init__(parent) |
199 | - self.setTitle(_("Syncing your computer with the cloud")) |
200 | + self.setTitle(LOCAL_FOLDERS_TITLE) |
201 | self.ui = local_folders_ui.Ui_Form() |
202 | self.ui.setupUi(self) |
203 | |
204 | @@ -81,7 +84,10 @@ |
205 | self.timer.start(2000) |
206 | self.timer.timeout.connect(self.update_sizes) |
207 | |
208 | + # initializePage is inherited |
209 | + # pylint: disable=C0103 |
210 | def initializePage(self): |
211 | + """UI details.""" |
212 | self.wizard()._next_id = None |
213 | |
214 | def quota(self): |
215 | @@ -102,7 +108,7 @@ |
216 | if path in self.items: |
217 | return None |
218 | # FIXME: the path should actually be sent to u1cp to verify as valid |
219 | - item = FolderItem([path, "", _("Remove")], path=path, queue=self.queue) |
220 | + item = FolderItem([path, "", "remove"], path=path, queue=self.queue) |
221 | self.ui.folder_list.addTopLevelItem(item) |
222 | self.items[path] = item |
223 | return item |
224 | @@ -120,7 +126,7 @@ |
225 | total = 0 |
226 | for path, item in self.items.items(): |
227 | if item.size is None: |
228 | - total = _("Calculating") |
229 | + total = LOCAL_FOLDERS_CALCULATING |
230 | break |
231 | total += item.size |
232 | |
233 | @@ -129,7 +135,8 @@ |
234 | total = humanize(total) |
235 | else: |
236 | self.show_hide_offer(0) |
237 | - self.ui.folder_list.headerItem().setText(1, _("Space (%s)" % total)) |
238 | + self.ui.folder_list.headerItem().setText( |
239 | + 1, LOCAL_FOLDERS_SPACE_HEADER % total) |
240 | |
241 | def show_hide_offer(self, cur_size): |
242 | """Show or hide the offer to buy space according to the total size.""" |
243 | @@ -140,15 +147,16 @@ |
244 | else: |
245 | self.ui.offer_frame.setVisible(False) |
246 | |
247 | - self.ui.offer_label.setText(_("The folders you have selected to sync " |
248 | - "take over your %s space. You can remove some folders or add " |
249 | - "some extra space" % humanize(quota))) |
250 | + self.ui.offer_label.setText(LOCAL_FOLDERS_OFFER_LABEL % |
251 | + {"quota": humanize(quota)}) |
252 | |
253 | def stop_threads(self): |
254 | """Stop all pending threads.""" |
255 | - for path, item in self.items: |
256 | + for _, item in self.items: |
257 | item.thread._stop = True |
258 | |
259 | + # itemClicked is a Qt signal name. |
260 | + # pylint: disable=C0103 |
261 | def on_folder_list_itemClicked(self, item, column): |
262 | """Delete folder from the list.""" |
263 | if column == 2: |
264 | |
265 | === modified file 'ubuntuone_installer/gui/qt/setup_account.py' |
266 | --- ubuntuone_installer/gui/qt/setup_account.py 2011-07-04 23:03:09 +0000 |
267 | +++ ubuntuone_installer/gui/qt/setup_account.py 2011-07-07 20:33:35 +0000 |
268 | @@ -27,8 +27,9 @@ |
269 | |
270 | _ = gettext.gettext |
271 | |
272 | -bad = u'<font color="red"> %s </font>' |
273 | -good = u'<font color="green"> %s </font>' |
274 | +# pylint: disable=C0103 |
275 | +BAD = u'<font color="red"> %s </font>' |
276 | +GOOD = u'<font color="green"> %s </font>' |
277 | |
278 | EMPTY_NAME = _("Please enter your name") |
279 | INVALID_EMAIL = _("Please enter a valid email address") |
280 | @@ -83,55 +84,59 @@ |
281 | self.password_assistance() |
282 | |
283 | def name_assistance(self): |
284 | + """Show help for the name field.""" |
285 | text = unicode(self.ui.name_edit.text()) |
286 | if not text.strip(): |
287 | self.ui.name_assistance.setVisible(True) |
288 | - self.ui.name_assistance.setText(bad % EMPTY_NAME) |
289 | + self.ui.name_assistance.setText(BAD % EMPTY_NAME) |
290 | else: |
291 | self.ui.name_assistance.setVisible(False) |
292 | |
293 | def email_assistance(self): |
294 | + """Show help for the email field.""" |
295 | text = unicode(self.ui.email_edit.text()) |
296 | if not is_correct_email(text): |
297 | - self.ui.email_assistance.setText(bad % INVALID_EMAIL) |
298 | + self.ui.email_assistance.setText(BAD % INVALID_EMAIL) |
299 | self.ui.email_assistance.setVisible(True) |
300 | else: |
301 | self.ui.email_assistance.setVisible(False) |
302 | |
303 | def confirm_email_assistance(self): |
304 | + """Show help for the confirm email field.""" |
305 | text1 = unicode(self.ui.email_edit.text()) |
306 | text2 = unicode(self.ui.confirm_email_edit.text()) |
307 | if text1 != text2: |
308 | - self.ui.confirm_email_assistance.setText(bad % EMAIL_MATCH) |
309 | + self.ui.confirm_email_assistance.setText(BAD % EMAIL_MATCH) |
310 | self.ui.confirm_email_assistance.setVisible(True) |
311 | else: |
312 | self.ui.confirm_email_assistance.setVisible(False) |
313 | |
314 | def password_assistance(self): |
315 | + """Show help for the password field.""" |
316 | text1 = unicode(self.ui.password_edit.text()) |
317 | text2 = unicode(self.ui.confirm_password_edit.text()) |
318 | label_text = [_("Your password must contain"), ] |
319 | |
320 | if len(text1) < 8: |
321 | - sign = bad |
322 | + sign = BAD |
323 | else: |
324 | - sign = good |
325 | + sign = GOOD |
326 | label_text.append(sign % PASSWORD_LENGTH) |
327 | |
328 | if re.search('[A-Z]', text1) is None: |
329 | - sign = bad |
330 | + sign = BAD |
331 | else: |
332 | - sign = good |
333 | + sign = GOOD |
334 | label_text.append(sign % PASSWORD_UPPER) |
335 | |
336 | if re.search('[\d+]', text1) is None: |
337 | - sign = bad |
338 | + sign = BAD |
339 | else: |
340 | - sign = good |
341 | + sign = GOOD |
342 | label_text.append(sign % PASSWORD_DIGIT) |
343 | |
344 | if text1 != text2: |
345 | - label_text.append(bad % PASSWORD_MATCH) |
346 | + label_text.append(BAD % PASSWORD_MATCH) |
347 | |
348 | self.ui.password_assistance.setText("<br>".join(label_text)) |
349 | |
350 | |
351 | === added file 'ubuntuone_installer/gui/qt/side_widget.py' |
352 | --- ubuntuone_installer/gui/qt/side_widget.py 1970-01-01 00:00:00 +0000 |
353 | +++ ubuntuone_installer/gui/qt/side_widget.py 2011-07-07 20:33:35 +0000 |
354 | @@ -0,0 +1,49 @@ |
355 | +# -*- coding: utf-8 -*- |
356 | + |
357 | +# Authors: Roberto Alsina <roberto.alsina@canonical.com> |
358 | +# |
359 | +# Copyright 2011 Canonical Ltd. |
360 | +# |
361 | +# This program is free software: you can redistribute it and/or modify it |
362 | +# under the terms of the GNU General Public License version 3, as published |
363 | +# by the Free Software Foundation. |
364 | +# |
365 | +# This program is distributed in the hope that it will be useful, but |
366 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
367 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
368 | +# PURPOSE. See the GNU General Public License for more details. |
369 | +# |
370 | +# You should have received a copy of the GNU General Public License along |
371 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
372 | + |
373 | +"""Wizard's side widget.""" |
374 | + |
375 | +from PyQt4 import QtGui |
376 | + |
377 | +from ubuntuone_installer.gui.qt.ui import side_widget_ui |
378 | + |
379 | + |
380 | +class SideWidget(QtGui.QWidget): |
381 | + |
382 | + """Wizard's side widget.""" |
383 | + |
384 | + install_stage = 0 |
385 | + signin_stage = 1 |
386 | + choose_services_stage = 2 |
387 | + select_sync_folders_stage = 3 |
388 | + sync_stage = 4 |
389 | + |
390 | + def __init__(self, *args, **kwargs): |
391 | + super(SideWidget, self).__init__(*args, **kwargs) |
392 | + self.ui = side_widget_ui.Ui_Form() |
393 | + self.ui.setupUi(self) |
394 | + self.stage = 0 |
395 | + |
396 | + def set_stage(self, stage): |
397 | + """Switch to the desired stage.""" |
398 | + self.stage = stage |
399 | + self.ui.install_label.setEnabled(stage >= 0) |
400 | + self.ui.sign_in_label.setEnabled(stage >= 1) |
401 | + self.ui.choose_services_label.setEnabled(stage >= 2) |
402 | + self.ui.select_folders_label.setEnabled(stage >= 3) |
403 | + self.ui.sync_label.setEnabled(stage >= 4) |
404 | |
405 | === modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py' |
406 | --- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-04 23:01:14 +0000 |
407 | +++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-07 20:33:35 +0000 |
408 | @@ -170,6 +170,71 @@ |
409 | ((), {'title': gui.SIGN_IN, |
410 | 'subtitle': gui.SIGN_IN_SUBTITLE})) |
411 | |
412 | + def test_stage_progression_1(self): |
413 | + """Check that each page in the wizard sets the correct stage.""" |
414 | + self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE) |
415 | + self.assertEqual(self.ui.sideWidget().stage, 0) |
416 | + |
417 | + def test_stage_progression_2(self): |
418 | + """Check that each page in the wizard sets the correct stage.""" |
419 | + self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE) |
420 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
421 | + |
422 | + def test_stage_progression_3(self): |
423 | + """Check that each page in the wizard sets the correct stage.""" |
424 | + self.ui.on_currentIdChanged(self.ui.setup_account_page_id) |
425 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
426 | + |
427 | + def test_stage_progression_4(self): |
428 | + """Check that each page in the wizard sets the correct stage.""" |
429 | + self.ui.on_currentIdChanged(self.ui.tos_page_id) |
430 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
431 | + |
432 | + def test_stage_progression_5(self): |
433 | + """Check that each page in the wizard sets the correct stage.""" |
434 | + self.ui.on_currentIdChanged(self.ui.email_verification_page_id) |
435 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
436 | + |
437 | + def test_stage_progression_6(self): |
438 | + """Check that each page in the wizard sets the correct stage.""" |
439 | + self.ui.on_currentIdChanged(self.ui.current_user_page_id) |
440 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
441 | + |
442 | + def test_stage_progression_7(self): |
443 | + """Check that each page in the wizard sets the correct stage.""" |
444 | + self.ui.on_currentIdChanged(self.ui.SUCCESS_PAGE) |
445 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
446 | + |
447 | + def test_stage_progression_8(self): |
448 | + """Check that each page in the wizard sets the correct stage.""" |
449 | + self.ui.on_currentIdChanged(self.ui.ERROR_PAGE) |
450 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
451 | + |
452 | + def test_stage_progression_9(self): |
453 | + """Check that each page in the wizard sets the correct stage.""" |
454 | + self.ui.on_currentIdChanged(self.ui.forgotten_password_page_id) |
455 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
456 | + |
457 | + def test_stage_progression_10(self): |
458 | + """Check that each page in the wizard sets the correct stage.""" |
459 | + self.ui.on_currentIdChanged(self.ui.reset_password_page_id) |
460 | + self.assertEqual(self.ui.sideWidget().stage, 1) |
461 | + |
462 | + def test_stage_progression_11(self): |
463 | + """Check that each page in the wizard sets the correct stage.""" |
464 | + self.ui.on_currentIdChanged(self.ui.local_folders_page_id) |
465 | + self.assertEqual(self.ui.sideWidget().stage, 3) |
466 | + |
467 | + def test_stage_progression_12(self): |
468 | + """Check that each page in the wizard sets the correct stage.""" |
469 | + self.ui.on_currentIdChanged(self.ui.SYNC_NOW_OR_LATER_PAGE) |
470 | + self.assertEqual(self.ui.sideWidget().stage, 3) |
471 | + |
472 | + def test_stage_progression_13(self): |
473 | + """Check that each page in the wizard sets the correct stage.""" |
474 | + self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE) |
475 | + self.assertEqual(self.ui.sideWidget().stage, 4) |
476 | + |
477 | def test_choose_signin_cancel(self): |
478 | """Test that the custom cancel button works.""" |
479 | self.ui.sign_in_page.ui.cancel_button.click() |
480 | @@ -225,10 +290,10 @@ |
481 | |
482 | def test_size_calculation(self): |
483 | """Test the recursive folder size calculation.""" |
484 | - self.queue = Queue.Queue() |
485 | - self.csize = local_folders.CalculateSize(self.tmpdir, self.queue) |
486 | - self.csize.run() |
487 | - path, size = self.queue.get() |
488 | + queue = Queue.Queue() |
489 | + csize = local_folders.CalculateSize(self.tmpdir, queue) |
490 | + csize.run() |
491 | + path, size = queue.get() |
492 | self.assertEqual(path, self.tmpdir) |
493 | self.assertEqual(size, 1337) |
494 | |
495 | @@ -328,7 +393,7 @@ |
496 | self.assertEqual(self.ui.ui.name_assistance.isVisible(), True) |
497 | self.assertEqual( |
498 | unicode(self.ui.ui.name_assistance.text()), |
499 | - setup_account.bad % setup_account.EMPTY_NAME |
500 | + setup_account.BAD % setup_account.EMPTY_NAME |
501 | ) |
502 | self.ui.hide() |
503 | |
504 | @@ -344,7 +409,7 @@ |
505 | self.assertEqual(self.ui.ui.name_assistance.isVisible(), True) |
506 | self.assertEqual( |
507 | unicode(self.ui.ui.name_assistance.text()), |
508 | - setup_account.bad % setup_account.EMPTY_NAME |
509 | + setup_account.BAD % setup_account.EMPTY_NAME |
510 | ) |
511 | self.ui.hide() |
512 | |
513 | @@ -371,7 +436,7 @@ |
514 | self.assertEqual(self.ui.ui.email_assistance.isVisible(), True) |
515 | self.assertEqual( |
516 | unicode(self.ui.ui.email_assistance.text()), |
517 | - setup_account.bad % setup_account.INVALID_EMAIL |
518 | + setup_account.BAD % setup_account.INVALID_EMAIL |
519 | ) |
520 | self.ui.hide() |
521 | |
522 | @@ -412,7 +477,7 @@ |
523 | self.assertEqual(self.ui.ui.confirm_email_assistance.isVisible(), True) |
524 | self.assertEqual( |
525 | unicode(self.ui.ui.confirm_email_assistance.text()), |
526 | - setup_account.bad % setup_account.EMAIL_MATCH |
527 | + setup_account.BAD % setup_account.EMAIL_MATCH |
528 | ) |
529 | self.ui.hide() |
530 | |
531 | @@ -425,7 +490,7 @@ |
532 | self.ui.password_assistance() |
533 | self.assertEqual( |
534 | True, |
535 | - setup_account.bad % setup_account.PASSWORD_LENGTH in |
536 | + setup_account.BAD % setup_account.PASSWORD_LENGTH in |
537 | unicode(self.ui.ui.password_assistance.text()), |
538 | ) |
539 | |
540 | @@ -438,7 +503,7 @@ |
541 | self.ui.password_assistance() |
542 | self.assertEqual( |
543 | True, |
544 | - setup_account.good % setup_account.PASSWORD_LENGTH in |
545 | + setup_account.GOOD % setup_account.PASSWORD_LENGTH in |
546 | unicode(self.ui.ui.password_assistance.text()), |
547 | ) |
548 | |
549 | @@ -451,7 +516,7 @@ |
550 | self.ui.password_assistance() |
551 | self.assertEqual( |
552 | True, |
553 | - setup_account.bad % setup_account.PASSWORD_DIGIT in |
554 | + setup_account.BAD % setup_account.PASSWORD_DIGIT in |
555 | unicode(self.ui.ui.password_assistance.text()), |
556 | ) |
557 | |
558 | @@ -464,7 +529,7 @@ |
559 | self.ui.password_assistance() |
560 | self.assertEqual( |
561 | True, |
562 | - setup_account.good % setup_account.PASSWORD_DIGIT in |
563 | + setup_account.GOOD % setup_account.PASSWORD_DIGIT in |
564 | unicode(self.ui.ui.password_assistance.text()), |
565 | ) |
566 | |
567 | @@ -477,7 +542,7 @@ |
568 | self.ui.password_assistance() |
569 | self.assertEqual( |
570 | True, |
571 | - setup_account.bad % setup_account.PASSWORD_UPPER in |
572 | + setup_account.BAD % setup_account.PASSWORD_UPPER in |
573 | unicode(self.ui.ui.password_assistance.text()), |
574 | ) |
575 | |
576 | @@ -490,7 +555,7 @@ |
577 | self.ui.password_assistance() |
578 | self.assertEqual( |
579 | True, |
580 | - setup_account.good % setup_account.PASSWORD_UPPER in |
581 | + setup_account.GOOD % setup_account.PASSWORD_UPPER in |
582 | unicode(self.ui.ui.password_assistance.text()), |
583 | ) |
584 | |
585 | @@ -518,6 +583,6 @@ |
586 | self.ui.password_assistance() |
587 | self.assertEqual( |
588 | True, |
589 | - setup_account.bad % setup_account.PASSWORD_MATCH in |
590 | + setup_account.BAD % setup_account.PASSWORD_MATCH in |
591 | unicode(self.ui.ui.password_assistance.text()), |
592 | ) |
593 | |
594 | === added file 'ubuntuone_installer/gui/qt/tests/test_side_widget.py' |
595 | --- ubuntuone_installer/gui/qt/tests/test_side_widget.py 1970-01-01 00:00:00 +0000 |
596 | +++ ubuntuone_installer/gui/qt/tests/test_side_widget.py 2011-07-07 20:33:35 +0000 |
597 | @@ -0,0 +1,100 @@ |
598 | +# -*- coding: utf-8 -*- |
599 | + |
600 | +# Authors: Alejandro J. Cura <alecu@canonical.com> |
601 | +# Roberto Alsina <roberto.alsina@canonical.com> |
602 | +# |
603 | +# Copyright 2011 Canonical Ltd. |
604 | +# |
605 | +# This program is free software: you can redistribute it and/or modify it |
606 | +# under the terms of the GNU General Public License version 3, as published |
607 | +# by the Free Software Foundation. |
608 | +# |
609 | +# This program is distributed in the hope that it will be useful, but |
610 | +# WITHOUT ANY WARRANTY; without even the implied warranties of |
611 | +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
612 | +# PURPOSE. See the GNU General Public License for more details. |
613 | +# |
614 | +# You should have received a copy of the GNU General Public License along |
615 | +# with this program. If not, see <http://www.gnu.org/licenses/>. |
616 | + |
617 | +"""Tests for the Qt UI.""" |
618 | + |
619 | +from ubuntuone_installer.gui.qt.tests import BaseTestCase |
620 | +from ubuntuone_installer.gui.qt.side_widget import SideWidget |
621 | + |
622 | + |
623 | +class SideWidgetTestCase(BaseTestCase): |
624 | + |
625 | + """Test the qt main window.""" |
626 | + |
627 | + class_ui = SideWidget |
628 | + |
629 | + def test_stage_0(self): |
630 | + """Check that each stage in the widget enables the right labels.""" |
631 | + self.ui.set_stage(0) |
632 | + self.assertEqual( |
633 | + self.ui.ui.install_label.isEnabled(), True) |
634 | + self.assertEqual( |
635 | + self.ui.ui.sign_in_label.isEnabled(), False) |
636 | + self.assertEqual( |
637 | + self.ui.ui.choose_services_label.isEnabled(), False) |
638 | + self.assertEqual( |
639 | + self.ui.ui.select_folders_label.isEnabled(), False) |
640 | + self.assertEqual( |
641 | + self.ui.ui.sync_label.isEnabled(), False) |
642 | + |
643 | + def test_stage_1(self): |
644 | + """Check that each stage in the widget enables the right labels.""" |
645 | + self.ui.set_stage(1) |
646 | + self.assertEqual( |
647 | + self.ui.ui.install_label.isEnabled(), True) |
648 | + self.assertEqual( |
649 | + self.ui.ui.sign_in_label.isEnabled(), True) |
650 | + self.assertEqual( |
651 | + self.ui.ui.choose_services_label.isEnabled(), False) |
652 | + self.assertEqual( |
653 | + self.ui.ui.select_folders_label.isEnabled(), False) |
654 | + self.assertEqual( |
655 | + self.ui.ui.sync_label.isEnabled(), False) |
656 | + |
657 | + def test_stage_2(self): |
658 | + """Check that each stage in the widget enables the right labels.""" |
659 | + self.ui.set_stage(2) |
660 | + self.assertEqual( |
661 | + self.ui.ui.install_label.isEnabled(), True) |
662 | + self.assertEqual( |
663 | + self.ui.ui.sign_in_label.isEnabled(), True) |
664 | + self.assertEqual( |
665 | + self.ui.ui.choose_services_label.isEnabled(), True) |
666 | + self.assertEqual( |
667 | + self.ui.ui.select_folders_label.isEnabled(), False) |
668 | + self.assertEqual( |
669 | + self.ui.ui.sync_label.isEnabled(), False) |
670 | + |
671 | + def test_stage_3(self): |
672 | + """Check that each stage in the widget enables the right labels.""" |
673 | + self.ui.set_stage(3) |
674 | + self.assertEqual( |
675 | + self.ui.ui.install_label.isEnabled(), True) |
676 | + self.assertEqual( |
677 | + self.ui.ui.sign_in_label.isEnabled(), True) |
678 | + self.assertEqual( |
679 | + self.ui.ui.choose_services_label.isEnabled(), True) |
680 | + self.assertEqual( |
681 | + self.ui.ui.select_folders_label.isEnabled(), True) |
682 | + self.assertEqual( |
683 | + self.ui.ui.sync_label.isEnabled(), False) |
684 | + |
685 | + def test_stage_4(self): |
686 | + """Check that each stage in the widget enables the right labels.""" |
687 | + self.ui.set_stage(4) |
688 | + self.assertEqual( |
689 | + self.ui.ui.install_label.isEnabled(), True) |
690 | + self.assertEqual( |
691 | + self.ui.ui.sign_in_label.isEnabled(), True) |
692 | + self.assertEqual( |
693 | + self.ui.ui.choose_services_label.isEnabled(), True) |
694 | + self.assertEqual( |
695 | + self.ui.ui.select_folders_label.isEnabled(), True) |
696 | + self.assertEqual( |
697 | + self.ui.ui.sync_label.isEnabled(), True) |
698 | |
699 | === modified file 'ubuntuone_installer/gui/qt/tos.py' |
700 | --- ubuntuone_installer/gui/qt/tos.py 2011-07-04 20:10:17 +0000 |
701 | +++ ubuntuone_installer/gui/qt/tos.py 2011-07-07 20:33:35 +0000 |
702 | @@ -28,6 +28,11 @@ |
703 | |
704 | |
705 | class TosPage(sso_gui.TosPage): |
706 | + |
707 | + """Page to display the Terms of Service.""" |
708 | + |
709 | + # initializePage is inherited |
710 | + # pylint: disable=C0103 |
711 | def initializePage(self): |
712 | """Setup UI details.""" |
713 | # Set the right texts and connections for buttons |
714 | @@ -56,6 +61,6 @@ |
715 | def print_document(self, button_id): |
716 | """Print the document displayed in textBrowser.""" |
717 | if button_id == QtGui.QWizard.CustomButton1: |
718 | - self.previewer = QtGui.QPrintPreviewDialog( |
719 | + previewer = QtGui.QPrintPreviewDialog( |
720 | paintRequested=self.ui.terms_webkit.print_) |
721 | - self.previewer.exec_() |
722 | + previewer.exec_() |
As per what we discussed in IRC, please add tests for the new side_widget, and split the current test_stage_ progression into smaller units of functionality to be tested.