Merge lp:~diegosarmentero/ubuntu-sso-client/pages-migration into lp:ubuntu-sso-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 857
Merged at revision: 849
Proposed branch: lp:~diegosarmentero/ubuntu-sso-client/pages-migration
Merge into: lp:ubuntu-sso-client
Diff against target: 2945 lines (+2414/-325)
19 files modified
data/qt/choose_sign_in.ui (+105/-61)
data/qt/loadingoverlay.ui (+103/-0)
data/qt/network_detection.ui (+145/-0)
data/qt/setup_account.ui (+640/-253)
setup.py (+1/-5)
ubuntu_sso/qt/__init__.py (+13/-0)
ubuntu_sso/qt/controllers.py (+1/-2)
ubuntu_sso/qt/current_user_sign_in_page.py (+61/-0)
ubuntu_sso/qt/enhanced_check_box.py (+50/-0)
ubuntu_sso/qt/loadingoverlay.py (+123/-0)
ubuntu_sso/qt/network_detection_page.py (+79/-0)
ubuntu_sso/qt/setup_account_page.py (+226/-0)
ubuntu_sso/qt/sign_in_page.py (+61/-0)
ubuntu_sso/qt/tests/__init__.py (+249/-4)
ubuntu_sso/qt/tests/test_enhanced_check_box.py (+49/-0)
ubuntu_sso/qt/tests/test_loadingoverlay.py (+36/-0)
ubuntu_sso/qt/tests/test_network_detection.py (+95/-0)
ubuntu_sso/qt/tests/test_setup_account.py (+332/-0)
ubuntu_sso/qt/tests/test_sign_in_page.py (+45/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-sso-client/pages-migration
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+91331@code.launchpad.net

Commit message

- Migrate SSO Pages from the Wizard to SSO (Bug #925531).

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

SSO should not import nor depend from anything in controlpanel:

  File "/home/nessita/canonical/ussoc/review_pages-migration/ubuntu_sso/qt/tests/__init__.py", line 22, in <module>
    from ubuntuone.controlpanel.gui.qt import loadingoverlay
ImportError: No module named qt

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

Also, SSO should not import anything from the ubuntone namespace:

from ubuntuone.platform.credentials import (
     CredentialsManagementTool,
     CredentialsError,
)

Can you please remove that code and just query the self.backend instance? login will work in general, except for U1 accounts. For now ignore that since it will be solved with bug #839877.

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

Looks good!

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 cool!

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (61.4 KiB)

The attempt to merge lp:~diegosarmentero/ubuntu-sso-client/pages-migration into lp:ubuntu-sso-client failed. Below is the output from the failed tests.

*** Running GTK test suite for ubuntu_sso ***
ubuntu_sso.tests.test_account
  AccountTestCase
    test_generate_captcha ... [OK]
    test_is_not_validated ... [OK]
    test_is_not_validated_empty_result ... [OK]
    test_is_validated ... [OK]
    test_login_if_http_error ... [OK]
    test_login_if_no_error ... [OK]
    test_register_user_checks_valid_email ... [OK]
    test_register_user_checks_valid_password ... [OK]
    test_register_user_if_status_error ... [OK]
    test_register_user_if_status_error_with_string_message ... [OK]
    test_register_user_if_status_ok ... [OK]
    test_register_user_if_status_unknown ... [OK]
    test_request_password_reset_token_if_http_error ... [OK]
    test_request_password_reset_token_if_status_ok ... [OK]
    test_request_password_reset_token_if_status_unknown ... [OK]
    test_set_new_password_if_http_error ... [OK]
    test_set_new_password_if_status_ok ... [OK]
    test_set_new_password_if_status_unknown ... [OK]
    test_validate_email_if_status_error ... [OK]
    test_validate_email_if_status_error_with_string_message ... [OK]
    test_validate_email_if_status_ok ... [OK]
    test_validate_email_if_status_unknown ... [OK]
  EnvironOverridesTestCase
    test_no_override_service_url ... [OK]
    test_override_service_url ... [OK]
    test_service_url_as_parameter ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntu_sso.tests.test_account
  TimestampedAuthorizerTestCase
    test_authorize_request_includes_timestamp ... [OK]
ubuntu_sso.tests.test_credentials
  BasicTestCase
    runTest ... [OK]
  ClearCredentialsTestCase
    test_clear_credentials ... [OK]
    test_keyring_failure ... [OK]
  CredentialsAuthDeniedTestCase
    test_auth_denial_cb ... [OK]
  CredentialsCallbacksTestCase
    test_callbacks_are_stored ... [OK]
    test_callbacks_default_to_no_op ... [OK]
    test_creation_parameters_are_stored ... ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/qt/choose_sign_in.ui'
2--- data/qt/choose_sign_in.ui 2011-04-05 14:04:50 +0000
3+++ data/qt/choose_sign_in.ui 2012-02-07 15:10:30 +0000
4@@ -1,32 +1,103 @@
5 <?xml version="1.0" encoding="UTF-8"?>
6 <ui version="4.0">
7 <class>ChooseSignInPage</class>
8- <widget class="QWizardPage" name="ChooseSingInPage">
9+ <widget class="QWizardPage" name="ChooseSignInPage">
10 <property name="geometry">
11 <rect>
12 <x>0</x>
13 <y>0</y>
14- <width>400</width>
15- <height>300</height>
16+ <width>432</width>
17+ <height>387</height>
18 </rect>
19 </property>
20 <property name="windowTitle">
21 <string>WizardPage</string>
22 </property>
23- <layout class="QHBoxLayout" name="horizontalLayout">
24- <item>
25- <layout class="QHBoxLayout" name="horizontalLayout_3">
26+ <layout class="QVBoxLayout" name="verticalLayout_2">
27+ <property name="leftMargin">
28+ <number>0</number>
29+ </property>
30+ <property name="topMargin">
31+ <number>0</number>
32+ </property>
33+ <property name="rightMargin">
34+ <number>0</number>
35+ </property>
36+ <item>
37+ <layout class="QHBoxLayout" name="horizontalLayout_2">
38+ <item>
39+ <widget class="QLabel" name="image_label">
40+ <property name="sizePolicy">
41+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
42+ <horstretch>0</horstretch>
43+ <verstretch>0</verstretch>
44+ </sizepolicy>
45+ </property>
46+ <property name="minimumSize">
47+ <size>
48+ <width>400</width>
49+ <height>150</height>
50+ </size>
51+ </property>
52+ <property name="text">
53+ <string/>
54+ </property>
55+ <property name="textFormat">
56+ <enum>Qt::PlainText</enum>
57+ </property>
58+ <property name="alignment">
59+ <set>Qt::AlignCenter</set>
60+ </property>
61+ <property name="wordWrap">
62+ <bool>true</bool>
63+ </property>
64+ </widget>
65+ </item>
66+ </layout>
67+ </item>
68+ <item>
69+ <widget class="QLabel" name="message_label">
70+ <property name="font">
71+ <font>
72+ <pointsize>11</pointsize>
73+ <weight>50</weight>
74+ <bold>false</bold>
75+ </font>
76+ </property>
77+ <property name="text">
78+ <string>Congratulations, Ubuntu One is installed!</string>
79+ </property>
80+ <property name="alignment">
81+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
82+ </property>
83+ </widget>
84+ </item>
85+ <item>
86+ <spacer name="verticalSpacer_3">
87+ <property name="orientation">
88+ <enum>Qt::Vertical</enum>
89+ </property>
90+ <property name="sizeType">
91+ <enum>QSizePolicy::Fixed</enum>
92+ </property>
93+ <property name="sizeHint" stdset="0">
94+ <size>
95+ <width>20</width>
96+ <height>30</height>
97+ </size>
98+ </property>
99+ </spacer>
100+ </item>
101+ <item>
102+ <layout class="QHBoxLayout" name="horizontalLayout">
103 <item>
104 <spacer name="horizontalSpacer_2">
105 <property name="orientation">
106 <enum>Qt::Horizontal</enum>
107 </property>
108- <property name="sizeType">
109- <enum>QSizePolicy::Expanding</enum>
110- </property>
111 <property name="sizeHint" stdset="0">
112 <size>
113- <width>40</width>
114+ <width>20</width>
115 <height>20</height>
116 </size>
117 </property>
118@@ -35,44 +106,11 @@
119 <item>
120 <layout class="QVBoxLayout" name="verticalLayout">
121 <item>
122- <spacer name="verticalSpacer_3">
123- <property name="orientation">
124- <enum>Qt::Vertical</enum>
125- </property>
126- <property name="sizeHint" stdset="0">
127- <size>
128- <width>20</width>
129- <height>40</height>
130- </size>
131- </property>
132- </spacer>
133- </item>
134- <item>
135- <layout class="QHBoxLayout" name="horizontalLayout_2">
136- <item>
137- <widget class="QPushButton" name="existing_account_button">
138- <property name="text">
139- <string/>
140- </property>
141- </widget>
142- </item>
143- </layout>
144- </item>
145- <item>
146- <spacer name="verticalSpacer">
147- <property name="orientation">
148- <enum>Qt::Vertical</enum>
149- </property>
150- <property name="sizeType">
151- <enum>QSizePolicy::Fixed</enum>
152- </property>
153- <property name="sizeHint" stdset="0">
154- <size>
155- <width>20</width>
156- <height>10</height>
157- </size>
158- </property>
159- </spacer>
160+ <widget class="QPushButton" name="existing_account_button">
161+ <property name="text">
162+ <string/>
163+ </property>
164+ </widget>
165 </item>
166 <item>
167 <widget class="QPushButton" name="setup_account_button">
168@@ -82,17 +120,11 @@
169 </widget>
170 </item>
171 <item>
172- <spacer name="verticalSpacer_2">
173- <property name="orientation">
174- <enum>Qt::Vertical</enum>
175- </property>
176- <property name="sizeHint" stdset="0">
177- <size>
178- <width>20</width>
179- <height>40</height>
180- </size>
181- </property>
182- </spacer>
183+ <widget class="QPushButton" name="cancel_button">
184+ <property name="text">
185+ <string/>
186+ </property>
187+ </widget>
188 </item>
189 </layout>
190 </item>
191@@ -106,7 +138,7 @@
192 </property>
193 <property name="sizeHint" stdset="0">
194 <size>
195- <width>40</width>
196+ <width>20</width>
197 <height>20</height>
198 </size>
199 </property>
200@@ -114,8 +146,20 @@
201 </item>
202 </layout>
203 </item>
204+ <item>
205+ <spacer name="verticalSpacer_2">
206+ <property name="orientation">
207+ <enum>Qt::Vertical</enum>
208+ </property>
209+ <property name="sizeHint" stdset="0">
210+ <size>
211+ <width>20</width>
212+ <height>50</height>
213+ </size>
214+ </property>
215+ </spacer>
216+ </item>
217 </layout>
218 </widget>
219- <resources/>
220 <connections/>
221 </ui>
222
223=== added file 'data/qt/loadingoverlay.ui'
224--- data/qt/loadingoverlay.ui 1970-01-01 00:00:00 +0000
225+++ data/qt/loadingoverlay.ui 2012-02-07 15:10:30 +0000
226@@ -0,0 +1,103 @@
227+<?xml version="1.0" encoding="UTF-8"?>
228+<ui version="4.0">
229+ <class>Form</class>
230+ <widget class="QFrame" name="Form">
231+ <property name="geometry">
232+ <rect>
233+ <x>0</x>
234+ <y>0</y>
235+ <width>702</width>
236+ <height>230</height>
237+ </rect>
238+ </property>
239+ <property name="windowTitle">
240+ <string>Frame</string>
241+ </property>
242+ <layout class="QVBoxLayout" name="verticalLayout">
243+ <property name="topMargin">
244+ <number>30</number>
245+ </property>
246+ <item>
247+ <layout class="QHBoxLayout" name="horizontalLayout_2">
248+ <item>
249+ <spacer name="horizontalSpacer_2">
250+ <property name="orientation">
251+ <enum>Qt::Horizontal</enum>
252+ </property>
253+ <property name="sizeHint" stdset="0">
254+ <size>
255+ <width>40</width>
256+ <height>20</height>
257+ </size>
258+ </property>
259+ </spacer>
260+ </item>
261+ <item>
262+ <widget class="QFrame" name="frm_box">
263+ <property name="minimumSize">
264+ <size>
265+ <width>0</width>
266+ <height>102</height>
267+ </size>
268+ </property>
269+ <layout class="QHBoxLayout" name="horizontalLayout">
270+ <property name="topMargin">
271+ <number>0</number>
272+ </property>
273+ <property name="bottomMargin">
274+ <number>30</number>
275+ </property>
276+ <item>
277+ <widget class="QLabel" name="label">
278+ <property name="sizePolicy">
279+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
280+ <horstretch>0</horstretch>
281+ <verstretch>0</verstretch>
282+ </sizepolicy>
283+ </property>
284+ <property name="font">
285+ <font>
286+ <pointsize>14</pointsize>
287+ </font>
288+ </property>
289+ <property name="text">
290+ <string>Getting information, please wait...</string>
291+ </property>
292+ </widget>
293+ </item>
294+ </layout>
295+ </widget>
296+ </item>
297+ <item>
298+ <spacer name="horizontalSpacer">
299+ <property name="orientation">
300+ <enum>Qt::Horizontal</enum>
301+ </property>
302+ <property name="sizeHint" stdset="0">
303+ <size>
304+ <width>40</width>
305+ <height>20</height>
306+ </size>
307+ </property>
308+ </spacer>
309+ </item>
310+ </layout>
311+ </item>
312+ <item>
313+ <spacer name="verticalSpacer">
314+ <property name="orientation">
315+ <enum>Qt::Vertical</enum>
316+ </property>
317+ <property name="sizeHint" stdset="0">
318+ <size>
319+ <width>20</width>
320+ <height>20</height>
321+ </size>
322+ </property>
323+ </spacer>
324+ </item>
325+ </layout>
326+ </widget>
327+ <resources/>
328+ <connections/>
329+</ui>
330
331=== added file 'data/qt/network_detection.ui'
332--- data/qt/network_detection.ui 1970-01-01 00:00:00 +0000
333+++ data/qt/network_detection.ui 2012-02-07 15:10:30 +0000
334@@ -0,0 +1,145 @@
335+<?xml version="1.0" encoding="UTF-8"?>
336+<ui version="4.0">
337+ <class>Form</class>
338+ <widget class="QWizardPage" name="Form">
339+ <property name="geometry">
340+ <rect>
341+ <x>0</x>
342+ <y>0</y>
343+ <width>541</width>
344+ <height>365</height>
345+ </rect>
346+ </property>
347+ <property name="windowTitle">
348+ <string>WizardPage</string>
349+ </property>
350+ <layout class="QVBoxLayout" name="verticalLayout">
351+ <item>
352+ <layout class="QHBoxLayout" name="horizontalLayout_2">
353+ <item>
354+ <spacer name="horizontalSpacer_3">
355+ <property name="orientation">
356+ <enum>Qt::Horizontal</enum>
357+ </property>
358+ <property name="sizeHint" stdset="0">
359+ <size>
360+ <width>40</width>
361+ <height>20</height>
362+ </size>
363+ </property>
364+ </spacer>
365+ </item>
366+ <item>
367+ <widget class="QLabel" name="image_label">
368+ <property name="sizePolicy">
369+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
370+ <horstretch>0</horstretch>
371+ <verstretch>0</verstretch>
372+ </sizepolicy>
373+ </property>
374+ <property name="minimumSize">
375+ <size>
376+ <width>400</width>
377+ <height>150</height>
378+ </size>
379+ </property>
380+ <property name="text">
381+ <string/>
382+ </property>
383+ <property name="textFormat">
384+ <enum>Qt::PlainText</enum>
385+ </property>
386+ <property name="alignment">
387+ <set>Qt::AlignCenter</set>
388+ </property>
389+ <property name="wordWrap">
390+ <bool>true</bool>
391+ </property>
392+ </widget>
393+ </item>
394+ <item>
395+ <spacer name="horizontalSpacer_4">
396+ <property name="orientation">
397+ <enum>Qt::Horizontal</enum>
398+ </property>
399+ <property name="sizeHint" stdset="0">
400+ <size>
401+ <width>40</width>
402+ <height>20</height>
403+ </size>
404+ </property>
405+ </spacer>
406+ </item>
407+ </layout>
408+ </item>
409+ <item>
410+ <widget class="QLabel" name="message_label">
411+ <property name="text">
412+ <string>Ubuntu One has installed!</string>
413+ </property>
414+ <property name="alignment">
415+ <set>Qt::AlignCenter</set>
416+ </property>
417+ </widget>
418+ </item>
419+ <item>
420+ <layout class="QHBoxLayout" name="horizontalLayout">
421+ <item>
422+ <spacer name="horizontalSpacer">
423+ <property name="orientation">
424+ <enum>Qt::Horizontal</enum>
425+ </property>
426+ <property name="sizeHint" stdset="0">
427+ <size>
428+ <width>40</width>
429+ <height>20</height>
430+ </size>
431+ </property>
432+ </spacer>
433+ </item>
434+ <item>
435+ <widget class="QLabel" name="label">
436+ <property name="text">
437+ <string>Are you online? We can't detect an internet connection - you will need to be connected to set up Ubuntu One</string>
438+ </property>
439+ <property name="textFormat">
440+ <enum>Qt::PlainText</enum>
441+ </property>
442+ <property name="wordWrap">
443+ <bool>true</bool>
444+ </property>
445+ </widget>
446+ </item>
447+ <item>
448+ <spacer name="horizontalSpacer_2">
449+ <property name="orientation">
450+ <enum>Qt::Horizontal</enum>
451+ </property>
452+ <property name="sizeHint" stdset="0">
453+ <size>
454+ <width>40</width>
455+ <height>20</height>
456+ </size>
457+ </property>
458+ </spacer>
459+ </item>
460+ </layout>
461+ </item>
462+ <item>
463+ <spacer name="verticalSpacer">
464+ <property name="orientation">
465+ <enum>Qt::Vertical</enum>
466+ </property>
467+ <property name="sizeHint" stdset="0">
468+ <size>
469+ <width>20</width>
470+ <height>76</height>
471+ </size>
472+ </property>
473+ </spacer>
474+ </item>
475+ </layout>
476+ </widget>
477+ <resources/>
478+ <connections/>
479+</ui>
480
481=== modified file 'data/qt/setup_account.ui'
482--- data/qt/setup_account.ui 2011-09-02 12:53:55 +0000
483+++ data/qt/setup_account.ui 2012-02-07 15:10:30 +0000
484@@ -6,275 +6,662 @@
485 <rect>
486 <x>0</x>
487 <y>0</y>
488- <width>407</width>
489- <height>572</height>
490+ <width>543</width>
491+ <height>523</height>
492 </rect>
493 </property>
494+ <property name="sizePolicy">
495+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
496+ <horstretch>0</horstretch>
497+ <verstretch>0</verstretch>
498+ </sizepolicy>
499+ </property>
500+ <property name="maximumSize">
501+ <size>
502+ <width>16777215</width>
503+ <height>16777215</height>
504+ </size>
505+ </property>
506 <property name="windowTitle">
507 <string>WizardPage</string>
508 </property>
509- <layout class="QVBoxLayout" name="verticalLayout_5">
510+ <layout class="QVBoxLayout" name="verticalLayout">
511+ <property name="spacing">
512+ <number>0</number>
513+ </property>
514+ <property name="leftMargin">
515+ <number>0</number>
516+ </property>
517 <property name="topMargin">
518 <number>0</number>
519 </property>
520+ <property name="rightMargin">
521+ <number>3</number>
522+ </property>
523+ <property name="bottomMargin">
524+ <number>0</number>
525+ </property>
526 <item>
527- <layout class="QVBoxLayout" name="verticalLayout">
528- <item>
529- <widget class="QFrame" name="_signInFrame">
530- <property name="frameShape">
531- <enum>QFrame::NoFrame</enum>
532- </property>
533- <layout class="QVBoxLayout" name="verticalLayout_3">
534- <item>
535- <layout class="QVBoxLayout" name="verticalLayout_2">
536- <item>
537- <widget class="QLabel" name="password_info_label">
538- <property name="sizePolicy">
539- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
540- <horstretch>0</horstretch>
541- <verstretch>0</verstretch>
542- </sizepolicy>
543- </property>
544- <property name="text">
545- <string/>
546- </property>
547- <property name="wordWrap">
548- <bool>true</bool>
549- </property>
550- </widget>
551- </item>
552- <item>
553- <layout class="QVBoxLayout" name="verticalLayout_4">
554- <item>
555- <widget class="QLabel" name="name_label">
556- <property name="text">
557- <string/>
558- </property>
559- </widget>
560- </item>
561- <item>
562- <widget class="QLineEdit" name="name_edit">
563- <property name="placeholderText">
564- <string/>
565- </property>
566- </widget>
567- </item>
568- <item>
569- <widget class="QLabel" name="email_label">
570- <property name="text">
571- <string/>
572- </property>
573- </widget>
574- </item>
575- <item>
576- <widget class="QLineEdit" name="email_edit">
577- <property name="placeholderText">
578- <string/>
579- </property>
580- </widget>
581- </item>
582- <item>
583- <widget class="QLabel" name="confirm_email_label">
584- <property name="text">
585- <string/>
586- </property>
587- </widget>
588- </item>
589- <item>
590- <widget class="QLineEdit" name="confirm_email_edit">
591- <property name="placeholderText">
592- <string/>
593- </property>
594- </widget>
595- </item>
596- <item>
597- <widget class="QLabel" name="password_label">
598- <property name="text">
599- <string/>
600- </property>
601- </widget>
602- </item>
603- <item>
604- <widget class="QLineEdit" name="password_edit">
605- <property name="toolTip">
606- <string>Your password must be at least 8 characters long and at least contain one number and one upper later.</string>
607- </property>
608- <property name="statusTip">
609- <string/>
610- </property>
611- <property name="echoMode">
612- <enum>QLineEdit::Password</enum>
613- </property>
614- <property name="placeholderText">
615- <string/>
616- </property>
617- </widget>
618- </item>
619- <item>
620- <widget class="QLabel" name="confirm_password_label">
621- <property name="text">
622- <string/>
623- </property>
624- </widget>
625- </item>
626- <item>
627- <widget class="QLineEdit" name="confirm_password_edit">
628- <property name="echoMode">
629- <enum>QLineEdit::Password</enum>
630- </property>
631- <property name="placeholderText">
632- <string/>
633- </property>
634- </widget>
635- </item>
636- </layout>
637- </item>
638- <item>
639- <layout class="QVBoxLayout" name="verticalLayout_9">
640- <item>
641- <widget class="QFrame" name="frame_2">
642- <property name="sizePolicy">
643- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
644- <horstretch>0</horstretch>
645- <verstretch>0</verstretch>
646- </sizepolicy>
647- </property>
648- <property name="frameShape">
649- <enum>QFrame::StyledPanel</enum>
650- </property>
651- <property name="frameShadow">
652- <enum>QFrame::Raised</enum>
653- </property>
654- <layout class="QHBoxLayout" name="horizontalLayout_16">
655- <property name="leftMargin">
656- <number>0</number>
657- </property>
658- <item>
659- <widget class="QLabel" name="captcha_view">
660- <property name="minimumSize">
661- <size>
662- <width>0</width>
663- <height>57</height>
664- </size>
665- </property>
666- <property name="frameShape">
667- <enum>QFrame::Box</enum>
668- </property>
669- <property name="text">
670- <string/>
671- </property>
672- </widget>
673- </item>
674- <item>
675- <widget class="QLabel" name="refresh_label">
676- <property name="sizePolicy">
677- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
678- <horstretch>0</horstretch>
679- <verstretch>0</verstretch>
680- </sizepolicy>
681- </property>
682- <property name="locale">
683- <locale language="English" country="UnitedStates"/>
684- </property>
685- <property name="text">
686- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
687-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
688-p, li { white-space: pre-wrap; }
689-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
690-&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;If you can't read this then &lt;/span&gt;&lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; this page&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
691- </property>
692- <property name="wordWrap">
693- <bool>true</bool>
694- </property>
695- </widget>
696- </item>
697- </layout>
698- </widget>
699- </item>
700- <item>
701- <widget class="QLineEdit" name="captcha_solution_edit">
702- <property name="locale">
703- <locale language="English" country="UnitedStates"/>
704- </property>
705- <property name="inputMask">
706- <string/>
707- </property>
708- <property name="text">
709- <string/>
710- </property>
711- <property name="placeholderText">
712- <string/>
713- </property>
714- </widget>
715- </item>
716- </layout>
717- </item>
718- <item>
719- <widget class="QCheckBox" name="terms_checkbox">
720- <property name="text">
721- <string/>
722- </property>
723- </widget>
724- </item>
725- <item>
726- <layout class="QHBoxLayout" name="horizontalLayout_4">
727- <property name="spacing">
728- <number>0</number>
729- </property>
730- <item>
731- <widget class="QPushButton" name="terms_button">
732- <property name="text">
733- <string/>
734- </property>
735- </widget>
736- </item>
737- <item>
738- <spacer name="horizontalSpacer_3">
739- <property name="orientation">
740- <enum>Qt::Horizontal</enum>
741- </property>
742- <property name="sizeHint" stdset="0">
743- <size>
744- <width>40</width>
745- <height>20</height>
746- </size>
747- </property>
748- </spacer>
749- </item>
750- <item>
751- <widget class="QPushButton" name="set_up_button">
752- <property name="enabled">
753- <bool>false</bool>
754- </property>
755- <property name="text">
756- <string/>
757- </property>
758- </widget>
759- </item>
760- </layout>
761- </item>
762- </layout>
763- </item>
764- </layout>
765- </widget>
766- </item>
767- <item>
768+ <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,220">
769+ <item row="0" column="0">
770+ <widget class="QLabel" name="password_info_label">
771+ <property name="sizePolicy">
772+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
773+ <horstretch>0</horstretch>
774+ <verstretch>0</verstretch>
775+ </sizepolicy>
776+ </property>
777+ <property name="text">
778+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#dd4814;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
779+ </property>
780+ <property name="wordWrap">
781+ <bool>true</bool>
782+ </property>
783+ </widget>
784+ </item>
785+ <item row="1" column="0">
786+ <layout class="QVBoxLayout" name="verticalLayout">
787+ <property name="spacing">
788+ <number>3</number>
789+ </property>
790+ <item>
791+ <widget class="QLabel" name="name_label">
792+ <property name="font">
793+ <font>
794+ <weight>75</weight>
795+ <bold>true</bold>
796+ </font>
797+ </property>
798+ <property name="text">
799+ <string>name_label</string>
800+ </property>
801+ </widget>
802+ </item>
803+ <item>
804+ <widget class="QLineEdit" name="name_edit">
805+ <property name="sizePolicy">
806+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
807+ <horstretch>0</horstretch>
808+ <verstretch>0</verstretch>
809+ </sizepolicy>
810+ </property>
811+ <property name="minimumSize">
812+ <size>
813+ <width>300</width>
814+ <height>0</height>
815+ </size>
816+ </property>
817+ <property name="maximumSize">
818+ <size>
819+ <width>300</width>
820+ <height>16777215</height>
821+ </size>
822+ </property>
823+ <property name="font">
824+ <font>
825+ <pointsize>11</pointsize>
826+ </font>
827+ </property>
828+ <property name="formError" stdset="0">
829+ <bool>false</bool>
830+ </property>
831+ </widget>
832+ </item>
833+ </layout>
834+ </item>
835+ <item row="3" column="0">
836+ <layout class="QVBoxLayout" name="verticalLayout">
837+ <property name="spacing">
838+ <number>3</number>
839+ </property>
840+ <item>
841+ <widget class="QLabel" name="email_label">
842+ <property name="font">
843+ <font>
844+ <weight>75</weight>
845+ <bold>true</bold>
846+ </font>
847+ </property>
848+ <property name="text">
849+ <string>email_label</string>
850+ </property>
851+ </widget>
852+ </item>
853+ <item>
854+ <widget class="QLineEdit" name="email_edit">
855+ <property name="sizePolicy">
856+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
857+ <horstretch>0</horstretch>
858+ <verstretch>0</verstretch>
859+ </sizepolicy>
860+ </property>
861+ <property name="minimumSize">
862+ <size>
863+ <width>300</width>
864+ <height>0</height>
865+ </size>
866+ </property>
867+ <property name="maximumSize">
868+ <size>
869+ <width>300</width>
870+ <height>16777215</height>
871+ </size>
872+ </property>
873+ <property name="font">
874+ <font>
875+ <pointsize>11</pointsize>
876+ </font>
877+ </property>
878+ <property name="placeholderText">
879+ <string/>
880+ </property>
881+ <property name="formError" stdset="0">
882+ <bool>false</bool>
883+ </property>
884+ </widget>
885+ </item>
886+ </layout>
887+ </item>
888+ <item row="4" column="0">
889+ <layout class="QVBoxLayout" name="verticalLayout">
890+ <property name="spacing">
891+ <number>3</number>
892+ </property>
893+ <item>
894+ <widget class="QLabel" name="confirm_email_label">
895+ <property name="font">
896+ <font>
897+ <weight>75</weight>
898+ <bold>true</bold>
899+ </font>
900+ </property>
901+ <property name="text">
902+ <string>confirm_email_label</string>
903+ </property>
904+ </widget>
905+ </item>
906+ <item>
907+ <widget class="QLineEdit" name="confirm_email_edit">
908+ <property name="sizePolicy">
909+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
910+ <horstretch>0</horstretch>
911+ <verstretch>0</verstretch>
912+ </sizepolicy>
913+ </property>
914+ <property name="minimumSize">
915+ <size>
916+ <width>300</width>
917+ <height>0</height>
918+ </size>
919+ </property>
920+ <property name="maximumSize">
921+ <size>
922+ <width>300</width>
923+ <height>16777215</height>
924+ </size>
925+ </property>
926+ <property name="font">
927+ <font>
928+ <pointsize>11</pointsize>
929+ </font>
930+ </property>
931+ <property name="placeholderText">
932+ <string/>
933+ </property>
934+ <property name="formError" stdset="0">
935+ <bool>false</bool>
936+ </property>
937+ </widget>
938+ </item>
939+ </layout>
940+ </item>
941+ <item row="6" column="0">
942+ <layout class="QVBoxLayout" name="verticalLayout">
943+ <property name="spacing">
944+ <number>3</number>
945+ </property>
946+ <item>
947+ <widget class="QLabel" name="password_label">
948+ <property name="font">
949+ <font>
950+ <weight>75</weight>
951+ <bold>true</bold>
952+ </font>
953+ </property>
954+ <property name="text">
955+ <string>password_label</string>
956+ </property>
957+ </widget>
958+ </item>
959+ <item>
960+ <widget class="QLineEdit" name="password_edit">
961+ <property name="sizePolicy">
962+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
963+ <horstretch>0</horstretch>
964+ <verstretch>0</verstretch>
965+ </sizepolicy>
966+ </property>
967+ <property name="minimumSize">
968+ <size>
969+ <width>300</width>
970+ <height>0</height>
971+ </size>
972+ </property>
973+ <property name="maximumSize">
974+ <size>
975+ <width>300</width>
976+ <height>16777215</height>
977+ </size>
978+ </property>
979+ <property name="font">
980+ <font>
981+ <pointsize>11</pointsize>
982+ </font>
983+ </property>
984+ <property name="toolTip">
985+ <string>Your password must be at least 8 characters long and at least contain one number and one upper later.</string>
986+ </property>
987+ <property name="statusTip">
988+ <string/>
989+ </property>
990+ <property name="echoMode">
991+ <enum>QLineEdit::Password</enum>
992+ </property>
993+ <property name="placeholderText">
994+ <string/>
995+ </property>
996+ <property name="formError" stdset="0">
997+ <bool>false</bool>
998+ </property>
999+ </widget>
1000+ </item>
1001+ </layout>
1002+ </item>
1003+ <item row="7" column="0">
1004+ <layout class="QVBoxLayout" name="verticalLayout">
1005+ <property name="spacing">
1006+ <number>3</number>
1007+ </property>
1008+ <item>
1009+ <widget class="QLabel" name="confirm_password_label">
1010+ <property name="font">
1011+ <font>
1012+ <weight>75</weight>
1013+ <bold>true</bold>
1014+ </font>
1015+ </property>
1016+ <property name="text">
1017+ <string>confirm_password_label</string>
1018+ </property>
1019+ </widget>
1020+ </item>
1021+ <item>
1022+ <widget class="QLineEdit" name="confirm_password_edit">
1023+ <property name="sizePolicy">
1024+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
1025+ <horstretch>0</horstretch>
1026+ <verstretch>0</verstretch>
1027+ </sizepolicy>
1028+ </property>
1029+ <property name="minimumSize">
1030+ <size>
1031+ <width>300</width>
1032+ <height>0</height>
1033+ </size>
1034+ </property>
1035+ <property name="maximumSize">
1036+ <size>
1037+ <width>300</width>
1038+ <height>16777215</height>
1039+ </size>
1040+ </property>
1041+ <property name="font">
1042+ <font>
1043+ <pointsize>11</pointsize>
1044+ </font>
1045+ </property>
1046+ <property name="echoMode">
1047+ <enum>QLineEdit::Password</enum>
1048+ </property>
1049+ <property name="placeholderText">
1050+ <string/>
1051+ </property>
1052+ <property name="formError" stdset="0">
1053+ <bool>false</bool>
1054+ </property>
1055+ </widget>
1056+ </item>
1057+ </layout>
1058+ </item>
1059+ <item row="9" column="0">
1060+ <layout class="QVBoxLayout" name="verticalLayout">
1061+ <property name="spacing">
1062+ <number>3</number>
1063+ </property>
1064+ <item>
1065+ <widget class="QLabel" name="captcha_view">
1066+ <property name="sizePolicy">
1067+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
1068+ <horstretch>0</horstretch>
1069+ <verstretch>0</verstretch>
1070+ </sizepolicy>
1071+ </property>
1072+ <property name="minimumSize">
1073+ <size>
1074+ <width>300</width>
1075+ <height>57</height>
1076+ </size>
1077+ </property>
1078+ <property name="maximumSize">
1079+ <size>
1080+ <width>300</width>
1081+ <height>16777215</height>
1082+ </size>
1083+ </property>
1084+ <property name="styleSheet">
1085+ <string notr="true">background-color: white</string>
1086+ </property>
1087+ <property name="frameShape">
1088+ <enum>QFrame::Box</enum>
1089+ </property>
1090+ <property name="text">
1091+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#dd4814;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
1092+ </property>
1093+ </widget>
1094+ </item>
1095+ <item>
1096+ <widget class="QLineEdit" name="captcha_solution_edit">
1097+ <property name="sizePolicy">
1098+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
1099+ <horstretch>0</horstretch>
1100+ <verstretch>0</verstretch>
1101+ </sizepolicy>
1102+ </property>
1103+ <property name="minimumSize">
1104+ <size>
1105+ <width>300</width>
1106+ <height>0</height>
1107+ </size>
1108+ </property>
1109+ <property name="maximumSize">
1110+ <size>
1111+ <width>300</width>
1112+ <height>16777215</height>
1113+ </size>
1114+ </property>
1115+ <property name="font">
1116+ <font>
1117+ <pointsize>11</pointsize>
1118+ </font>
1119+ </property>
1120+ <property name="locale">
1121+ <locale language="English" country="UnitedStates"/>
1122+ </property>
1123+ <property name="inputMask">
1124+ <string/>
1125+ </property>
1126+ <property name="text">
1127+ <string/>
1128+ </property>
1129+ <property name="placeholderText">
1130+ <string/>
1131+ </property>
1132+ <property name="formError" stdset="0">
1133+ <bool>false</bool>
1134+ </property>
1135+ </widget>
1136+ </item>
1137+ </layout>
1138+ </item>
1139+ <item row="9" column="1">
1140+ <widget class="QLabel" name="refresh_label">
1141+ <property name="sizePolicy">
1142+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
1143+ <horstretch>0</horstretch>
1144+ <verstretch>0</verstretch>
1145+ </sizepolicy>
1146+ </property>
1147+ <property name="minimumSize">
1148+ <size>
1149+ <width>220</width>
1150+ <height>0</height>
1151+ </size>
1152+ </property>
1153+ <property name="maximumSize">
1154+ <size>
1155+ <width>220</width>
1156+ <height>16777215</height>
1157+ </size>
1158+ </property>
1159+ <property name="locale">
1160+ <locale language="English" country="UnitedStates"/>
1161+ </property>
1162+ <property name="text">
1163+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#dd4814;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
1164+ </property>
1165+ <property name="wordWrap">
1166+ <bool>true</bool>
1167+ </property>
1168+ <property name="indent">
1169+ <number>0</number>
1170+ </property>
1171+ </widget>
1172+ </item>
1173+ <item row="1" column="1">
1174+ <layout class="QVBoxLayout" name="verticalLayout_7">
1175+ <property name="spacing">
1176+ <number>0</number>
1177+ </property>
1178+ <property name="leftMargin">
1179+ <number>0</number>
1180+ </property>
1181+ <item>
1182+ <widget class="QLabel" name="name_assistance">
1183+ <property name="sizePolicy">
1184+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
1185+ <horstretch>0</horstretch>
1186+ <verstretch>0</verstretch>
1187+ </sizepolicy>
1188+ </property>
1189+ <property name="minimumSize">
1190+ <size>
1191+ <width>220</width>
1192+ <height>0</height>
1193+ </size>
1194+ </property>
1195+ <property name="maximumSize">
1196+ <size>
1197+ <width>220</width>
1198+ <height>16777215</height>
1199+ </size>
1200+ </property>
1201+ <property name="text">
1202+ <string>name_assistance</string>
1203+ </property>
1204+ <property name="alignment">
1205+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
1206+ </property>
1207+ <property name="wordWrap">
1208+ <bool>true</bool>
1209+ </property>
1210+ </widget>
1211+ </item>
1212+ </layout>
1213+ </item>
1214+ <item row="3" column="1">
1215+ <layout class="QVBoxLayout" name="verticalLayout_8">
1216+ <property name="spacing">
1217+ <number>0</number>
1218+ </property>
1219+ <property name="leftMargin">
1220+ <number>0</number>
1221+ </property>
1222+ <item>
1223+ <widget class="QLabel" name="email_assistance">
1224+ <property name="sizePolicy">
1225+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
1226+ <horstretch>0</horstretch>
1227+ <verstretch>0</verstretch>
1228+ </sizepolicy>
1229+ </property>
1230+ <property name="minimumSize">
1231+ <size>
1232+ <width>220</width>
1233+ <height>0</height>
1234+ </size>
1235+ </property>
1236+ <property name="maximumSize">
1237+ <size>
1238+ <width>220</width>
1239+ <height>16777215</height>
1240+ </size>
1241+ </property>
1242+ <property name="text">
1243+ <string>email_assistance</string>
1244+ </property>
1245+ <property name="alignment">
1246+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
1247+ </property>
1248+ <property name="wordWrap">
1249+ <bool>true</bool>
1250+ </property>
1251+ </widget>
1252+ </item>
1253+ </layout>
1254+ </item>
1255+ <item row="4" column="1">
1256+ <layout class="QVBoxLayout" name="verticalLayout_9">
1257+ <property name="spacing">
1258+ <number>0</number>
1259+ </property>
1260+ <property name="leftMargin">
1261+ <number>0</number>
1262+ </property>
1263+ <item>
1264+ <widget class="QLabel" name="confirm_email_assistance">
1265+ <property name="sizePolicy">
1266+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
1267+ <horstretch>0</horstretch>
1268+ <verstretch>0</verstretch>
1269+ </sizepolicy>
1270+ </property>
1271+ <property name="minimumSize">
1272+ <size>
1273+ <width>220</width>
1274+ <height>0</height>
1275+ </size>
1276+ </property>
1277+ <property name="maximumSize">
1278+ <size>
1279+ <width>220</width>
1280+ <height>16777215</height>
1281+ </size>
1282+ </property>
1283+ <property name="text">
1284+ <string>confirm_email_assistance</string>
1285+ </property>
1286+ <property name="alignment">
1287+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
1288+ </property>
1289+ <property name="wordWrap">
1290+ <bool>true</bool>
1291+ </property>
1292+ <property name="indent">
1293+ <number>0</number>
1294+ </property>
1295+ </widget>
1296+ </item>
1297+ </layout>
1298+ </item>
1299+ <item row="6" column="1" rowspan="2">
1300+ <widget class="QLabel" name="password_assistance">
1301+ <property name="sizePolicy">
1302+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
1303+ <horstretch>0</horstretch>
1304+ <verstretch>0</verstretch>
1305+ </sizepolicy>
1306+ </property>
1307+ <property name="minimumSize">
1308+ <size>
1309+ <width>220</width>
1310+ <height>0</height>
1311+ </size>
1312+ </property>
1313+ <property name="maximumSize">
1314+ <size>
1315+ <width>220</width>
1316+ <height>16777215</height>
1317+ </size>
1318+ </property>
1319+ <property name="text">
1320+ <string>password_assistance</string>
1321+ </property>
1322+ <property name="wordWrap">
1323+ <bool>true</bool>
1324+ </property>
1325+ <property name="indent">
1326+ <number>17</number>
1327+ </property>
1328+ </widget>
1329+ </item>
1330+ <item row="2" column="1">
1331+ <spacer name="verticalSpacer">
1332+ <property name="orientation">
1333+ <enum>Qt::Vertical</enum>
1334+ </property>
1335+ <property name="sizeType">
1336+ <enum>QSizePolicy::Fixed</enum>
1337+ </property>
1338+ <property name="sizeHint" stdset="0">
1339+ <size>
1340+ <width>20</width>
1341+ <height>15</height>
1342+ </size>
1343+ </property>
1344+ </spacer>
1345+ </item>
1346+ <item row="5" column="1">
1347 <spacer name="verticalSpacer_2">
1348 <property name="orientation">
1349 <enum>Qt::Vertical</enum>
1350 </property>
1351- <property name="sizeHint" stdset="0">
1352- <size>
1353- <width>20</width>
1354- <height>40</height>
1355- </size>
1356- </property>
1357- </spacer>
1358- </item>
1359+ <property name="sizeType">
1360+ <enum>QSizePolicy::Fixed</enum>
1361+ </property>
1362+ <property name="sizeHint" stdset="0">
1363+ <size>
1364+ <width>20</width>
1365+ <height>15</height>
1366+ </size>
1367+ </property>
1368+ </spacer>
1369+ </item>
1370+ <item row="8" column="1">
1371+ <spacer name="verticalSpacer_3">
1372+ <property name="orientation">
1373+ <enum>Qt::Vertical</enum>
1374+ </property>
1375+ <property name="sizeType">
1376+ <enum>QSizePolicy::Fixed</enum>
1377+ </property>
1378+ <property name="sizeHint" stdset="0">
1379+ <size>
1380+ <width>20</width>
1381+ <height>15</height>
1382+ </size>
1383+ </property>
1384+ </spacer>
1385+ </item>
1386+ </layout>
1387+ </item>
1388+ <item>
1389+ <layout class="QHBoxLayout" name="hlayout_check">
1390+ <property name="spacing">
1391+ <number>0</number>
1392+ </property>
1393 </layout>
1394 </item>
1395 </layout>
1396 </widget>
1397- <resources/>
1398 <connections/>
1399 </ui>
1400
1401=== modified file 'setup.py'
1402--- setup.py 2012-02-01 20:20:45 +0000
1403+++ setup.py 2012-02-07 15:10:30 +0000
1404@@ -1,11 +1,7 @@
1405 #!/usr/bin/env python
1406 # setup.py - Build system for Ubuntu SSO Client package
1407 #
1408-# Authors: Natalia B. Bidart <natalia.bidart@canonical.com>
1409-# Manuel de la Pena <manuel@canonical.com>
1410-# Alejandro J. Cura <alecu@canonical.com>
1411-#
1412-# Copyright 2010-2011 Canonical Ltd.
1413+# Copyright 2010-2012 Canonical Ltd.
1414 #
1415 # This program is free software: you can redistribute it and/or modify it
1416 # under the terms of the GNU General Public License version 3, as published
1417
1418=== modified file 'ubuntu_sso/qt/__init__.py'
1419--- ubuntu_sso/qt/__init__.py 2012-02-01 19:19:32 +0000
1420+++ ubuntu_sso/qt/__init__.py 2012-02-07 15:10:30 +0000
1421@@ -15,3 +15,16 @@
1422 # with this program. If not, see <http://www.gnu.org/licenses/>.
1423
1424 """The Qt graphical interface for the Ubuntu Single Sign On Client."""
1425+
1426+import gettext
1427+
1428+
1429+_ = gettext.gettext
1430+
1431+LOCAL_FOLDERS_TITLE = _("Syncing your computer with the cloud")
1432+LOCAL_FOLDERS_SPACE_HEADER = _("Space (%s)")
1433+LOCAL_FOLDERS_OFFER_LABEL = _("The folders you have selected to sync "
1434+ "take over your %(quota)s space. You can remove some folders or add "
1435+ "some extra space")
1436+LOCAL_FOLDERS_CALCULATING = _("Calculating")
1437+NEXT = _("Next")
1438
1439=== modified file 'ubuntu_sso/qt/controllers.py'
1440--- ubuntu_sso/qt/controllers.py 2012-02-01 19:19:32 +0000
1441+++ ubuntu_sso/qt/controllers.py 2012-02-07 15:10:30 +0000
1442@@ -1,7 +1,6 @@
1443 # -*- coding: utf-8 -*-
1444-# Author: Manuel de la Pena <manuel@canonical.com>
1445 #
1446-# Copyright 2011 Canonical Ltd.
1447+# Copyright 2011-2012 Canonical Ltd.
1448 #
1449 # This program is free software: you can redistribute it and/or modify it
1450 # under the terms of the GNU General Public License version 3, as published
1451
1452=== added file 'ubuntu_sso/qt/current_user_sign_in_page.py'
1453--- ubuntu_sso/qt/current_user_sign_in_page.py 1970-01-01 00:00:00 +0000
1454+++ ubuntu_sso/qt/current_user_sign_in_page.py 2012-02-07 15:10:30 +0000
1455@@ -0,0 +1,61 @@
1456+# -*- coding: utf-8 -*-
1457+
1458+# Copyright 2012 Canonical Ltd.
1459+#
1460+# This program is free software: you can redistribute it and/or modify it
1461+# under the terms of the GNU General Public License version 3, as published
1462+# by the Free Software Foundation.
1463+#
1464+# This program is distributed in the hope that it will be useful, but
1465+# WITHOUT ANY WARRANTY; without even the implied warranties of
1466+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1467+# PURPOSE. See the GNU General Public License for more details.
1468+#
1469+# You should have received a copy of the GNU General Public License along
1470+# with this program. If not, see <http://www.gnu.org/licenses/>.
1471+
1472+"""Page to allow the user to login into Ubuntu One."""
1473+
1474+import gettext
1475+
1476+from PyQt4 import QtGui
1477+
1478+from ubuntu_sso.qt.gui import SSOWizardPage
1479+
1480+
1481+_ = gettext.gettext
1482+
1483+
1484+class CurrentUserSignInPage(SSOWizardPage):
1485+ """Wizard Page that lets a current user Sign into Ubuntu One."""
1486+
1487+ # Invalid names of Qt-inherited methods
1488+ # pylint: disable=C0103
1489+
1490+ def nextId(self):
1491+ """Provide the next id."""
1492+ return self.next
1493+
1494+ def initializePage(self):
1495+ """Setup UI details."""
1496+ self.setButtonText(QtGui.QWizard.CancelButton,
1497+ _("Cancel"))
1498+ # Layout without custom button 1,
1499+ # without finish button
1500+ self.wizard().setButtonLayout([
1501+ QtGui.QWizard.BackButton,
1502+ QtGui.QWizard.Stretch])
1503+
1504+ # Set sign_in_button as default when the page is shown.
1505+ self.ui.sign_in_button.setDefault(True)
1506+ self.ui.sign_in_button.setEnabled(False)
1507+ self.ui.sign_in_button.setProperty("DisabledState",
1508+ not self.ui.sign_in_button.isEnabled())
1509+ self.ui.sign_in_button.style().unpolish(
1510+ self.ui.sign_in_button)
1511+ self.ui.sign_in_button.style().polish(
1512+ self.ui.sign_in_button)
1513+
1514+ def cleanupPage(self):
1515+ """Reset the state of the wizard if Verification code was visited."""
1516+ self.wizard()._next_id = None
1517
1518=== added file 'ubuntu_sso/qt/enhanced_check_box.py'
1519--- ubuntu_sso/qt/enhanced_check_box.py 1970-01-01 00:00:00 +0000
1520+++ ubuntu_sso/qt/enhanced_check_box.py 2012-02-07 15:10:30 +0000
1521@@ -0,0 +1,50 @@
1522+# -*- coding: utf-8 -*-
1523+
1524+# Authors: Diego Sarmentero <diego.sarmentero@canonical.com>
1525+#
1526+# Copyright 2011 Canonical Ltd.
1527+#
1528+# This program is free software: you can redistribute it and/or modify it
1529+# under the terms of the GNU General Public License version 3, as published
1530+# by the Free Software Foundation.
1531+#
1532+# This program is distributed in the hope that it will be useful, but
1533+# WITHOUT ANY WARRANTY; without even the implied warranties of
1534+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1535+# PURPOSE. See the GNU General Public License for more details.
1536+#
1537+# You should have received a copy of the GNU General Public License along
1538+# with this program. If not, see <http://www.gnu.org/licenses/>.
1539+
1540+"""Customized Check Box to support links."""
1541+
1542+from PyQt4 import QtGui
1543+
1544+
1545+class EnhancedCheckBox(QtGui.QCheckBox):
1546+ """Enhanced QCheckBox to support links in the message displayed."""
1547+
1548+ def __init__(self, text=""):
1549+ QtGui.QCheckBox.__init__(self)
1550+ hbox = QtGui.QHBoxLayout()
1551+ self.text_label = QtGui.QLabel(text)
1552+ self.text_label.setOpenExternalLinks(True)
1553+ padding = self.iconSize().width()
1554+ self.text_label.setStyleSheet("padding-left: {0}px;".format(padding))
1555+ hbox.addWidget(self.text_label)
1556+ self.setLayout(hbox)
1557+
1558+ self.stateChanged.connect(self.text_label.setFocus)
1559+
1560+ def text(self):
1561+ """Return the text of this widget."""
1562+ return self.text_label.text()
1563+
1564+ # Invalid name "setText"
1565+ # pylint: disable=C0103
1566+
1567+ def setText(self, text):
1568+ """Set a new text to this widget."""
1569+ self.text_label.setText(text)
1570+
1571+ # pylint: enable=C0103
1572
1573=== added file 'ubuntu_sso/qt/loadingoverlay.py'
1574--- ubuntu_sso/qt/loadingoverlay.py 1970-01-01 00:00:00 +0000
1575+++ ubuntu_sso/qt/loadingoverlay.py 2012-02-07 15:10:30 +0000
1576@@ -0,0 +1,123 @@
1577+# -*- coding: utf-8 -*-
1578+
1579+# Copyright 2012 Canonical Ltd.
1580+#
1581+# This program is free software: you can redistribute it and/or modify it
1582+# under the terms of the GNU General Public License version 3, as published
1583+# by the Free Software Foundation.
1584+#
1585+# This program is distributed in the hope that it will be useful, but
1586+# WITHOUT ANY WARRANTY; without even the implied warranties of
1587+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1588+# PURPOSE. See the GNU General Public License for more details.
1589+#
1590+# You should have received a copy of the GNU General Public License along
1591+# with this program. If not, see <http://www.gnu.org/licenses/>.
1592+
1593+"""Loading animation over a widget."""
1594+
1595+from PyQt4 import QtGui, QtCore
1596+
1597+from ubuntu_sso.qt.ui import loadingoverlay_ui
1598+
1599+
1600+class LoadingOverlay(QtGui.QFrame):
1601+ """The widget that shows a loading animation and disable the widget below.
1602+
1603+ In order to have this working, the Widget which is going to use this
1604+ overlay has to reimplement the resizeEvent as follows:
1605+
1606+ def resizeEvent(self, event):
1607+ self.overlay.resize(event.size())
1608+ event.accept()
1609+
1610+ """
1611+
1612+ def __init__(self, parent=None):
1613+ super(LoadingOverlay, self).__init__(parent=parent)
1614+ self.ui = loadingoverlay_ui.Ui_Form()
1615+ self.ui.setupUi(self)
1616+
1617+ self.timer = None
1618+ self.counter = 0
1619+ self.orientation = False
1620+
1621+ # Invalid name "paintEvent"
1622+ # pylint: disable=C0103
1623+
1624+ def paintEvent(self, event):
1625+ """Paint over the widget to overlay its content."""
1626+ painter = QtGui.QPainter()
1627+ painter.begin(self)
1628+ painter.setRenderHint(QtGui.QPainter.TextAntialiasing, True)
1629+ painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
1630+ painter.fillRect(event.rect(), QtGui.QBrush(
1631+ QtGui.QColor(255, 255, 255, 135)))
1632+ painter.setPen(QtGui.QPen(QtCore.Qt.NoPen))
1633+ painter.end()
1634+ QtGui.QFrame.paintEvent(self, event)
1635+
1636+ # Invalid name "eventFilter"
1637+ # pylint: disable=C0103
1638+
1639+ def eventFilter(self, obj, event):
1640+ """Filter events from Frame content to draw the dot animation."""
1641+ if getattr(self, 'ui', None) is not None and \
1642+ obj == self.ui.frm_box and event.type() == QtCore.QEvent.Paint:
1643+ painter = QtGui.QPainter()
1644+ painter.begin(obj)
1645+ painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
1646+ pos_x = self.ui.frm_box.width() / 3
1647+ x_padding = pos_x / 5
1648+ for i in xrange(5):
1649+ if self.counter != i:
1650+ linear_gradient = QtGui.QLinearGradient(
1651+ pos_x + (x_padding * i),
1652+ self.ui.frm_box.height() / 2 + 10,
1653+ pos_x + (x_padding * i) + 15,
1654+ self.ui.frm_box.height() / 2 + 25)
1655+ linear_gradient.setColorAt(0, QtGui.QColor(205, 200, 198))
1656+ linear_gradient.setColorAt(1, QtGui.QColor(237, 237, 237))
1657+ painter.setBrush(QtGui.QBrush(linear_gradient))
1658+ else:
1659+ linear_gradient = QtGui.QLinearGradient(
1660+ pos_x + (x_padding * i),
1661+ self.ui.frm_box.height() / 2 + 10,
1662+ pos_x + (x_padding * i) + 15,
1663+ self.ui.frm_box.height() / 2 + 25)
1664+ linear_gradient.setColorAt(0, QtGui.QColor(240, 67, 26))
1665+ linear_gradient.setColorAt(1, QtGui.QColor(255, 122, 53))
1666+ painter.setBrush(QtGui.QBrush(linear_gradient))
1667+ painter.drawEllipse(
1668+ pos_x + (x_padding * i),
1669+ self.ui.frm_box.height() / 2 + 10,
1670+ 15, 15)
1671+
1672+ painter.end()
1673+ return False
1674+
1675+ # Invalid name "showEvent"
1676+ # pylint: disable=C0103
1677+
1678+ def showEvent(self, event):
1679+ """Start the dot animation."""
1680+ self.ui.frm_box.installEventFilter(self)
1681+ palette = QtGui.QPalette(self.palette())
1682+ palette.setColor(palette.Background, QtCore.Qt.transparent)
1683+ self.setPalette(palette)
1684+
1685+ if not self.timer:
1686+ self.timer = self.startTimer(200)
1687+
1688+ # Invalid name "timerEvent"
1689+ # pylint: disable=C0103
1690+
1691+ def timerEvent(self, event):
1692+ """Execute a loop to update the dot animation."""
1693+ if self.counter in (0, 4):
1694+ self.orientation = not self.orientation
1695+ if self.orientation:
1696+ self.counter += 1
1697+ else:
1698+ self.counter -= 1
1699+ self.update()
1700
1701=== added file 'ubuntu_sso/qt/network_detection_page.py'
1702--- ubuntu_sso/qt/network_detection_page.py 1970-01-01 00:00:00 +0000
1703+++ ubuntu_sso/qt/network_detection_page.py 2012-02-07 15:10:30 +0000
1704@@ -0,0 +1,79 @@
1705+# -*- coding: utf-8 -*-
1706+
1707+# Copyright 2012 Canonical Ltd.
1708+#
1709+# This program is free software: you can redistribute it and/or modify it
1710+# under the terms of the GNU General Public License version 3, as published
1711+# by the Free Software Foundation.
1712+#
1713+# This program is distributed in the hope that it will be useful, but
1714+# WITHOUT ANY WARRANTY; without even the implied warranties of
1715+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1716+# PURPOSE. See the GNU General Public License for more details.
1717+#
1718+# You should have received a copy of the GNU General Public License along
1719+# with this program. If not, see <http://www.gnu.org/licenses/>.
1720+
1721+"""Pages from SSO."""
1722+
1723+
1724+import gettext
1725+
1726+from twisted.internet import defer
1727+from PyQt4 import QtGui
1728+
1729+from ubuntu_sso import networkstate
1730+
1731+from ubuntu_sso.qt.ui import network_detection_ui
1732+
1733+_ = gettext.gettext
1734+
1735+
1736+class NetworkDetectionPage(QtGui.QWizardPage):
1737+
1738+ """Widget to show if we don't detect a network connection."""
1739+
1740+ def __init__(self, banner_pixmap=None, parent=None):
1741+ super(NetworkDetectionPage, self).__init__(parent)
1742+ self.setTitle(_("Installing Ubuntu One"))
1743+ self.ui = network_detection_ui.Ui_Form()
1744+ self.ui.setupUi(self)
1745+ if banner_pixmap is not None:
1746+ self.ui.image_label.setPixmap(banner_pixmap)
1747+ self.btn_try_again = None
1748+
1749+ # pylint: disable=C0103
1750+ def initializePage(self):
1751+ """Set UI details."""
1752+ self.wizard()._next_id = None
1753+
1754+ self.setButtonText(QtGui.QWizard.CustomButton1, _("Try again"))
1755+ self.setButtonText(QtGui.QWizard.CancelButton,
1756+ _("Close window and set up later"))
1757+ self.wizard().setButtonLayout([
1758+ QtGui.QWizard.Stretch,
1759+ QtGui.QWizard.CustomButton1,
1760+ QtGui.QWizard.CancelButton,
1761+ ])
1762+
1763+ try:
1764+ self.wizard().customButtonClicked.disconnect()
1765+ except TypeError:
1766+ pass
1767+
1768+ self.btn_try_again = self.wizard().button(QtGui.QWizard.CustomButton1)
1769+ self.btn_try_again.setDefault(True)
1770+ self.btn_try_again.style().unpolish(self.btn_try_again)
1771+ self.btn_try_again.style().polish(self.btn_try_again)
1772+ self.wizard().customButtonClicked.connect(self.try_again)
1773+ # pylint: enable=C0103
1774+
1775+ @defer.inlineCallbacks
1776+ def try_again(self, button_id=QtGui.QWizard.CustomButton1):
1777+ """Test the connection again."""
1778+ if button_id == QtGui.QWizard.CustomButton1:
1779+ d = yield networkstate.is_machine_connected()
1780+ if d:
1781+ self.wizard()._next_id = self.wizard().SIGN_IN_PAGE_ID
1782+ self.wizard().next()
1783+ self.wizard()._next_id = None
1784
1785=== added file 'ubuntu_sso/qt/setup_account_page.py'
1786--- ubuntu_sso/qt/setup_account_page.py 1970-01-01 00:00:00 +0000
1787+++ ubuntu_sso/qt/setup_account_page.py 2012-02-07 15:10:30 +0000
1788@@ -0,0 +1,226 @@
1789+# -*- coding: utf-8 -*-
1790+
1791+# Copyright 2012 Canonical Ltd.
1792+#
1793+# This program is free software: you can redistribute it and/or modify it
1794+# under the terms of the GNU General Public License version 3, as published
1795+# by the Free Software Foundation.
1796+#
1797+# This program is distributed in the hope that it will be useful, but
1798+# WITHOUT ANY WARRANTY; without even the implied warranties of
1799+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1800+# PURPOSE. See the GNU General Public License for more details.
1801+#
1802+# You should have received a copy of the GNU General Public License along
1803+# with this program. If not, see <http://www.gnu.org/licenses/>.
1804+
1805+"""Customized Setup Account page for SSO."""
1806+
1807+import gettext
1808+import re
1809+
1810+from PyQt4 import QtGui, QtCore
1811+
1812+from ubuntu_sso.qt import common
1813+from ubuntu_sso.qt import gui as sso_gui
1814+from ubuntu_sso.qt import enhanced_check_box
1815+from ubuntu_sso.utils.ui import SET_UP_ACCOUNT_BUTTON
1816+
1817+
1818+_ = gettext.gettext
1819+
1820+# pylint: disable=C0103
1821+ERROR = u'<font color="#df2d1f"><b> %s </b></font>'
1822+TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>"
1823+
1824+EMAIL = _("Email")
1825+EMPTY_NAME = _("Please enter your name")
1826+INVALID_EMAIL = _("Please enter a valid email address")
1827+EMAIL_MATCH = _("The email addresses do not match")
1828+NAME = _("Name")
1829+PASSWORD = _("Create a password")
1830+RETYPE_EMAIL = _("Retype email")
1831+RETYPE_PASSWORD = _("Retype password")
1832+SUBTITLE = _("You only need to set up your account "
1833+ "once to get access to Ubuntu One across your devices.")
1834+TERMS = _("By signing up to Ubuntu One you agree to our "
1835+ "{terms_and_conditions} and {privacy_policy}")
1836+TERMS_LINK = _("<a href='https://one.ubuntu.com/terms/'>"
1837+ "<span style='color:#df2d1f;'>Terms of Service</span></a>")
1838+PRIVACY_POLICY_LINK = _("<a href='https://one.ubuntu.com/privacy/'>"
1839+ "<span style='color:#df2d1f;'>Privacy Policy"
1840+ "</span></a></font>")
1841+TITLE = _("Sign Up to Ubuntu One")
1842+
1843+
1844+class SetupAccountPage(sso_gui.SetupAccountPage):
1845+ """Customized Setup Account page for SSO."""
1846+
1847+ def __init__(self, *args, **kwargs):
1848+ super(SetupAccountPage, self).__init__(*args, **kwargs)
1849+ self.ui.password_edit.textEdited.connect(
1850+ lambda: common.password_assistance(self.ui.password_edit,
1851+ self.ui.password_assistance,
1852+ common.NORMAL))
1853+ terms = TERMS.format(terms_and_conditions=TERMS_LINK,
1854+ privacy_policy=PRIVACY_POLICY_LINK)
1855+ self.terms_checkbox = enhanced_check_box.EnhancedCheckBox(terms)
1856+ self.ui.hlayout_check.addWidget(self.terms_checkbox)
1857+
1858+ self.set_up_button = None
1859+ self.captcha_received = False
1860+
1861+ # Invalid name "initializePage"
1862+ # pylint: disable=C0103
1863+
1864+ def initializePage(self):
1865+ """Setup UI details."""
1866+ # We need to override some texts from SSO
1867+ # to match our spec
1868+ title_page = TITLE_STYLE % TITLE
1869+ self.setTitle(title_page)
1870+ self.setSubTitle(SUBTITLE)
1871+ # Set Setup Account button
1872+ self.wizard().setOption(QtGui.QWizard.HaveCustomButton3, True)
1873+ try:
1874+ self.wizard().customButtonClicked.disconnect()
1875+ except TypeError:
1876+ pass
1877+ self.setButtonText(QtGui.QWizard.CustomButton3, SET_UP_ACCOUNT_BUTTON)
1878+ self.set_up_button = self.wizard().button(QtGui.QWizard.CustomButton3)
1879+ self.set_up_button.clicked.connect(self.wizard().overlay.show)
1880+ self.set_up_button.clicked.connect(self.controller.set_next_validation)
1881+ self.set_up_button.setEnabled(False)
1882+
1883+ self.ui.name_label.setText(NAME)
1884+ self.ui.email_label.setText(EMAIL)
1885+ self.ui.confirm_email_label.setText(RETYPE_EMAIL)
1886+ self.ui.password_label.setText(PASSWORD)
1887+ self.ui.confirm_password_label.setText(RETYPE_PASSWORD)
1888+ self.ui.password_info_label.hide()
1889+
1890+ # Button setup
1891+ self.wizard().setButtonLayout([
1892+ QtGui.QWizard.BackButton,
1893+ QtGui.QWizard.Stretch,
1894+ QtGui.QWizard.CustomButton3])
1895+
1896+ common.password_default_assistance(self.ui.password_assistance)
1897+ # Hide assistance labels by default
1898+ self.ui.name_assistance.setVisible(False)
1899+ self.ui.email_assistance.setVisible(False)
1900+ self.ui.confirm_email_assistance.setVisible(False)
1901+ self.ui.password_assistance.setVisible(False)
1902+ self.ui.refresh_label.setVisible(True)
1903+
1904+ def focus_changed(self, old, now):
1905+ """Check who has the focus to activate password popups if necessary."""
1906+ if old == self.ui.name_edit:
1907+ self.name_assistance()
1908+ elif old == self.ui.email_edit:
1909+ self.email_assistance()
1910+ elif old == self.ui.confirm_email_edit:
1911+ self.confirm_email_assistance()
1912+ elif old == self.ui.confirm_password_edit:
1913+ common.password_check_match(self.ui.password_edit,
1914+ self.ui.confirm_password_edit,
1915+ self.ui.password_assistance)
1916+ if now == self.ui.password_edit:
1917+ self.ui.password_assistance.setVisible(True)
1918+
1919+ def name_assistance(self):
1920+ """Show help for the name field."""
1921+ text = unicode(self.ui.name_edit.text())
1922+ if not text.strip():
1923+ self.set_error_message(self.ui.name_assistance,
1924+ EMPTY_NAME)
1925+ common.check_as_invalid(self.ui.name_edit)
1926+ else:
1927+ self.ui.name_assistance.setVisible(False)
1928+ common.check_as_valid(self.ui.name_edit)
1929+
1930+ def email_assistance(self):
1931+ """Show help for the email field."""
1932+ text = unicode(self.ui.email_edit.text())
1933+ if not is_correct_email(text):
1934+ self.set_error_message(self.ui.email_assistance,
1935+ INVALID_EMAIL)
1936+ common.check_as_invalid(self.ui.email_edit)
1937+ else:
1938+ self.ui.email_assistance.setVisible(False)
1939+ common.check_as_valid(self.ui.email_edit)
1940+
1941+ def confirm_email_assistance(self):
1942+ """Show help for the confirm email field."""
1943+ text1 = unicode(self.ui.email_edit.text())
1944+ text2 = unicode(self.ui.confirm_email_edit.text())
1945+ if text1 != text2:
1946+ self.set_error_message(self.ui.confirm_email_assistance,
1947+ EMAIL_MATCH)
1948+ common.check_as_invalid(self.ui.confirm_email_edit)
1949+ else:
1950+ self.ui.confirm_email_assistance.setVisible(False)
1951+ common.check_as_valid(self.ui.confirm_email_edit)
1952+
1953+ def set_error_message(self, label, msg):
1954+ """Set the message to the proper label applying the error style."""
1955+ label.setText(ERROR % msg)
1956+ label.setVisible(True)
1957+
1958+ def showEvent(self, event):
1959+ """Set set_up_button as default button when the page is shown."""
1960+ # This method should stays here because if we move it to initializePage
1961+ # set_up_button won't take the proper style for hover and press
1962+ if self.set_up_button is not None:
1963+ self.set_up_button.setVisible(True)
1964+ self.set_up_button.setDefault(True)
1965+ if not self.set_up_button.isEnabled():
1966+ self.set_up_button.setProperty("DisabledState", True)
1967+ self.set_up_button.style().unpolish(self.set_up_button)
1968+ self.set_up_button.style().polish(self.set_up_button)
1969+ self.connect(QtGui.QApplication.instance(),
1970+ QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
1971+ self.focus_changed)
1972+ super(SetupAccountPage, self).showEvent(event)
1973+ if not self.captcha_received:
1974+ self.wizard().overlay.show()
1975+
1976+ def hideEvent(self, event):
1977+ """Disconnect the focusChanged signal when the page change."""
1978+ if self.set_up_button is not None:
1979+ self.set_up_button.setVisible(False)
1980+ try:
1981+ self.disconnect(QtGui.QApplication.instance(),
1982+ QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
1983+ self.focus_changed)
1984+ except TypeError:
1985+ pass
1986+ super(SetupAccountPage, self).hideEvent(event)
1987+
1988+ def on_captcha_refreshing(self):
1989+ """Show overlay when captcha is refreshing."""
1990+ if self.isVisible():
1991+ self.wizard().overlay.show()
1992+ self.captcha_received = False
1993+
1994+ def on_captcha_refresh_complete(self):
1995+ """Hide overlay when captcha finished refreshing."""
1996+ self.wizard().overlay.hide()
1997+ self.captcha_received = True
1998+
1999+
2000+def is_min_required_password(password):
2001+ """Return if the password meets the minimum requirements."""
2002+ if (len(password) < 8 or
2003+ re.search('[A-Z]', password) is None or
2004+ re.search('\d+', password) is None):
2005+ return False
2006+ return True
2007+
2008+
2009+# pylint: disable=W0511
2010+# FIXME: this should do the same check as SSO's server side
2011+def is_correct_email(email_address):
2012+ """Return if the email is correct."""
2013+ return '@' in email_address
2014+# pylint: enable=W0511
2015
2016=== added file 'ubuntu_sso/qt/sign_in_page.py'
2017--- ubuntu_sso/qt/sign_in_page.py 1970-01-01 00:00:00 +0000
2018+++ ubuntu_sso/qt/sign_in_page.py 2012-02-07 15:10:30 +0000
2019@@ -0,0 +1,61 @@
2020+# -*- coding: utf-8 -*-
2021+
2022+# Copyright 2012 Canonical Ltd.
2023+#
2024+# This program is free software: you can redistribute it and/or modify it
2025+# under the terms of the GNU General Public License version 3, as published
2026+# by the Free Software Foundation.
2027+#
2028+# This program is distributed in the hope that it will be useful, but
2029+# WITHOUT ANY WARRANTY; without even the implied warranties of
2030+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2031+# PURPOSE. See the GNU General Public License for more details.
2032+#
2033+# You should have received a copy of the GNU General Public License along
2034+# with this program. If not, see <http://www.gnu.org/licenses/>.
2035+
2036+"""Page to allow the user to sign in."""
2037+
2038+import gettext
2039+
2040+from PyQt4 import QtGui
2041+
2042+from ubuntu_sso.qt.gui import SSOWizardPage
2043+
2044+
2045+_ = gettext.gettext
2046+
2047+
2048+class SignInPage(SSOWizardPage):
2049+ """Wizard Page that lets the user Sign into Ubuntu One."""
2050+
2051+ def __init__(self, image_pixmap, *args, **kwargs):
2052+ super(SignInPage, self).__init__(*args, **kwargs)
2053+ self.ui.image_label.setPixmap(image_pixmap)
2054+
2055+ # Invalid names of Qt-inherited methods
2056+ # pylint: disable=C0103
2057+
2058+ def initializePage(self):
2059+ """Setup UI details."""
2060+ self.ui.cancel_button.setText(_("Close window and setup later"))
2061+ self.ui.cancel_button.clicked.connect(self.wizard().reject)
2062+ # Layout without custom button 1,
2063+ # without finish button
2064+ # without cancel
2065+ self.wizard().setButtonLayout([
2066+ QtGui.QWizard.Stretch,
2067+ QtGui.QWizard.NextButton])
2068+
2069+ def showEvent(self, event):
2070+ """Set existing_account_button as default when the page is shown."""
2071+ super(SignInPage, self).showEvent(event)
2072+ self.ui.existing_account_button.setDefault(True)
2073+ self.ui.existing_account_button.style().unpolish(
2074+ self.ui.existing_account_button)
2075+ self.ui.existing_account_button.style().polish(
2076+ self.ui.existing_account_button)
2077+
2078+ def nextId(self):
2079+ """Provide the next id."""
2080+ return self.next
2081
2082=== modified file 'ubuntu_sso/qt/tests/__init__.py'
2083--- ubuntu_sso/qt/tests/__init__.py 2012-01-04 22:04:53 +0000
2084+++ ubuntu_sso/qt/tests/__init__.py 2012-02-07 15:10:30 +0000
2085@@ -1,9 +1,6 @@
2086 # -*- coding: utf-8 -*-
2087-
2088-# Authors: Natalia B. Bidart <natalia.bidart@canonical.com>
2089-# Diego Sarmentero <diego.sarmentero@canonical.com>
2090 #
2091-# Copyright 2011 Canonical Ltd.
2092+# Copyright 2011-2012 Canonical Ltd.
2093 #
2094 # This program is free software: you can redistribute it and/or modify it
2095 # under the terms of the GNU General Public License version 3, as published
2096@@ -19,8 +16,10 @@
2097
2098 """Test the Ui code."""
2099
2100+from PyQt4 import QtGui, QtCore
2101 from twisted.internet import defer
2102 from twisted.trial.unittest import TestCase
2103+from ubuntu_sso.qt import loadingoverlay
2104
2105 from ubuntu_sso import main
2106
2107@@ -122,6 +121,209 @@
2108 return self.properties['visible']
2109
2110
2111+class FakeOverlay(object):
2112+
2113+ """A fake delay overlay."""
2114+
2115+ def __init__(self, *args, **kwargs):
2116+ """Initialize."""
2117+ self.show_counter = 0
2118+ self.hide_counter = 0
2119+ self.args = (args, kwargs)
2120+
2121+ def show(self):
2122+ """Fake show."""
2123+ self.show_counter += 1
2124+
2125+ def hide(self):
2126+ """Fake hide."""
2127+ self.hide_counter += 1
2128+
2129+ def resize(self, *args):
2130+ """Fake resize."""
2131+
2132+
2133+class FakeSignal(object):
2134+
2135+ """A fake PyQt signal."""
2136+
2137+ def __init__(self, *args, **kwargs):
2138+ """Initialize."""
2139+ self.target = None
2140+
2141+ def connect(self, target):
2142+ """Fake connect."""
2143+ self.target = target
2144+
2145+ def disconnect(self, *args):
2146+ """Fake disconnect."""
2147+ self.target = None
2148+
2149+ def emit(self, *args):
2150+ """Fake emit."""
2151+ if self.target:
2152+ self.target(*args)
2153+
2154+
2155+class FakeWizardPage(object):
2156+
2157+ """A fake wizard page."""
2158+
2159+ def __init__(self, *args, **kwargs):
2160+ self.has_back_button = True
2161+
2162+ # pylint: disable=C0103
2163+ def initializePage(self):
2164+ """Fake initializePage."""
2165+
2166+
2167+class FakeMainWindow(object):
2168+
2169+ """A fake MainWindow."""
2170+
2171+ currentIdChanged = FakeSignal()
2172+ loginSuccess = FakeSignal()
2173+ registrationIncomplete = FakeSignal()
2174+ registrationSuccess = FakeSignal()
2175+ userCancellation = FakeSignal()
2176+ shown = False
2177+ SYNC_NOW_OR_LATER_PAGE = 4
2178+ CONGRATULATIONS_PAGE = 5
2179+ folders_page_id = 6
2180+ local_folders_page_id = 7
2181+
2182+ def __init__(self, close_callback=None):
2183+ self.button_texts = []
2184+ self.button_layout = None
2185+ self.options = []
2186+ self.overlay = FakeOverlay()
2187+ self.local_folders_page = FakeWizardPage()
2188+ self.folders_page = FakeWizardPage()
2189+ self.app_name = 'app_name'
2190+
2191+ def show(self):
2192+ """Fake method."""
2193+ self.shown = True
2194+
2195+ # pylint: disable=C0103
2196+ def setButtonText(self, button, text):
2197+ """Fake setButtonText."""
2198+ self.button_texts.append((button, text))
2199+
2200+ def setButtonLayout(self, layout):
2201+ """Fake setButtonText."""
2202+ self.button_layout = layout
2203+
2204+ def button(self, button):
2205+ """Fake button method to obtain the wizard buttons."""
2206+ return QtGui.QPushButton()
2207+
2208+ def setOption(self, *args):
2209+ """Fake setOption."""
2210+ self.options.append(args)
2211+
2212+ def next(self):
2213+ """Fake next."""
2214+
2215+ def reject(self):
2216+ """Fake reject."""
2217+
2218+
2219+class FakeController(object):
2220+
2221+ """A fake controller for the tests."""
2222+
2223+ is_fake = True
2224+ set_next_validation = lambda *a, **kw: None
2225+
2226+ def __init__(self, *args, **kwargs):
2227+ self.args = (args, kwargs)
2228+
2229+ # pylint: disable=C0103
2230+ def setupUi(self, view):
2231+ """Fake the setup."""
2232+ # pylint: enable=C0103
2233+
2234+
2235+class FakeWizard(object):
2236+ """Replace wizard() function on wizard pages."""
2237+
2238+ customButtonClicked = QtCore.QObject()
2239+
2240+ def __init__(self):
2241+ self.overlay = FakeOverlay()
2242+ self.called = []
2243+ self.buttons = {}
2244+ self._next_id = -1
2245+
2246+ # Invalid name "setButtonLayout", "setOption"
2247+ # pylint: disable=C0103
2248+
2249+ def setButtonLayout(self, *args, **kwargs):
2250+ """Fake the functionality of setButtonLayout on QWizard class."""
2251+ self.called.append(('setButtonLayout', (args, kwargs)))
2252+
2253+ def setOption(self, *args, **kwargs):
2254+ """Fake the functionality of setOption on QWizard class."""
2255+ self.called.append(('setOption', (args, kwargs)))
2256+
2257+ # pylint: enable=C0103
2258+
2259+ def button(self, button_id):
2260+ """Fake the functionality of button on QWizard class."""
2261+ return self.buttons.setdefault(button_id, QtGui.QPushButton())
2262+
2263+
2264+class FakeWizardButtonStyle(FakeWizard):
2265+
2266+ """Fake Wizard with button style implementation."""
2267+
2268+ SIGN_IN_PAGE_ID = 1
2269+
2270+ # pylint: disable=C0103
2271+ def __init__(self):
2272+ super(FakeWizardButtonStyle, self).__init__()
2273+ self.data = {}
2274+ self.customButtonClicked = self
2275+
2276+ def setDefault(self, value):
2277+ """Fake setDefault for button."""
2278+ self.data['default'] = value
2279+
2280+ def isDefault(self):
2281+ """Fake isDefault."""
2282+ return self.data['default']
2283+ # pylint: enable=C0103
2284+
2285+ def connect(self, func):
2286+ """Fake customButtonClicked connect."""
2287+ self.data['connect'] = func
2288+
2289+ def disconnect(self, func):
2290+ """Fake customButtonClicked disconnect."""
2291+ self.data['disconnect'] = func
2292+
2293+ def button(self, button_id):
2294+ """Fake the functionality of button on QWizard class."""
2295+ return self
2296+
2297+ def style(self):
2298+ """Fake button style."""
2299+ return self
2300+
2301+ def polish(self, button):
2302+ """Fake polish."""
2303+ self.data['polish'] = button
2304+
2305+ def unpolish(self, button):
2306+ """Fake unpolish."""
2307+ self.data['unpolish'] = button
2308+
2309+ def next(self):
2310+ """Fake next for wizard."""
2311+ self.data['next'] = True
2312+
2313+
2314 class BaseTestCase(TestCase):
2315 """The base test case."""
2316
2317@@ -137,3 +339,46 @@
2318 def _set_called(self, *args, **kwargs):
2319 """Store 'args' and 'kwargs' for test assertions."""
2320 self._called = (args, kwargs)
2321+
2322+
2323+class BaseTestCaseUI(TestCase):
2324+ """Base Test Case."""
2325+
2326+ class_ui = None
2327+ kwargs = {}
2328+
2329+ @defer.inlineCallbacks
2330+ def setUp(self):
2331+ yield super(BaseTestCaseUI, self).setUp()
2332+ # self.class_ui is not callable
2333+ # pylint: disable=E1102, C0103, W0212
2334+ self.ui = None
2335+ self._called = False
2336+ if self.class_ui is not None:
2337+ self.ui = self.class_ui(**self.kwargs)
2338+
2339+ if hasattr(self.ui, 'backend'):
2340+ # clean backend calls
2341+ self.ui.backend._called.clear()
2342+
2343+ self.patch(loadingoverlay, 'LoadingOverlay', FakeOverlay)
2344+
2345+ def _set_called(self, *args, **kwargs):
2346+ """Store 'args' and 'kwargs' for test assertions."""
2347+ self._called = (args, kwargs)
2348+
2349+ def get_pixmap_data(self, pixmap):
2350+ """Get the raw data of a QPixmap."""
2351+ byte_array = QtCore.QByteArray()
2352+ array_buffer = QtCore.QBuffer(byte_array)
2353+ pixmap.save(array_buffer, "PNG")
2354+ return byte_array
2355+
2356+ # Invalid name "assertEqualPixmap"
2357+ # pylint: disable=C0103
2358+
2359+ def assertEqualPixmaps(self, pixmap1, pixmap2):
2360+ """Compare two Qt pixmaps."""
2361+ d1 = self.get_pixmap_data(pixmap1)
2362+ d2 = self.get_pixmap_data(pixmap2)
2363+ self.assertEqual(d1, d2)
2364
2365=== added file 'ubuntu_sso/qt/tests/test_enhanced_check_box.py'
2366--- ubuntu_sso/qt/tests/test_enhanced_check_box.py 1970-01-01 00:00:00 +0000
2367+++ ubuntu_sso/qt/tests/test_enhanced_check_box.py 2012-02-07 15:10:30 +0000
2368@@ -0,0 +1,49 @@
2369+# -*- coding: utf-8 -*-
2370+
2371+# Authors: Diego Sarmentero <diego.sarmentero@canonical.com>
2372+#
2373+# Copyright 2011 Canonical Ltd.
2374+#
2375+# This program is free software: you can redistribute it and/or modify it
2376+# under the terms of the GNU General Public License version 3, as published
2377+# by the Free Software Foundation.
2378+#
2379+# This program is distributed in the hope that it will be useful, but
2380+# WITHOUT ANY WARRANTY; without even the implied warranties of
2381+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2382+# PURPOSE. See the GNU General Public License for more details.
2383+#
2384+# You should have received a copy of the GNU General Public License along
2385+# with this program. If not, see <http://www.gnu.org/licenses/>.
2386+
2387+"""Tests for the EnhancedCheckBox widget."""
2388+
2389+import re
2390+
2391+from PyQt4 import QtCore
2392+
2393+from ubuntu_sso.qt import enhanced_check_box
2394+from ubuntu_sso.qt.tests import BaseTestCase
2395+
2396+
2397+class EnhancedCheckBoxTestCase(BaseTestCase):
2398+ """Test the EnhancedCheckBox code."""
2399+
2400+ def test_init(self):
2401+ """Check the initial state of EnhancedCheckBox."""
2402+ check = enhanced_check_box.EnhancedCheckBox("text")
2403+ self.assertEqual(check.text(), "text")
2404+ self.assertTrue(check.text_label.openExternalLinks())
2405+ style_sheet = unicode(check.text_label.styleSheet())
2406+ size = re.sub("\D", "", style_sheet)
2407+ self.assertEqual(check.iconSize().width(), int(size))
2408+ self.assertEqual(check.receivers(
2409+ QtCore.SIGNAL('stateChanged(int)')), 1)
2410+
2411+ def test_set_text(self):
2412+ """Check if override setText and text methods works properly."""
2413+ check = enhanced_check_box.EnhancedCheckBox()
2414+ self.assertEqual(check.text_label.text(), "")
2415+ check.setText("text")
2416+ self.assertEqual(check.text(), "text")
2417+ self.assertEqual(check.text(), check.text_label.text())
2418
2419=== added file 'ubuntu_sso/qt/tests/test_loadingoverlay.py'
2420--- ubuntu_sso/qt/tests/test_loadingoverlay.py 1970-01-01 00:00:00 +0000
2421+++ ubuntu_sso/qt/tests/test_loadingoverlay.py 2012-02-07 15:10:30 +0000
2422@@ -0,0 +1,36 @@
2423+# -*- coding: utf-8 -*-
2424+
2425+# Copyright 2012 Canonical Ltd.
2426+#
2427+# This program is free software: you can redistribute it and/or modify it
2428+# under the terms of the GNU General Public License version 3, as published
2429+# by the Free Software Foundation.
2430+#
2431+# This program is distributed in the hope that it will be useful, but
2432+# WITHOUT ANY WARRANTY; without even the implied warranties of
2433+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2434+# PURPOSE. See the GNU General Public License for more details.
2435+#
2436+# You should have received a copy of the GNU General Public License along
2437+# with this program. If not, see <http://www.gnu.org/licenses/>.
2438+
2439+"""Tests for the Loading Overlay."""
2440+
2441+from ubuntu_sso.qt import loadingoverlay as gui
2442+from ubuntu_sso.qt.tests import BaseTestCase
2443+
2444+
2445+class LoadingOverlayTestCase(BaseTestCase):
2446+ """Test the qt control panel."""
2447+
2448+ innerclass_ui = gui.loadingoverlay_ui
2449+ innerclass_name = "Ui_Form"
2450+ class_ui = gui.LoadingOverlay
2451+
2452+ # pylint: disable=E1101
2453+ def assert_status_correct(self):
2454+ """Test if the necessary variables for the animation exists"""
2455+ self.ui.show()
2456+ self.assertTrue(self.ui.counter is not None)
2457+ self.assertTrue(self.ui.orientation is not None)
2458+ # pylint: enable=E1101
2459
2460=== added file 'ubuntu_sso/qt/tests/test_network_detection.py'
2461--- ubuntu_sso/qt/tests/test_network_detection.py 1970-01-01 00:00:00 +0000
2462+++ ubuntu_sso/qt/tests/test_network_detection.py 2012-02-07 15:10:30 +0000
2463@@ -0,0 +1,95 @@
2464+# -*- coding: utf-8 -*-
2465+
2466+# Copyright 2012 Canonical Ltd.
2467+#
2468+# This program is free software: you can redistribute it and/or modify it
2469+# under the terms of the GNU General Public License version 3, as published
2470+# by the Free Software Foundation.
2471+#
2472+# This program is distributed in the hope that it will be useful, but
2473+# WITHOUT ANY WARRANTY; without even the implied warranties of
2474+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2475+# PURPOSE. See the GNU General Public License for more details.
2476+#
2477+# You should have received a copy of the GNU General Public License along
2478+# with this program. If not, see <http://www.gnu.org/licenses/>.
2479+
2480+"""The test suite for Network Detection UI."""
2481+
2482+from twisted.internet import defer
2483+
2484+from PyQt4 import QtGui
2485+
2486+from ubuntu_sso.qt import network_detection_page
2487+from ubuntu_sso.qt.tests import (
2488+ BaseTestCase,
2489+ FakeWizardButtonStyle,
2490+)
2491+
2492+
2493+class NetworkDetectionTestCase(BaseTestCase):
2494+
2495+ """Test the CurrentUserController."""
2496+
2497+ @defer.inlineCallbacks
2498+ def setUp(self):
2499+ """Initialize this test instance."""
2500+ yield super(NetworkDetectionTestCase, self).setUp()
2501+ self.wizard = FakeWizardButtonStyle()
2502+ self.network_detection = network_detection_page.NetworkDetectionPage()
2503+ self.patch(self.network_detection, 'wizard', self._get_wizard)
2504+
2505+ def _get_wizard(self):
2506+ """Fake wizard method for wizard page."""
2507+ return self.wizard
2508+
2509+ # pylint: disable=W0212
2510+ def test_initialize_page(self):
2511+ """Check Network detection initialize page."""
2512+ self.network_detection.initializePage()
2513+ self.assertEqual(self.wizard._next_id, None)
2514+ self.assertTrue(('setButtonLayout', ([
2515+ QtGui.QWizard.Stretch,
2516+ QtGui.QWizard.CustomButton1,
2517+ QtGui.QWizard.CancelButton], {})),
2518+ self.wizard.called)
2519+
2520+ def test_initialize_page_button_property(self):
2521+ """Test the Try Again button properties."""
2522+ self.patch(self.network_detection,
2523+ "wizard", FakeWizardButtonStyle)
2524+ self.network_detection.initializePage()
2525+ self.assertTrue(self.network_detection.btn_try_again.isDefault())
2526+ self.assertTrue(
2527+ 'polish' in self.network_detection.btn_try_again.data)
2528+ self.assertTrue(
2529+ 'unpolish' in self.network_detection.btn_try_again.data)
2530+ self.assertEqual(
2531+ self.network_detection.btn_try_again.data['polish'],
2532+ self.network_detection.btn_try_again)
2533+ self.assertEqual(
2534+ self.network_detection.btn_try_again.data['unpolish'],
2535+ self.network_detection.btn_try_again)
2536+
2537+ def test_try_again_with_connection(self):
2538+ """Check try again method with connection."""
2539+ self.patch(network_detection_page.networkstate, 'is_machine_connected',
2540+ lambda: True)
2541+ self.wizard._next_id = -1
2542+ if 'next' in self.wizard.data:
2543+ self.wizard.data.pop('next')
2544+ self.network_detection.try_again()
2545+ self.assertEqual(self.wizard._next_id, None)
2546+ self.assertTrue(self.wizard.data.get('next', False))
2547+
2548+ def test_try_again_without_connection(self):
2549+ """Check try again method without connection."""
2550+ self.patch(network_detection_page.networkstate, 'is_machine_connected',
2551+ lambda: False)
2552+ self.wizard._next_id = -1
2553+ if 'next' in self.wizard.data:
2554+ self.wizard.data.pop('next')
2555+ self.network_detection.try_again()
2556+ self.assertEqual(self.wizard._next_id, -1)
2557+ self.assertFalse(self.wizard.data.get('next', False))
2558+ # pylint: enable=W0212
2559
2560=== added file 'ubuntu_sso/qt/tests/test_setup_account.py'
2561--- ubuntu_sso/qt/tests/test_setup_account.py 1970-01-01 00:00:00 +0000
2562+++ ubuntu_sso/qt/tests/test_setup_account.py 2012-02-07 15:10:30 +0000
2563@@ -0,0 +1,332 @@
2564+# -*- coding: utf-8 -*-
2565+
2566+# Copyright 2011 Canonical Ltd.
2567+#
2568+# This program is free software: you can redistribute it and/or modify it
2569+# under the terms of the GNU General Public License version 3, as published
2570+# by the Free Software Foundation.
2571+#
2572+# This program is distributed in the hope that it will be useful, but
2573+# WITHOUT ANY WARRANTY; without even the implied warranties of
2574+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2575+# PURPOSE. See the GNU General Public License for more details.
2576+#
2577+# You should have received a copy of the GNU General Public License along
2578+# with this program. If not, see <http://www.gnu.org/licenses/>.
2579+
2580+"""Tests for the Setup Account page Qt UI."""
2581+
2582+from PyQt4 import QtGui, QtCore
2583+
2584+from twisted.internet import defer
2585+
2586+from ubuntu_sso.qt import common
2587+from ubuntu_sso.qt import setup_account_page as gui
2588+from ubuntu_sso.qt.tests import (
2589+ BaseTestCaseUI,
2590+ FakeController,
2591+ FakeWizard,
2592+)
2593+from ubuntu_sso.qt.ui import setup_account_ui
2594+
2595+
2596+class SetupAccountTestCase(BaseTestCaseUI):
2597+ """Test the SetupAccountPage code."""
2598+
2599+ class_ui = gui.SetupAccountPage
2600+ kwargs = dict(
2601+ ui=setup_account_ui.Ui_SetUpAccountPage(),
2602+ controller=FakeController(),
2603+ parent=None,
2604+ )
2605+
2606+ @defer.inlineCallbacks
2607+ def setUp(self):
2608+ yield super(SetupAccountTestCase, self).setUp()
2609+ self.wizard = FakeWizard()
2610+ self.patch(self.ui, 'wizard', lambda: self.wizard)
2611+ self.patch(self.ui, "set_up_button", QtGui.QPushButton())
2612+
2613+ def test_init(self):
2614+ """Check the initial state of SetupAccount."""
2615+ self.assertEqual(self.ui.ui.password_edit.receivers(
2616+ QtCore.SIGNAL('textEdited(QString)')), 1)
2617+
2618+ def test_empty_name(self):
2619+ """Status when the name field is empty.
2620+
2621+ * Name Assistance label visible.
2622+ * Correct error message in it.
2623+ """
2624+ self.ui.ui.name_edit.setText("")
2625+ self.ui.name_assistance()
2626+ self.ui.show()
2627+ self.addCleanup(self.ui.hide)
2628+ self.assertTrue(self.ui.ui.name_assistance.isVisible())
2629+ self.assertEqual(
2630+ unicode(self.ui.ui.name_assistance.text()),
2631+ gui.ERROR % gui.EMPTY_NAME)
2632+ self.ui.hide()
2633+
2634+ def test_password_default_assistance(self):
2635+ """Status when the password line edit receive focus and shows popup.
2636+
2637+ * Password assistance contains the right message.
2638+ """
2639+ self.ui.ui.password_edit.setText("")
2640+ self.ui.ui.confirm_password_edit.setText("")
2641+ common.password_default_assistance(self.ui.ui.password_assistance)
2642+ self.ui.focus_changed(None, self.ui.ui.password_edit)
2643+ self.assertIn(
2644+ common.NORMAL % common.PASSWORD_LENGTH,
2645+ unicode(self.ui.ui.password_assistance.text()),
2646+ )
2647+ self.assertIn(
2648+ common.NORMAL % common.PASSWORD_UPPER,
2649+ unicode(self.ui.ui.password_assistance.text()),
2650+ )
2651+ self.assertIn(
2652+ common.NORMAL % common.PASSWORD_DIGIT,
2653+ unicode(self.ui.ui.password_assistance.text()),
2654+ )
2655+
2656+ def test_password_focus_gain(self):
2657+ """Check functions execution when focus_changed() is executed."""
2658+ self.ui.show()
2659+ self.addCleanup(self.ui.hide)
2660+ self.ui.ui.password_assistance.setVisible(False)
2661+ self.assertFalse(self.ui.ui.password_assistance.isVisible())
2662+ self.patch(self.ui, 'name_assistance', self._set_called)
2663+ self.ui.focus_changed(None, self.ui.ui.password_edit)
2664+ self.assertTrue(self.ui.ui.password_assistance.isVisible())
2665+
2666+ def test_name_focus_lost(self):
2667+ """Check functions execution when focus_changed() is executed."""
2668+ self.patch(self.ui, 'name_assistance', self._set_called)
2669+ self.ui.focus_changed(self.ui.ui.name_edit, None)
2670+ self.assertTrue(self._called)
2671+
2672+ def test_email_focus_lost(self):
2673+ """Check functions execution when focus_changed() is executed."""
2674+ self.patch(self.ui, 'email_assistance', self._set_called)
2675+ self.ui.focus_changed(self.ui.ui.email_edit, None)
2676+ self.assertTrue(self._called)
2677+
2678+ def test_confirm_email_focus_lost(self):
2679+ """Check functions execution when focus_changed() is executed."""
2680+ self.patch(self.ui, 'confirm_email_assistance', self._set_called)
2681+ self.ui.focus_changed(self.ui.ui.confirm_email_edit, None)
2682+ self.assertTrue(self._called)
2683+
2684+ def test_confirm_password_focus_lost(self):
2685+ """Check functions execution when focus_changed() is executed."""
2686+ self.patch(common, 'password_check_match', self._set_called)
2687+ self.ui.focus_changed(self.ui.ui.confirm_password_edit, None)
2688+ self.assertTrue(self._called)
2689+
2690+
2691+class SetupAccountFakeWizardTestCase(BaseTestCaseUI):
2692+ """Test the SetupAccountPage code."""
2693+
2694+ class_ui = gui.SetupAccountPage
2695+ kwargs = dict(
2696+ ui=setup_account_ui.Ui_SetUpAccountPage(),
2697+ controller=FakeController(),
2698+ parent=None,
2699+ )
2700+
2701+ @defer.inlineCallbacks
2702+ def setUp(self):
2703+ """Initialize this test instance."""
2704+ # Faking each SSO object instead of doing it lower
2705+ # so we don't rely on any SSO behaviour
2706+ yield super(SetupAccountFakeWizardTestCase, self).setUp()
2707+ self.wizard = FakeWizard()
2708+ self.patch(self.ui, 'wizard', lambda: self.wizard)
2709+
2710+ def test_initialize_page(self):
2711+ """Widgets are properly initialized."""
2712+ self.ui.initializePage()
2713+ self.ui.show()
2714+ self.addCleanup(self.ui.hide)
2715+
2716+ # titles
2717+ self.assertEqual(self.ui.header.title_label.text(),
2718+ gui.TITLE_STYLE % gui.TITLE)
2719+ self.assertEqual(self.ui.header.subtitle_label.text(), gui.SUBTITLE)
2720+
2721+ # set up account button
2722+ expected = [QtGui.QWizard.BackButton, QtGui.QWizard.Stretch,
2723+ QtGui.QWizard.CustomButton3]
2724+ self.assertIn(('setButtonLayout', ((expected,), {})),
2725+ self.ui.wizard().called)
2726+ self.assertEqual(gui.SET_UP_ACCOUNT_BUTTON,
2727+ self.ui.buttonText(QtGui.QWizard.CustomButton3))
2728+ self.assertTrue(self.ui.wizard().button(QtGui.QWizard.CustomButton3) is
2729+ self.ui.set_up_button)
2730+ self.assertFalse(self.ui.set_up_button.isEnabled())
2731+
2732+ self.assertFalse(self.ui.captcha_received)
2733+
2734+ # labels
2735+ self.assertEqual(self.ui.ui.name_label.text(), gui.NAME)
2736+ self.assertEqual(self.ui.ui.email_label.text(), gui.EMAIL)
2737+ self.assertEqual(self.ui.ui.confirm_email_label.text(),
2738+ gui.RETYPE_EMAIL)
2739+ self.assertEqual(self.ui.ui.password_label.text(),
2740+ gui.PASSWORD)
2741+ self.assertEqual(self.ui.ui.confirm_password_label.text(),
2742+ gui.RETYPE_PASSWORD)
2743+ self.assertFalse(self.ui.ui.password_info_label.isVisible())
2744+
2745+ # assistants
2746+ self.assertFalse(self.ui.ui.name_assistance.isVisible())
2747+ self.assertFalse(self.ui.ui.email_assistance.isVisible())
2748+ self.assertFalse(self.ui.ui.confirm_email_assistance.isVisible())
2749+ self.assertFalse(self.ui.ui.password_assistance.isVisible())
2750+ self.assertTrue(self.ui.ui.refresh_label.isVisible())
2751+
2752+ def test_set_up_button_clicked(self):
2753+ """Validation and overlay is shown when the setupbutton is clicked."""
2754+ self.patch(self.ui.controller, 'set_next_validation', self._set_called)
2755+ self.ui.initializePage()
2756+ self.ui.captcha_received = True
2757+ self.ui.show()
2758+ self.addCleanup(self.ui.hide)
2759+
2760+ self.ui.set_up_button.clicked.emit(False)
2761+
2762+ self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
2763+ self.assertEqual(self._called, ((False,), {}))
2764+
2765+ def test_set_error_message(self):
2766+ """Check the state of the label after calling: set_error_message."""
2767+ self.ui.email_assistance()
2768+ self.ui.show()
2769+ self.addCleanup(self.ui.hide)
2770+ self.ui.set_error_message(self.ui.ui.email_assistance, "message")
2771+ self.assertTrue(self.ui.ui.email_assistance.isVisible())
2772+ self.assertEqual(
2773+ unicode(self.ui.ui.email_assistance.text()),
2774+ gui.ERROR % "message")
2775+
2776+ def test_blank_name(self):
2777+ """Status when the name field is blank (spaces).
2778+
2779+ * Name Assistance label visible.
2780+ * Correct error message in it.
2781+ """
2782+ self.ui.ui.name_edit.setText(" ")
2783+ self.ui.name_assistance()
2784+ self.ui.show()
2785+ self.addCleanup(self.ui.hide)
2786+ self.assertTrue(self.ui.ui.name_assistance.isVisible())
2787+ self.assertEqual(
2788+ unicode(self.ui.ui.name_assistance.text()),
2789+ gui.ERROR % gui.EMPTY_NAME)
2790+ self.ui.hide()
2791+
2792+ def test_valid_name(self):
2793+ """Status when the name field is valid.
2794+
2795+ * Name Assistance label invisible.
2796+ """
2797+ self.ui.ui.name_edit.setText("John Doe")
2798+ self.ui.name_assistance()
2799+ self.ui.show()
2800+ self.addCleanup(self.ui.hide)
2801+ self.assertFalse(self.ui.ui.name_assistance.isVisible())
2802+ self.ui.hide()
2803+
2804+ def test_invalid_email(self):
2805+ """Status when the email field has no @.
2806+
2807+ * Email Assistance label visible.
2808+ * Correct error message in it.
2809+ """
2810+ self.ui.ui.email_edit.setText("foobar")
2811+ self.ui.email_assistance()
2812+ self.ui.show()
2813+ self.addCleanup(self.ui.hide)
2814+ self.assertTrue(self.ui.ui.email_assistance.isVisible())
2815+ self.assertEqual(
2816+ unicode(self.ui.ui.email_assistance.text()),
2817+ gui.ERROR % gui.INVALID_EMAIL)
2818+
2819+ def test_valid_email(self):
2820+ """Status when the email field has a @.
2821+
2822+ * Email Assistance label invisible.
2823+ """
2824+ self.ui.ui.email_edit.setText("foo@bar")
2825+ self.ui.email_assistance()
2826+ self.ui.show()
2827+ self.addCleanup(self.ui.hide)
2828+ self.assertFalse(self.ui.ui.email_assistance.isVisible())
2829+ self.ui.hide()
2830+
2831+ def test_matching_emails(self):
2832+ """Status when the email fields match.
2833+
2834+ * Email Assistance label invisible.
2835+ """
2836+ self.ui.ui.email_edit.setText("foo@bar")
2837+ self.ui.ui.confirm_email_edit.setText("foo@bar")
2838+ self.ui.confirm_email_assistance()
2839+ self.ui.show()
2840+ self.addCleanup(self.ui.hide)
2841+ self.assertFalse(self.ui.ui.confirm_email_assistance.isVisible())
2842+ self.ui.hide()
2843+
2844+ def test_not_matching_emails(self):
2845+ """Status when the email fields don't match.
2846+
2847+ * Email Assistance label visible.
2848+ * Correct error message.
2849+ """
2850+ self.ui.ui.email_edit.setText("foo@bar")
2851+ self.ui.ui.confirm_email_edit.setText("foo@baz")
2852+ self.ui.confirm_email_assistance()
2853+ self.ui.show()
2854+ self.addCleanup(self.ui.hide)
2855+ self.assertTrue(self.ui.ui.confirm_email_assistance.isVisible())
2856+ self.assertEqual(
2857+ unicode(self.ui.ui.confirm_email_assistance.text()),
2858+ gui.ERROR % gui.EMAIL_MATCH)
2859+ self.ui.hide()
2860+
2861+ def test_focus_changed_password_visibility(self):
2862+ """Check visibility changes when focus_changed() is executed."""
2863+ self.ui.show()
2864+ self.addCleanup(self.ui.hide)
2865+ self.ui.focus_changed(None, self.ui.ui.password_edit)
2866+ self.assertTrue(self.ui.ui.password_assistance.isVisible())
2867+
2868+ def test_hide_event(self):
2869+ """Check that hide_event works when set_up_button is none."""
2870+ self.assertEqual(self.ui.set_up_button, None)
2871+ self.ui.hideEvent(QtGui.QHideEvent())
2872+
2873+ def test_show_event(self):
2874+ """Check that show_event works when set_up_button is none."""
2875+ self.assertEqual(self.ui.set_up_button, None)
2876+ self.ui.showEvent(QtGui.QShowEvent())
2877+ self.ui.hideEvent(QtGui.QHideEvent())
2878+
2879+ def test_on_captcha_refreshing(self):
2880+ """Check the state of the overlay on captcha refreshing."""
2881+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
2882+ self.ui.on_captcha_refreshing()
2883+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
2884+ self.ui.captcha_received = True
2885+ self.ui.show()
2886+ self.addCleanup(self.ui.hide)
2887+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
2888+ self.ui.on_captcha_refreshing()
2889+ self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
2890+
2891+ def test_on_captcha_refresh_complete(self):
2892+ """Check the state of the overlay on captcha refreshing complete."""
2893+ self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)
2894+ self.ui.on_captcha_refresh_complete()
2895+ self.assertEqual(self.ui.wizard().overlay.hide_counter, 1)
2896
2897=== added file 'ubuntu_sso/qt/tests/test_sign_in_page.py'
2898--- ubuntu_sso/qt/tests/test_sign_in_page.py 1970-01-01 00:00:00 +0000
2899+++ ubuntu_sso/qt/tests/test_sign_in_page.py 2012-02-07 15:10:30 +0000
2900@@ -0,0 +1,45 @@
2901+# -*- coding: utf-8 -*-
2902+
2903+# Copyright 2012 Canonical Ltd.
2904+#
2905+# This program is free software: you can redistribute it and/or modify it
2906+# under the terms of the GNU General Public License version 3, as published
2907+# by the Free Software Foundation.
2908+#
2909+# This program is distributed in the hope that it will be useful, but
2910+# WITHOUT ANY WARRANTY; without even the implied warranties of
2911+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2912+# PURPOSE. See the GNU General Public License for more details.
2913+#
2914+# You should have received a copy of the GNU General Public License along
2915+# with this program. If not, see <http://www.gnu.org/licenses/>.
2916+
2917+"""The test suite for Sign In UI."""
2918+
2919+from PyQt4 import QtGui
2920+from twisted.internet import defer
2921+
2922+from ubuntu_sso.qt import sign_in_page as gui
2923+from ubuntu_sso.qt.ui.choose_sign_in_ui import Ui_ChooseSignInPage
2924+from ubuntu_sso.qt.tests import BaseTestCase, FakeMainWindow
2925+
2926+
2927+class SignInPageTestCase(BaseTestCase):
2928+ """Test the SignInPage code."""
2929+
2930+ @defer.inlineCallbacks
2931+ def setUp(self):
2932+ """Initialize this test instance."""
2933+ yield super(SignInPageTestCase, self).setUp()
2934+ self.ui = gui.SignInPage(QtGui.QPixmap(':/win_installer_graphic.png'),
2935+ Ui_ChooseSignInPage(),
2936+ None, None)
2937+
2938+ def test_show_event(self):
2939+ """Check the page is initialized correctly."""
2940+ wizard = FakeMainWindow()
2941+ self.patch(self.ui, 'wizard', lambda *args: wizard)
2942+ self.ui.initializePage()
2943+ self.ui.show()
2944+ self.addCleanup(self.ui.hide)
2945+ self.assertTrue(self.ui.ui.existing_account_button.isDefault())

Subscribers

People subscribed via source and target branches