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

Proposed by Roberto Alsina
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
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+66827@code.launchpad.net

Commit message

Add sidewidget as specced.

Description of the change

Add sidewidget as specced.

Wireframe:

https://bugs.launchpad.net/ubuntuone-windows-installer/+bug/803929/+attachment/2185434/+files/sidewidget.png

Implementation:

https://bugs.launchpad.net/ubuntuone-windows-installer/+bug/803929/+attachment/2191109/+files/2011-07-04_1518.png

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-sso-login

On another terminal, start the installer:

set PYTHONPATH=..\ubuntuone-client;..\ubuntuone-control-panel;..\ubuntu-sso-client;.
python bin\ubuntuone-installer-qt

You should see a series of labels on the left side that show what stage of the installation/setup you are at.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

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.

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

The branch looks great. Some lint issues:

C0111: 85:SetupAccountPage.name_assistance: Missing docstring
C0111: 93:SetupAccountPage.email_assistance: Missing docstring
C0111:101:SetupAccountPage.confirm_email_assistance: Missing docstring
C0111:110:SetupAccountPage.password_assistance: Missing docstring
C0111:399:MainWindow.on_currentIdChanged: Missing docstring
W0612: 57:CalculateSize.run: Unused variable 'dirnames'
C0103: 84:LocalFoldersPage.initializePage: Invalid name "initializePage" (should match ([a-z_][a-z0-9_]{2,79}$|setUp|tearDown))
C0111: 84:LocalFoldersPage.initializePage: Missing docstring
W0612:149:LocalFoldersPage.stop_threads: Unused variable 'path'
C0103:152:LocalFoldersPage.on_folder_list_itemClicked: Invalid name "on_folder_list_itemClicked" (should match ([a-z_][a-z0-9_]{2,79}$|setUp|tearDown))
C0111: 30:TosPage: Missing docstring
W0201:293:LocalFoldersTestCase.test_size_calculation: Attribute 'queue' defined outside __init__
W0201:294:LocalFoldersTestCase.test_size_calculation: Attribute 'csize' defined outside __init__

nessita@dali:~/canonical/u1/windows-installer/review_fix_803929$ pep8 --repeat --exclude="*_ui.py" .
./build/lib.linux-x86_64-2.7/ubuntuone_installer/gui/qt/gui.py:70:21: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/gui.py:70:21: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/tests/test_gui.py:43:21: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/tests/test_gui.py:396:57: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/tests/test_gui.py:412:57: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/tests/test_gui.py:439:60: E202 whitespace before ')'
./ubuntuone_installer/gui/qt/tests/test_gui.py:480:58: E202 whitespace before ')'

review: Needs Fixing
Revision history for this message
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.

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

