Merge lp:~diegosarmentero/ubuntuone-windows-installer/uninstall into lp:ubuntuone-windows-installer
- uninstall
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~diegosarmentero/ubuntuone-windows-installer/uninstall |
Merge into: | lp:ubuntuone-windows-installer |
Diff against target: |
1019 lines (+608/-80) 5 files modified
data/qt/setup_account.ui (+289/-53) data/qt/ubuntuone.qss (+8/-3) ubuntuone_installer/gui/qt/gui.py (+20/-2) ubuntuone_installer/gui/qt/setup_account.py (+104/-18) ubuntuone_installer/gui/qt/tests/test_gui.py (+187/-4) |
To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/uninstall |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart | Pending | ||
Review via email: mp+72209@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-08-22.
Commit message
Allows the user to uninstall U1 from the installer if the choose "Disagree & uninstall"
Description of the change
Allows the user to uninstall U1 from the installer if the choose "Disagree & uninstall"
- 47. By Diego Sarmentero
-
merge
- 48. By Diego Sarmentero
-
Moved uninstall implementation to utils (multiplatform) module.
- 49. By Diego Sarmentero
-
Fixed Bug: 829361
- 50. By Diego Sarmentero
-
Moved uninstall tests inside utils module.
- 51. By Diego Sarmentero
-
Fixed import inside method no longer needed.
- 52. By Diego Sarmentero
-
Removed unnecessary check for "win32" in test_windows
- 53. By Diego Sarmentero
-
Fixed path creation for the uninstaller.
- 54. By Diego Sarmentero
-
Fixed uninstaller tests.
- 55. By Diego Sarmentero
-
Fixed tests to use _set_called.
- 56. By Diego Sarmentero
-
Fixed lines length.
- 57. By Diego Sarmentero
-
Added test_windows to ignored list in test when they are executed in linux.
- 58. By Diego Sarmentero
-
Fixed test_start_
control_ panel_frozen to skip it in linux. - 59. By Diego Sarmentero
-
Fixed run-tests.bat, moving -i "test_linux" from pep8 to u1trial.
Unmerged revisions
Preview Diff
1 | === modified file 'data/qt/setup_account.ui' |
2 | --- data/qt/setup_account.ui 2011-08-17 14:22:25 +0000 |
3 | +++ data/qt/setup_account.ui 2011-08-19 15:57:23 +0000 |
4 | @@ -7,7 +7,7 @@ |
5 | <x>0</x> |
6 | <y>0</y> |
7 | <width>575</width> |
8 | - <height>521</height> |
9 | + <height>573</height> |
10 | </rect> |
11 | </property> |
12 | <property name="windowTitle"> |
13 | @@ -18,7 +18,7 @@ |
14 | <number>6</number> |
15 | </property> |
16 | <item> |
17 | - <layout class="QGridLayout" name="gridLayout" columnminimumwidth="300,250"> |
18 | + <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,250"> |
19 | <item row="0" column="0"> |
20 | <widget class="QLabel" name="password_info_label"> |
21 | <property name="sizePolicy"> |
22 | @@ -55,29 +55,37 @@ |
23 | </item> |
24 | <item> |
25 | <widget class="QLineEdit" name="name_edit"> |
26 | + <property name="sizePolicy"> |
27 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
28 | + <horstretch>0</horstretch> |
29 | + <verstretch>0</verstretch> |
30 | + </sizepolicy> |
31 | + </property> |
32 | + <property name="minimumSize"> |
33 | + <size> |
34 | + <width>300</width> |
35 | + <height>0</height> |
36 | + </size> |
37 | + </property> |
38 | + <property name="maximumSize"> |
39 | + <size> |
40 | + <width>300</width> |
41 | + <height>16777215</height> |
42 | + </size> |
43 | + </property> |
44 | <property name="font"> |
45 | <font> |
46 | <pointsize>11</pointsize> |
47 | </font> |
48 | </property> |
49 | + <property name="formError" stdset="0"> |
50 | + <bool>false</bool> |
51 | + </property> |
52 | </widget> |
53 | </item> |
54 | </layout> |
55 | </item> |
56 | - <item row="1" column="1"> |
57 | - <widget class="QLabel" name="name_assistance"> |
58 | - <property name="text"> |
59 | - <string>name_assistance</string> |
60 | - </property> |
61 | - <property name="alignment"> |
62 | - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
63 | - </property> |
64 | - <property name="indent"> |
65 | - <number>20</number> |
66 | - </property> |
67 | - </widget> |
68 | - </item> |
69 | - <item row="2" column="0"> |
70 | + <item row="3" column="0"> |
71 | <layout class="QVBoxLayout" name="verticalLayout"> |
72 | <property name="spacing"> |
73 | <number>3</number> |
74 | @@ -97,6 +105,24 @@ |
75 | </item> |
76 | <item> |
77 | <widget class="QLineEdit" name="email_edit"> |
78 | + <property name="sizePolicy"> |
79 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
80 | + <horstretch>0</horstretch> |
81 | + <verstretch>0</verstretch> |
82 | + </sizepolicy> |
83 | + </property> |
84 | + <property name="minimumSize"> |
85 | + <size> |
86 | + <width>300</width> |
87 | + <height>0</height> |
88 | + </size> |
89 | + </property> |
90 | + <property name="maximumSize"> |
91 | + <size> |
92 | + <width>300</width> |
93 | + <height>16777215</height> |
94 | + </size> |
95 | + </property> |
96 | <property name="font"> |
97 | <font> |
98 | <pointsize>11</pointsize> |
99 | @@ -105,21 +131,14 @@ |
100 | <property name="placeholderText"> |
101 | <string/> |
102 | </property> |
103 | + <property name="formError" stdset="0"> |
104 | + <bool>false</bool> |
105 | + </property> |
106 | </widget> |
107 | </item> |
108 | </layout> |
109 | </item> |
110 | - <item row="2" column="1"> |
111 | - <widget class="QLabel" name="email_assistance"> |
112 | - <property name="text"> |
113 | - <string>email_assistance</string> |
114 | - </property> |
115 | - <property name="indent"> |
116 | - <number>20</number> |
117 | - </property> |
118 | - </widget> |
119 | - </item> |
120 | - <item row="3" column="0"> |
121 | + <item row="4" column="0"> |
122 | <layout class="QVBoxLayout" name="verticalLayout"> |
123 | <property name="spacing"> |
124 | <number>3</number> |
125 | @@ -139,6 +158,24 @@ |
126 | </item> |
127 | <item> |
128 | <widget class="QLineEdit" name="confirm_email_edit"> |
129 | + <property name="sizePolicy"> |
130 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
131 | + <horstretch>0</horstretch> |
132 | + <verstretch>0</verstretch> |
133 | + </sizepolicy> |
134 | + </property> |
135 | + <property name="minimumSize"> |
136 | + <size> |
137 | + <width>300</width> |
138 | + <height>0</height> |
139 | + </size> |
140 | + </property> |
141 | + <property name="maximumSize"> |
142 | + <size> |
143 | + <width>300</width> |
144 | + <height>16777215</height> |
145 | + </size> |
146 | + </property> |
147 | <property name="font"> |
148 | <font> |
149 | <pointsize>11</pointsize> |
150 | @@ -147,21 +184,14 @@ |
151 | <property name="placeholderText"> |
152 | <string/> |
153 | </property> |
154 | + <property name="formError" stdset="0"> |
155 | + <bool>false</bool> |
156 | + </property> |
157 | </widget> |
158 | </item> |
159 | </layout> |
160 | </item> |
161 | - <item row="3" column="1"> |
162 | - <widget class="QLabel" name="confirm_email_assistance"> |
163 | - <property name="text"> |
164 | - <string>confirm_email_assistance</string> |
165 | - </property> |
166 | - <property name="indent"> |
167 | - <number>20</number> |
168 | - </property> |
169 | - </widget> |
170 | - </item> |
171 | - <item row="4" column="0"> |
172 | + <item row="6" column="0"> |
173 | <layout class="QVBoxLayout" name="verticalLayout"> |
174 | <property name="spacing"> |
175 | <number>3</number> |
176 | @@ -181,6 +211,24 @@ |
177 | </item> |
178 | <item> |
179 | <widget class="QLineEdit" name="password_edit"> |
180 | + <property name="sizePolicy"> |
181 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
182 | + <horstretch>0</horstretch> |
183 | + <verstretch>0</verstretch> |
184 | + </sizepolicy> |
185 | + </property> |
186 | + <property name="minimumSize"> |
187 | + <size> |
188 | + <width>300</width> |
189 | + <height>0</height> |
190 | + </size> |
191 | + </property> |
192 | + <property name="maximumSize"> |
193 | + <size> |
194 | + <width>300</width> |
195 | + <height>16777215</height> |
196 | + </size> |
197 | + </property> |
198 | <property name="font"> |
199 | <font> |
200 | <pointsize>11</pointsize> |
201 | @@ -198,11 +246,14 @@ |
202 | <property name="placeholderText"> |
203 | <string/> |
204 | </property> |
205 | + <property name="formError" stdset="0"> |
206 | + <bool>false</bool> |
207 | + </property> |
208 | </widget> |
209 | </item> |
210 | </layout> |
211 | </item> |
212 | - <item row="5" column="0"> |
213 | + <item row="7" column="0"> |
214 | <layout class="QVBoxLayout" name="verticalLayout"> |
215 | <property name="spacing"> |
216 | <number>3</number> |
217 | @@ -222,6 +273,24 @@ |
218 | </item> |
219 | <item> |
220 | <widget class="QLineEdit" name="confirm_password_edit"> |
221 | + <property name="sizePolicy"> |
222 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
223 | + <horstretch>0</horstretch> |
224 | + <verstretch>0</verstretch> |
225 | + </sizepolicy> |
226 | + </property> |
227 | + <property name="minimumSize"> |
228 | + <size> |
229 | + <width>300</width> |
230 | + <height>0</height> |
231 | + </size> |
232 | + </property> |
233 | + <property name="maximumSize"> |
234 | + <size> |
235 | + <width>300</width> |
236 | + <height>16777215</height> |
237 | + </size> |
238 | + </property> |
239 | <property name="font"> |
240 | <font> |
241 | <pointsize>11</pointsize> |
242 | @@ -233,21 +302,14 @@ |
243 | <property name="placeholderText"> |
244 | <string/> |
245 | </property> |
246 | + <property name="formError" stdset="0"> |
247 | + <bool>false</bool> |
248 | + </property> |
249 | </widget> |
250 | </item> |
251 | </layout> |
252 | </item> |
253 | - <item row="4" column="1" rowspan="2"> |
254 | - <widget class="QLabel" name="password_assistance"> |
255 | - <property name="text"> |
256 | - <string>password_assistance</string> |
257 | - </property> |
258 | - <property name="indent"> |
259 | - <number>20</number> |
260 | - </property> |
261 | - </widget> |
262 | - </item> |
263 | - <item row="6" column="0"> |
264 | + <item row="8" column="0"> |
265 | <layout class="QVBoxLayout" name="verticalLayout"> |
266 | <property name="spacing"> |
267 | <number>3</number> |
268 | @@ -255,7 +317,7 @@ |
269 | <item> |
270 | <widget class="QLabel" name="captcha_view"> |
271 | <property name="sizePolicy"> |
272 | - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> |
273 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
274 | <horstretch>0</horstretch> |
275 | <verstretch>0</verstretch> |
276 | </sizepolicy> |
277 | @@ -266,6 +328,12 @@ |
278 | <height>57</height> |
279 | </size> |
280 | </property> |
281 | + <property name="maximumSize"> |
282 | + <size> |
283 | + <width>300</width> |
284 | + <height>16777215</height> |
285 | + </size> |
286 | + </property> |
287 | <property name="styleSheet"> |
288 | <string notr="true">background-color: white</string> |
289 | </property> |
290 | @@ -279,6 +347,24 @@ |
291 | </item> |
292 | <item> |
293 | <widget class="QLineEdit" name="captcha_solution_edit"> |
294 | + <property name="sizePolicy"> |
295 | + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
296 | + <horstretch>0</horstretch> |
297 | + <verstretch>0</verstretch> |
298 | + </sizepolicy> |
299 | + </property> |
300 | + <property name="minimumSize"> |
301 | + <size> |
302 | + <width>300</width> |
303 | + <height>0</height> |
304 | + </size> |
305 | + </property> |
306 | + <property name="maximumSize"> |
307 | + <size> |
308 | + <width>300</width> |
309 | + <height>16777215</height> |
310 | + </size> |
311 | + </property> |
312 | <property name="font"> |
313 | <font> |
314 | <pointsize>11</pointsize> |
315 | @@ -296,18 +382,27 @@ |
316 | <property name="placeholderText"> |
317 | <string/> |
318 | </property> |
319 | + <property name="formError" stdset="0"> |
320 | + <bool>false</bool> |
321 | + </property> |
322 | </widget> |
323 | </item> |
324 | </layout> |
325 | </item> |
326 | - <item row="6" column="1"> |
327 | + <item row="8" column="1"> |
328 | <widget class="QLabel" name="refresh_label"> |
329 | <property name="sizePolicy"> |
330 | - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> |
331 | + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> |
332 | <horstretch>0</horstretch> |
333 | <verstretch>0</verstretch> |
334 | </sizepolicy> |
335 | </property> |
336 | + <property name="maximumSize"> |
337 | + <size> |
338 | + <width>300</width> |
339 | + <height>16777215</height> |
340 | + </size> |
341 | + </property> |
342 | <property name="locale"> |
343 | <locale language="English" country="UnitedStates"/> |
344 | </property> |
345 | @@ -322,6 +417,147 @@ |
346 | </property> |
347 | </widget> |
348 | </item> |
349 | + <item row="1" column="1"> |
350 | + <layout class="QVBoxLayout" name="verticalLayout_7"> |
351 | + <property name="leftMargin"> |
352 | + <number>10</number> |
353 | + </property> |
354 | + <item> |
355 | + <widget class="QLabel" name="name_assistance"> |
356 | + <property name="sizePolicy"> |
357 | + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> |
358 | + <horstretch>0</horstretch> |
359 | + <verstretch>0</verstretch> |
360 | + </sizepolicy> |
361 | + </property> |
362 | + <property name="maximumSize"> |
363 | + <size> |
364 | + <width>300</width> |
365 | + <height>16777215</height> |
366 | + </size> |
367 | + </property> |
368 | + <property name="text"> |
369 | + <string>name_assistance</string> |
370 | + </property> |
371 | + <property name="alignment"> |
372 | + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> |
373 | + </property> |
374 | + </widget> |
375 | + </item> |
376 | + </layout> |
377 | + </item> |
378 | + <item row="3" column="1"> |
379 | + <layout class="QVBoxLayout" name="verticalLayout_8"> |
380 | + <property name="leftMargin"> |
381 | + <number>10</number> |
382 | + </property> |
383 | + <item> |
384 | + <widget class="QLabel" name="email_assistance"> |
385 | + <property name="sizePolicy"> |
386 | + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> |
387 | + <horstretch>0</horstretch> |
388 | + <verstretch>0</verstretch> |
389 | + </sizepolicy> |
390 | + </property> |
391 | + <property name="maximumSize"> |
392 | + <size> |
393 | + <width>300</width> |
394 | + <height>16777215</height> |
395 | + </size> |
396 | + </property> |
397 | + <property name="text"> |
398 | + <string>email_assistance</string> |
399 | + </property> |
400 | + <property name="alignment"> |
401 | + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> |
402 | + </property> |
403 | + </widget> |
404 | + </item> |
405 | + </layout> |
406 | + </item> |
407 | + <item row="4" column="1"> |
408 | + <layout class="QVBoxLayout" name="verticalLayout_9"> |
409 | + <property name="leftMargin"> |
410 | + <number>10</number> |
411 | + </property> |
412 | + <item> |
413 | + <widget class="QLabel" name="confirm_email_assistance"> |
414 | + <property name="sizePolicy"> |
415 | + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> |
416 | + <horstretch>0</horstretch> |
417 | + <verstretch>0</verstretch> |
418 | + </sizepolicy> |
419 | + </property> |
420 | + <property name="maximumSize"> |
421 | + <size> |
422 | + <width>300</width> |
423 | + <height>16777215</height> |
424 | + </size> |
425 | + </property> |
426 | + <property name="text"> |
427 | + <string>confirm_email_assistance</string> |
428 | + </property> |
429 | + <property name="alignment"> |
430 | + <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set> |
431 | + </property> |
432 | + </widget> |
433 | + </item> |
434 | + </layout> |
435 | + </item> |
436 | + <item row="6" column="1" rowspan="2"> |
437 | + <widget class="QLabel" name="password_assistance"> |
438 | + <property name="sizePolicy"> |
439 | + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> |
440 | + <horstretch>0</horstretch> |
441 | + <verstretch>0</verstretch> |
442 | + </sizepolicy> |
443 | + </property> |
444 | + <property name="maximumSize"> |
445 | + <size> |
446 | + <width>300</width> |
447 | + <height>16777215</height> |
448 | + </size> |
449 | + </property> |
450 | + <property name="text"> |
451 | + <string>password_assistance</string> |
452 | + </property> |
453 | + <property name="indent"> |
454 | + <number>20</number> |
455 | + </property> |
456 | + </widget> |
457 | + </item> |
458 | + <item row="2" column="1"> |
459 | + <spacer name="verticalSpacer"> |
460 | + <property name="orientation"> |
461 | + <enum>Qt::Vertical</enum> |
462 | + </property> |
463 | + <property name="sizeType"> |
464 | + <enum>QSizePolicy::Fixed</enum> |
465 | + </property> |
466 | + <property name="sizeHint" stdset="0"> |
467 | + <size> |
468 | + <width>20</width> |
469 | + <height>20</height> |
470 | + </size> |
471 | + </property> |
472 | + </spacer> |
473 | + </item> |
474 | + <item row="5" column="1"> |
475 | + <spacer name="verticalSpacer_2"> |
476 | + <property name="orientation"> |
477 | + <enum>Qt::Vertical</enum> |
478 | + </property> |
479 | + <property name="sizeType"> |
480 | + <enum>QSizePolicy::Fixed</enum> |
481 | + </property> |
482 | + <property name="sizeHint" stdset="0"> |
483 | + <size> |
484 | + <width>20</width> |
485 | + <height>20</height> |
486 | + </size> |
487 | + </property> |
488 | + </spacer> |
489 | + </item> |
490 | </layout> |
491 | </item> |
492 | <item> |
493 | |
494 | === modified file 'data/qt/ubuntuone.qss' |
495 | --- data/qt/ubuntuone.qss 2011-08-17 14:34:27 +0000 |
496 | +++ data/qt/ubuntuone.qss 2011-08-19 15:57:23 +0000 |
497 | @@ -18,9 +18,6 @@ |
498 | background-color: white; |
499 | } |
500 | |
501 | -QLabel#name_assistance, |
502 | -QLabel#email_assistance, |
503 | -QLabel#confirm_email_assistance, |
504 | QLabel#password_assistance, |
505 | QLabel#refresh_label{ |
506 | border-image: url(":/balloon_shape.png"); |
507 | @@ -174,3 +171,11 @@ |
508 | font: bold 14px; |
509 | color: #dd4814; |
510 | } |
511 | + |
512 | +QLineEdit[formError="true"]{ |
513 | + background-color: #ffe5e5; |
514 | +} |
515 | + |
516 | +QLineEdit[formError="false"]{ |
517 | + background-color: white; |
518 | +} |
519 | |
520 | === modified file 'ubuntuone_installer/gui/qt/gui.py' |
521 | --- ubuntuone_installer/gui/qt/gui.py 2011-08-17 13:34:23 +0000 |
522 | +++ ubuntuone_installer/gui/qt/gui.py 2011-08-19 15:57:23 +0000 |
523 | @@ -63,6 +63,8 @@ |
524 | TC_URL, |
525 | ) |
526 | |
527 | +import win32api |
528 | + |
529 | from ubuntuone_installer.logger import setup_logging |
530 | from ubuntuone_installer.gui.qt.ui import ( |
531 | choose_sign_in_ui, |
532 | @@ -109,9 +111,9 @@ |
533 | def initializePage(self): |
534 | """Setup UI details.""" |
535 | # Set the right texts and connections for buttons |
536 | - self.setButtonText(QtGui.QWizard.NextButton, _("Agree && Install")) |
537 | + self.setButtonText(QtGui.QWizard.NextButton, _("Agree")) |
538 | self.setButtonText(QtGui.QWizard.CancelButton, |
539 | - _("Disagree && Cancel")) |
540 | + _("Disagree && uninstall")) |
541 | self.setButtonText(QtGui.QWizard.CustomButton1, _("&Print")) |
542 | |
543 | # This is just to catch an exception thrown when nothing |
544 | @@ -478,6 +480,22 @@ |
545 | else: |
546 | cp_path = "ubuntuone-control-panel-qt" |
547 | subprocess.Popen([cp_path, ]) |
548 | + elif self.currentId() == self.LICENSE_PAGE_ID: |
549 | + if not AreYouSure(self).exec_(): |
550 | + if sys.platform == "win32" and hasattr(sys, "frozen"): |
551 | + uninstall_path = os.path.join(os.path.dirname( |
552 | + os.path.dirname( |
553 | + os.path.abspath(sys.executable))), |
554 | + "uninstall.exe") |
555 | + else: |
556 | + uninstall_path = os.path.join(os.path.dirname( |
557 | + os.path.dirname( |
558 | + __file__, )), "uninstall.exe") |
559 | + win32api.ShellExecute(None, 'runas', |
560 | + uninstall_path, |
561 | + '--mode=qt', '', 0) |
562 | + else: |
563 | + return |
564 | elif self.currentId() != self.CONGRATULATIONS_PAGE: |
565 | if AreYouSure(self).exec_(): |
566 | return |
567 | |
568 | === modified file 'ubuntuone_installer/gui/qt/setup_account.py' |
569 | --- ubuntuone_installer/gui/qt/setup_account.py 2011-08-08 21:48:11 +0000 |
570 | +++ ubuntuone_installer/gui/qt/setup_account.py 2011-08-19 15:57:23 +0000 |
571 | @@ -22,14 +22,17 @@ |
572 | import re |
573 | |
574 | from PyQt4 import QtGui |
575 | +from PyQt4 import QtCore |
576 | |
577 | from ubuntu_sso.qt import gui as sso_gui |
578 | |
579 | _ = gettext.gettext |
580 | |
581 | # pylint: disable=C0103 |
582 | -BAD = u'<img src=":/password_hint_warning.png" /><font color="red"> %s </font>' |
583 | -GOOD = u'<img src=":/password_hint_ok.png" /><font color="green"> %s </font>' |
584 | +BAD = u'<img src=":/password_hint_warning.png" /><font> %s </font>' |
585 | +ERROR = u'<font color="#dd4814"><b> %s </b></font>' |
586 | +GOOD = u'<img src=":/password_hint_ok.png" /><font> %s </font>' |
587 | +NORMAL = u'<font> %s </font>' |
588 | TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>" |
589 | |
590 | EMPTY_NAME = _("Please enter your name") |
591 | @@ -42,9 +45,20 @@ |
592 | |
593 | |
594 | class SetupAccountPage(sso_gui.SetupAccountPage): |
595 | - |
596 | """Customized Setup Account page for SSO""" |
597 | |
598 | + def __init__(self, *args, **kwargs): |
599 | + super(SetupAccountPage, self).__init__(*args, **kwargs) |
600 | + self.ui.name_edit.textEdited.connect(self.name_assistance) |
601 | + self.ui.email_edit.textEdited.connect(self.email_assistance) |
602 | + self.ui.email_edit.textEdited.connect(self.confirm_email_assistance) |
603 | + self.ui.confirm_email_edit.textEdited.connect( |
604 | + self.confirm_email_assistance) |
605 | + self.ui.password_edit.textEdited.connect( |
606 | + self.password_assistance_in_focus) |
607 | + self.ui.confirm_password_edit.textEdited.connect( |
608 | + self.password_assistance) |
609 | + |
610 | # Invalid name "initializePage" |
611 | # pylint: disable=C0103 |
612 | |
613 | @@ -73,46 +87,56 @@ |
614 | QtGui.QWizard.BackButton, |
615 | QtGui.QWizard.Stretch]) |
616 | |
617 | - self.ui.name_edit.textEdited.connect(self.name_assistance) |
618 | - self.name_assistance() |
619 | - self.ui.email_edit.textEdited.connect(self.email_assistance) |
620 | - self.ui.email_edit.textEdited.connect(self.confirm_email_assistance) |
621 | - self.email_assistance() |
622 | - self.ui.confirm_email_edit.textEdited.connect( |
623 | - self.confirm_email_assistance) |
624 | - self.confirm_email_assistance() |
625 | - self.ui.password_edit.textEdited.connect(self.password_assistance) |
626 | - self.ui.confirm_password_edit.textEdited.connect( |
627 | - self.password_assistance) |
628 | - self.password_assistance() |
629 | + self.password_default_assistance() |
630 | + # Hide assistance labels by default |
631 | + self.ui.name_assistance.setVisible(False) |
632 | + self.ui.email_assistance.setVisible(False) |
633 | + self.ui.confirm_email_assistance.setVisible(False) |
634 | + self.ui.password_assistance.setVisible(False) |
635 | + self.ui.refresh_label.setVisible(False) |
636 | + |
637 | + def focus_changed(self, old, now): |
638 | + """Check who has the focus to activate password popups if necessary""" |
639 | + if now == self.ui.password_edit: |
640 | + self.ui.password_assistance.setVisible(True) |
641 | + elif old == self.ui.password_edit: |
642 | + self.password_assistance() |
643 | + elif now == self.ui.captcha_solution_edit: |
644 | + self.ui.refresh_label.setVisible(True) |
645 | |
646 | def name_assistance(self): |
647 | """Show help for the name field.""" |
648 | text = unicode(self.ui.name_edit.text()) |
649 | if not text.strip(): |
650 | self.ui.name_assistance.setVisible(True) |
651 | - self.ui.name_assistance.setText(BAD % EMPTY_NAME) |
652 | + self.ui.name_assistance.setText(ERROR % EMPTY_NAME) |
653 | + self.check_as_invalid(self.ui.name_edit) |
654 | else: |
655 | self.ui.name_assistance.setVisible(False) |
656 | + self.check_as_valid(self.ui.name_edit) |
657 | |
658 | def email_assistance(self): |
659 | """Show help for the email field.""" |
660 | text = unicode(self.ui.email_edit.text()) |
661 | if not is_correct_email(text): |
662 | - self.ui.email_assistance.setText(BAD % INVALID_EMAIL) |
663 | + self.ui.email_assistance.setText(ERROR % INVALID_EMAIL) |
664 | self.ui.email_assistance.setVisible(True) |
665 | + self.check_as_invalid(self.ui.email_edit) |
666 | else: |
667 | self.ui.email_assistance.setVisible(False) |
668 | + self.check_as_valid(self.ui.email_edit) |
669 | |
670 | def confirm_email_assistance(self): |
671 | """Show help for the confirm email field.""" |
672 | text1 = unicode(self.ui.email_edit.text()) |
673 | text2 = unicode(self.ui.confirm_email_edit.text()) |
674 | if text1 != text2: |
675 | - self.ui.confirm_email_assistance.setText(BAD % EMAIL_MATCH) |
676 | + self.ui.confirm_email_assistance.setText(ERROR % EMAIL_MATCH) |
677 | self.ui.confirm_email_assistance.setVisible(True) |
678 | + self.check_as_invalid(self.ui.confirm_email_edit) |
679 | else: |
680 | self.ui.confirm_email_assistance.setVisible(False) |
681 | + self.check_as_valid(self.ui.confirm_email_edit) |
682 | |
683 | def password_assistance(self): |
684 | """Show help for the password field.""" |
685 | @@ -143,6 +167,57 @@ |
686 | |
687 | self.ui.password_assistance.setText("<br>".join(label_text)) |
688 | |
689 | + def password_assistance_in_focus(self): |
690 | + """Show help for the password field.""" |
691 | + text1 = unicode(self.ui.password_edit.text()) |
692 | + text2 = unicode(self.ui.confirm_password_edit.text()) |
693 | + label_text = ["<b>%s</b>" % _("Your password must contain"), ] |
694 | + |
695 | + if len(text1) < 8: |
696 | + sign = NORMAL |
697 | + else: |
698 | + sign = GOOD |
699 | + label_text.append(sign % PASSWORD_LENGTH) |
700 | + |
701 | + if re.search('[A-Z]', text1) is None: |
702 | + sign = NORMAL |
703 | + else: |
704 | + sign = GOOD |
705 | + label_text.append(sign % PASSWORD_UPPER) |
706 | + |
707 | + if re.search('[\d+]', text1) is None: |
708 | + sign = NORMAL |
709 | + else: |
710 | + sign = GOOD |
711 | + label_text.append(sign % PASSWORD_DIGIT) |
712 | + |
713 | + if text1 != text2: |
714 | + label_text.append(NORMAL % PASSWORD_MATCH) |
715 | + |
716 | + self.ui.password_assistance.setText("<br>".join(label_text)) |
717 | + |
718 | + def password_default_assistance(self): |
719 | + """Show default help for the password field.""" |
720 | + label_text = ["<b>%s</b>" % _("Your password must contain"), ] |
721 | + |
722 | + label_text.append(NORMAL % PASSWORD_LENGTH) |
723 | + label_text.append(NORMAL % PASSWORD_UPPER) |
724 | + label_text.append(NORMAL % PASSWORD_DIGIT) |
725 | + |
726 | + self.ui.password_assistance.setText("<br>".join(label_text)) |
727 | + |
728 | + def check_as_invalid(self, line_edit): |
729 | + """Set QLineEdit's formError property as True, refresh the style.""" |
730 | + line_edit.setProperty("formError", True) |
731 | + line_edit.style().unpolish(line_edit) |
732 | + line_edit.style().polish(line_edit) |
733 | + |
734 | + def check_as_valid(self, line_edit): |
735 | + """Set QLineEdit's formError property as False, refresh the style.""" |
736 | + line_edit.setProperty("formError", False) |
737 | + line_edit.style().unpolish(line_edit) |
738 | + line_edit.style().polish(line_edit) |
739 | + |
740 | def showEvent(self, event): |
741 | """Set set_up_button as default button when the page is shown.""" |
742 | # This method should stays here because if we move it to initializePage |
743 | @@ -151,6 +226,17 @@ |
744 | self.ui.set_up_button.setProperty("DisabledState", True) |
745 | self.ui.set_up_button.style().unpolish(self.ui.set_up_button) |
746 | self.ui.set_up_button.style().polish(self.ui.set_up_button) |
747 | + self.connect(QtGui.QApplication.instance(), |
748 | + QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), |
749 | + self.focus_changed) |
750 | + |
751 | + def hideEvent(self, event): |
752 | + try: |
753 | + self.disconnect(QtGui.QApplication.instance(), |
754 | + QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"), |
755 | + self.focus_changed) |
756 | + except TypeError: |
757 | + pass |
758 | |
759 | |
760 | def is_min_required_password(password): |
761 | |
762 | === modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py' |
763 | --- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-08-17 13:34:23 +0000 |
764 | +++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-08-19 15:57:23 +0000 |
765 | @@ -28,6 +28,7 @@ |
766 | from PyQt4 import QtGui, QtCore |
767 | from ubuntuone.platform.credentials import APP_NAME |
768 | from ubuntuone.controlpanel.gui import qt |
769 | +import win32api |
770 | |
771 | from ubuntuone_installer.gui.qt import gui |
772 | from ubuntuone_installer.gui.qt.tests import BaseTestCase |
773 | @@ -364,8 +365,45 @@ |
774 | self.assertEqual(self._called, |
775 | ((['ubuntuone-control-panel-qt'],), {})) |
776 | |
777 | + def test_execute_uninstall_on_licence_cancel(self): |
778 | + """Pressing Disagree button from license page the uninstall is exec.""" |
779 | + self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
780 | + self.ui.restart() |
781 | + self.ui.show() |
782 | + gui.AreYouSure.result = 0 |
783 | + self.patch(win32api, "ShellExecute", self._set_called) |
784 | + # If it's frozen this test fails because the path |
785 | + # depends on the location of the exe |
786 | + if hasattr(gui.sys, "frozen"): |
787 | + delattr(gui.sys, "frozen") |
788 | + self.ui.done(result=0) |
789 | + uninstall_path = os.path.join(os.path.dirname( |
790 | + os.path.dirname( |
791 | + gui.__file__)), "uninstall.exe") |
792 | + self.assertEqual(self._called, |
793 | + ((None, 'runas', uninstall_path, '--mode=qt', '', 0), {})) |
794 | + |
795 | + def test_execute_uninstall_on_licence_cancel_frozen(self): |
796 | + """Pressing Disagree button from license page the uninstall is exec.""" |
797 | + self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
798 | + self.ui.restart() |
799 | + self.ui.show() |
800 | + gui.AreYouSure.result = 0 |
801 | + self.patch(win32api, "ShellExecute", self._set_called) |
802 | + gui.sys.frozen = True |
803 | + self.ui.done(result=0) |
804 | + self.assertTrue(self._called[0][0] is None) |
805 | + self.assertTrue("uninstall.exe" in self._called[0][2]) |
806 | + self.assertTrue('runas' == self._called[0][1]) |
807 | + self.assertTrue('--mode=qt' == self._called[0][3]) |
808 | + self.assertTrue('' == self._called[0][4]) |
809 | + self.assertTrue(0 == self._called[0][5]) |
810 | + |
811 | def test_start_control_panel_frozen(self): |
812 | """When frozen, the control-panel has a path.""" |
813 | + self.ui.setStartId(self.ui.SYNC_NOW_OR_LATER_PAGE) |
814 | + self.ui.restart() |
815 | + self.ui.show() |
816 | gui.AreYouSure.result = 0 |
817 | # I can't patch sys because frozen is not there by default |
818 | gui.sys.frozen = True |
819 | @@ -400,6 +438,9 @@ |
820 | |
821 | def test_later_accepts_cancel(self): |
822 | """Clicking 'Later' accepts cancellation.""" |
823 | + self.ui.setStartId(self.ui.SYNC_NOW_OR_LATER_PAGE) |
824 | + self.ui.restart() |
825 | + self.ui.show() |
826 | gui.AreYouSure.result = 0 |
827 | self.ui.show() |
828 | self.ui.done(result=0) |
829 | @@ -713,7 +754,7 @@ |
830 | self.assertEqual(self.ui.ui.name_assistance.isVisible(), True) |
831 | self.assertEqual( |
832 | unicode(self.ui.ui.name_assistance.text()), |
833 | - setup_account.BAD % setup_account.EMPTY_NAME) |
834 | + setup_account.ERROR % setup_account.EMPTY_NAME) |
835 | self.ui.hide() |
836 | |
837 | def test_blank_name(self): |
838 | @@ -728,7 +769,7 @@ |
839 | self.assertEqual(self.ui.ui.name_assistance.isVisible(), True) |
840 | self.assertEqual( |
841 | unicode(self.ui.ui.name_assistance.text()), |
842 | - setup_account.BAD % setup_account.EMPTY_NAME) |
843 | + setup_account.ERROR % setup_account.EMPTY_NAME) |
844 | self.ui.hide() |
845 | |
846 | def test_valid_name(self): |
847 | @@ -754,7 +795,7 @@ |
848 | self.assertEqual(self.ui.ui.email_assistance.isVisible(), True) |
849 | self.assertEqual( |
850 | unicode(self.ui.ui.email_assistance.text()), |
851 | - setup_account.BAD % setup_account.INVALID_EMAIL) |
852 | + setup_account.ERROR % setup_account.INVALID_EMAIL) |
853 | self.ui.hide() |
854 | |
855 | def test_valid_email(self): |
856 | @@ -794,7 +835,7 @@ |
857 | self.assertEqual(self.ui.ui.confirm_email_assistance.isVisible(), True) |
858 | self.assertEqual( |
859 | unicode(self.ui.ui.confirm_email_assistance.text()), |
860 | - setup_account.BAD % setup_account.EMAIL_MATCH) |
861 | + setup_account.ERROR % setup_account.EMAIL_MATCH) |
862 | self.ui.hide() |
863 | |
864 | def test_short_password(self): |
865 | @@ -903,6 +944,129 @@ |
866 | unicode(self.ui.ui.password_assistance.text()), |
867 | ) |
868 | |
869 | + def test_password_default_assistance(self): |
870 | + """Status when the password line edit receive focus and shows popup: |
871 | + |
872 | + * Password assistance contains the right message |
873 | + """ |
874 | + self.ui.ui.password_edit.setText("") |
875 | + self.ui.ui.confirm_password_edit.setText("") |
876 | + self.ui.password_assistance() |
877 | + self.ui.focus_changed(None, self.ui.ui.password_edit) |
878 | + self.assertEqual( |
879 | + True, |
880 | + setup_account.NORMAL % setup_account.PASSWORD_LENGTH in |
881 | + unicode(self.ui.ui.password_assistance.text()), |
882 | + ) |
883 | + self.assertEqual( |
884 | + True, |
885 | + setup_account.NORMAL % setup_account.PASSWORD_UPPER in |
886 | + unicode(self.ui.ui.password_assistance.text()), |
887 | + ) |
888 | + self.assertEqual( |
889 | + True, |
890 | + setup_account.NORMAL % setup_account.PASSWORD_DIGIT in |
891 | + unicode(self.ui.ui.password_assistance.text()), |
892 | + ) |
893 | + |
894 | + def test_password_assistance_in_focus(self): |
895 | + """Check the different conditions of password line edit.""" |
896 | + self.ui.ui.password_edit.setText("aaaaaaaaa") |
897 | + self.ui.ui.confirm_password_edit.setText("") |
898 | + self.ui.password_assistance_in_focus() |
899 | + self.assertEqual( |
900 | + True, |
901 | + setup_account.GOOD % setup_account.PASSWORD_LENGTH in |
902 | + unicode(self.ui.ui.password_assistance.text()), |
903 | + ) |
904 | + self.assertEqual( |
905 | + True, |
906 | + setup_account.NORMAL % setup_account.PASSWORD_UPPER in |
907 | + unicode(self.ui.ui.password_assistance.text()), |
908 | + ) |
909 | + self.assertEqual( |
910 | + True, |
911 | + setup_account.NORMAL % setup_account.PASSWORD_DIGIT in |
912 | + unicode(self.ui.ui.password_assistance.text()), |
913 | + ) |
914 | + self.assertEqual( |
915 | + True, |
916 | + setup_account.NORMAL % setup_account.PASSWORD_MATCH in |
917 | + unicode(self.ui.ui.password_assistance.text()), |
918 | + ) |
919 | + |
920 | + self.ui.ui.password_edit.setText("AAa") |
921 | + self.ui.ui.confirm_password_edit.setText("") |
922 | + self.ui.password_assistance_in_focus() |
923 | + self.assertEqual( |
924 | + True, |
925 | + setup_account.NORMAL % setup_account.PASSWORD_LENGTH in |
926 | + unicode(self.ui.ui.password_assistance.text()), |
927 | + ) |
928 | + self.assertEqual( |
929 | + True, |
930 | + setup_account.GOOD % setup_account.PASSWORD_UPPER in |
931 | + unicode(self.ui.ui.password_assistance.text()), |
932 | + ) |
933 | + self.assertEqual( |
934 | + True, |
935 | + setup_account.NORMAL % setup_account.PASSWORD_DIGIT in |
936 | + unicode(self.ui.ui.password_assistance.text()), |
937 | + ) |
938 | + self.assertEqual( |
939 | + True, |
940 | + setup_account.NORMAL % setup_account.PASSWORD_MATCH in |
941 | + unicode(self.ui.ui.password_assistance.text()), |
942 | + ) |
943 | + |
944 | + self.ui.ui.password_edit.setText("a123") |
945 | + self.ui.ui.confirm_password_edit.setText("") |
946 | + self.ui.password_assistance_in_focus() |
947 | + self.assertEqual( |
948 | + True, |
949 | + setup_account.NORMAL % setup_account.PASSWORD_LENGTH in |
950 | + unicode(self.ui.ui.password_assistance.text()), |
951 | + ) |
952 | + self.assertEqual( |
953 | + True, |
954 | + setup_account.NORMAL % setup_account.PASSWORD_UPPER in |
955 | + unicode(self.ui.ui.password_assistance.text()), |
956 | + ) |
957 | + self.assertEqual( |
958 | + True, |
959 | + setup_account.GOOD % setup_account.PASSWORD_DIGIT in |
960 | + unicode(self.ui.ui.password_assistance.text()), |
961 | + ) |
962 | + self.assertEqual( |
963 | + True, |
964 | + setup_account.NORMAL % setup_account.PASSWORD_MATCH in |
965 | + unicode(self.ui.ui.password_assistance.text()), |
966 | + ) |
967 | + |
968 | + self.ui.ui.password_edit.setText("T3st3rqw") |
969 | + self.ui.ui.confirm_password_edit.setText("T3st3rqw") |
970 | + self.ui.password_assistance_in_focus() |
971 | + self.assertEqual( |
972 | + True, |
973 | + setup_account.GOOD % setup_account.PASSWORD_LENGTH in |
974 | + unicode(self.ui.ui.password_assistance.text()), |
975 | + ) |
976 | + self.assertEqual( |
977 | + True, |
978 | + setup_account.GOOD % setup_account.PASSWORD_UPPER in |
979 | + unicode(self.ui.ui.password_assistance.text()), |
980 | + ) |
981 | + self.assertEqual( |
982 | + True, |
983 | + setup_account.GOOD % setup_account.PASSWORD_DIGIT in |
984 | + unicode(self.ui.ui.password_assistance.text()), |
985 | + ) |
986 | + self.assertEqual( |
987 | + True, |
988 | + setup_account.NORMAL % setup_account.PASSWORD_MATCH not in |
989 | + unicode(self.ui.ui.password_assistance.text()), |
990 | + ) |
991 | + |
992 | def test_side_widget_state(self): |
993 | """Test if the side widget of the wizard has state frame visible.""" |
994 | if type(self.ui) != gui.MainWindow: |
995 | @@ -924,6 +1088,25 @@ |
996 | True, |
997 | self.ui.sideWidget().ui.states_frame.isVisible()) |
998 | |
999 | + def test_check_valid(self): |
1000 | + """Check the propery value of a QLineEdit marked as valid.""" |
1001 | + self.ui.check_as_valid(self.ui.ui.name_edit) |
1002 | + self.assertEqual(self.ui.ui.name_edit.property("formError"), |
1003 | + False) |
1004 | + |
1005 | + def test_check_invalid(self): |
1006 | + """Check the propery value of a QLineEdit marked as invalid.""" |
1007 | + self.ui.check_as_invalid(self.ui.ui.name_edit) |
1008 | + self.assertEqual(self.ui.ui.name_edit.property("formError"), |
1009 | + True) |
1010 | + |
1011 | + def test_focus_changed(self): |
1012 | + self.ui.show() |
1013 | + self.ui.focus_changed(None, self.ui.ui.password_edit) |
1014 | + self.assertTrue(self.ui.ui.password_assistance.isVisible()) |
1015 | + self.ui.focus_changed(None, self.ui.ui.captcha_solution_edit) |
1016 | + self.assertTrue(self.ui.ui.refresh_label.isVisible()) |
1017 | + |
1018 | |
1019 | class FakeFailingCredentialsManagementTool(object): |
1020 |