Merge lp:~diegosarmentero/ubuntuone-windows-installer/titles-on-pages into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Superseded
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/titles-on-pages
Merge into: lp:ubuntuone-windows-installer
Diff against target: 1229 lines (+473/-393)
15 files modified
bin/ubuntuone-installer-qt (+0/-3)
data/qt/choose_sign_in.ui (+31/-16)
data/qt/local_folders.ui (+95/-34)
data/qt/setup_account.ui (+37/-3)
ubuntuone_installer/gui/qt/currentuser.py (+48/-0)
ubuntuone_installer/gui/qt/embedded_sso.py (+0/-61)
ubuntuone_installer/gui/qt/forgotten.py (+34/-34)
ubuntuone_installer/gui/qt/gui.py (+30/-5)
ubuntuone_installer/gui/qt/local_folders.py (+9/-3)
ubuntuone_installer/gui/qt/main/tests/test_main.py (+0/-97)
ubuntuone_installer/gui/qt/main/windows.py (+20/-29)
ubuntuone_installer/gui/qt/setup_account.py (+0/-5)
ubuntuone_installer/gui/qt/sync_now_or_later.py (+44/-44)
ubuntuone_installer/gui/qt/tests/test_currentuser.py (+90/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+35/-59)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/titles-on-pages
Reviewer Review Type Date Requested Status
Natalia Bidart Pending
Review via email: mp+70156@code.launchpad.net

This proposal has been superseded by a proposal from 2011-08-02.

Commit message

Move all the Titles and Subtitles into the Wizard Pages

Description of the change

Move all the Titles and Subtitles into the Wizard Pages

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

Both of the revisions says merge, but the first one is:
"Add Title and Subtitle labels into the UI to avoid the resizing of the SideWidget"

Revision history for this message
John Lenton (chipaca) wrote :

are the changes to 'bin/ubuntuone-installer-qt' kosher?

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

That changes are really from Roberto's branch, but his branch is already merge with mine because they are related.
I'm waiting for his branch to be approved to merge mine.

Revision history for this message
John Lenton (chipaca) wrote :

On Tue, 02 Aug 2011 14:24:34 -0000, Diego Sarmentero <email address hidden> wrote:
> That changes are really from Roberto's branch, but his branch is already merge with mine because they are related.
> I'm waiting for his branch to be approved to merge mine.

that's what the 'prerequisite branch' field is for in merge
proposals :)

26. By Diego Sarmentero

adding word wrap mode to title and subtitles.

27. By Diego Sarmentero

Installer modified to allow the pages to work with setTitle and setSubTitle.

28. By Diego Sarmentero

tests modified to use the new setTitle and setSubtitle

29. By Diego Sarmentero

modifying ui to add a header in all the pages dinamically.

30. By Diego Sarmentero

merge

31. By Diego Sarmentero

removing __init__ with just super.

32. By Diego Sarmentero