Looks great, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'data/qt/side_widget.ui'
--- data/qt/side_widget.ui 1970-01-01 00:00:00 +0000
+++ data/qt/side_widget.ui 2011-07-07 20:33:35 +0000
@@ -0,0 +1,94 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>Form</class>
4 <widget class="QWidget" name="Form">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>185</width>
10 <height>511</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="spacing">
18 <number>20</number>
19 </property>
20 <item>
21 <widget class="QLabel" name="label">
22 <property name="text">
23 <string>Ubuntu One logo</string>
24 </property>
25 </widget>
26 </item>
27 <item>
28 <widget class="QLabel" name="install_label">
29 <property name="enabled">
30 <bool>true</bool>
31 </property>
32 <property name="text">
33 <string>Install</string>
34 </property>
35 </widget>
36 </item>
37 <item>
38 <widget class="QLabel" name="sign_in_label">
39 <property name="enabled">
40 <bool>true</bool>
41 </property>
42 <property name="text">
43 <string>Sign In</string>
44 </property>
45 </widget>
46 </item>
47 <item>
48 <widget class="QLabel" name="choose_services_label">
49 <property name="enabled">
50 <bool>true</bool>
51 </property>
52 <property name="text">
53 <string>Choose services</string>
54 </property>
55 </widget>
56 </item>
57 <item>
58 <widget class="QLabel" name="select_folders_label">
59 <property name="enabled">
60 <bool>true</bool>
61 </property>
62 <property name="text">
63 <string>Select sync folders</string>
64 </property>
65 </widget>
66 </item>
67 <item>
68 <widget class="QLabel" name="sync_label">
69 <property name="enabled">
70 <bool>true</bool>
71 </property>
72 <property name="text">
73 <string>Sync, stream, share!</string>
74 </property>
75 </widget>
76 </item>
77 <item>
78 <spacer name="verticalSpacer">
79 <property name="orientation">
80 <enum>Qt::Vertical</enum>
81 </property>
82 <property name="sizeHint" stdset="0">
83 <size>
84 <width>20</width>
85 <height>292</height>
86 </size>
87 </property>
88 </spacer>
89 </item>
90 </layout>
91 </widget>
92 <resources/>
93 <connections/>
94</ui>
095
=== modified file 'ubuntuone_installer/gui/__init__.py'
--- ubuntuone_installer/gui/__init__.py 2011-06-21 16:16:27 +0000
+++ ubuntuone_installer/gui/__init__.py 2011-07-07 20:33:35 +0000
@@ -21,3 +21,10 @@
21import gettext21import gettext
2222
23_ = gettext.gettext23_ = gettext.gettext
24
25LOCAL_FOLDERS_TITLE = _("Syncing your computer with the cloud")
26LOCAL_FOLDERS_SPACE_HEADER = _("Space (%s)")
27LOCAL_FOLDERS_OFFER_LABEL = _("The folders you have selected to sync "
28 "take over your %(quota)s space. You can remove some folders or add "
29 "some extra space")
30LOCAL_FOLDERS_CALCULATING = _("Calculating")
2431
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-07-05 13:40:00 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-07-07 20:33:35 +0000
@@ -72,6 +72,7 @@
72from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage72from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage
73from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage73from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
74from ubuntuone_installer.gui.qt.setup_account import SetupAccountPage74from ubuntuone_installer.gui.qt.setup_account import SetupAccountPage
75from ubuntuone_installer.gui.qt.side_widget import SideWidget
75from ubuntuone_installer.gui.qt.tos import TosPage76from ubuntuone_installer.gui.qt.tos import TosPage
7677
77_ = gettext.gettext78_ = gettext.gettext
@@ -290,6 +291,8 @@
290 self.setWizardStyle(self.ModernStyle)291 self.setWizardStyle(self.ModernStyle)
291 self.close_callback = close_callback292 self.close_callback = close_callback
292293
294 self.setSideWidget(SideWidget())
295
293 self.creds = Credentials(296 self.creds = Credentials(
294 app_name=self.app_name,297 app_name=self.app_name,
295 ui_module="ubuntuone_installer.gui.qt.embedded_sso",298 ui_module="ubuntuone_installer.gui.qt.embedded_sso",
@@ -361,6 +364,8 @@
361 self.SYNC_NOW_OR_LATER_PAGE = self.addPage(SyncNowOrLaterPage())364 self.SYNC_NOW_OR_LATER_PAGE = self.addPage(SyncNowOrLaterPage())
362 self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage())365 self.CONGRATULATIONS_PAGE = self.addPage(CongratulationsPage())
363366
367 self.currentIdChanged.connect(self.on_currentIdChanged)
368
364 # Invalid name "closeEvent"369 # Invalid name "closeEvent"
365 # pylint: disable=C0103370 # pylint: disable=C0103
366371
@@ -390,3 +395,14 @@
390 if self.close_callback is not None:395 if self.close_callback is not None:
391 self.close_callback()396 self.close_callback()
392 QtGui.QWizard.done(self, result)397 QtGui.QWizard.done(self, result)
398
399 def on_currentIdChanged(self, page_id):
400 """The current page changed."""
401 if page_id < self.SIGNIN_PAGE:
402 self.sideWidget().set_stage(0)
403 elif page_id < self.local_folders_page_id:
404 self.sideWidget().set_stage(1)
405 elif page_id < self.CONGRATULATIONS_PAGE:
406 self.sideWidget().set_stage(3)
407 else:
408 self.sideWidget().set_stage(4)
393409
=== modified file 'ubuntuone_installer/gui/qt/local_folders.py'
--- ubuntuone_installer/gui/qt/local_folders.py 2011-06-30 21:31:01 +0000
+++ ubuntuone_installer/gui/qt/local_folders.py 2011-07-07 20:33:35 +0000
@@ -19,7 +19,6 @@
19"""Widget to create UDFs in the Windows Install Wizard."""19"""Widget to create UDFs in the Windows Install Wizard."""
2020
21import ctypes21import ctypes
22import gettext
23import os22import os
24import threading23import threading
25import Queue24import Queue
@@ -29,8 +28,12 @@
29from ubuntuone.controlpanel.gui import humanize28from ubuntuone.controlpanel.gui import humanize
3029
31from ubuntuone_installer.gui.qt.ui import local_folders_ui30from ubuntuone_installer.gui.qt.ui import local_folders_ui
3231from ubuntuone_installer.gui import (
33_ = gettext.gettext32 LOCAL_FOLDERS_TITLE,
33 LOCAL_FOLDERS_SPACE_HEADER,
34 LOCAL_FOLDERS_OFFER_LABEL,
35 LOCAL_FOLDERS_CALCULATING,
36)
3437
3538
36class FolderItem(QtGui.QTreeWidgetItem):39class FolderItem(QtGui.QTreeWidgetItem):
@@ -54,7 +57,7 @@
5457
55 def run(self):58 def run(self):
56 total_size = 059 total_size = 0
57 for dirpath, dirnames, filenames in os.walk(self.path_name):60 for dirpath, _, filenames in os.walk(self.path_name):
58 for f in filenames:61 for f in filenames:
59 fp = os.path.join(dirpath, f)62 fp = os.path.join(dirpath, f)
60 total_size += os.path.getsize(fp)63 total_size += os.path.getsize(fp)
@@ -65,7 +68,7 @@
65 """Wizard page to create UDFs in the Windows Installer."""68 """Wizard page to create UDFs in the Windows Installer."""
66 def __init__(self, parent=None):69 def __init__(self, parent=None):
67 super(LocalFoldersPage, self).__init__(parent)70 super(LocalFoldersPage, self).__init__(parent)
68 self.setTitle(_("Syncing your computer with the cloud"))71 self.setTitle(LOCAL_FOLDERS_TITLE)
69 self.ui = local_folders_ui.Ui_Form()72 self.ui = local_folders_ui.Ui_Form()
70 self.ui.setupUi(self)73 self.ui.setupUi(self)
7174
@@ -81,7 +84,10 @@
81 self.timer.start(2000)84 self.timer.start(2000)
82 self.timer.timeout.connect(self.update_sizes)85 self.timer.timeout.connect(self.update_sizes)
8386
87 # initializePage is inherited
88 # pylint: disable=C0103
84 def initializePage(self):89 def initializePage(self):
90 """UI details."""
85 self.wizard()._next_id = None91 self.wizard()._next_id = None
8692
87 def quota(self):93 def quota(self):
@@ -102,7 +108,7 @@
102 if path in self.items:108 if path in self.items:
103 return None109 return None
104 # FIXME: the path should actually be sent to u1cp to verify as valid110 # FIXME: the path should actually be sent to u1cp to verify as valid
105 item = FolderItem([path, "", _("Remove")], path=path, queue=self.queue)111 item = FolderItem([path, "", "remove"], path=path, queue=self.queue)
106 self.ui.folder_list.addTopLevelItem(item)112 self.ui.folder_list.addTopLevelItem(item)
107 self.items[path] = item113 self.items[path] = item
108 return item114 return item
@@ -120,7 +126,7 @@
120 total = 0126 total = 0
121 for path, item in self.items.items():127 for path, item in self.items.items():
122 if item.size is None:128 if item.size is None:
123 total = _("Calculating")129 total = LOCAL_FOLDERS_CALCULATING
124 break130 break
125 total += item.size131 total += item.size
126132
@@ -129,7 +135,8 @@
129 total = humanize(total)135 total = humanize(total)
130 else:136 else:
131 self.show_hide_offer(0)137 self.show_hide_offer(0)
132 self.ui.folder_list.headerItem().setText(1, _("Space (%s)" % total))138 self.ui.folder_list.headerItem().setText(
139 1, LOCAL_FOLDERS_SPACE_HEADER % total)
133140
134 def show_hide_offer(self, cur_size):141 def show_hide_offer(self, cur_size):
135 """Show or hide the offer to buy space according to the total size."""142 """Show or hide the offer to buy space according to the total size."""
@@ -140,15 +147,16 @@
140 else:147 else:
141 self.ui.offer_frame.setVisible(False)148 self.ui.offer_frame.setVisible(False)
142149
143 self.ui.offer_label.setText(_("The folders you have selected to sync "150 self.ui.offer_label.setText(LOCAL_FOLDERS_OFFER_LABEL %
144 "take over your %s space. You can remove some folders or add "151 {"quota": humanize(quota)})
145 "some extra space" % humanize(quota)))
146152
147 def stop_threads(self):153 def stop_threads(self):
148 """Stop all pending threads."""154 """Stop all pending threads."""
149 for path, item in self.items:155 for _, item in self.items:
150 item.thread._stop = True156 item.thread._stop = True
151157
158 # itemClicked is a Qt signal name.
159 # pylint: disable=C0103
152 def on_folder_list_itemClicked(self, item, column):160 def on_folder_list_itemClicked(self, item, column):
153 """Delete folder from the list."""161 """Delete folder from the list."""
154 if column == 2:162 if column == 2:
155163
=== modified file 'ubuntuone_installer/gui/qt/setup_account.py'
--- ubuntuone_installer/gui/qt/setup_account.py 2011-07-04 23:03:09 +0000
+++ ubuntuone_installer/gui/qt/setup_account.py 2011-07-07 20:33:35 +0000
@@ -27,8 +27,9 @@
2727
28_ = gettext.gettext28_ = gettext.gettext
2929
30bad = u'<font color="red"> %s </font>'30# pylint: disable=C0103
31good = u'<font color="green"> %s </font>'31BAD = u'<font color="red"> %s </font>'
32GOOD = u'<font color="green"> %s </font>'
3233
33EMPTY_NAME = _("Please enter your name")34EMPTY_NAME = _("Please enter your name")
34INVALID_EMAIL = _("Please enter a valid email address")35INVALID_EMAIL = _("Please enter a valid email address")
@@ -83,55 +84,59 @@
83 self.password_assistance()84 self.password_assistance()
8485
85 def name_assistance(self):86 def name_assistance(self):
87 """Show help for the name field."""
86 text = unicode(self.ui.name_edit.text())88 text = unicode(self.ui.name_edit.text())
87 if not text.strip():89 if not text.strip():
88 self.ui.name_assistance.setVisible(True)90 self.ui.name_assistance.setVisible(True)
89 self.ui.name_assistance.setText(bad % EMPTY_NAME)91 self.ui.name_assistance.setText(BAD % EMPTY_NAME)
90 else:92 else:
91 self.ui.name_assistance.setVisible(False)93 self.ui.name_assistance.setVisible(False)
9294
93 def email_assistance(self):95 def email_assistance(self):
96 """Show help for the email field."""
94 text = unicode(self.ui.email_edit.text())97 text = unicode(self.ui.email_edit.text())
95 if not is_correct_email(text):98 if not is_correct_email(text):
96 self.ui.email_assistance.setText(bad % INVALID_EMAIL)99 self.ui.email_assistance.setText(BAD % INVALID_EMAIL)
97 self.ui.email_assistance.setVisible(True)100 self.ui.email_assistance.setVisible(True)
98 else:101 else:
99 self.ui.email_assistance.setVisible(False)102 self.ui.email_assistance.setVisible(False)
100103
101 def confirm_email_assistance(self):104 def confirm_email_assistance(self):
105 """Show help for the confirm email field."""
102 text1 = unicode(self.ui.email_edit.text())106 text1 = unicode(self.ui.email_edit.text())
103 text2 = unicode(self.ui.confirm_email_edit.text())107 text2 = unicode(self.ui.confirm_email_edit.text())
104 if text1 != text2:108 if text1 != text2:
105 self.ui.confirm_email_assistance.setText(bad % EMAIL_MATCH)109 self.ui.confirm_email_assistance.setText(BAD % EMAIL_MATCH)
106 self.ui.confirm_email_assistance.setVisible(True)110 self.ui.confirm_email_assistance.setVisible(True)
107 else:111 else:
108 self.ui.confirm_email_assistance.setVisible(False)112 self.ui.confirm_email_assistance.setVisible(False)
109113
110 def password_assistance(self):114 def password_assistance(self):
115 """Show help for the password field."""
111 text1 = unicode(self.ui.password_edit.text())116 text1 = unicode(self.ui.password_edit.text())
112 text2 = unicode(self.ui.confirm_password_edit.text())117 text2 = unicode(self.ui.confirm_password_edit.text())
113 label_text = [_("Your password must contain"), ]118 label_text = [_("Your password must contain"), ]
114119
115 if len(text1) < 8:120 if len(text1) < 8:
116 sign = bad121 sign = BAD
117 else:122 else:
118 sign = good123 sign = GOOD
119 label_text.append(sign % PASSWORD_LENGTH)124 label_text.append(sign % PASSWORD_LENGTH)
120125
121 if re.search('[A-Z]', text1) is None:126 if re.search('[A-Z]', text1) is None:
122 sign = bad127 sign = BAD
123 else:128 else:
124 sign = good129 sign = GOOD
125 label_text.append(sign % PASSWORD_UPPER)130 label_text.append(sign % PASSWORD_UPPER)
126131
127 if re.search('[\d+]', text1) is None:132 if re.search('[\d+]', text1) is None:
128 sign = bad133 sign = BAD
129 else:134 else:
130 sign = good135 sign = GOOD
131 label_text.append(sign % PASSWORD_DIGIT)136 label_text.append(sign % PASSWORD_DIGIT)
132137
133 if text1 != text2:138 if text1 != text2:
134 label_text.append(bad % PASSWORD_MATCH)139 label_text.append(BAD % PASSWORD_MATCH)
135140
136 self.ui.password_assistance.setText("<br>".join(label_text))141 self.ui.password_assistance.setText("<br>".join(label_text))
137142
138143
=== added file 'ubuntuone_installer/gui/qt/side_widget.py'
--- ubuntuone_installer/gui/qt/side_widget.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/side_widget.py 2011-07-07 20:33:35 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2
3# Authors: Roberto Alsina <roberto.alsina@canonical.com>
4#
5# Copyright 2011 Canonical Ltd.
6#
7# This program is free software: you can redistribute it and/or modify it
8# under the terms of the GNU General Public License version 3, as published
9# by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranties of
13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14# PURPOSE. See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program. If not, see <http://www.gnu.org/licenses/>.
18
19"""Wizard's side widget."""
20
21from PyQt4 import QtGui
22
23from ubuntuone_installer.gui.qt.ui import side_widget_ui
24
25
26class SideWidget(QtGui.QWidget):
27
28 """Wizard's side widget."""
29
30 install_stage = 0
31 signin_stage = 1
32 choose_services_stage = 2
33 select_sync_folders_stage = 3
34 sync_stage = 4
35
36 def __init__(self, *args, **kwargs):
37 super(SideWidget, self).__init__(*args, **kwargs)
38 self.ui = side_widget_ui.Ui_Form()
39 self.ui.setupUi(self)
40 self.stage = 0
41
42 def set_stage(self, stage):
43 """Switch to the desired stage."""
44 self.stage = stage
45 self.ui.install_label.setEnabled(stage >= 0)
46 self.ui.sign_in_label.setEnabled(stage >= 1)
47 self.ui.choose_services_label.setEnabled(stage >= 2)
48 self.ui.select_folders_label.setEnabled(stage >= 3)
49 self.ui.sync_label.setEnabled(stage >= 4)
050
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-04 23:01:14 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-07 20:33:35 +0000
@@ -170,6 +170,71 @@
170 ((), {'title': gui.SIGN_IN,170 ((), {'title': gui.SIGN_IN,
171 'subtitle': gui.SIGN_IN_SUBTITLE}))171 'subtitle': gui.SIGN_IN_SUBTITLE}))
172172
173 def test_stage_progression_1(self):
174 """Check that each page in the wizard sets the correct stage."""
175 self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE)
176 self.assertEqual(self.ui.sideWidget().stage, 0)
177
178 def test_stage_progression_2(self):
179 """Check that each page in the wizard sets the correct stage."""
180 self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE)
181 self.assertEqual(self.ui.sideWidget().stage, 1)
182
183 def test_stage_progression_3(self):
184 """Check that each page in the wizard sets the correct stage."""
185 self.ui.on_currentIdChanged(self.ui.setup_account_page_id)
186 self.assertEqual(self.ui.sideWidget().stage, 1)
187
188 def test_stage_progression_4(self):
189 """Check that each page in the wizard sets the correct stage."""
190 self.ui.on_currentIdChanged(self.ui.tos_page_id)
191 self.assertEqual(self.ui.sideWidget().stage, 1)
192
193 def test_stage_progression_5(self):
194 """Check that each page in the wizard sets the correct stage."""
195 self.ui.on_currentIdChanged(self.ui.email_verification_page_id)
196 self.assertEqual(self.ui.sideWidget().stage, 1)
197
198 def test_stage_progression_6(self):
199 """Check that each page in the wizard sets the correct stage."""
200 self.ui.on_currentIdChanged(self.ui.current_user_page_id)
201 self.assertEqual(self.ui.sideWidget().stage, 1)
202
203 def test_stage_progression_7(self):
204 """Check that each page in the wizard sets the correct stage."""
205 self.ui.on_currentIdChanged(self.ui.SUCCESS_PAGE)
206 self.assertEqual(self.ui.sideWidget().stage, 1)
207
208 def test_stage_progression_8(self):
209 """Check that each page in the wizard sets the correct stage."""
210 self.ui.on_currentIdChanged(self.ui.ERROR_PAGE)
211 self.assertEqual(self.ui.sideWidget().stage, 1)
212
213 def test_stage_progression_9(self):
214 """Check that each page in the wizard sets the correct stage."""
215 self.ui.on_currentIdChanged(self.ui.forgotten_password_page_id)
216 self.assertEqual(self.ui.sideWidget().stage, 1)
217
218 def test_stage_progression_10(self):
219 """Check that each page in the wizard sets the correct stage."""
220 self.ui.on_currentIdChanged(self.ui.reset_password_page_id)
221 self.assertEqual(self.ui.sideWidget().stage, 1)
222
223 def test_stage_progression_11(self):
224 """Check that each page in the wizard sets the correct stage."""
225 self.ui.on_currentIdChanged(self.ui.local_folders_page_id)
226 self.assertEqual(self.ui.sideWidget().stage, 3)
227
228 def test_stage_progression_12(self):
229 """Check that each page in the wizard sets the correct stage."""
230 self.ui.on_currentIdChanged(self.ui.SYNC_NOW_OR_LATER_PAGE)
231 self.assertEqual(self.ui.sideWidget().stage, 3)
232
233 def test_stage_progression_13(self):
234 """Check that each page in the wizard sets the correct stage."""
235 self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE)
236 self.assertEqual(self.ui.sideWidget().stage, 4)
237
173 def test_choose_signin_cancel(self):238 def test_choose_signin_cancel(self):
174 """Test that the custom cancel button works."""239 """Test that the custom cancel button works."""
175 self.ui.sign_in_page.ui.cancel_button.click()240 self.ui.sign_in_page.ui.cancel_button.click()
@@ -225,10 +290,10 @@
225290
226 def test_size_calculation(self):291 def test_size_calculation(self):
227 """Test the recursive folder size calculation."""292 """Test the recursive folder size calculation."""
228 self.queue = Queue.Queue()293 queue = Queue.Queue()
229 self.csize = local_folders.CalculateSize(self.tmpdir, self.queue)294 csize = local_folders.CalculateSize(self.tmpdir, queue)
230 self.csize.run()295 csize.run()
231 path, size = self.queue.get()296 path, size = queue.get()
232 self.assertEqual(path, self.tmpdir)297 self.assertEqual(path, self.tmpdir)
233 self.assertEqual(size, 1337)298 self.assertEqual(size, 1337)
234299
@@ -328,7 +393,7 @@
328 self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)393 self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)
329 self.assertEqual(394 self.assertEqual(
330 unicode(self.ui.ui.name_assistance.text()),395 unicode(self.ui.ui.name_assistance.text()),
331 setup_account.bad % setup_account.EMPTY_NAME396 setup_account.BAD % setup_account.EMPTY_NAME
332 )397 )
333 self.ui.hide()398 self.ui.hide()
334399
@@ -344,7 +409,7 @@
344 self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)409 self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)
345 self.assertEqual(410 self.assertEqual(
346 unicode(self.ui.ui.name_assistance.text()),411 unicode(self.ui.ui.name_assistance.text()),
347 setup_account.bad % setup_account.EMPTY_NAME412 setup_account.BAD % setup_account.EMPTY_NAME
348 )413 )
349 self.ui.hide()414 self.ui.hide()
350415
@@ -371,7 +436,7 @@
371 self.assertEqual(self.ui.ui.email_assistance.isVisible(), True)436 self.assertEqual(self.ui.ui.email_assistance.isVisible(), True)
372 self.assertEqual(437 self.assertEqual(
373 unicode(self.ui.ui.email_assistance.text()),438 unicode(self.ui.ui.email_assistance.text()),
374 setup_account.bad % setup_account.INVALID_EMAIL439 setup_account.BAD % setup_account.INVALID_EMAIL
375 )440 )
376 self.ui.hide()441 self.ui.hide()
377442
@@ -412,7 +477,7 @@
412 self.assertEqual(self.ui.ui.confirm_email_assistance.isVisible(), True)477 self.assertEqual(self.ui.ui.confirm_email_assistance.isVisible(), True)
413 self.assertEqual(478 self.assertEqual(
414 unicode(self.ui.ui.confirm_email_assistance.text()),479 unicode(self.ui.ui.confirm_email_assistance.text()),
415 setup_account.bad % setup_account.EMAIL_MATCH480 setup_account.BAD % setup_account.EMAIL_MATCH
416 )481 )
417 self.ui.hide()482 self.ui.hide()
418483
@@ -425,7 +490,7 @@
425 self.ui.password_assistance()490 self.ui.password_assistance()
426 self.assertEqual(491 self.assertEqual(
427 True,492 True,
428 setup_account.bad % setup_account.PASSWORD_LENGTH in493 setup_account.BAD % setup_account.PASSWORD_LENGTH in
429 unicode(self.ui.ui.password_assistance.text()),494 unicode(self.ui.ui.password_assistance.text()),
430 )495 )
431496
@@ -438,7 +503,7 @@
438 self.ui.password_assistance()503 self.ui.password_assistance()
439 self.assertEqual(504 self.assertEqual(
440 True,505 True,
441 setup_account.good % setup_account.PASSWORD_LENGTH in506 setup_account.GOOD % setup_account.PASSWORD_LENGTH in
442 unicode(self.ui.ui.password_assistance.text()),507 unicode(self.ui.ui.password_assistance.text()),
443 )508 )
444509
@@ -451,7 +516,7 @@
451 self.ui.password_assistance()516 self.ui.password_assistance()
452 self.assertEqual(517 self.assertEqual(
453 True,518 True,
454 setup_account.bad % setup_account.PASSWORD_DIGIT in519 setup_account.BAD % setup_account.PASSWORD_DIGIT in
455 unicode(self.ui.ui.password_assistance.text()),520 unicode(self.ui.ui.password_assistance.text()),
456 )521 )
457522
@@ -464,7 +529,7 @@
464 self.ui.password_assistance()529 self.ui.password_assistance()
465 self.assertEqual(530 self.assertEqual(
466 True,531 True,
467 setup_account.good % setup_account.PASSWORD_DIGIT in532 setup_account.GOOD % setup_account.PASSWORD_DIGIT in
468 unicode(self.ui.ui.password_assistance.text()),533 unicode(self.ui.ui.password_assistance.text()),
469 )534 )
470535
@@ -477,7 +542,7 @@
477 self.ui.password_assistance()542 self.ui.password_assistance()
478 self.assertEqual(543 self.assertEqual(
479 True,544 True,
480 setup_account.bad % setup_account.PASSWORD_UPPER in545 setup_account.BAD % setup_account.PASSWORD_UPPER in
481 unicode(self.ui.ui.password_assistance.text()),546 unicode(self.ui.ui.password_assistance.text()),
482 )547 )
483548
@@ -490,7 +555,7 @@
490 self.ui.password_assistance()555 self.ui.password_assistance()
491 self.assertEqual(556 self.assertEqual(
492 True,557 True,
493 setup_account.good % setup_account.PASSWORD_UPPER in558 setup_account.GOOD % setup_account.PASSWORD_UPPER in
494 unicode(self.ui.ui.password_assistance.text()),559 unicode(self.ui.ui.password_assistance.text()),
495 )560 )
496561
@@ -518,6 +583,6 @@
518 self.ui.password_assistance()583 self.ui.password_assistance()
519 self.assertEqual(584 self.assertEqual(
520 True,585 True,
521 setup_account.bad % setup_account.PASSWORD_MATCH in586 setup_account.BAD % setup_account.PASSWORD_MATCH in
522 unicode(self.ui.ui.password_assistance.text()),587 unicode(self.ui.ui.password_assistance.text()),
523 )588 )
524589
=== added file 'ubuntuone_installer/gui/qt/tests/test_side_widget.py'
--- ubuntuone_installer/gui/qt/tests/test_side_widget.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/tests/test_side_widget.py 2011-07-07 20:33:35 +0000
@@ -0,0 +1,100 @@
1# -*- coding: utf-8 -*-
2
3# Authors: Alejandro J. Cura <alecu@canonical.com>
4# Roberto Alsina <roberto.alsina@canonical.com>
5#
6# Copyright 2011 Canonical Ltd.
7#
8# This program is free software: you can redistribute it and/or modify it
9# under the terms of the GNU General Public License version 3, as published
10# by the Free Software Foundation.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranties of
14# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15# PURPOSE. See the GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program. If not, see <http://www.gnu.org/licenses/>.
19
20"""Tests for the Qt UI."""
21
22from ubuntuone_installer.gui.qt.tests import BaseTestCase
23from ubuntuone_installer.gui.qt.side_widget import SideWidget
24
25
26class SideWidgetTestCase(BaseTestCase):
27
28 """Test the qt main window."""
29
30 class_ui = SideWidget
31
32 def test_stage_0(self):
33 """Check that each stage in the widget enables the right labels."""
34 self.ui.set_stage(0)
35 self.assertEqual(
36 self.ui.ui.install_label.isEnabled(), True)
37 self.assertEqual(
38 self.ui.ui.sign_in_label.isEnabled(), False)
39 self.assertEqual(
40 self.ui.ui.choose_services_label.isEnabled(), False)
41 self.assertEqual(
42 self.ui.ui.select_folders_label.isEnabled(), False)
43 self.assertEqual(
44 self.ui.ui.sync_label.isEnabled(), False)
45
46 def test_stage_1(self):
47 """Check that each stage in the widget enables the right labels."""
48 self.ui.set_stage(1)
49 self.assertEqual(
50 self.ui.ui.install_label.isEnabled(), True)
51 self.assertEqual(
52 self.ui.ui.sign_in_label.isEnabled(), True)
53 self.assertEqual(
54 self.ui.ui.choose_services_label.isEnabled(), False)
55 self.assertEqual(
56 self.ui.ui.select_folders_label.isEnabled(), False)
57 self.assertEqual(
58 self.ui.ui.sync_label.isEnabled(), False)
59
60 def test_stage_2(self):
61 """Check that each stage in the widget enables the right labels."""
62 self.ui.set_stage(2)
63 self.assertEqual(
64 self.ui.ui.install_label.isEnabled(), True)
65 self.assertEqual(
66 self.ui.ui.sign_in_label.isEnabled(), True)
67 self.assertEqual(
68 self.ui.ui.choose_services_label.isEnabled(), True)
69 self.assertEqual(
70 self.ui.ui.select_folders_label.isEnabled(), False)
71 self.assertEqual(
72 self.ui.ui.sync_label.isEnabled(), False)
73
74 def test_stage_3(self):
75 """Check that each stage in the widget enables the right labels."""
76 self.ui.set_stage(3)
77 self.assertEqual(
78 self.ui.ui.install_label.isEnabled(), True)
79 self.assertEqual(
80 self.ui.ui.sign_in_label.isEnabled(), True)
81 self.assertEqual(
82 self.ui.ui.choose_services_label.isEnabled(), True)
83 self.assertEqual(
84 self.ui.ui.select_folders_label.isEnabled(), True)
85 self.assertEqual(
86 self.ui.ui.sync_label.isEnabled(), False)
87
88 def test_stage_4(self):
89 """Check that each stage in the widget enables the right labels."""
90 self.ui.set_stage(4)
91 self.assertEqual(
92 self.ui.ui.install_label.isEnabled(), True)
93 self.assertEqual(
94 self.ui.ui.sign_in_label.isEnabled(), True)
95 self.assertEqual(
96 self.ui.ui.choose_services_label.isEnabled(), True)
97 self.assertEqual(
98 self.ui.ui.select_folders_label.isEnabled(), True)
99 self.assertEqual(
100 self.ui.ui.sync_label.isEnabled(), True)
0101
=== modified file 'ubuntuone_installer/gui/qt/tos.py'
--- ubuntuone_installer/gui/qt/tos.py 2011-07-04 20:10:17 +0000
+++ ubuntuone_installer/gui/qt/tos.py 2011-07-07 20:33:35 +0000
@@ -28,6 +28,11 @@
2828
2929
30class TosPage(sso_gui.TosPage):30class TosPage(sso_gui.TosPage):
31
32 """Page to display the Terms of Service."""
33
34 # initializePage is inherited
35 # pylint: disable=C0103
31 def initializePage(self):36 def initializePage(self):
32 """Setup UI details."""37 """Setup UI details."""
33 # Set the right texts and connections for buttons38 # Set the right texts and connections for buttons
@@ -56,6 +61,6 @@
56 def print_document(self, button_id):61 def print_document(self, button_id):
57 """Print the document displayed in textBrowser."""62 """Print the document displayed in textBrowser."""
58 if button_id == QtGui.QWizard.CustomButton1:63 if button_id == QtGui.QWizard.CustomButton1:
59 self.previewer = QtGui.QPrintPreviewDialog(64 previewer = QtGui.QPrintPreviewDialog(
60 paintRequested=self.ui.terms_webkit.print_)65 paintRequested=self.ui.terms_webkit.print_)
61 self.previewer.exec_()66 previewer.exec_()

Subscribers

People subscribed via source and target branches