Merge lp:~diegosarmentero/ubuntu-sso-client/show-errors into lp:ubuntu-sso-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 900
Merged at revision: 893
Proposed branch: lp:~diegosarmentero/ubuntu-sso-client/show-errors
Merge into: lp:ubuntu-sso-client
Diff against target: 1151 lines (+381/-301)
18 files modified
data/qt/setup_account.ui (+246/-268)
data/qt/stylesheet.qss (+9/-1)
ubuntu_sso/qt/__init__.py (+1/-1)
ubuntu_sso/qt/current_user_sign_in_page.py (+3/-3)
ubuntu_sso/qt/email_verification_page.py (+2/-1)
ubuntu_sso/qt/enhanced_check_box.py (+1/-1)
ubuntu_sso/qt/forgotten_password_page.py (+3/-1)
ubuntu_sso/qt/main.py (+4/-0)
ubuntu_sso/qt/reset_password_page.py (+2/-3)
ubuntu_sso/qt/setup_account_page.py (+4/-5)
ubuntu_sso/qt/sso_wizard_page.py (+34/-9)
ubuntu_sso/qt/tests/test_current_user_sign_in_page.py (+8/-2)
ubuntu_sso/qt/tests/test_email_verification.py (+7/-1)
ubuntu_sso/qt/tests/test_forgotten_password.py (+8/-2)
ubuntu_sso/qt/tests/test_reset_password.py (+3/-0)
ubuntu_sso/qt/tests/test_setup_account.py (+3/-1)
ubuntu_sso/qt/tests/test_sso_wizard_page.py (+39/-0)
ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py (+4/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-sso-client/show-errors
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+94617@code.launchpad.net

Commit message

- Fix: [UIFe] Improve the display of errors in the Qt UI (LP: #938604).
- Fix: Qt UI: center when first opening (LP: #934173).

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

I'm getting all these:

== Python Lint Notices ==

ubuntu_sso/qt/current_user_sign_in_page.py:
    158: [E1121, CurrentUserSignInPage.on_login_error] Too many positional arguments for function call

ubuntu_sso/qt/email_verification_page.py:
    135: [E1121, EmailVerificationPage.on_email_validation_error] Too many positional arguments for function call

ubuntu_sso/qt/forgotten_password_page.py:
    189: [E1121, ForgottenPasswordPage.on_password_reset_error] Too many positional arguments for function call

ubuntu_sso/qt/reset_password_page.py:
    183: [E1121, ResetPasswordPage.on_password_change_error] Too many positional arguments for function call

ubuntu_sso/qt/setup_account_page.py:
    350: [E1121, SetupAccountPage.on_user_registration_error] Too many positional arguments for function call
    391: [E1121, SetupAccountPage.validate_form] Too many positional arguments for function call

nessita@dali:~/canonical/ussoc/review_show-errors$

review: Needs Fixing
890. By Diego Sarmentero

Fixing lint issues

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

> I'm getting all these:
>
> == Python Lint Notices ==
>
> ubuntu_sso/qt/current_user_sign_in_page.py:
> 158: [E1121, CurrentUserSignInPage.on_login_error] Too many positional
> arguments for function call
>
> ubuntu_sso/qt/email_verification_page.py:
> 135: [E1121, EmailVerificationPage.on_email_validation_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/forgotten_password_page.py:
> 189: [E1121, ForgottenPasswordPage.on_password_reset_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/reset_password_page.py:
> 183: [E1121, ResetPasswordPage.on_password_change_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/setup_account_page.py:
> 350: [E1121, SetupAccountPage.on_user_registration_error] Too many
> positional arguments for function call
> 391: [E1121, SetupAccountPage.validate_form] Too many positional
> arguments for function call
>
> nessita@dali:~/canonical/ussoc/review_show-errors$

Fixed, forgot to push that.

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

Branch looks good!

* One tiny note: in current_user_sign_in_page.py, cleanupPage should not call self.hide_error() but super() instead.

* Instead of using assertTrue(foo >= bar), can you please ise assertGreaterEqual?

* Can you please restore the removed empty line in ubuntu_sso_wizard.py?

Thanks!

review: Needs Fixing
891. By Diego Sarmentero

Fixing some minor details.

892. By Diego Sarmentero

Changing the style and location of the errors.

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

Please do not increase the sso dialog size since we're already above the limit (limit is 525).

So, instead, remove the padding a bit, since there is too much white space between the header and the "Name" legend. Do not worry for the padding for the warning label.

Thanks!

review: Needs Fixing
893. By Diego Sarmentero

Fixing size, and adding ellipsis to the error message.

894. By Diego Sarmentero

Improves in the ui style.

895. By Diego Sarmentero

Some modifications in the setup_account_page_ui padding and spaces.

896. By Diego Sarmentero

Conflict resolve

897. By Diego Sarmentero

Conflict resolved.

898. By Diego Sarmentero

fixing setup_page

899. By Diego Sarmentero

improves in setup_account_page

900. By Diego Sarmentero

Fixing errors reset when the user restart request again some data.

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

Looks good!

Thanks for working on this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/qt/setup_account.ui'
2--- data/qt/setup_account.ui 2012-02-23 20:28:00 +0000
3+++ data/qt/setup_account.ui 2012-03-01 20:49:18 +0000
4@@ -7,7 +7,7 @@
5 <x>0</x>
6 <y>0</y>
7 <width>543</width>
8- <height>514</height>
9+ <height>476</height>
10 </rect>
11 </property>
12 <property name="sizePolicy">
13@@ -39,24 +39,27 @@
14 <number>0</number>
15 </property>
16 <item>
17- <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,220">
18+ <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,0">
19+ <property name="sizeConstraint">
20+ <enum>QLayout::SetDefaultConstraint</enum>
21+ </property>
22+ <item row="1" column="1">
23+ <spacer name="verticalSpacer">
24+ <property name="orientation">
25+ <enum>Qt::Vertical</enum>
26+ </property>
27+ <property name="sizeType">
28+ <enum>QSizePolicy::Fixed</enum>
29+ </property>
30+ <property name="sizeHint" stdset="0">
31+ <size>
32+ <width>20</width>
33+ <height>15</height>
34+ </size>
35+ </property>
36+ </spacer>
37+ </item>
38 <item row="0" column="0">
39- <widget class="QLabel" name="password_info_label">
40- <property name="sizePolicy">
41- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
42- <horstretch>0</horstretch>
43- <verstretch>0</verstretch>
44- </sizepolicy>
45- </property>
46- <property name="text">
47- <string notr="true">password_info_label</string>
48- </property>
49- <property name="wordWrap">
50- <bool>true</bool>
51- </property>
52- </widget>
53- </item>
54- <item row="1" column="0">
55 <layout class="QVBoxLayout" name="verticalLayout">
56 <property name="spacing">
57 <number>3</number>
58@@ -106,7 +109,7 @@
59 </item>
60 </layout>
61 </item>
62- <item row="3" column="0">
63+ <item row="2" column="0">
64 <layout class="QVBoxLayout" name="verticalLayout">
65 <property name="spacing">
66 <number>3</number>
67@@ -159,7 +162,48 @@
68 </item>
69 </layout>
70 </item>
71- <item row="4" column="0">
72+ <item row="2" column="1">
73+ <layout class="QVBoxLayout" name="verticalLayout_8">
74+ <property name="spacing">
75+ <number>0</number>
76+ </property>
77+ <property name="leftMargin">
78+ <number>0</number>
79+ </property>
80+ <item>
81+ <widget class="QLabel" name="email_assistance">
82+ <property name="sizePolicy">
83+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
84+ <horstretch>0</horstretch>
85+ <verstretch>0</verstretch>
86+ </sizepolicy>
87+ </property>
88+ <property name="minimumSize">
89+ <size>
90+ <width>220</width>
91+ <height>0</height>
92+ </size>
93+ </property>
94+ <property name="maximumSize">
95+ <size>
96+ <width>220</width>
97+ <height>16777215</height>
98+ </size>
99+ </property>
100+ <property name="text">
101+ <string notr="true">email_assistance</string>
102+ </property>
103+ <property name="alignment">
104+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
105+ </property>
106+ <property name="wordWrap">
107+ <bool>true</bool>
108+ </property>
109+ </widget>
110+ </item>
111+ </layout>
112+ </item>
113+ <item row="3" column="0">
114 <layout class="QVBoxLayout" name="verticalLayout">
115 <property name="spacing">
116 <number>3</number>
117@@ -212,28 +256,139 @@
118 </item>
119 </layout>
120 </item>
121- <item row="6" column="0">
122+ <item row="3" column="1">
123+ <layout class="QVBoxLayout" name="verticalLayout_9">
124+ <property name="spacing">
125+ <number>0</number>
126+ </property>
127+ <property name="leftMargin">
128+ <number>0</number>
129+ </property>
130+ <item>
131+ <widget class="QLabel" name="confirm_email_assistance">
132+ <property name="sizePolicy">
133+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
134+ <horstretch>0</horstretch>
135+ <verstretch>0</verstretch>
136+ </sizepolicy>
137+ </property>
138+ <property name="minimumSize">
139+ <size>
140+ <width>220</width>
141+ <height>0</height>
142+ </size>
143+ </property>
144+ <property name="maximumSize">
145+ <size>
146+ <width>220</width>
147+ <height>16777215</height>
148+ </size>
149+ </property>
150+ <property name="text">
151+ <string notr="true">confirm_email_assistance</string>
152+ </property>
153+ <property name="alignment">
154+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
155+ </property>
156+ <property name="wordWrap">
157+ <bool>true</bool>
158+ </property>
159+ <property name="indent">
160+ <number>0</number>
161+ </property>
162+ </widget>
163+ </item>
164+ </layout>
165+ </item>
166+ <item row="4" column="1">
167+ <spacer name="verticalSpacer_2">
168+ <property name="orientation">
169+ <enum>Qt::Vertical</enum>
170+ </property>
171+ <property name="sizeType">
172+ <enum>QSizePolicy::Fixed</enum>
173+ </property>
174+ <property name="sizeHint" stdset="0">
175+ <size>
176+ <width>20</width>
177+ <height>15</height>
178+ </size>
179+ </property>
180+ </spacer>
181+ </item>
182+ <item row="9" column="1">
183+ <spacer name="verticalSpacer_5">
184+ <property name="orientation">
185+ <enum>Qt::Vertical</enum>
186+ </property>
187+ <property name="sizeType">
188+ <enum>QSizePolicy::Fixed</enum>
189+ </property>
190+ <property name="sizeHint" stdset="0">
191+ <size>
192+ <width>20</width>
193+ <height>15</height>
194+ </size>
195+ </property>
196+ </spacer>
197+ </item>
198+ <item row="10" column="0" colspan="2">
199+ <layout class="QHBoxLayout" name="hlayout_check">
200+ <property name="spacing">
201+ <number>0</number>
202+ </property>
203+ <property name="topMargin">
204+ <number>10</number>
205+ </property>
206+ </layout>
207+ </item>
208+ <item row="0" column="1">
209+ <layout class="QVBoxLayout" name="verticalLayout_7">
210+ <property name="spacing">
211+ <number>0</number>
212+ </property>
213+ <property name="leftMargin">
214+ <number>0</number>
215+ </property>
216+ <item>
217+ <widget class="QLabel" name="name_assistance">
218+ <property name="sizePolicy">
219+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
220+ <horstretch>0</horstretch>
221+ <verstretch>0</verstretch>
222+ </sizepolicy>
223+ </property>
224+ <property name="minimumSize">
225+ <size>
226+ <width>220</width>
227+ <height>0</height>
228+ </size>
229+ </property>
230+ <property name="maximumSize">
231+ <size>
232+ <width>220</width>
233+ <height>16777215</height>
234+ </size>
235+ </property>
236+ <property name="text">
237+ <string notr="true">name_assistance</string>
238+ </property>
239+ <property name="alignment">
240+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
241+ </property>
242+ <property name="wordWrap">
243+ <bool>true</bool>
244+ </property>
245+ </widget>
246+ </item>
247+ </layout>
248+ </item>
249+ <item row="5" column="0">
250 <layout class="QVBoxLayout" name="verticalLayout">
251 <property name="spacing">
252 <number>3</number>
253 </property>
254 <item>
255- <spacer name="verticalSpacer_4">
256- <property name="orientation">
257- <enum>Qt::Vertical</enum>
258- </property>
259- <property name="sizeType">
260- <enum>QSizePolicy::Fixed</enum>
261- </property>
262- <property name="sizeHint" stdset="0">
263- <size>
264- <width>20</width>
265- <height>10</height>
266- </size>
267- </property>
268- </spacer>
269- </item>
270- <item>
271 <widget class="QLabel" name="password_label">
272 <property name="font">
273 <font>
274@@ -290,28 +445,47 @@
275 </item>
276 </layout>
277 </item>
278- <item row="7" column="0">
279+ <item row="5" column="1" rowspan="2">
280+ <layout class="QHBoxLayout" name="horizontalLayout_3">
281+ <item>
282+ <widget class="QLabel" name="password_assistance">
283+ <property name="sizePolicy">
284+ <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
285+ <horstretch>0</horstretch>
286+ <verstretch>0</verstretch>
287+ </sizepolicy>
288+ </property>
289+ <property name="minimumSize">
290+ <size>
291+ <width>220</width>
292+ <height>80</height>
293+ </size>
294+ </property>
295+ <property name="maximumSize">
296+ <size>
297+ <width>220</width>
298+ <height>16777215</height>
299+ </size>
300+ </property>
301+ <property name="text">
302+ <string notr="true">password_assistance</string>
303+ </property>
304+ <property name="wordWrap">
305+ <bool>true</bool>
306+ </property>
307+ <property name="indent">
308+ <number>17</number>
309+ </property>
310+ </widget>
311+ </item>
312+ </layout>
313+ </item>
314+ <item row="6" column="0">
315 <layout class="QVBoxLayout" name="verticalLayout">
316 <property name="spacing">
317 <number>3</number>
318 </property>
319 <item>
320- <spacer name="verticalSpacer_5">
321- <property name="orientation">
322- <enum>Qt::Vertical</enum>
323- </property>
324- <property name="sizeType">
325- <enum>QSizePolicy::Fixed</enum>
326- </property>
327- <property name="sizeHint" stdset="0">
328- <size>
329- <width>20</width>
330- <height>10</height>
331- </size>
332- </property>
333- </spacer>
334- </item>
335- <item>
336 <widget class="QLabel" name="confirm_password_label">
337 <property name="font">
338 <font>
339@@ -362,7 +536,23 @@
340 </item>
341 </layout>
342 </item>
343- <item row="9" column="0">
344+ <item row="7" column="1">
345+ <spacer name="verticalSpacer_3">
346+ <property name="orientation">
347+ <enum>Qt::Vertical</enum>
348+ </property>
349+ <property name="sizeType">
350+ <enum>QSizePolicy::Fixed</enum>
351+ </property>
352+ <property name="sizeHint" stdset="0">
353+ <size>
354+ <width>20</width>
355+ <height>15</height>
356+ </size>
357+ </property>
358+ </spacer>
359+ </item>
360+ <item row="8" column="0">
361 <layout class="QVBoxLayout" name="verticalLayout">
362 <property name="spacing">
363 <number>3</number>
364@@ -442,7 +632,7 @@
365 </item>
366 </layout>
367 </item>
368- <item row="9" column="1">
369+ <item row="8" column="1">
370 <widget class="QLabel" name="refresh_label">
371 <property name="sizePolicy">
372 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
373@@ -476,218 +666,6 @@
374 </property>
375 </widget>
376 </item>
377- <item row="1" column="1">
378- <layout class="QVBoxLayout" name="verticalLayout_7">
379- <property name="spacing">
380- <number>0</number>
381- </property>
382- <property name="leftMargin">
383- <number>0</number>
384- </property>
385- <item>
386- <widget class="QLabel" name="name_assistance">
387- <property name="sizePolicy">
388- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
389- <horstretch>0</horstretch>
390- <verstretch>0</verstretch>
391- </sizepolicy>
392- </property>
393- <property name="minimumSize">
394- <size>
395- <width>220</width>
396- <height>0</height>
397- </size>
398- </property>
399- <property name="maximumSize">
400- <size>
401- <width>220</width>
402- <height>16777215</height>
403- </size>
404- </property>
405- <property name="text">
406- <string notr="true">name_assistance</string>
407- </property>
408- <property name="alignment">
409- <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
410- </property>
411- <property name="wordWrap">
412- <bool>true</bool>
413- </property>
414- </widget>
415- </item>
416- </layout>
417- </item>
418- <item row="3" column="1">
419- <layout class="QVBoxLayout" name="verticalLayout_8">
420- <property name="spacing">
421- <number>0</number>
422- </property>
423- <property name="leftMargin">
424- <number>0</number>
425- </property>
426- <item>
427- <widget class="QLabel" name="email_assistance">
428- <property name="sizePolicy">
429- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
430- <horstretch>0</horstretch>
431- <verstretch>0</verstretch>
432- </sizepolicy>
433- </property>
434- <property name="minimumSize">
435- <size>
436- <width>220</width>
437- <height>0</height>
438- </size>
439- </property>
440- <property name="maximumSize">
441- <size>
442- <width>220</width>
443- <height>16777215</height>
444- </size>
445- </property>
446- <property name="text">
447- <string notr="true">email_assistance</string>
448- </property>
449- <property name="alignment">
450- <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
451- </property>
452- <property name="wordWrap">
453- <bool>true</bool>
454- </property>
455- </widget>
456- </item>
457- </layout>
458- </item>
459- <item row="4" column="1">
460- <layout class="QVBoxLayout" name="verticalLayout_9">
461- <property name="spacing">
462- <number>0</number>
463- </property>
464- <property name="leftMargin">
465- <number>0</number>
466- </property>
467- <item>
468- <widget class="QLabel" name="confirm_email_assistance">
469- <property name="sizePolicy">
470- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
471- <horstretch>0</horstretch>
472- <verstretch>0</verstretch>
473- </sizepolicy>
474- </property>
475- <property name="minimumSize">
476- <size>
477- <width>220</width>
478- <height>0</height>
479- </size>
480- </property>
481- <property name="maximumSize">
482- <size>
483- <width>220</width>
484- <height>16777215</height>
485- </size>
486- </property>
487- <property name="text">
488- <string notr="true">confirm_email_assistance</string>
489- </property>
490- <property name="alignment">
491- <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
492- </property>
493- <property name="wordWrap">
494- <bool>true</bool>
495- </property>
496- <property name="indent">
497- <number>0</number>
498- </property>
499- </widget>
500- </item>
501- </layout>
502- </item>
503- <item row="6" column="1" rowspan="2">
504- <widget class="QLabel" name="password_assistance">
505- <property name="sizePolicy">
506- <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
507- <horstretch>0</horstretch>
508- <verstretch>0</verstretch>
509- </sizepolicy>
510- </property>
511- <property name="minimumSize">
512- <size>
513- <width>220</width>
514- <height>100</height>
515- </size>
516- </property>
517- <property name="maximumSize">
518- <size>
519- <width>220</width>
520- <height>16777215</height>
521- </size>
522- </property>
523- <property name="text">
524- <string notr="true">password_assistance</string>
525- </property>
526- <property name="wordWrap">
527- <bool>true</bool>
528- </property>
529- <property name="indent">
530- <number>17</number>
531- </property>
532- </widget>
533- </item>
534- <item row="2" column="1">
535- <spacer name="verticalSpacer">
536- <property name="orientation">
537- <enum>Qt::Vertical</enum>
538- </property>
539- <property name="sizeType">
540- <enum>QSizePolicy::Fixed</enum>
541- </property>
542- <property name="sizeHint" stdset="0">
543- <size>
544- <width>20</width>
545- <height>15</height>
546- </size>
547- </property>
548- </spacer>
549- </item>
550- <item row="5" column="1">
551- <spacer name="verticalSpacer_2">
552- <property name="orientation">
553- <enum>Qt::Vertical</enum>
554- </property>
555- <property name="sizeType">
556- <enum>QSizePolicy::Fixed</enum>
557- </property>
558- <property name="sizeHint" stdset="0">
559- <size>
560- <width>20</width>
561- <height>15</height>
562- </size>
563- </property>
564- </spacer>
565- </item>
566- <item row="8" column="1">
567- <spacer name="verticalSpacer_3">
568- <property name="orientation">
569- <enum>Qt::Vertical</enum>
570- </property>
571- <property name="sizeType">
572- <enum>QSizePolicy::Fixed</enum>
573- </property>
574- <property name="sizeHint" stdset="0">
575- <size>
576- <width>20</width>
577- <height>15</height>
578- </size>
579- </property>
580- </spacer>
581- </item>
582- </layout>
583- </item>
584- <item>
585- <layout class="QHBoxLayout" name="hlayout_check">
586- <property name="spacing">
587- <number>0</number>
588- </property>
589 </layout>
590 </item>
591 </layout>
592
593=== modified file 'data/qt/stylesheet.qss'
594--- data/qt/stylesheet.qss 2012-02-29 14:00:12 +0000
595+++ data/qt/stylesheet.qss 2012-03-01 20:49:18 +0000
596@@ -15,6 +15,7 @@
597
598 QLabel#password_assistance {
599 border-image: url(":/balloon_shape.png");
600+ font-size: 12px;
601 }
602
603 QLineEdit {
604@@ -98,5 +99,12 @@
605 }
606
607 QFrame#header {
608- padding: 10px;
609+ padding-top: 1px;
610+ padding-bottom: 1px;
611+}
612+
613+QLabel#form_errors {
614+ font: bold 14px;
615+ color: #df2d1f;
616+ padding-bottom: 1px;
617 }
618
619=== modified file 'ubuntu_sso/qt/__init__.py'
620--- ubuntu_sso/qt/__init__.py 2012-02-23 20:16:46 +0000
621+++ ubuntu_sso/qt/__init__.py 2012-03-01 20:49:18 +0000
622@@ -21,7 +21,7 @@
623
624 ERROR_ALL = '__all__'
625 ERROR_MESSAGE = 'message'
626-PREFERED_UI_SIZE = {'width': 550, 'height': 530}
627+PREFERED_UI_SIZE = {'width': 550, 'height': 525}
628
629
630 # Based on the gtk implementation
631
632=== modified file 'ubuntu_sso/qt/current_user_sign_in_page.py'
633--- ubuntu_sso/qt/current_user_sign_in_page.py 2012-02-29 14:00:12 +0000
634+++ ubuntu_sso/qt/current_user_sign_in_page.py 2012-03-01 20:49:18 +0000
635@@ -91,6 +91,7 @@
636
637 def cleanupPage(self):
638 """Reset the wizard buttons."""
639+ super(CurrentUserSignInPage, self).cleanupPage()
640 self.wizard().setButtonLayout([QtGui.QWizard.Stretch])
641
642 def _set_translated_strings(self):
643@@ -134,6 +135,7 @@
644 else:
645 f = self.backend.login
646
647+ self.hide_error()
648 self.show_overlay()
649 error_handler = partial(self._handle_error, f, self.on_login_error)
650 f(*args, reply_handler=NO_OP, error_handler=error_handler)
651@@ -143,9 +145,7 @@
652 # let the user know
653 logger.error('Got error when login %s, error: %s',
654 self.app_name, error)
655- self.hide_overlay()
656- self.message_box.critical(self, self.app_name,
657- build_general_error_message(error))
658+ self.show_error(self.app_name, build_general_error_message(error))
659
660 def on_logged_in(self, app_name, result):
661 """We managed to log in."""
662
663=== modified file 'ubuntu_sso/qt/email_verification_page.py'
664--- ubuntu_sso/qt/email_verification_page.py 2012-02-29 14:00:12 +0000
665+++ ubuntu_sso/qt/email_verification_page.py 2012-03-01 20:49:18 +0000
666@@ -106,6 +106,7 @@
667 logger.debug('EmailVerificationController.validate_email')
668 code = unicode(self.ui.verification_code_edit.text())
669 args = (self.app_name, self.email, self.password, code)
670+ self.hide_error()
671 if self.ping_url:
672 f = self.backend.validate_email_and_ping
673 args = args + (self.ping_url,)
674@@ -128,7 +129,7 @@
675 """Signal thrown when there's a problem validating the email."""
676 msg = error.pop(ERROR_EMAIL_TOKEN, '')
677 msg += build_general_error_message(error)
678- self.message_box.critical(self, self.app_name, msg)
679+ self.show_error(self.app_name, msg)
680
681 #pylint: disable=C0103
682 def initializePage(self):
683
684=== modified file 'ubuntu_sso/qt/enhanced_check_box.py'
685--- ubuntu_sso/qt/enhanced_check_box.py 2012-02-16 18:40:41 +0000
686+++ ubuntu_sso/qt/enhanced_check_box.py 2012-03-01 20:49:18 +0000
687@@ -32,7 +32,7 @@
688 self.text_label.setOpenExternalLinks(True)
689 padding = self.iconSize().width()
690 self.text_label.setStyleSheet("margin-top: -3px;"
691- "padding-left: {0}px;".format(padding))
692+ "padding-left: 2px;")
693 hbox.setContentsMargins(padding, 0, 0, 0)
694 hbox.addWidget(self.text_label)
695 self.setLayout(hbox)
696
697=== modified file 'ubuntu_sso/qt/forgotten_password_page.py'
698--- ubuntu_sso/qt/forgotten_password_page.py 2012-02-29 14:00:12 +0000
699+++ ubuntu_sso/qt/forgotten_password_page.py 2012-03-01 20:49:18 +0000
700@@ -138,6 +138,7 @@
701
702 def request_new_password(self):
703 """Send the request password operation."""
704+ self.hide_error()
705 args = (self.app_name, self.email_address)
706 f = self.backend.request_password_reset_token
707
708@@ -154,6 +155,7 @@
709
710 def on_try_again(self):
711 """Set back the widget to the initial state."""
712+ self.hide_error()
713 self.try_again_widget.setVisible(False)
714 self.email_widget.setVisible(True)
715
716@@ -177,4 +179,4 @@
717 self.email_widget.setVisible(False)
718 self.forgotted_password_intro_label.setVisible(False)
719 self.try_again_widget.setVisible(True)
720- self.message_box.critical(self, self.app_name, msg)
721+ self.show_error(self.app_name, msg)
722
723=== modified file 'ubuntu_sso/qt/main.py'
724--- ubuntu_sso/qt/main.py 2012-02-24 17:22:32 +0000
725+++ ubuntu_sso/qt/main.py 2012-03-01 20:49:18 +0000
726@@ -40,5 +40,9 @@
727
728 # Unused variable 'ui', pylint: disable=W0612
729 ui = UbuntuSSOClientGUI(close_callback=app.exit, **kwargs)
730+ style = QtGui.QStyle.alignedRect(
731+ QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter,
732+ ui.size(), app.desktop().availableGeometry())
733+ ui.setGeometry(style)
734 ui.show()
735 app.exec_()
736
737=== modified file 'ubuntu_sso/qt/reset_password_page.py'
738--- ubuntu_sso/qt/reset_password_page.py 2012-02-29 14:00:12 +0000
739+++ ubuntu_sso/qt/reset_password_page.py 2012-03-01 20:49:18 +0000
740@@ -166,12 +166,11 @@
741 """Let the user know that there was an error."""
742 logger.error('Got error changing password for %s, error: %s',
743 self.app_name, error)
744- self.hide_overlay()
745- self.message_box.critical(self, self.app_name,
746- build_general_error_message(error))
747+ self.show_error(self.app_name, build_general_error_message(error))
748
749 def set_new_password(self):
750 """Request a new password to be set."""
751+ self.hide_error()
752 email = unicode(self.wizard().forgotten.ui.email_line_edit.text())
753 code = unicode(self.ui.reset_code_line_edit.text())
754 password = unicode(self.ui.password_line_edit.text())
755
756=== modified file 'ubuntu_sso/qt/setup_account_page.py'
757--- ubuntu_sso/qt/setup_account_page.py 2012-03-01 13:33:51 +0000
758+++ ubuntu_sso/qt/setup_account_page.py 2012-03-01 20:49:18 +0000
759@@ -144,7 +144,6 @@
760 self.ui.confirm_email_label.setText(RETYPE_EMAIL)
761 self.ui.password_label.setText(PASSWORD)
762 self.ui.confirm_password_label.setText(RETYPE_PASSWORD)
763- self.ui.password_info_label.hide()
764
765 # Button setup
766 self.wizard().setButtonLayout([
767@@ -172,7 +171,6 @@
768 self.ui.password_label.setText(PASSWORD1_ENTRY)
769 self.ui.confirm_password_label.setText(PASSWORD2_ENTRY)
770 self.ui.password_edit.setToolTip(PASSWORD_HELP)
771- self.ui.password_info_label.setText(PASSWORD_HELP)
772 self.ui.captcha_solution_edit.setPlaceholderText(
773 CAPTCHA_SOLUTION_ENTRY)
774 link = CAPTCHA_RELOAD_LINK % {'reload_text': CAPTCHA_RELOAD_TEXT}
775@@ -332,7 +330,7 @@
776 def on_captcha_generation_error(self, error, *args, **kwargs):
777 """An error ocurred."""
778 logger.debug('SetUpAccountPage.on_captcha_generation_error')
779- self.message_box.critical(self, self.app_name, CAPTCHA_LOAD_ERROR)
780+ self.show_error(self.app_name, CAPTCHA_LOAD_ERROR)
781 self.on_captcha_refresh_complete()
782
783 def on_user_registration_error(self, app_name, error):
784@@ -344,7 +342,7 @@
785 self.set_error_message(self.ui.email_assistance, msg)
786 error_msg = build_general_error_message(error)
787 if error_msg:
788- self.message_box.critical(self, self.app_name, error_msg)
789+ self.show_error(self.app_name, error_msg)
790 self._refresh_captcha()
791
792 def on_user_registered(self, app_name, result):
793@@ -385,7 +383,7 @@
794 messages.append(CAPTCHA_REQUIRED_ERROR)
795 if len(messages) > 0:
796 condition = False
797- self.message_box.critical(self, self.app_name, '\n'.join(messages))
798+ self.show_error(self.app_name, '\n'.join(messages))
799 return condition
800
801 def set_next_validation(self):
802@@ -399,6 +397,7 @@
803 # validate the current info of the form, try to perform the action
804 # to register the user, and then move foward
805 if self.validate_form():
806+ self.hide_error()
807 args = (self.app_name, email, password, name, captcha_id,
808 captcha_solution)
809 f = self.backend.register_user
810
811=== modified file 'ubuntu_sso/qt/sso_wizard_page.py'
812--- ubuntu_sso/qt/sso_wizard_page.py 2012-02-29 14:31:45 +0000
813+++ ubuntu_sso/qt/sso_wizard_page.py 2012-03-01 20:49:18 +0000
814@@ -26,7 +26,6 @@
815 QFontMetrics,
816 QHBoxLayout,
817 QVBoxLayout,
818- QMessageBox,
819 QStyle,
820 QWizardPage,
821 QLabel,
822@@ -50,7 +49,7 @@
823 super(Header, self).__init__()
824 self.setObjectName('header')
825 vbox = QVBoxLayout(self)
826- vbox.setContentsMargins(0, 0, 0, 10)
827+ vbox.setContentsMargins(0, 0, 0, 0)
828 self.title_label = QLabel()
829 self.title_label.setWordWrap(True)
830 self.title_label.setObjectName('title_label')
831@@ -113,27 +112,48 @@
832 self.policy_url = kwargs.get('policy_url', '')
833 self.help_text = kwargs.get('help_text', '')
834
835+ # Set the error area
836+ self.form_errors_label = QLabel(' ')
837+ self.form_errors_label.setObjectName('form_errors')
838+ self.form_errors_label.setAlignment(Qt.AlignBottom)
839+ self.layout().insertWidget(0, self.form_errors_label)
840+ # Set the header
841 self.header = Header()
842 self.header.set_title(title='')
843 self.header.set_subtitle(subtitle='')
844 self.layout().insertWidget(0, self.header)
845-
846- self.message_box = QMessageBox
847 self._signals_receivers = {}
848 self.backend = None
849
850+ self.layout().setAlignment(Qt.AlignLeft)
851+
852 self.setup_page()
853
854+ def show_error(self, app_name, message):
855+ """Show an error message inside the page."""
856+ self.hide_overlay()
857+ fm = QFontMetrics(self.form_errors_label.font())
858+ width = PREFERED_UI_SIZE['width'] * 0.95
859+ elided_text = fm.elidedText(message, Qt.ElideRight, width)
860+ self.form_errors_label.setText(elided_text)
861+ self.form_errors_label.setToolTip(message)
862+
863+ def hide_error(self):
864+ """Hide the label errors in the current page."""
865+ # We actually want the label with one chat, because if it is an
866+ # empty string, the height of the label is 0
867+ self.form_errors_label.setText(' ')
868+
869+ def hide_overlay(self):
870+ """Emit the signal to notify the upper container that ends loading."""
871+ self.setEnabled(True)
872+ self.processingFinished.emit()
873+
874 def show_overlay(self):
875 """Emit the signal to notify the upper container that is loading."""
876 self.setEnabled(False)
877 self.processingStarted.emit()
878
879- def hide_overlay(self):
880- """Emit the signal to notify the upper container that ends loading."""
881- self.setEnabled(True)
882- self.processingFinished.emit()
883-
884 @defer.inlineCallbacks
885 def setup_page(self):
886 """Setup the widget components."""
887@@ -145,6 +165,11 @@
888 self._connect_ui()
889
890 # pylint: disable=C0103
891+
892+ def cleanupPage(self):
893+ """Hide the errors."""
894+ self.hide_error()
895+
896 def setTitle(self, title=''):
897 """Set the Wizard Page Title."""
898 self.header.set_title(title)
899
900=== modified file 'ubuntu_sso/qt/tests/test_current_user_sign_in_page.py'
901--- ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-02-29 14:00:12 +0000
902+++ ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-03-01 20:49:18 +0000
903@@ -111,6 +111,7 @@
904
905 def test_login_with_ping(self):
906 """Test the login method."""
907+ self.patch(self.ui, "hide_error", self._set_called)
908 email = 'valid@email'
909 password = '123456'
910 self.ui.ui.email_edit.setText(email)
911@@ -120,9 +121,12 @@
912 self.assertFalse(self.ui.isEnabled())
913 self.assert_backend_called('login_and_ping',
914 self.app_name, email, password, self.ping_url)
915+ expected = ((), {})
916+ self.assertEqual(expected, self._called)
917
918 def test_login_without_ping(self):
919 """Test the login method."""
920+ self.patch(self.ui, "hide_error", self._set_called)
921 self.ui.ping_url = ''
922 email = 'valid@email'
923 password = '123456'
924@@ -133,15 +137,17 @@
925 self.assertFalse(self.ui.isEnabled())
926 self.assert_backend_called('login',
927 self.app_name, email, password)
928+ expected = ((), {})
929+ self.assertEqual(expected, self._called)
930
931 def test_on_login_error(self):
932 """Test the on_login_error method."""
933- self.patch(self.ui.message_box, "critical", self._set_called)
934+ self.patch(self.ui, "show_error", self._set_called)
935 app_name = 'my_app'
936 self.ui.app_name = app_name
937 error = {'errtype': 'UserNotValidated'}
938 self.ui.on_login_error(app_name, error)
939- self.assertEqual(self._overlay_hide_counter, 1)
940+ self.assertEqual(self._overlay_hide_counter, 0)
941 self.assertTrue(self.ui.isEnabled())
942 expected = ((self.ui, 'my_app', ''), {})
943 self.assertTrue(expected, self._called)
944
945=== modified file 'ubuntu_sso/qt/tests/test_email_verification.py'
946--- ubuntu_sso/qt/tests/test_email_verification.py 2012-02-29 14:00:12 +0000
947+++ ubuntu_sso/qt/tests/test_email_verification.py 2012-03-01 20:49:18 +0000
948@@ -99,7 +99,7 @@
949
950 def test_on_email_validation_error(self):
951 """Test the validate_email method."""
952- self.patch(self.ui.message_box, "critical", self._set_called)
953+ self.patch(self.ui, "show_error", self._set_called)
954 app_name = 'my_app'
955 error = {email_verification_page: 'error in email_verification_page'}
956 self.ui.on_email_validation_error(app_name, error)
957@@ -122,6 +122,7 @@
958
959 def test_validate_email_with_ping(self):
960 """Test the login method."""
961+ self.patch(self.ui, "hide_error", self._set_called)
962 email = 'email@example.com'
963 password = 'password'
964 code = 'code'
965@@ -133,9 +134,12 @@
966
967 self.assert_backend_called('validate_email_and_ping',
968 self.app_name, email, password, code, self.ping_url)
969+ expected = ((), {})
970+ self.assertEqual(expected, self._called)
971
972 def test_validate_email_without_ping(self):
973 """Test the login method."""
974+ self.patch(self.ui, "hide_error", self._set_called)
975 self.ui.ping_url = ''
976 email = 'email@example.com'
977 password = 'password'
978@@ -148,3 +152,5 @@
979
980 self.assert_backend_called('validate_email',
981 self.app_name, email, password, code)
982+ expected = ((), {})
983+ self.assertEqual(expected, self._called)
984
985=== modified file 'ubuntu_sso/qt/tests/test_forgotten_password.py'
986--- ubuntu_sso/qt/tests/test_forgotten_password.py 2012-02-29 14:00:12 +0000
987+++ ubuntu_sso/qt/tests/test_forgotten_password.py 2012-03-01 20:49:18 +0000
988@@ -85,9 +85,12 @@
989
990 def test_send_button_clicked(self):
991 """Test the send_button property."""
992+ self.patch(self.ui, "hide_error", self._set_called)
993 self.ui.send_button.clicked.emit(True)
994 self.assert_backend_called('request_password_reset_token',
995 self.app_name, '')
996+ expected = ((), {})
997+ self.assertEqual(expected, self._called)
998
999 def test_try_again_widget(self):
1000 """Test the try_again_widget property."""
1001@@ -157,11 +160,14 @@
1002
1003 def test_on_try_again(self):
1004 """Test on_try_again method."""
1005+ self.patch(self.ui, "hide_error", self._set_called)
1006 self.ui.show()
1007 self.addCleanup(self.ui.hide)
1008 self.ui.on_try_again()
1009 self.assertTrue(self.ui.email_widget.isVisible())
1010 self.assertFalse(self.ui.try_again_widget.isVisible())
1011+ expected = ((), {})
1012+ self.assertEqual(expected, self._called)
1013
1014 def test_on_password_reset_token_sent(self):
1015 """Test on_password_reset_token_sent method."""
1016@@ -177,7 +183,7 @@
1017
1018 def test_on_password_reset_error(self):
1019 """Test on_password_reset_error method."""
1020- self.patch(self.ui.message_box, "critical", self._set_called)
1021+ self.patch(self.ui, "show_error", self._set_called)
1022 app_name = 'my_app'
1023 error = {'errtype': 'AnotherError'}
1024 self.ui.show()
1025@@ -194,7 +200,7 @@
1026
1027 def test_on_password_reset_error_with_token_error(self):
1028 """Test on_password_reset_error method."""
1029- self.patch(self.ui.message_box, "critical", self._set_called)
1030+ self.patch(self.ui, "show_error", self._set_called)
1031 app_name = 'my_app'
1032 error = {'errtype': 'ResetPasswordTokenError'}
1033 self.ui.on_password_reset_error(app_name, error)
1034
1035=== modified file 'ubuntu_sso/qt/tests/test_reset_password.py'
1036--- ubuntu_sso/qt/tests/test_reset_password.py 2012-02-23 19:49:02 +0000
1037+++ ubuntu_sso/qt/tests/test_reset_password.py 2012-03-01 20:49:18 +0000
1038@@ -128,6 +128,7 @@
1039
1040 def test_set_new_password(self):
1041 """Test set_new_password method."""
1042+ self.patch(self.ui, "hide_error", self._set_called)
1043 email = 'email@example.com'
1044 code = 'code'
1045 password = 'password'
1046@@ -141,3 +142,5 @@
1047
1048 self.assert_backend_called('set_new_password',
1049 self.app_name, email, code, password)
1050+ expected = ((), {})
1051+ self.assertEqual(expected, self._called)
1052
1053=== modified file 'ubuntu_sso/qt/tests/test_setup_account.py'
1054--- ubuntu_sso/qt/tests/test_setup_account.py 2012-02-29 14:00:12 +0000
1055+++ ubuntu_sso/qt/tests/test_setup_account.py 2012-03-01 20:49:18 +0000
1056@@ -152,6 +152,7 @@
1057 def test_on_user_registered(self):
1058 """Test on_user_registered method."""
1059 self.patch(self.ui, "validate_form", lambda: True)
1060+ self.patch(self.ui, "hide_error", self._set_called)
1061
1062 email = 'email@example'
1063 password = 'password'
1064@@ -176,6 +177,8 @@
1065 self.assert_backend_called('register_user',
1066 self.app_name, email, password, name, captcha_id,
1067 captcha_solution)
1068+ expected = ((), {})
1069+ self.assertEqual(expected, self._called)
1070
1071 def test_set_next_validation(self):
1072 """Test on_user_registered method."""
1073@@ -238,7 +241,6 @@
1074 setup_account_page.PASSWORD)
1075 self.assertEqual(self.ui.ui.confirm_password_label.text(),
1076 setup_account_page.RETYPE_PASSWORD)
1077- self.assertFalse(self.ui.ui.password_info_label.isVisible())
1078
1079 # assistants
1080 self.assertFalse(self.ui.ui.name_assistance.isVisible())
1081
1082=== modified file 'ubuntu_sso/qt/tests/test_sso_wizard_page.py'
1083--- ubuntu_sso/qt/tests/test_sso_wizard_page.py 2012-02-24 15:52:33 +0000
1084+++ ubuntu_sso/qt/tests/test_sso_wizard_page.py 2012-03-01 20:49:18 +0000
1085@@ -19,6 +19,7 @@
1086 from twisted.internet import defer
1087
1088 from ubuntu_sso.qt import PREFERED_UI_SIZE
1089+from ubuntu_sso.qt.setup_account_page import SetupAccountPage
1090 from ubuntu_sso.qt.sso_wizard_page import Header
1091 from ubuntu_sso.qt.tests import BaseTestCase
1092
1093@@ -81,3 +82,41 @@
1094 """Check if the widget is hidden for empty subtitle."""
1095 self.header.set_title('')
1096 self.assertFalse(self.header.title_label.isVisible())
1097+
1098+
1099+class SSOWizardPageTest(BaseTestCase):
1100+
1101+ """Tests for SSOWizardPage."""
1102+
1103+ @defer.inlineCallbacks
1104+ def setUp(self):
1105+ yield super(SSOWizardPageTest, self).setUp()
1106+ self.app_name = 'app_name'
1107+ # We need to choose some specific page to test SSOWizardPage,
1108+ # because the __init__ of SSOWizardPage fails by its own.
1109+ self.sso_wizard_page = SetupAccountPage(self.app_name)
1110+
1111+ def test_show_error(self):
1112+ """Test show_error with a normal length string."""
1113+ message = 'error-message'
1114+ self.sso_wizard_page.show_error(self.app_name, message)
1115+ self.assertEqual(
1116+ self.sso_wizard_page.form_errors_label.toolTip(), message)
1117+ expected = unicode(self.sso_wizard_page.form_errors_label.text())
1118+ self.assertEqual(expected, message)
1119+
1120+ def test_show_error_long_text(self):
1121+ """Test show_error with a long length string."""
1122+ message = 'a' * int(PREFERED_UI_SIZE['width'] * 0.95) + 'a'
1123+ self.sso_wizard_page.show_error(self.app_name, message)
1124+ self.assertEqual(
1125+ self.sso_wizard_page.form_errors_label.toolTip(), message)
1126+ expected = unicode(self.sso_wizard_page.form_errors_label.text())
1127+ self.assertTrue(expected.endswith(u'\u2026'))
1128+
1129+ def test_hide_error(self):
1130+ """Test show_error with a long length string."""
1131+ message = ' '
1132+ self.sso_wizard_page.hide_error()
1133+ self.assertEqual(
1134+ self.sso_wizard_page.form_errors_label.text(), message)
1135
1136=== modified file 'ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py'
1137--- ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py 2012-02-29 17:33:56 +0000
1138+++ ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py 2012-03-01 20:49:18 +0000
1139@@ -105,8 +105,10 @@
1140 self.ui.show()
1141 self.addCleanup(self.ui.hide)
1142 size = self.ui.size()
1143- self.assertTrue(size.height() >= PREFERED_UI_SIZE['height'])
1144- self.assertEqual(size.width(), PREFERED_UI_SIZE['width'])
1145+ # pylint: disable=E1101
1146+ self.assertGreaterEqual(size.height(), PREFERED_UI_SIZE['height'])
1147+ self.assertGreaterEqual(size.width(), PREFERED_UI_SIZE['width'])
1148+ # pylint: enable=E1101
1149
1150 def test_move_to_success_page_state(self):
1151 """Test _move_to_success_page method."""

Subscribers

People subscribed via source and target branches