reverting changes in setup_account.py

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubuntuone-installer-qt'
--- bin/ubuntuone-installer-qt 2011-07-13 20:21:48 +0000
+++ bin/ubuntuone-installer-qt 2011-08-02 12:48:37 +0000
@@ -27,8 +27,6 @@
2727
28from optparse import OptionParser28from optparse import OptionParser
2929
30from twisted.internet import reactor
31
32from ubuntuone_installer import TRANSLATION_DOMAIN30from ubuntuone_installer import TRANSLATION_DOMAIN
3331
34gettext.textdomain(TRANSLATION_DOMAIN)32gettext.textdomain(TRANSLATION_DOMAIN)
@@ -48,4 +46,3 @@
48 parser = parser_options()46 parser = parser_options()
49 (options, args) = parser.parse_args(sys.argv)47 (options, args) = parser.parse_args(sys.argv)
50 main.main()48 main.main()
51 reactor.run()
5249
=== modified file 'data/qt/choose_sign_in.ui'
--- data/qt/choose_sign_in.ui 2011-07-27 15:17:31 +0000
+++ data/qt/choose_sign_in.ui 2011-08-02 12:48:37 +0000
@@ -6,8 +6,8 @@
6 <rect>6 <rect>
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>541</width>9 <width>432</width>
10 <height>365</height>10 <height>393</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <property name="windowTitle">13 <property name="windowTitle">
@@ -15,20 +15,35 @@
15 </property>15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_2">16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 <item>17 <item>
18 <spacer name="verticalSpacer">18 <layout class="QVBoxLayout" name="verticalLayout_4">
19 <property name="orientation">19 <property name="spacing">
20 <enum>Qt::Vertical</enum>20 <number>15</number>
21 </property>21 </property>
22 <property name="sizeType">22 <property name="bottomMargin">
23 <enum>QSizePolicy::Preferred</enum>23 <number>15</number>
24 </property>24 </property>
25 <property name="sizeHint" stdset="0">25 <item>
26 <size>26 <widget class="QLabel" name="title_label">
27 <width>10</width>27 <property name="font">
28 <height>30</height>28 <font>
29 </size>29 <pointsize>24</pointsize>
30 </property>30 <weight>75</weight>
31 </spacer>31 <bold>true</bold>
32 </font>
33 </property>
34 <property name="text">
35 <string>title_label</string>
36 </property>
37 </widget>
38 </item>
39 <item>
40 <widget class="QLabel" name="subtitle_label">
41 <property name="text">
42 <string>subtitle_label</string>
43 </property>
44 </widget>
45 </item>
46 </layout>
32 </item>47 </item>
33 <item>48 <item>
34 <layout class="QHBoxLayout" name="horizontalLayout_2">49 <layout class="QHBoxLayout" name="horizontalLayout_2">
3550
=== modified file 'data/qt/local_folders.ui'
--- data/qt/local_folders.ui 2011-06-28 15:46:02 +0000
+++ data/qt/local_folders.ui 2011-08-02 12:48:37 +0000
@@ -6,7 +6,7 @@
6 <rect>6 <rect>
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>460</width>9 <width>519</width>
10 <height>536</height>10 <height>536</height>
11 </rect>11 </rect>
12 </property>12 </property>
@@ -15,13 +15,44 @@
15 </property>15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_2">16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 <item>17 <item>
18 <layout class="QVBoxLayout" name="verticalLayout_4">
19 <property name="spacing">
20 <number>15</number>
21 </property>
22 <property name="bottomMargin">
23 <number>15</number>
24 </property>
25 <item>
26 <widget class="QLabel" name="title_label">
27 <property name="font">
28 <font>
29 <pointsize>24</pointsize>
30 <weight>75</weight>
31 <bold>true</bold>
32 </font>
33 </property>
34 <property name="text">
35 <string>title_label</string>
36 </property>
37 </widget>
38 </item>
39 <item>
40 <widget class="QLabel" name="subtitle_label">
41 <property name="text">
42 <string>subtitle_label</string>
43 </property>
44 </widget>
45 </item>
46 </layout>
47 </item>
48 <item>
18 <widget class="QLabel" name="label">49 <widget class="QLabel" name="label">
19 <property name="text">50 <property name="text">
20 <string>Ok! Now it's time to choose wich folder sync to the cloud from this computer.51 <string>Let's get started! First choose which folder you want to sync to your Ubuntu One personal cloud from this computer.
21We started by suggesting a few</string>52To help you get going we have suggested a few.</string>
22 </property>53 </property>
23 <property name="textFormat">54 <property name="textFormat">
24 <enum>Qt::RichText</enum>55 <enum>Qt::PlainText</enum>
25 </property>56 </property>
26 <property name="wordWrap">57 <property name="wordWrap">
27 <bool>true</bool>58 <bool>true</bool>
@@ -50,23 +81,28 @@
50 </property>81 </property>
51 </spacer>82 </spacer>
52 </item>83 </item>
53 <item>
54 <widget class="QPushButton" name="pushButton_2">
55 <property name="text">
56 <string>Add a folder</string>
57 </property>
58 </widget>
59 </item>
60 </layout>84 </layout>
61 </item>85 </item>
62 <item>86 <item>
63 <widget class="QTreeWidget" name="folder_list">87 <widget class="QTreeWidget" name="folder_list">
88 <property name="indentation">
89 <number>0</number>
90 </property>
91 <property name="rootIsDecorated">
92 <bool>false</bool>
93 </property>
94 <property name="uniformRowHeights">
95 <bool>true</bool>
96 </property>
97 <property name="allColumnsShowFocus">
98 <bool>true</bool>
99 </property>
64 <attribute name="headerStretchLastSection">100 <attribute name="headerStretchLastSection">
65 <bool>false</bool>101 <bool>false</bool>
66 </attribute>102 </attribute>
67 <column>103 <column>
68 <property name="text">104 <property name="text">
69 <string>My Folders</string>105 <string>Sync these folders on my computer</string>
70 </property>106 </property>
71 </column>107 </column>
72 <column>108 <column>
@@ -74,26 +110,44 @@
74 <string>Space (Total)</string>110 <string>Space (Total)</string>
75 </property>111 </property>
76 </column>112 </column>
77 <column>113 </widget>
78 <property name="text">114 </item>
79 <string>Remove</string>115 <item>
80 </property>116 <layout class="QHBoxLayout" name="horizontalLayout_3">
81 </column>117 <item>
82 </widget>118 <spacer name="horizontalSpacer_4">
83 </item>119 <property name="orientation">
84 <item>120 <enum>Qt::Horizontal</enum>
85 <widget class="QCheckBox" name="checkBox">121 </property>
86 <property name="text">122 <property name="sizeHint" stdset="0">
87 <string>Connect automatically when computer starts</string>123 <size>
88 </property>124 <width>40</width>
89 </widget>125 <height>20</height>
90 </item>126 </size>
91 <item>127 </property>
92 <widget class="QCheckBox" name="checkBox_2">128 </spacer>
93 <property name="text">129 </item>
94 <string>Automatically sync all selected folders from this computer to the cloud</string>130 <item>
95 </property>131 <widget class="AddFolderButton" name="add_folder_button">
96 </widget>132 <property name="text">
133 <string>Add a folder</string>
134 </property>
135 </widget>
136 </item>
137 <item>
138 <spacer name="horizontalSpacer_5">
139 <property name="orientation">
140 <enum>Qt::Horizontal</enum>
141 </property>
142 <property name="sizeHint" stdset="0">
143 <size>
144 <width>40</width>
145 <height>20</height>
146 </size>
147 </property>
148 </spacer>
149 </item>
150 </layout>
97 </item>151 </item>
98 <item>152 <item>
99 <widget class="QFrame" name="offer_frame">153 <widget class="QFrame" name="offer_frame">
@@ -113,7 +167,7 @@
113 <item>167 <item>
114 <widget class="QLabel" name="offer_label">168 <widget class="QLabel" name="offer_label">
115 <property name="text">169 <property name="text">
116 <string>The folders you have selected to sync take over your 2GB space. You can remove some folders or add some extra space</string>170 <string>The folders you have selected to sync take over your 5GB storage space by 6.5GB. You can remove some folders or add some extra storage now.</string>
117 </property>171 </property>
118 <property name="wordWrap">172 <property name="wordWrap">
119 <bool>true</bool>173 <bool>true</bool>
@@ -138,7 +192,7 @@
138 <item>192 <item>
139 <widget class="QPushButton" name="pushButton">193 <widget class="QPushButton" name="pushButton">
140 <property name="text">194 <property name="text">
141 <string>add more space</string>195 <string>Add more storage</string>
142 </property>196 </property>
143 </widget>197 </widget>
144 </item>198 </item>
@@ -162,6 +216,13 @@
162 </item>216 </item>
163 </layout>217 </layout>
164 </widget>218 </widget>
219 <customwidgets>
220 <customwidget>
221 <class>AddFolderButton</class>
222 <extends>QPushButton</extends>
223 <header>ubuntuone.controlpanel.gui.qt.addfolder</header>
224 </customwidget>
225 </customwidgets>
165 <resources/>226 <resources/>
166 <connections/>227 <connections/>
167</ui>228</ui>
168229
=== modified file 'data/qt/setup_account.ui'
--- data/qt/setup_account.ui 2011-07-28 18:24:58 +0000
+++ data/qt/setup_account.ui 2011-08-02 12:48:37 +0000
@@ -6,8 +6,8 @@
6 <rect>6 <rect>
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>569</width>9 <width>575</width>
10 <height>521</height>10 <height>612</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <property name="windowTitle">13 <property name="windowTitle">
@@ -15,9 +15,43 @@
15 </property>15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">16 <layout class="QVBoxLayout" name="verticalLayout">
17 <property name="rightMargin">17 <property name="rightMargin">
18 <number>0</number>18 <number>6</number>
19 </property>19 </property>
20 <item>20 <item>
21 <layout class="QVBoxLayout" name="verticalLayout_2">
22 <property name="spacing">
23 <number>15</number>
24 </property>
25 <property name="bottomMargin">
26 <number>15</number>
27 </property>
28 <item>
29 <widget class="QLabel" name="title_label">
30 <property name="font">
31 <font>
32 <pointsize>18</pointsize>
33 <weight>75</weight>
34 <bold>true</bold>
35 </font>
36 </property>
37 <property name="text">
38 <string>title_label</string>
39 </property>
40 </widget>
41 </item>
42 <item>
43 <widget class="QLabel" name="subtitle_label">
44 <property name="text">
45 <string>subtitle_label</string>
46 </property>
47 <property name="wordWrap">
48 <bool>true</bool>
49 </property>
50 </widget>
51 </item>
52 </layout>
53 </item>
54 <item>
21 <layout class="QGridLayout" name="gridLayout" columnminimumwidth="300,250">55 <layout class="QGridLayout" name="gridLayout" columnminimumwidth="300,250">
22 <item row="0" column="0">56 <item row="0" column="0">
23 <widget class="QLabel" name="password_info_label">57 <widget class="QLabel" name="password_info_label">
2458
=== added file 'ubuntuone_installer/gui/qt/currentuser.py'
--- ubuntuone_installer/gui/qt/currentuser.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/currentuser.py 2011-08-02 12:48:37 +0000
@@ -0,0 +1,48 @@
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"""Custom controller for current user page."""
20
21from twisted.internet.defer import inlineCallbacks
22
23from ubuntu_sso.qt import controllers
24
25from ubuntuone.platform.credentials import (
26 CredentialsManagementTool,
27 CredentialsError,
28)
29
30
31class CurrentUserController(controllers.CurrentUserController):
32 """Custom controller for current user page."""
33
34 @inlineCallbacks
35 def login(self, *args):
36 """Perform the login using the self.backend."""
37 email = str(self.view.ui.email_edit.text())
38 password = str(self.view.ui.password_edit.text())
39 credtool = CredentialsManagementTool()
40 try:
41 d = yield credtool.login_email_password(
42 email=email,
43 password=password,
44 )
45 self.on_logged_in(self.view.wizard().app_name, d)
46 except CredentialsError, e:
47 print e, type(e), repr(e)
48 self.on_login_error(e.args[0])
049
=== removed file 'ubuntuone_installer/gui/qt/embedded_sso.py'
--- ubuntuone_installer/gui/qt/embedded_sso.py 2011-07-27 14:53:56 +0000
+++ ubuntuone_installer/gui/qt/embedded_sso.py 1970-01-01 00:00:00 +0000
@@ -1,61 +0,0 @@
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"""The user interface for the Ubuntu One Installer's SSO client."""
20
21import ubuntu_sso.qt.gui as sso_gui
22
23from ubuntuone_installer.gui.qt.gui import MainWindow
24
25
26class UbuntuSSOClientGUI(object):
27 """A custom Client GUI for SSO."""
28
29 def __init__(self, app_name, tc_url, help_text,
30 window_id=0, login_only=False):
31 """Create a new instance."""
32
33 # create the controller and the ui, then set the cb and call the show
34 # method so that we can work
35 self.controller = sso_gui.UbuntuSSOWizardController(
36 app_name,
37 user_cancellation_callback=self._user_cancellation_callback)
38 self.view = MainWindow()
39
40 self.login_success_callback = lambda x, y: None
41 self.registration_success_callback = lambda x, y: None
42 self.user_cancellation_callback = lambda x: None
43
44 self.view.loginSuccess.connect(self._login_success_callback)
45 self.view.registrationSuccess.connect(
46 self._registration_success_callback)
47 self.view.userCancellation.connect(self._user_cancellation_callback)
48
49 self.view.show()
50
51 def _login_success_callback(self, app_name, email):
52 """Call the real callback, set by the Credentials object"""
53 self.login_success_callback(str(app_name), str(email))
54
55 def _registration_success_callback(self, app_name, email):
56 """Call the real callback, set by the Credentials object"""
57 self.registration_success_callback(str(app_name), str(email))
58
59 def _user_cancellation_callback(self, app_name):
60 """Call the real callback, set by the Credentials object"""
61 self.user_cancellation_callback(str(app_name))
620
=== modified file 'ubuntuone_installer/gui/qt/forgotten.py'
--- ubuntuone_installer/gui/qt/forgotten.py 2011-07-19 21:06:06 +0000
+++ ubuntuone_installer/gui/qt/forgotten.py 2011-08-02 12:48:37 +0000
@@ -1,34 +1,34 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
22
3# Authors: Roberto Alsina <roberto.alsina@canonical.com>3# Authors: Roberto Alsina <roberto.alsina@canonical.com>
4#4#
5# Copyright 2011 Canonical Ltd.5# Copyright 2011 Canonical Ltd.
6#6#
7# This program is free software: you can redistribute it and/or modify it7# 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 published8# under the terms of the GNU General Public License version 3, as published
9# by the Free Software Foundation.9# by the Free Software Foundation.
10#10#
11# This program is distributed in the hope that it will be useful, but11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranties of12# WITHOUT ANY WARRANTY; without even the implied warranties of
13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14# PURPOSE. See the GNU General Public License for more details.14# PURPOSE. See the GNU General Public License for more details.
15#15#
16# You should have received a copy of the GNU General Public License along16# 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/>.17# with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19"""Custom forgotten password controller."""19"""Custom forgotten password controller."""
2020
21from ubuntu_sso.qt import controllers21from ubuntu_sso.qt import controllers
2222
2323
24class ForgottenPasswordController(controllers.ForgottenPasswordController):24class ForgottenPasswordController(controllers.ForgottenPasswordController):
25 """A custom forgotten password controller.25 """A custom forgotten password controller.
2626
27 This controller hides the overlay as needed.27 This controller hides the overlay as needed.
28 """28 """
2929
30 def on_password_reset_error(self, app_name, error):30 def on_password_reset_error(self, app_name, error):
31 """Hide the overlay, then do as the default controller does."""31 """Hide the overlay, then do as the default controller does."""
32 self.view.wizard().overlay.hide()32 self.view.wizard().overlay.hide()
33 super(ForgottenPasswordController,33 super(ForgottenPasswordController,
34 self).on_password_reset_error(app_name, error)34 self).on_password_reset_error(app_name, error)
3535
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-07-28 18:24:58 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-08-02 12:48:37 +0000
@@ -23,6 +23,8 @@
2323
24import gettext24import gettext
2525
26from twisted.internet.defer import inlineCallbacks, returnValue
27
26from PyQt4 import QtGui, QtCore28from PyQt4 import QtGui, QtCore
2729
28from ubuntu_sso.qt.gui import (30from ubuntu_sso.qt.gui import (
@@ -43,7 +45,6 @@
43from ubuntu_sso.qt.reset_password_ui import Ui_ResetPasswordPage45from ubuntu_sso.qt.reset_password_ui import Ui_ResetPasswordPage
44from ubuntu_sso.qt.controllers import (46from ubuntu_sso.qt.controllers import (
45 ChooseSignInController,47 ChooseSignInController,
46 CurrentUserController,
47 EmailVerificationController,48 EmailVerificationController,
48 ErrorController,49 ErrorController,
49 ResetPasswordController,50 ResetPasswordController,
@@ -58,6 +59,7 @@
58 APP_NAME,59 APP_NAME,
59 TC_URL,60 TC_URL,
60)61)
62from ubuntuone.platform.credentials import CredentialsManagementTool
6163
62from ubuntuone_installer.logger import setup_logging64from ubuntuone_installer.logger import setup_logging
63from ubuntuone_installer.gui.qt.ui import (65from ubuntuone_installer.gui.qt.ui import (
@@ -73,6 +75,7 @@
73# pylint: enable=W061175# pylint: enable=W0611
7476
75from ubuntuone_installer.gui.qt.are_you_sure import AreYouSure77from ubuntuone_installer.gui.qt.are_you_sure import AreYouSure
78from ubuntuone_installer.gui.qt.currentuser import CurrentUserController
76from ubuntuone_installer.gui.qt.forgotten import ForgottenPasswordController79from ubuntuone_installer.gui.qt.forgotten import ForgottenPasswordController
77from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage80from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage
78from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage81from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
@@ -99,6 +102,7 @@
99 super(LicensePage, self).__init__(parent)102 super(LicensePage, self).__init__(parent)
100 self.ui = license_ui.Ui_Form()103 self.ui = license_ui.Ui_Form()
101 self.ui.setupUi(self)104 self.ui.setupUi(self)
105 self._next_id = None
102106
103 # Invalid names of Qt-inherited methods107 # Invalid names of Qt-inherited methods
104 # pylint: disable=C0103108 # pylint: disable=C0103
@@ -144,6 +148,12 @@
144 printer.setPageSize(QtGui.QPrinter.A4)148 printer.setPageSize(QtGui.QPrinter.A4)
145 document.print_(printer)149 document.print_(printer)
146150
151 def nextId(self):
152 """Return next page's ID."""
153 if self._next_id is None:
154 return super(LicensePage, self).nextId()
155 return self._next_id
156
147157
148class SignInPage(QtGui.QWizardPage):158class SignInPage(QtGui.QWizardPage):
149 """Wizard Page that lets the user Sign into Ubuntu One."""159 """Wizard Page that lets the user Sign into Ubuntu One."""
@@ -314,8 +324,7 @@
314324
315 self.setWindowTitle(APP_NAME)325 self.setWindowTitle(APP_NAME)
316 self.setMinimumHeight(630)326 self.setMinimumHeight(630)
317 self.setMinimumWidth(820)327 self.setMinimumWidth(800)
318 self.setTitleFormat(QtCore.Qt.RichText)
319 self.setWizardStyle(self.ModernStyle)328 self.setWizardStyle(self.ModernStyle)
320 self.close_callback = close_callback329 self.close_callback = close_callback
321330
@@ -328,7 +337,9 @@
328 # PyQt doesn't support the (int, page) version of addPage, so337 # PyQt doesn't support the (int, page) version of addPage, so
329 # Add the pages in the right order338 # Add the pages in the right order
330 # pylint: disable=C0103339 # pylint: disable=C0103
331 self.LICENSE_PAGE = self.addPage(LicensePage())340
341 self.LICENSE_PAGE = LicensePage()
342 self.LICENSE_PAGE_ID = self.addPage(self.LICENSE_PAGE)
332343
333 #SSO Pages344 #SSO Pages
334 title_page = TITLE_STYLE % SIGN_IN345 title_page = TITLE_STYLE % SIGN_IN
@@ -339,7 +350,11 @@
339 controller=self.sign_in_controller,350 controller=self.sign_in_controller,
340 parent=self)351 parent=self)
341352
342 self.setup_controller = SetUpAccountController(message_box=self)353 title_page = TITLE_STYLE % _("Sign Up to Ubuntu One")
354 subtitle = _("You only need to set up your account "
355 "once to get access to Ubuntu One across your devices.")
356 self.setup_controller = SetUpAccountController(
357 message_box=self, title=title_page, subtitle=subtitle)
343 self.setup_account = SetupAccountPage(358 self.setup_account = SetupAccountPage(
344 setup_account_ui.Ui_SetUpAccountPage(),359 setup_account_ui.Ui_SetUpAccountPage(),
345 self.setup_controller,360 self.setup_controller,
@@ -422,10 +437,20 @@
422 # Apply font to the entire application437 # Apply font to the entire application
423 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')438 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-R.ttf')
424 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')439 QtGui.QFontDatabase.addApplicationFont(':/Ubuntu-B.ttf')
440 credtool = CredentialsManagementTool()
441 d = credtool.find_credentials()
442 d.addCallback(self.creds_cb)
425443
426 # Invalid name "closeEvent"444 # Invalid name "closeEvent"
427 # pylint: disable=C0103445 # pylint: disable=C0103
428446
447 def creds_cb(self, token):
448 """Change wizard flow if we have credentials."""
449 if not token:
450 self.LICENSE_PAGE._next_id = self.SIGNIN_PAGE
451 else:
452 self.LICENSE_PAGE._next_id = self.local_folders_page_id
453
429 def critical(self, *args, **kwargs):454 def critical(self, *args, **kwargs):
430 """Wrapper for QMessageBox.critical that hides the overlay."""455 """Wrapper for QMessageBox.critical that hides the overlay."""
431 self.overlay.hide()456 self.overlay.hide()
432457
=== modified file 'ubuntuone_installer/gui/qt/local_folders.py'
--- ubuntuone_installer/gui/qt/local_folders.py 2011-07-22 16:32:35 +0000
+++ ubuntuone_installer/gui/qt/local_folders.py 2011-08-02 12:48:37 +0000
@@ -70,9 +70,10 @@
7070
71 def __init__(self, parent=None):71 def __init__(self, parent=None):
72 super(LocalFoldersPage, self).__init__(parent)72 super(LocalFoldersPage, self).__init__(parent)
73 self.setTitle(LOCAL_FOLDERS_TITLE)
74 self.ui = local_folders_ui.Ui_Form()73 self.ui = local_folders_ui.Ui_Form()
75 self.ui.setupUi(self)74 self.ui.setupUi(self)
75 self.ui.title_label.setText(LOCAL_FOLDERS_TITLE)
76 self.ui.subtitle_label.setVisible(False)
7677
77 header_view = self.ui.folder_list.header()78 header_view = self.ui.folder_list.header()
78 header_view.setResizeMode(0, header_view.Stretch)79 header_view.setResizeMode(0, header_view.Stretch)
@@ -103,8 +104,13 @@
103 # Special Folder "My Documents"104 # Special Folder "My Documents"
104 dll = ctypes.windll.shell32105 dll = ctypes.windll.shell32
105 buf = ctypes.create_string_buffer(300)106 buf = ctypes.create_string_buffer(300)
106 dll.SHGetSpecialFolderPathA(None, buf, 0x0005, False)107 dll.SHGetSpecialFolderPathA(None, buf, 5, False)
107 result = [buf.value, ]108 docs = buf.value
109 dll.SHGetSpecialFolderPathA(None, buf, 13, False)
110 music = buf.value
111 dll.SHGetSpecialFolderPathA(None, buf, 39, False)
112 pictures = buf.value
113 return [docs, music, pictures]
108 else:114 else:
109 result = ['To be implemented']115 result = ['To be implemented']
110 return result116 return result
111117
=== removed file 'ubuntuone_installer/gui/qt/main/tests/test_main.py'
--- ubuntuone_installer/gui/qt/main/tests/test_main.py 2011-07-27 15:09:28 +0000
+++ ubuntuone_installer/gui/qt/main/tests/test_main.py 1970-01-01 00:00:00 +0000
@@ -1,97 +0,0 @@
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"""The test suite for the Qt UI of the Ubuntu One Installer."""
20
21from ubuntuone_installer.tests import TestCase
22
23import ubuntuone_installer.gui.qt.main.windows as main_module
24
25# pylint: disable=W0212
26
27from ubuntuone.platform.credentials import (
28 APP_NAME,
29 DESCRIPTION,
30 TC_URL,
31)
32
33
34class FakeSSOCred(object):
35 """A fake sso_cred."""
36
37 _registered_to_signal = False
38 _login_args = ()
39 on_credentials_found = None
40
41 def register_to_signals(self):
42 """Fake method."""
43 self._registered_to_signal = True
44
45 def login_or_register_to_get_credentials(self, *args, **kwargs):
46 """Fake method."""
47 self._login_args = (args, kwargs)
48
49
50class FakeSSOClient(object):
51
52 """Fake UbuntuSSOClient."""
53
54 sso_cred = FakeSSOCred()
55 testcase = None
56
57 def connect(self):
58 """Fake method."""
59 self.testcase._connected = True
60 return self
61
62
63class MainTestCase(TestCase):
64
65 """Tests for the main() function."""
66
67 _connected = False
68
69 def setUp(self):
70 """Prepare tests."""
71 self.patch(main_module, "UbuntuSSOClient", FakeSSOClient)
72 main_module.UbuntuSSOClient.testcase = self
73
74 def test_connect(self):
75 """Test that we instantiate the SSO Client and connect."""
76 main_module.main()
77 self.assertEqual(FakeSSOClient.testcase._connected, True)
78
79 def test_credentials_found_cb(self):
80 """Test that the credentials found signal is connected."""
81 main_module.main()
82 self.assertEqual(
83 FakeSSOClient.sso_cred.on_credentials_found_cb.__name__,
84 "stop")
85
86 def test_registered(self):
87 """Test that the credentials registers to signals."""
88 main_module.main()
89 self.assertEqual(FakeSSOClient.sso_cred._registered_to_signal,
90 True)
91
92 def test_check_register_args(self):
93 """Test that the credentials registers to signals."""
94 main_module.main()
95 self.assertEqual(FakeSSOClient.sso_cred._login_args,
96 ((APP_NAME, TC_URL, DESCRIPTION, 0),
97 {'ui_module': 'ubuntuone_installer.gui.qt.embedded_sso'}))
980
=== modified file 'ubuntuone_installer/gui/qt/main/windows.py'
--- ubuntuone_installer/gui/qt/main/windows.py 2011-07-27 14:53:56 +0000
+++ ubuntuone_installer/gui/qt/main/windows.py 2011-08-02 12:48:37 +0000
@@ -19,34 +19,25 @@
1919
20# pylint: disable=E1101, F0401, W040420# pylint: disable=E1101, F0401, W0404
2121
22from twisted.internet.defer import inlineCallbacks22import sys
23from ubuntu_sso.main.windows import UbuntuSSOClient23from PyQt4 import QtGui
2424
25from ubuntuone.platform.credentials import (25
26 APP_NAME,26def stop(*args):
27 DESCRIPTION,27 """End the process."""
28 TC_URL,28 from twisted.internet import reactor
29)29 reactor.stop()
3030
3131
32@inlineCallbacks
33def main():32def main():
34 """Perform a client request to be logged in."""33 """Perform a client request to be logged in."""
35 client = UbuntuSSOClient()34
36 client = yield client.connect()35 app = QtGui.QApplication(sys.argv)
3736 import qtreactor.qt4reactor
38 @inlineCallbacks37 qtreactor.qt4reactor.install()
39 def stop(*args):38 from ubuntuone_installer.gui.qt.gui import MainWindow
40 """End the process."""39 from twisted.internet import reactor
41 from twisted.internet import reactor40 window = MainWindow(close_callback=stop)
42 yield client.sso_cred.unregister_to_signals()41 app.window = window
43 reactor.stop()42 window.show()
4443 reactor.run()
45 client.sso_cred.on_credentials_found_cb = stop
46 client.sso_cred.on_authorization_denied_cb = stop
47 client.sso_cred.on_credentials_error_cb = stop
48 yield client.sso_cred.register_to_signals()
49 yield client.sso_cred.login_or_register_to_get_credentials(APP_NAME,
50 TC_URL,
51 DESCRIPTION, 0,
52 ui_module="ubuntuone_installer.gui.qt.embedded_sso")
5344
=== modified file 'ubuntuone_installer/gui/qt/setup_account.py'
--- ubuntuone_installer/gui/qt/setup_account.py 2011-07-28 18:24:58 +0000
+++ ubuntuone_installer/gui/qt/setup_account.py 2011-08-02 12:48:37 +0000
@@ -31,7 +31,6 @@
31# pylint: disable=C010331# pylint: disable=C0103
32BAD = u'<img src=":/password_hint_warning.png" /><font color="red"> %s </font>'32BAD = u'<img src=":/password_hint_warning.png" /><font color="red"> %s </font>'
33GOOD = u'<img src=":/password_hint_ok.png" /><font color="green"> %s </font>'33GOOD = u'<img src=":/password_hint_ok.png" /><font color="green"> %s </font>'
34TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>"
3534
36EMPTY_NAME = _("Please enter your name")35EMPTY_NAME = _("Please enter your name")
37INVALID_EMAIL = _("Please enter a valid email address")36INVALID_EMAIL = _("Please enter a valid email address")
@@ -53,10 +52,6 @@
53 """Setup UI details."""52 """Setup UI details."""
54 # We need to override some texts from SSO53 # We need to override some texts from SSO
55 # to match our spec54 # to match our spec
56 title_page = TITLE_STYLE % _("Sign Up to Ubuntu One")
57 self.setTitle(title_page)
58 self.setSubTitle(_("You only need to set up your account "
59 "once to get access to Ubuntu One across your devices."))
6055
61 self.ui.name_label.setText(_("Name"))56 self.ui.name_label.setText(_("Name"))
62 self.ui.email_label.setText(_("Email"))57 self.ui.email_label.setText(_("Email"))
6358
=== modified file 'ubuntuone_installer/gui/qt/sync_now_or_later.py'
--- ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-06-29 11:44:23 +0000
+++ ubuntuone_installer/gui/qt/sync_now_or_later.py 2011-08-02 12:48:37 +0000
@@ -1,44 +1,44 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
22
3# Authors: Roberto Alsina <roberto.alsina@canonical.com>3# Authors: Roberto Alsina <roberto.alsina@canonical.com>
4#4#
5# Copyright 2011 Canonical Ltd.5# Copyright 2011 Canonical Ltd.
6#6#
7# This program is free software: you can redistribute it and/or modify it7# 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 published8# under the terms of the GNU General Public License version 3, as published
9# by the Free Software Foundation.9# by the Free Software Foundation.
10#10#
11# This program is distributed in the hope that it will be useful, but11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranties of12# WITHOUT ANY WARRANTY; without even the implied warranties of
13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14# PURPOSE. See the GNU General Public License for more details.14# PURPOSE. See the GNU General Public License for more details.
15#15#
16# You should have received a copy of the GNU General Public License along16# 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/>.17# with this program. If not, see <http://www.gnu.org/licenses/>.
1818
19"""The user interface for the Ubuntu One Installer."""19"""The user interface for the Ubuntu One Installer."""
2020
21from PyQt4 import QtGui21from PyQt4 import QtGui
2222
23from ubuntuone_installer.gui.qt.ui import sync_now_or_later_ui23from ubuntuone_installer.gui.qt.ui import sync_now_or_later_ui
2424
2525
26class SyncNowOrLaterPage(QtGui.QWizardPage):26class SyncNowOrLaterPage(QtGui.QWizardPage):
27 """User can choose whether to sync now, later, or selectively"""27 """User can choose whether to sync now, later, or selectively"""
2828
29 def __init__(self, parent=None):29 def __init__(self, parent=None):
30 QtGui.QWizardPage.__init__(self, parent)30 QtGui.QWizardPage.__init__(self, parent)
31 self.ui = sync_now_or_later_ui.Ui_Form()31 self.ui = sync_now_or_later_ui.Ui_Form()
32 self.ui.setupUi(self)32 self.ui.setupUi(self)
33 self.registerField("sync_now", self.ui.sync_now)33 self.registerField("sync_now", self.ui.sync_now)
34 self.registerField("sync_later", self.ui.sync_later)34 self.registerField("sync_later", self.ui.sync_later)
35 self.registerField("sync_custom", self.ui.sync_custom)35 self.registerField("sync_custom", self.ui.sync_custom)
3636
37 # Invalid names of Qt-inherited methods37 # Invalid names of Qt-inherited methods
38 # pylint: disable=C010338 # pylint: disable=C0103
3939
40 def initializePage(self):40 def initializePage(self):
41 """Setup UI details"""41 """Setup UI details"""
42 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)42 self.wizard().setOption(QtGui.QWizard.HaveCustomButton1, False)
43 self.wizard().setOption(QtGui.QWizard.NoCancelButton, True)43 self.wizard().setOption(QtGui.QWizard.NoCancelButton, True)
44 self.wizard()._next_id = None44 self.wizard()._next_id = None
4545
=== added file 'ubuntuone_installer/gui/qt/tests/test_currentuser.py'
--- ubuntuone_installer/gui/qt/tests/test_currentuser.py 1970-01-01 00:00:00 +0000
+++ ubuntuone_installer/gui/qt/tests/test_currentuser.py 2011-08-02 12:48:37 +0000
@@ -0,0 +1,90 @@
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"""Tests for the CurrentUserController."""
20
21from ubuntuone_installer.gui.qt import currentuser
22from ubuntuone_installer.gui.qt.tests import BaseTestCase
23
24
25class FakeView(object):
26
27 """A Fake view for the controller."""
28
29 def __init__(self):
30 """Setup."""
31 self.view = self
32 self.ui = self
33 self.email_edit = self
34 self.password_edit = self
35 self.app_name = "APP"
36
37 def text(self):
38 """Return some text."""
39 return "text"
40
41 def wizard(self):
42 """"Fake the wizard() method of QWizardPage."""
43 return self
44
45
46class FakeCredentialsManagementToolSuccess(object):
47
48 """A fake CredentialsManagementTool where login succeeds."""
49
50 def login_email_password(self, *args, **kwargs):
51 """Fake credentials."""
52 return {"x": "y"}
53
54
55class FakeCredentialsManagementToolFailure(object):
56
57 """A fake CredentialsManagementTool where login fails."""
58
59 def login_email_password(self, *args, **kwargs):
60 """Raises a credentials exception."""
61 raise currentuser.CredentialsError("Failure")
62
63
64class CurrentUserTestCase(BaseTestCase):
65
66 """Test the CurrentUserController."""
67
68 class_ui = FakeView
69
70 def setUp(self):
71 """Initialize this test instance."""
72 self.controller = currentuser.CurrentUserController()
73 self.controller.view = FakeView()
74 super(CurrentUserTestCase, self).setUp()
75
76 def test_login_success(self):
77 """Check that login works correctly."""
78 self.patch(currentuser, 'CredentialsManagementTool',
79 FakeCredentialsManagementToolSuccess)
80 self.patch(self.controller, 'on_logged_in', self._set_called)
81 self.controller.login()
82 self.assertEqual(self._called, (('APP', {'x': 'y'}), {}))
83
84 def test_login_failure(self):
85 """Check that login fails correctly."""
86 self.patch(currentuser, 'CredentialsManagementTool',
87 FakeCredentialsManagementToolFailure)
88 self.patch(self.controller, 'on_login_error', self._set_called)
89 self.controller.login()
90 self.assertEqual(self._called, (('Failure',), {}))
091
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-27 15:09:28 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-08-02 12:48:37 +0000
@@ -24,6 +24,8 @@
24import shutil24import shutil
25import tempfile25import tempfile
2626
27from twisted.internet import reactor, defer
28
27from PyQt4 import QtCore29from PyQt4 import QtCore
2830
29from ubuntuone.platform.credentials import (31from ubuntuone.platform.credentials import (
@@ -35,7 +37,6 @@
3537
36from ubuntuone_installer.gui.qt import gui38from ubuntuone_installer.gui.qt import gui
37from ubuntuone_installer.gui.qt.tests import BaseTestCase39from ubuntuone_installer.gui.qt.tests import BaseTestCase
38from ubuntuone_installer.gui.qt import embedded_sso
39from ubuntuone_installer.gui.qt import forgotten40from ubuntuone_installer.gui.qt import forgotten
40from ubuntuone_installer.gui.qt import local_folders41from ubuntuone_installer.gui.qt import local_folders
41from ubuntuone_installer.gui.qt import setup_account42from ubuntuone_installer.gui.qt import setup_account
@@ -51,6 +52,16 @@
51 u'token_secret': u'qFYImEtlczPbsCnYyuwLoPDlPEnvNcIktZphPQklAWrvyfFMV'}52 u'token_secret': u'qFYImEtlczPbsCnYyuwLoPDlPEnvNcIktZphPQklAWrvyfFMV'}
5253
5354
55class FakeFailureCredentialsManagementTool(object):
56
57 """A fake CredentialsManagementTool that fails."""
58
59 def find_credentials(self):
60 """Return a deferred that never triggers callback."""
61 d = defer.Deferred()
62 return d
63
64
54class FakeController(object):65class FakeController(object):
5566
56 """A fake controller for the tests."""67 """A fake controller for the tests."""
@@ -99,6 +110,9 @@
99 """Fake hide."""110 """Fake hide."""
100 self.hide_counter += 1111 self.hide_counter += 1
101112
113 def resize(self, *args):
114 """Fake resize."""
115
102116
103class MainWindowTestCase(BaseTestCase):117class MainWindowTestCase(BaseTestCase):
104 """Test the qt main window."""118 """Test the qt main window."""
@@ -118,6 +132,8 @@
118 self.patch(gui, "ResetPasswordController", FakeController)132 self.patch(gui, "ResetPasswordController", FakeController)
119 self.patch(gui, "AreYouSure", FakeAreYouSure)133 self.patch(gui, "AreYouSure", FakeAreYouSure)
120 self.patch(gui, "LoadingOverlay", FakeOverlay)134 self.patch(gui, "LoadingOverlay", FakeOverlay)
135 self.patch(gui, "CredentialsManagementTool",
136 FakeFailureCredentialsManagementTool)
121 super(MainWindowTestCase, self).setUp()137 super(MainWindowTestCase, self).setUp()
122138
123 def test_critical(self):139 def test_critical(self):
@@ -276,7 +292,7 @@
276292
277 def test_stage_progression_1(self):293 def test_stage_progression_1(self):
278 """Check that each page in the wizard sets the correct stage."""294 """Check that each page in the wizard sets the correct stage."""
279 self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE)295 self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE_ID)
280 self.assertEqual(self.ui.sideWidget().stage, 0)296 self.assertEqual(self.ui.sideWidget().stage, 0)
281297
282 def test_stage_progression_2(self):298 def test_stage_progression_2(self):
@@ -345,6 +361,16 @@
345 QtCore.QCoreApplication.instance().processEvents()361 QtCore.QCoreApplication.instance().processEvents()
346 self.assertEqual(self.ui.result(), self.ui.Rejected)362 self.assertEqual(self.ui.result(), self.ui.Rejected)
347363
364 def test_license_next(self):
365 """Test what's the license page's nextID."""
366 self.assertEqual(self.ui.LICENSE_PAGE.nextId(), self.ui.SIGNIN_PAGE)
367
368 def test_license_next(self):
369 """Test what's the license page's nextID."""
370 self.ui.creds_cb("fakecreds")
371 self.assertEqual(self.ui.LICENSE_PAGE.nextId(),
372 self.ui.local_folders_page_id)
373
348374
349class FakeSignal(object):375class FakeSignal(object):
350376
@@ -373,51 +399,6 @@
373 self.shown = True399 self.shown = True
374400
375401
376class SSOGuiTestCase(BaseTestCase):
377 """Test the custom SSO GUI."""
378
379 class_ui = embedded_sso.UbuntuSSOClientGUI
380
381 def setUp(self):
382 """Initialize this test instance."""
383 self.kwargs = {
384 'app_name': APP_NAME,
385 'tc_url': TC_URL,
386 'help_text': '',
387 }
388 self.patch(embedded_sso, "MainWindow", FakeMainWindow)
389 super(SSOGuiTestCase, self).setUp()
390
391 def test_sso_client_gui(self):
392 """Ensure the class instantiates correctly."""
393 self.assertIsInstance(
394 self.ui.controller,
395 ubuntu_sso.qt.controllers.UbuntuSSOWizardController)
396 self.assertIsInstance(self.ui.view, FakeMainWindow)
397
398 def test_login_callback(self):
399 """Test that the login success callback is correctly handled."""
400 self.ui.login_success_callback = self._set_called
401 self.ui.view.loginSuccess.emit("app", "email")
402 self.assertEqual(self._called, (('app', 'email'), {}))
403
404 def test_registration_callback(self):
405 """Test that the registration success callback is correctly handled."""
406 self.ui.registration_success_callback = self._set_called
407 self.ui.view.registrationSuccess.emit("app", "email")
408 self.assertEqual(self._called, (('app', 'email'), {}))
409
410 def test_cancellation_callback(self):
411 """Test that the cancellation callback is called right."""
412 self.ui.user_cancellation_callback = self._set_called
413 self.ui.view.userCancellation.emit("app")
414 self.assertEqual(self._called, (('app',), {}))
415
416 def test_view_is_shown(self):
417 """Test that the view is actually shown."""
418 self.assertTrue(self.ui.view.shown)
419
420
421class LocalFoldersTestCase(BaseTestCase):402class LocalFoldersTestCase(BaseTestCase):
422 """Test the LocalFoldersPage code."""403 """Test the LocalFoldersPage code."""
423404
@@ -450,16 +431,10 @@
450 self.assertEqual(path, self.tmpdir)431 self.assertEqual(path, self.tmpdir)
451 self.assertEqual(size, 1337)432 self.assertEqual(size, 1337)
452433
453 def test_item_addition_removal(self):434 def test_item_addition(self):
454 """Add an item (plus the default one), then remove them."""435 """Add an item (plus the default one), then remove them."""
455 self.ui.add_folder(self.tmpdir)436 self.ui.add_folder(self.tmpdir)
456 self.assertEqual(2, self.ui.ui.folder_list.topLevelItemCount())437 self.assertEqual(4, self.ui.ui.folder_list.topLevelItemCount())
457 self.ui.on_folder_list_itemClicked(
458 self.ui.ui.folder_list.topLevelItem(0), 2)
459 self.ui.on_folder_list_itemClicked(
460 self.ui.ui.folder_list.topLevelItem(0), 2)
461 self.assertEqual(0, self.ui.ui.folder_list.topLevelItemCount())
462 self.assertEqual({}, self.ui.items)
463438
464 def test_total_size(self):439 def test_total_size(self):
465 """Test that the header reflects the change in item sizes."""440 """Test that the header reflects the change in item sizes."""
@@ -500,6 +475,7 @@
500 item = self.ui.add_folder(os.path.join("xyzzy", "xyzzy", "xyzzy"))475 item = self.ui.add_folder(os.path.join("xyzzy", "xyzzy", "xyzzy"))
501 self.assertEqual(1, self.ui.ui.folder_list.topLevelItemCount())476 self.assertEqual(1, self.ui.ui.folder_list.topLevelItemCount())
502 item.thread.run()477 item.thread.run()
478 item.thread.join()
503 self.ui.update_sizes()479 self.ui.update_sizes()
504 self.assertEqual(0, item.size)480 self.assertEqual(0, item.size)
505 # world did not explode481 # world did not explode
@@ -743,16 +719,16 @@
743 self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE)719 self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE)
744 self.assertEqual(720 self.assertEqual(
745 True,721 True,
746 sideWidget().ui.states_frame.isVisible())722 self.ui.sideWidget().ui.states_frame.isVisible())
747 self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE)723 self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE)
748 self.assertEqual(724 self.assertEqual(
749 True,725 True,
750 sideWidget().ui.states_frame.isVisible())726 self.ui.sideWidget().ui.states_frame.isVisible())
751 self.ui.on_currentIdChanged(self.ui.local_folders_page_id)727 self.ui.on_currentIdChanged(self.ui.local_folders_page_id)
752 self.assertEqual(728 self.assertEqual(
753 True,729 True,
754 sideWidget().ui.states_frame.isVisible())730 self.ui.sideWidget().ui.states_frame.isVisible())
755 self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE)731 self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE)
756 self.assertEqual(732 self.assertEqual(
757 True,733 True,
758 sideWidget().ui.states_frame.isVisible())734 self.ui.sideWidget().ui.states_frame.isVisible())

Subscribers

People subscribed via source and target branches