Merge lp:~ralsina/ubuntuone-windows-installer/diego-installer-ui into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 31
Merged at revision: 21
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/diego-installer-ui
Merge into: lp:ubuntuone-windows-installer
Diff against target: 1956 lines (+1028/-595)
12 files modified
data/qt/choose_sign_in.ui (+12/-6)
data/qt/images.qrc (+17/-0)
data/qt/license.ui (+8/-8)
data/qt/setup_account.ui (+51/-34)
data/qt/side_widget.ui (+238/-64)
data/qt/ubuntuone.qss (+96/-0)
ubuntuone_installer/gui/qt/gui.py (+23/-6)
ubuntuone_installer/gui/qt/local_folders.py (+171/-171)
ubuntuone_installer/gui/qt/setup_account.py (+158/-156)
ubuntuone_installer/gui/qt/side_widget.py (+73/-49)
ubuntuone_installer/gui/qt/tests/test_gui.py (+26/-1)
ubuntuone_installer/gui/qt/tests/test_side_widget.py (+155/-100)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/diego-installer-ui
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+68876@code.launchpad.net

Commit message

Styling for the installer (by Diego Sarmentero)

Description of the change

Styling for the installer (by Diego Sarmentero)

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

This branch had 2 approves when it was proposed by Diego, this MP is exactly the same, but with two conflicts resolved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/Ubuntu-R.ttf'
2Binary files data/Ubuntu-R.ttf 1970-01-01 00:00:00 +0000 and data/Ubuntu-R.ttf 2011-07-22 16:39:49 +0000 differ
3=== added file 'data/balloon_shape.png'
4Binary files data/balloon_shape.png 1970-01-01 00:00:00 +0000 and data/balloon_shape.png 2011-07-22 16:39:49 +0000 differ
5=== added file 'data/password_hint_ok.png'
6Binary files data/password_hint_ok.png 1970-01-01 00:00:00 +0000 and data/password_hint_ok.png 2011-07-22 16:39:49 +0000 differ
7=== added file 'data/password_hint_warning.png'
8Binary files data/password_hint_warning.png 1970-01-01 00:00:00 +0000 and data/password_hint_warning.png 2011-07-22 16:39:49 +0000 differ
9=== added file 'data/progress_arrow_grey.png'
10Binary files data/progress_arrow_grey.png 1970-01-01 00:00:00 +0000 and data/progress_arrow_grey.png 2011-07-22 16:39:49 +0000 differ
11=== added file 'data/progress_arrow_orange.png'
12Binary files data/progress_arrow_orange.png 1970-01-01 00:00:00 +0000 and data/progress_arrow_orange.png 2011-07-22 16:39:49 +0000 differ
13=== added file 'data/progress_finish_grey.png'
14Binary files data/progress_finish_grey.png 1970-01-01 00:00:00 +0000 and data/progress_finish_grey.png 2011-07-22 16:39:49 +0000 differ
15=== added file 'data/progress_finish_orange.png'
16Binary files data/progress_finish_orange.png 1970-01-01 00:00:00 +0000 and data/progress_finish_orange.png 2011-07-22 16:39:49 +0000 differ
17=== added file 'data/progress_tick.png'
18Binary files data/progress_tick.png 1970-01-01 00:00:00 +0000 and data/progress_tick.png 2011-07-22 16:39:49 +0000 differ
19=== modified file 'data/qt/choose_sign_in.ui'
20--- data/qt/choose_sign_in.ui 2011-07-02 01:20:51 +0000
21+++ data/qt/choose_sign_in.ui 2011-07-22 16:39:49 +0000
22@@ -44,13 +44,14 @@
23 </size>
24 </property>
25 <property name="text">
26- <string>image
27-
28-[This will be the same image as appears on Ubuntu One Home page on the web - in production]</string>
29+ <string/>
30 </property>
31 <property name="textFormat">
32 <enum>Qt::PlainText</enum>
33 </property>
34+ <property name="pixmap">
35+ <pixmap resource="images.qrc">:/win_install_img_placeholder.png</pixmap>
36+ </property>
37 <property name="alignment">
38 <set>Qt::AlignCenter</set>
39 </property>
40@@ -93,7 +94,7 @@
41 </property>
42 <property name="sizeHint" stdset="0">
43 <size>
44- <width>40</width>
45+ <width>20</width>
46 <height>20</height>
47 </size>
48 </property>
49@@ -129,9 +130,12 @@
50 <property name="orientation">
51 <enum>Qt::Horizontal</enum>
52 </property>
53+ <property name="sizeType">
54+ <enum>QSizePolicy::Expanding</enum>
55+ </property>
56 <property name="sizeHint" stdset="0">
57 <size>
58- <width>40</width>
59+ <width>20</width>
60 <height>20</height>
61 </size>
62 </property>
63@@ -154,6 +158,8 @@
64 </item>
65 </layout>
66 </widget>
67- <resources/>
68+ <resources>
69+ <include location="images.qrc"/>
70+ </resources>
71 <connections/>
72 </ui>
73
74=== added file 'data/qt/images.qrc'
75--- data/qt/images.qrc 1970-01-01 00:00:00 +0000
76+++ data/qt/images.qrc 2011-07-22 16:39:49 +0000
77@@ -0,0 +1,17 @@
78+<RCC>
79+ <qresource prefix="/">
80+ <file>../balloon_shape.png</file>
81+ <file>../password_hint_ok.png</file>
82+ <file>../password_hint_warning.png</file>
83+ <file>../Ubuntu-R.ttf</file>
84+ <file>ubuntuone.qss</file>
85+ <file>../progress_arrow_grey.png</file>
86+ <file>../u1_logo.png</file>
87+ <file>../progress_arrow_orange.png</file>
88+ <file>../progress_finish_grey.png</file>
89+ <file>../progress_finish_orange.png</file>
90+ <file>../progress_tick.png</file>
91+ <file>../u1icon.png</file>
92+ <file>../win_install_img_placeholder.png</file>
93+ </qresource>
94+</RCC>
95
96=== modified file 'data/qt/license.ui'
97--- data/qt/license.ui 2011-06-21 18:45:09 +0000
98+++ data/qt/license.ui 2011-07-22 16:39:49 +0000
99@@ -20,14 +20,14 @@
100 <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;
101 &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;
102 p, li { white-space: pre-wrap; }
103-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
104-&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-family:'MS Shell Dlg 2'; font-size:14pt; font-weight:600;&quot;&gt;License Agreement&lt;/span&gt;&lt;/p&gt;
105-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;&lt;/p&gt;
106-&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-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation.&lt;/span&gt;&lt;/p&gt;
107-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;&lt;/p&gt;
108-&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-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Ubuntu One Basic is free, while additional service add-ons may be paid for services.&lt;/span&gt;&lt;/p&gt;
109-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;&lt;/p&gt;
110-&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-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;As free software, this programme is distributed without warranty. See the GNU General Public License for more details at &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
111+&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;
112+&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:14pt; font-weight:600;&quot;&gt;License Agreement&lt;/span&gt;&lt;/p&gt;
113+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
114+&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;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation.&lt;/span&gt;&lt;/p&gt;
115+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
116+&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;Ubuntu One Basic is free, while additional service add-ons may be paid for services.&lt;/span&gt;&lt;/p&gt;
117+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;/p&gt;
118+&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;As free software, this programme is distributed without warranty. See the GNU General Public License for more details at &lt;/span&gt;&lt;a href=&quot;http://www.gnu.org/licenses&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#dd4814;&quot;&gt;http://www.gnu.org/licenses&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
119 </property>
120 <property name="openExternalLinks">
121 <bool>true</bool>
122
123=== modified file 'data/qt/setup_account.ui'
124--- data/qt/setup_account.ui 2011-07-01 20:33:17 +0000
125+++ data/qt/setup_account.ui 2011-07-22 16:39:49 +0000
126@@ -6,8 +6,8 @@
127 <rect>
128 <x>0</x>
129 <y>0</y>
130- <width>482</width>
131- <height>514</height>
132+ <width>631</width>
133+ <height>527</height>
134 </rect>
135 </property>
136 <property name="windowTitle">
137@@ -15,7 +15,7 @@
138 </property>
139 <layout class="QVBoxLayout" name="verticalLayout">
140 <item>
141- <layout class="QGridLayout" name="gridLayout">
142+ <layout class="QGridLayout" name="gridLayout" columnminimumwidth="1,250">
143 <item row="0" column="0">
144 <widget class="QLabel" name="password_info_label">
145 <property name="sizePolicy">
146@@ -25,7 +25,7 @@
147 </sizepolicy>
148 </property>
149 <property name="text">
150- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
151+ <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>
152 </property>
153 <property name="wordWrap">
154 <bool>true</bool>
155@@ -35,7 +35,7 @@
156 <item row="1" column="0">
157 <widget class="QLabel" name="name_label">
158 <property name="text">
159- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
160+ <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>
161 </property>
162 </widget>
163 </item>
164@@ -49,14 +49,17 @@
165 <item row="2" column="1">
166 <widget class="QLabel" name="name_assistance">
167 <property name="text">
168- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
169+ <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>
170+ </property>
171+ <property name="indent">
172+ <number>20</number>
173 </property>
174 </widget>
175 </item>
176 <item row="3" column="0">
177 <widget class="QLabel" name="email_label">
178 <property name="text">
179- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
180+ <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>
181 </property>
182 </widget>
183 </item>
184@@ -70,14 +73,17 @@
185 <item row="4" column="1">
186 <widget class="QLabel" name="email_assistance">
187 <property name="text">
188- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
189+ <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>
190+ </property>
191+ <property name="indent">
192+ <number>20</number>
193 </property>
194 </widget>
195 </item>
196 <item row="5" column="0">
197 <widget class="QLabel" name="confirm_email_label">
198 <property name="text">
199- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
200+ <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>
201 </property>
202 </widget>
203 </item>
204@@ -91,14 +97,17 @@
205 <item row="6" column="1">
206 <widget class="QLabel" name="confirm_email_assistance">
207 <property name="text">
208- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
209+ <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>
210+ </property>
211+ <property name="indent">
212+ <number>20</number>
213 </property>
214 </widget>
215 </item>
216 <item row="7" column="0">
217 <widget class="QLabel" name="password_label">
218 <property name="text">
219- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
220+ <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>
221 </property>
222 </widget>
223 </item>
224@@ -121,14 +130,17 @@
225 <item row="9" column="0">
226 <widget class="QLabel" name="confirm_password_label">
227 <property name="text">
228- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
229+ <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>
230 </property>
231 </widget>
232 </item>
233 <item row="8" column="1" rowspan="3">
234 <widget class="QLabel" name="password_assistance">
235 <property name="text">
236- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
237+ <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>
238+ </property>
239+ <property name="indent">
240+ <number>20</number>
241 </property>
242 </widget>
243 </item>
244@@ -163,26 +175,7 @@
245 <enum>QFrame::Box</enum>
246 </property>
247 <property name="text">
248- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
249- </property>
250- </widget>
251- </item>
252- <item row="11" column="1">
253- <widget class="QLabel" name="refresh_label">
254- <property name="sizePolicy">
255- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
256- <horstretch>0</horstretch>
257- <verstretch>0</verstretch>
258- </sizepolicy>
259- </property>
260- <property name="locale">
261- <locale language="English" country="UnitedStates"/>
262- </property>
263- <property name="text">
264- <string>If you can't read this then &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; this page&lt;/span&gt;</string>
265- </property>
266- <property name="wordWrap">
267- <bool>true</bool>
268+ <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>
269 </property>
270 </widget>
271 </item>
272@@ -202,6 +195,28 @@
273 </property>
274 </widget>
275 </item>
276+ <item row="11" column="1">
277+ <widget class="QLabel" name="refresh_label">
278+ <property name="sizePolicy">
279+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
280+ <horstretch>0</horstretch>
281+ <verstretch>0</verstretch>
282+ </sizepolicy>
283+ </property>
284+ <property name="locale">
285+ <locale language="English" country="UnitedStates"/>
286+ </property>
287+ <property name="text">
288+ <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>
289+ </property>
290+ <property name="wordWrap">
291+ <bool>true</bool>
292+ </property>
293+ <property name="indent">
294+ <number>20</number>
295+ </property>
296+ </widget>
297+ </item>
298 </layout>
299 </item>
300 <item>
301@@ -250,6 +265,8 @@
302 </item>
303 </layout>
304 </widget>
305- <resources/>
306+ <resources>
307+ <include location="images.qrc"/>
308+ </resources>
309 <connections/>
310 </ui>
311
312=== modified file 'data/qt/side_widget.ui'
313--- data/qt/side_widget.ui 2011-07-04 17:39:31 +0000
314+++ data/qt/side_widget.ui 2011-07-22 16:39:49 +0000
315@@ -1,77 +1,249 @@
316 <?xml version="1.0" encoding="UTF-8"?>
317 <ui version="4.0">
318- <class>Form</class>
319- <widget class="QWidget" name="Form">
320+ <class>SideWidget</class>
321+ <widget class="QFrame" name="SideWidget">
322 <property name="geometry">
323 <rect>
324 <x>0</x>
325 <y>0</y>
326- <width>185</width>
327- <height>511</height>
328+ <width>200</width>
329+ <height>563</height>
330 </rect>
331 </property>
332+ <property name="sizePolicy">
333+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
334+ <horstretch>0</horstretch>
335+ <verstretch>0</verstretch>
336+ </sizepolicy>
337+ </property>
338+ <property name="minimumSize">
339+ <size>
340+ <width>200</width>
341+ <height>0</height>
342+ </size>
343+ </property>
344 <property name="windowTitle">
345- <string>Form</string>
346+ <string>Frame</string>
347+ </property>
348+ <property name="frameShape">
349+ <enum>QFrame::StyledPanel</enum>
350+ </property>
351+ <property name="frameShadow">
352+ <enum>QFrame::Raised</enum>
353 </property>
354 <layout class="QVBoxLayout" name="verticalLayout">
355 <property name="spacing">
356- <number>20</number>
357- </property>
358- <item>
359- <widget class="QLabel" name="label">
360- <property name="text">
361- <string>Ubuntu One logo</string>
362- </property>
363- </widget>
364- </item>
365- <item>
366- <widget class="QLabel" name="install_label">
367- <property name="enabled">
368- <bool>true</bool>
369- </property>
370- <property name="text">
371- <string>Install</string>
372- </property>
373- </widget>
374- </item>
375- <item>
376- <widget class="QLabel" name="sign_in_label">
377- <property name="enabled">
378- <bool>true</bool>
379- </property>
380- <property name="text">
381- <string>Sign In</string>
382- </property>
383- </widget>
384- </item>
385- <item>
386- <widget class="QLabel" name="choose_services_label">
387- <property name="enabled">
388- <bool>true</bool>
389- </property>
390- <property name="text">
391- <string>Choose services</string>
392- </property>
393- </widget>
394- </item>
395- <item>
396- <widget class="QLabel" name="select_folders_label">
397- <property name="enabled">
398- <bool>true</bool>
399- </property>
400- <property name="text">
401- <string>Select sync folders</string>
402- </property>
403- </widget>
404- </item>
405- <item>
406- <widget class="QLabel" name="sync_label">
407- <property name="enabled">
408- <bool>true</bool>
409- </property>
410- <property name="text">
411- <string>Sync, stream, share!</string>
412- </property>
413+ <number>40</number>
414+ </property>
415+ <property name="margin">
416+ <number>10</number>
417+ </property>
418+ <item>
419+ <widget class="QLabel" name="ubuntu_one_logo_label">
420+ <property name="sizePolicy">
421+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
422+ <horstretch>0</horstretch>
423+ <verstretch>0</verstretch>
424+ </sizepolicy>
425+ </property>
426+ <property name="text">
427+ <string/>
428+ </property>
429+ <property name="pixmap">
430+ <pixmap resource="images.qrc">:/u1_logo.png</pixmap>
431+ </property>
432+ </widget>
433+ </item>
434+ <item>
435+ <widget class="QFrame" name="states_frame">
436+ <property name="sizePolicy">
437+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
438+ <horstretch>0</horstretch>
439+ <verstretch>0</verstretch>
440+ </sizepolicy>
441+ </property>
442+ <property name="frameShape">
443+ <enum>QFrame::StyledPanel</enum>
444+ </property>
445+ <property name="frameShadow">
446+ <enum>QFrame::Raised</enum>
447+ </property>
448+ <layout class="QVBoxLayout" name="verticalLayout_2">
449+ <property name="spacing">
450+ <number>20</number>
451+ </property>
452+ <property name="margin">
453+ <number>0</number>
454+ </property>
455+ <item>
456+ <layout class="QHBoxLayout" name="horizontalLayout">
457+ <property name="spacing">
458+ <number>7</number>
459+ </property>
460+ <item>
461+ <widget class="QLabel" name="install_icon_label">
462+ <property name="sizePolicy">
463+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
464+ <horstretch>0</horstretch>
465+ <verstretch>0</verstretch>
466+ </sizepolicy>
467+ </property>
468+ <property name="text">
469+ <string/>
470+ </property>
471+ <property name="pixmap">
472+ <pixmap resource="images.qrc">:/progress_arrow_grey.png</pixmap>
473+ </property>
474+ </widget>
475+ </item>
476+ <item>
477+ <widget class="QLabel" name="install_label">
478+ <property name="enabled">
479+ <bool>true</bool>
480+ </property>
481+ <property name="text">
482+ <string>Install</string>
483+ </property>
484+ </widget>
485+ </item>
486+ </layout>
487+ </item>
488+ <item>
489+ <layout class="QHBoxLayout" name="horizontalLayout_2">
490+ <property name="spacing">
491+ <number>7</number>
492+ </property>
493+ <property name="sizeConstraint">
494+ <enum>QLayout::SetDefaultConstraint</enum>
495+ </property>
496+ <item>
497+ <widget class="QLabel" name="sign_icon_label">
498+ <property name="sizePolicy">
499+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
500+ <horstretch>0</horstretch>
501+ <verstretch>0</verstretch>
502+ </sizepolicy>
503+ </property>
504+ <property name="text">
505+ <string/>
506+ </property>
507+ <property name="pixmap">
508+ <pixmap resource="images.qrc">:/progress_arrow_grey.png</pixmap>
509+ </property>
510+ </widget>
511+ </item>
512+ <item>
513+ <widget class="QLabel" name="sign_in_label">
514+ <property name="enabled">
515+ <bool>true</bool>
516+ </property>
517+ <property name="text">
518+ <string>Sign In</string>
519+ </property>
520+ </widget>
521+ </item>
522+ </layout>
523+ </item>
524+ <item>
525+ <layout class="QHBoxLayout" name="horizontalLayout_3">
526+ <property name="spacing">
527+ <number>7</number>
528+ </property>
529+ <item>
530+ <widget class="QLabel" name="choose_icon_label">
531+ <property name="sizePolicy">
532+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
533+ <horstretch>0</horstretch>
534+ <verstretch>0</verstretch>
535+ </sizepolicy>
536+ </property>
537+ <property name="text">
538+ <string/>
539+ </property>
540+ <property name="pixmap">
541+ <pixmap resource="images.qrc">:/progress_arrow_grey.png</pixmap>
542+ </property>
543+ </widget>
544+ </item>
545+ <item>
546+ <widget class="QLabel" name="choose_services_label">
547+ <property name="enabled">
548+ <bool>true</bool>
549+ </property>
550+ <property name="text">
551+ <string>Choose services</string>
552+ </property>
553+ </widget>
554+ </item>
555+ </layout>
556+ </item>
557+ <item>
558+ <layout class="QHBoxLayout" name="horizontalLayout_4">
559+ <property name="spacing">
560+ <number>7</number>
561+ </property>
562+ <item>
563+ <widget class="QLabel" name="folders_icon_label">
564+ <property name="sizePolicy">
565+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
566+ <horstretch>0</horstretch>
567+ <verstretch>0</verstretch>
568+ </sizepolicy>
569+ </property>
570+ <property name="text">
571+ <string/>
572+ </property>
573+ <property name="pixmap">
574+ <pixmap resource="images.qrc">:/progress_arrow_grey.png</pixmap>
575+ </property>
576+ </widget>
577+ </item>
578+ <item>
579+ <widget class="QLabel" name="select_folders_label">
580+ <property name="enabled">
581+ <bool>true</bool>
582+ </property>
583+ <property name="text">
584+ <string>Select sync folders</string>
585+ </property>
586+ </widget>
587+ </item>
588+ </layout>
589+ </item>
590+ <item>
591+ <layout class="QHBoxLayout" name="horizontalLayout_5">
592+ <property name="spacing">
593+ <number>7</number>
594+ </property>
595+ <item>
596+ <widget class="QLabel" name="sync_icon_label">
597+ <property name="sizePolicy">
598+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
599+ <horstretch>0</horstretch>
600+ <verstretch>0</verstretch>
601+ </sizepolicy>
602+ </property>
603+ <property name="text">
604+ <string/>
605+ </property>
606+ <property name="pixmap">
607+ <pixmap resource="images.qrc">:/progress_finish_grey.png</pixmap>
608+ </property>
609+ </widget>
610+ </item>
611+ <item>
612+ <widget class="QLabel" name="sync_label">
613+ <property name="enabled">
614+ <bool>true</bool>
615+ </property>
616+ <property name="text">
617+ <string>Sync, stream, share!</string>
618+ </property>
619+ </widget>
620+ </item>
621+ </layout>
622+ </item>
623+ </layout>
624 </widget>
625 </item>
626 <item>
627@@ -82,13 +254,15 @@
628 <property name="sizeHint" stdset="0">
629 <size>
630 <width>20</width>
631- <height>292</height>
632+ <height>40</height>
633 </size>
634 </property>
635 </spacer>
636 </item>
637 </layout>
638 </widget>
639- <resources/>
640+ <resources>
641+ <include location="images.qrc"/>
642+ </resources>
643 <connections/>
644 </ui>
645
646=== added file 'data/qt/ubuntuone.qss'
647--- data/qt/ubuntuone.qss 1970-01-01 00:00:00 +0000
648+++ data/qt/ubuntuone.qss 2011-07-22 16:39:49 +0000
649@@ -0,0 +1,96 @@
650+QFrame#SideWidget {
651+ background-color: white;
652+ border-style: dotted;
653+ border-color: #939389;
654+ border-right-width: 1px;
655+ color: white;
656+ min-height: 100px;
657+ margin-left: 10px;
658+}
659+
660+QWizard,
661+QDialog{
662+ background-color: white;
663+}
664+
665+QLabel#name_assistance,
666+QLabel#email_assistance,
667+QLabel#confirm_email_assistance,
668+QLabel#password_assistance,
669+QLabel#refresh_label{
670+ border-image: url(":/balloon_shape.png");
671+ padding-right: 2px;
672+}
673+
674+QLabel#install_label,
675+QLabel#sign_in_label,
676+QLabel#choose_services_label,
677+QLabel#select_folders_label,
678+QLabel#sync_label{
679+ font-size: 14px;
680+}
681+
682+QTextEdit{
683+ background-color: #ffffff;
684+ border: none;
685+}
686+
687+QPushButton[enabled="false"] {
688+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
689+ stop: 0 #fecfc2,stop: 1.0 #df4d1a);
690+ border-radius: 5px;
691+ border-style: solid;
692+ padding: 6px;
693+ padding-left: 20px;
694+ padding-right: 20px;
695+ color: white;
696+ border-color: #939389;
697+ border-width: 1px;
698+ height: 14px;
699+ font-size: 12px;
700+}
701+
702+QPushButton[enabled="true"] {
703+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
704+ stop: 0 #eaeaea, stop: 1.0 #cacaca);
705+ border-radius: 5px;
706+ border-style: solid;
707+ padding: 6px;
708+ padding-left: 20px;
709+ padding-right: 20px;
710+ color: #595959;
711+ border-color: #939389;
712+ border-width: 1px;
713+ height: 14px;
714+ font-size: 12px;
715+}
716+
717+QPushButton:hover {
718+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
719+ stop: 0 #feae99,stop: 1.0 #df4e1c);
720+ border-radius: 5px;
721+ border-style: solid;
722+ padding: 6px;
723+ color: white;
724+ border-color: #939389;
725+ border-width: 1px;
726+ height: 12px;
727+}
728+
729+QPushButton:pressed {
730+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
731+ stop: 0 #ba3f14,stop: 1.0 #db4714);
732+ border-radius: 5px;
733+ border-style: solid;
734+ padding: 6px;
735+ color: white;
736+ border-color: #939389;
737+ border-width: 1px;
738+ height: 12px;
739+}
740+
741+QWidget{
742+ font-family: "Ubuntu";
743+ color: #333333;
744+ font-size: 12px;
745+}
746
747=== added file 'data/u1_logo.png'
748Binary files data/u1_logo.png 1970-01-01 00:00:00 +0000 and data/u1_logo.png 2011-07-22 16:39:49 +0000 differ
749=== added file 'data/u1icon.png'
750Binary files data/u1icon.png 1970-01-01 00:00:00 +0000 and data/u1icon.png 2011-07-22 16:39:49 +0000 differ
751=== added file 'data/win_install_img_placeholder.png'
752Binary files data/win_install_img_placeholder.png 1970-01-01 00:00:00 +0000 and data/win_install_img_placeholder.png 2011-07-22 16:39:49 +0000 differ
753=== modified file 'ubuntuone_installer/gui/qt/gui.py'
754--- ubuntuone_installer/gui/qt/gui.py 2011-07-19 17:16:11 +0000
755+++ ubuntuone_installer/gui/qt/gui.py 2011-07-22 16:39:49 +0000
756@@ -66,6 +66,12 @@
757 license_ui,
758 setup_account_ui,
759 )
760+
761+# Module used to include the resources into this file
762+# pylint: disable=W0611
763+from ubuntuone_installer.gui.qt.ui import images_rc
764+# pylint: enable=W0611
765+
766 from ubuntuone_installer.gui.qt.are_you_sure import AreYouSure
767 from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage
768 from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
769@@ -77,6 +83,7 @@
770 SIGN_IN = _("Sign in to Ubuntu One")
771 SIGN_IN_SUBTITLE = _("Sign in with your existing Ubuntu One"
772 " username and password.")
773+TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>"
774
775 # Invalid name logger
776 # pylint: disable=C0103
777@@ -114,9 +121,9 @@
778 self.wizard().customButtonClicked.connect(self.print_document)
779
780 self.wizard().setButtonLayout([
781+ QtGui.QWizard.CancelButton,
782+ QtGui.QWizard.Stretch,
783 QtGui.QWizard.CustomButton1,
784- QtGui.QWizard.Stretch,
785- QtGui.QWizard.CancelButton,
786 QtGui.QWizard.BackButton,
787 QtGui.QWizard.NextButton,
788 QtGui.QWizard.FinishButton,
789@@ -194,9 +201,9 @@
790 # Layout without custom button 1,
791 # without finish button
792 self.wizard().setButtonLayout([
793+ QtGui.QWizard.CancelButton,
794 QtGui.QWizard.Stretch,
795 QtGui.QWizard.BackButton,
796- QtGui.QWizard.CancelButton,
797 ])
798
799
800@@ -287,6 +294,10 @@
801 self.help_text = ""
802
803 super(MainWindow, self).__init__()
804+ self.setWindowTitle(APP_NAME)
805+ self.setMinimumHeight(630)
806+ self.setMinimumWidth(800)
807+ self.setTitleFormat(QtCore.Qt.RichText)
808 self.setWizardStyle(self.ModernStyle)
809 self.close_callback = close_callback
810
811@@ -300,7 +311,9 @@
812 self.LICENSE_PAGE = self.addPage(LicensePage())
813
814 #SSO Pages
815- self.sign_in_controller = ChooseSignInController(title=SIGN_IN)
816+ title_page = TITLE_STYLE % SIGN_IN
817+ self.sign_in_controller = ChooseSignInController(
818+ title=title_page)
819 self.sign_in_page = SignInPage(
820 ui=choose_sign_in_ui.Ui_ChooseSignInPage(),
821 controller=self.sign_in_controller,
822@@ -310,15 +323,17 @@
823 setup_account_ui.Ui_SetUpAccountPage(),
824 self.setup_controller,
825 parent=self)
826+ title_page = TITLE_STYLE % _("Ubuntu One Terms of Service")
827 self.tos = TosPage(Ui_TosPage(),
828 TosController(tos_url=TC_URL,
829- title=_("Ubuntu One Terms of Service")),
830+ title=title_page),
831 parent=self)
832 self.email_verification = EmailVerificationPage(
833 Ui_EmailVerificationPage(),
834 EmailVerificationController())
835+ title_page = TITLE_STYLE % SIGN_IN
836 self.current_user_controller = CurrentUserController(
837- title=SIGN_IN, subtitle=SIGN_IN_SUBTITLE)
838+ title=title_page, subtitle=SIGN_IN_SUBTITLE)
839 self.current_user = CurrentUserSignInPage(Ui_CurrentUserSignInPage(),
840 self.current_user_controller,
841 parent=self)
842@@ -396,8 +411,10 @@
843 def on_currentIdChanged(self, page_id):
844 """The current page changed."""
845 if page_id < self.SIGNIN_PAGE:
846+ self.sideWidget().ui.states_frame.hide()
847 self.sideWidget().set_stage(0)
848 elif page_id < self.local_folders_page_id:
849+ self.sideWidget().ui.states_frame.show()
850 self.sideWidget().set_stage(1)
851 elif page_id < self.CONGRATULATIONS_PAGE:
852 self.sideWidget().set_stage(3)
853
854=== modified file 'ubuntuone_installer/gui/qt/local_folders.py'
855--- ubuntuone_installer/gui/qt/local_folders.py 2011-07-19 00:38:27 +0000
856+++ ubuntuone_installer/gui/qt/local_folders.py 2011-07-22 16:39:49 +0000
857@@ -1,173 +1,173 @@
858-# -*- coding: utf-8 -*-
859-
860-# Authors: Roberto Alsina <roberto.alsina@canonical.com>
861-#
862-# Copyright 2011 Canonical Ltd.
863-#
864-# This program is free software: you can redistribute it and/or modify it
865-# under the terms of the GNU General Public License version 3, as published
866-# by the Free Software Foundation.
867-#
868-# This program is distributed in the hope that it will be useful, but
869-# WITHOUT ANY WARRANTY; without even the implied warranties of
870-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
871-# PURPOSE. See the GNU General Public License for more details.
872-#
873-# You should have received a copy of the GNU General Public License along
874-# with this program. If not, see <http://www.gnu.org/licenses/>.
875-
876-"""Widget to create UDFs in the Windows Install Wizard."""
877-
878-import ctypes
879-import os
880-import sys
881-import threading
882-import Queue
883-
884-from PyQt4 import QtCore, QtGui
885-
886-from ubuntuone.controlpanel.gui import humanize
887-
888-from ubuntuone_installer.gui.qt.ui import local_folders_ui
889-from ubuntuone_installer.gui import (
890- LOCAL_FOLDERS_TITLE,
891- LOCAL_FOLDERS_SPACE_HEADER,
892- LOCAL_FOLDERS_OFFER_LABEL,
893- LOCAL_FOLDERS_CALCULATING,
894-)
895-
896-
897-class FolderItem(QtGui.QTreeWidgetItem):
898- """Class representing a folder in the folder list UI."""
899- def __init__(self, strings, path=None, queue=None):
900- super(FolderItem, self).__init__(strings)
901- self.thread = CalculateSize(path, queue)
902- self.thread.start()
903- self.size = None
904- self.path = path
905-
906-
907-class CalculateSize(threading.Thread):
908- """Class to calculate the size of a folder in the background."""
909- def __init__(self, path_name, queue):
910- self.path_name = path_name
911- self.queue = queue
912- self._stop = False
913- super(CalculateSize, self).__init__()
914- self.daemon = True
915-
916- def run(self):
917- total_size = 0
918- for dirpath, _, filenames in os.walk(self.path_name):
919- for f in filenames:
920- fp = os.path.join(dirpath, f)
921- total_size += os.path.getsize(fp)
922- self.queue.put([self.path_name, total_size])
923-
924-
925-class LocalFoldersPage(QtGui.QWizardPage):
926- """Wizard page to create UDFs in the Windows Installer."""
927-
928- def __init__(self, parent=None):
929- super(LocalFoldersPage, self).__init__(parent)
930- self.setTitle(LOCAL_FOLDERS_TITLE)
931- self.ui = local_folders_ui.Ui_Form()
932- self.ui.setupUi(self)
933-
934- header_view = self.ui.folder_list.header()
935- header_view.setResizeMode(0, header_view.Stretch)
936-
937- self.queue = Queue.Queue()
938- self.timer = QtCore.QTimer()
939- self.items = {}
940- for folder_name in self.default_folders():
941- self.add_folder(folder_name)
942- self.update_sizes()
943- self.timer.start(2000)
944- self.timer.timeout.connect(self.update_sizes)
945-
946- # initializePage is inherited
947- # pylint: disable=C0103
948- def initializePage(self):
949- """UI details."""
950- self.wizard()._next_id = None
951-
952- def quota(self):
953- """The quota available to the user."""
954- # FIXME: get this from real life
955- return 2 * 1024 * 1024
956-
957- def default_folders(self):
958- """Return a list of the folders to add by default."""
959- if sys.platform == 'win32':
960- # Special Folder "My Documents"
961- dll = ctypes.windll.shell32
962- buf = ctypes.create_string_buffer(300)
963- dll.SHGetSpecialFolderPathA(None, buf, 0x0005, False)
964- result = [buf.value, ]
965+# -*- coding: utf-8 -*-
966+
967+# Authors: Roberto Alsina <roberto.alsina@canonical.com>
968+#
969+# Copyright 2011 Canonical Ltd.
970+#
971+# This program is free software: you can redistribute it and/or modify it
972+# under the terms of the GNU General Public License version 3, as published
973+# by the Free Software Foundation.
974+#
975+# This program is distributed in the hope that it will be useful, but
976+# WITHOUT ANY WARRANTY; without even the implied warranties of
977+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
978+# PURPOSE. See the GNU General Public License for more details.
979+#
980+# You should have received a copy of the GNU General Public License along
981+# with this program. If not, see <http://www.gnu.org/licenses/>.
982+
983+"""Widget to create UDFs in the Windows Install Wizard."""
984+
985+import ctypes
986+import os
987+import sys
988+import threading
989+import Queue
990+
991+from PyQt4 import QtCore, QtGui
992+
993+from ubuntuone.controlpanel.gui import humanize
994+
995+from ubuntuone_installer.gui.qt.ui import local_folders_ui
996+from ubuntuone_installer.gui import (
997+ LOCAL_FOLDERS_TITLE,
998+ LOCAL_FOLDERS_SPACE_HEADER,
999+ LOCAL_FOLDERS_OFFER_LABEL,
1000+ LOCAL_FOLDERS_CALCULATING,
1001+)
1002+
1003+
1004+class FolderItem(QtGui.QTreeWidgetItem):
1005+ """Class representing a folder in the folder list UI."""
1006+ def __init__(self, strings, path=None, queue=None):
1007+ super(FolderItem, self).__init__(strings)
1008+ self.thread = CalculateSize(path, queue)
1009+ self.thread.start()
1010+ self.size = None
1011+ self.path = path
1012+
1013+
1014+class CalculateSize(threading.Thread):
1015+ """Class to calculate the size of a folder in the background."""
1016+ def __init__(self, path_name, queue):
1017+ self.path_name = path_name
1018+ self.queue = queue
1019+ self._stop = False
1020+ super(CalculateSize, self).__init__()
1021+ self.daemon = True
1022+
1023+ def run(self):
1024+ total_size = 0
1025+ for dirpath, _, filenames in os.walk(self.path_name):
1026+ for f in filenames:
1027+ fp = os.path.join(dirpath, f)
1028+ total_size += os.path.getsize(fp)
1029+ self.queue.put([self.path_name, total_size])
1030+
1031+
1032+class LocalFoldersPage(QtGui.QWizardPage):
1033+ """Wizard page to create UDFs in the Windows Installer."""
1034+
1035+ def __init__(self, parent=None):
1036+ super(LocalFoldersPage, self).__init__(parent)
1037+ self.setTitle(LOCAL_FOLDERS_TITLE)
1038+ self.ui = local_folders_ui.Ui_Form()
1039+ self.ui.setupUi(self)
1040+
1041+ header_view = self.ui.folder_list.header()
1042+ header_view.setResizeMode(0, header_view.Stretch)
1043+
1044+ self.queue = Queue.Queue()
1045+ self.timer = QtCore.QTimer()
1046+ self.items = {}
1047+ for folder_name in self.default_folders():
1048+ self.add_folder(folder_name)
1049+ self.update_sizes()
1050+ self.timer.start(2000)
1051+ self.timer.timeout.connect(self.update_sizes)
1052+
1053+ # initializePage is inherited
1054+ # pylint: disable=C0103
1055+ def initializePage(self):
1056+ """UI details."""
1057+ self.wizard()._next_id = None
1058+
1059+ def quota(self):
1060+ """The quota available to the user."""
1061+ # FIXME: get this from real life
1062+ return 2 * 1024 * 1024
1063+
1064+ def default_folders(self):
1065+ """Return a list of the folders to add by default."""
1066+ if sys.platform == 'win32':
1067+ # Special Folder "My Documents"
1068+ dll = ctypes.windll.shell32
1069+ buf = ctypes.create_string_buffer(300)
1070+ dll.SHGetSpecialFolderPathA(None, buf, 0x0005, False)
1071+ result = [buf.value, ]
1072 else:
1073 result = ['To be implemented']
1074- return result
1075-
1076- def add_folder(self, path):
1077- """Add a folder to the list."""
1078- if path in self.items:
1079- return None
1080- # FIXME: the path should actually be sent to u1cp to verify as valid
1081- item = FolderItem([path, "", "remove"], path=path, queue=self.queue)
1082- self.ui.folder_list.addTopLevelItem(item)
1083- self.items[path] = item
1084- return item
1085-
1086- def update_sizes(self):
1087- """Poll the queue were the threads put the size info."""
1088- try:
1089- path, size = self.queue.get(False)
1090- item = self.items.get(path)
1091- if item:
1092- item.size = size
1093- item.setText(1, humanize(size))
1094- except Queue.Empty:
1095- pass
1096- total = 0
1097- for path, item in self.items.items():
1098- if item.size is None:
1099- total = LOCAL_FOLDERS_CALCULATING
1100- break
1101- total += item.size
1102-
1103- if isinstance(total, long):
1104- self.show_hide_offer(total)
1105- total = humanize(total)
1106- else:
1107- self.show_hide_offer(0)
1108- self.ui.folder_list.headerItem().setText(
1109- 1, LOCAL_FOLDERS_SPACE_HEADER % total)
1110-
1111- def show_hide_offer(self, cur_size):
1112- """Show or hide the offer to buy space according to the total size."""
1113- quota = self.quota()
1114-
1115- if cur_size > quota:
1116- self.ui.offer_frame.setVisible(True)
1117- else:
1118- self.ui.offer_frame.setVisible(False)
1119-
1120- self.ui.offer_label.setText(LOCAL_FOLDERS_OFFER_LABEL %
1121- {"quota": humanize(quota)})
1122-
1123- def stop_threads(self):
1124- """Stop all pending threads."""
1125- for _, item in self.items:
1126- item.thread._stop = True
1127-
1128- # itemClicked is a Qt signal name.
1129- # pylint: disable=C0103
1130- def on_folder_list_itemClicked(self, item, column):
1131- """Delete folder from the list."""
1132- if column == 2:
1133- del(self.items[item.path])
1134- item.thread._stop = True
1135- self.ui.folder_list.takeTopLevelItem(
1136- self.ui.folder_list.indexOfTopLevelItem(item))
1137- self.update_sizes()
1138+ return result
1139+
1140+ def add_folder(self, path):
1141+ """Add a folder to the list."""
1142+ if path in self.items:
1143+ return None
1144+ # FIXME: the path should actually be sent to u1cp to verify as valid
1145+ item = FolderItem([path, "", "remove"], path=path, queue=self.queue)
1146+ self.ui.folder_list.addTopLevelItem(item)
1147+ self.items[path] = item
1148+ return item
1149+
1150+ def update_sizes(self):
1151+ """Poll the queue were the threads put the size info."""
1152+ try:
1153+ path, size = self.queue.get(False)
1154+ item = self.items.get(path)
1155+ if item:
1156+ item.size = size
1157+ item.setText(1, humanize(size))
1158+ except Queue.Empty:
1159+ pass
1160+ total = 0
1161+ for path, item in self.items.items():
1162+ if item.size is None:
1163+ total = LOCAL_FOLDERS_CALCULATING
1164+ break
1165+ total += item.size
1166+
1167+ if isinstance(total, long):
1168+ self.show_hide_offer(total)
1169+ total = humanize(total)
1170+ else:
1171+ self.show_hide_offer(0)
1172+ self.ui.folder_list.headerItem().setText(
1173+ 1, LOCAL_FOLDERS_SPACE_HEADER % total)
1174+
1175+ def show_hide_offer(self, cur_size):
1176+ """Show or hide the offer to buy space according to the total size."""
1177+ quota = self.quota()
1178+
1179+ if cur_size > quota:
1180+ self.ui.offer_frame.setVisible(True)
1181+ else:
1182+ self.ui.offer_frame.setVisible(False)
1183+
1184+ self.ui.offer_label.setText(LOCAL_FOLDERS_OFFER_LABEL %
1185+ {"quota": humanize(quota)})
1186+
1187+ def stop_threads(self):
1188+ """Stop all pending threads."""
1189+ for _, item in self.items:
1190+ item.thread._stop = True
1191+
1192+ # itemClicked is a Qt signal name.
1193+ # pylint: disable=C0103
1194+ def on_folder_list_itemClicked(self, item, column):
1195+ """Delete folder from the list."""
1196+ if column == 2:
1197+ del(self.items[item.path])
1198+ item.thread._stop = True
1199+ self.ui.folder_list.takeTopLevelItem(
1200+ self.ui.folder_list.indexOfTopLevelItem(item))
1201+ self.update_sizes()
1202
1203=== modified file 'ubuntuone_installer/gui/qt/setup_account.py'
1204--- ubuntuone_installer/gui/qt/setup_account.py 2011-07-07 20:32:17 +0000
1205+++ ubuntuone_installer/gui/qt/setup_account.py 2011-07-22 16:39:49 +0000
1206@@ -1,156 +1,158 @@
1207-# -*- coding: utf-8 -*-
1208-
1209-# Authors: Roberto Alsina <roberto.alsina@canonical.com>
1210-#
1211-# Copyright 2011 Canonical Ltd.
1212-#
1213-# This program is free software: you can redistribute it and/or modify it
1214-# under the terms of the GNU General Public License version 3, as published
1215-# by the Free Software Foundation.
1216-#
1217-# This program is distributed in the hope that it will be useful, but
1218-# WITHOUT ANY WARRANTY; without even the implied warranties of
1219-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1220-# PURPOSE. See the GNU General Public License for more details.
1221-#
1222-# You should have received a copy of the GNU General Public License along
1223-# with this program. If not, see <http://www.gnu.org/licenses/>.
1224-
1225-"""Customized Setup Account page for SSO."""
1226-
1227-import gettext
1228-import re
1229-
1230-from PyQt4 import QtGui
1231-
1232-from ubuntu_sso.qt import gui as sso_gui
1233-
1234-_ = gettext.gettext
1235-
1236-# pylint: disable=C0103
1237-BAD = u'<font color="red"> %s </font>'
1238-GOOD = u'<font color="green"> %s </font>'
1239-
1240-EMPTY_NAME = _("Please enter your name")
1241-INVALID_EMAIL = _("Please enter a valid email address")
1242-EMAIL_MATCH = _("The email addresses do not match")
1243-PASSWORD_LENGTH = _("At least 8 characters")
1244-PASSWORD_DIGIT = _("At least one number")
1245-PASSWORD_UPPER = _("At least one uppercase letter")
1246-PASSWORD_MATCH = _("Passwords don't match")
1247-
1248-
1249-class SetupAccountPage(sso_gui.SetupAccountPage):
1250-
1251- """Customized Setup Account page for SSO"""
1252-
1253- def initializePage(self):
1254- """Setup UI details."""
1255- # We need to override some texts from SSO
1256- # to match our spec
1257- self.setTitle(_("Sign Up to Ubuntu One"))
1258- self.setSubTitle(_("You only need to set up your account "
1259- "once to get access to Ubuntu One across your devices."))
1260-
1261- self.ui.name_label.setText(_("Name"))
1262- self.ui.email_label.setText(_("Email"))
1263- self.ui.confirm_email_label.setText(_("Retype email"))
1264- self.ui.password_label.setText(_("Create a password"))
1265- self.ui.confirm_password_label.setText(_("Retype password"))
1266- self.ui.terms_checkbox.setText(
1267- _("By signing up to Ubuntu One you agree to our Terms "
1268- "of Service and Privacy Policy"))
1269- self.ui.terms_button.setText(_("Show Terms of Service"))
1270- self.ui.password_info_label.hide()
1271-
1272- # Button setup
1273- self.wizard().setButtonLayout([
1274- QtGui.QWizard.Stretch,
1275- QtGui.QWizard.BackButton,
1276- QtGui.QWizard.CancelButton,
1277- ])
1278-
1279- self.ui.name_edit.textEdited.connect(self.name_assistance)
1280- self.name_assistance()
1281- self.ui.email_edit.textEdited.connect(self.email_assistance)
1282- self.ui.email_edit.textEdited.connect(self.confirm_email_assistance)
1283- self.email_assistance()
1284- self.ui.confirm_email_edit.textEdited.connect(
1285- self.confirm_email_assistance)
1286- self.confirm_email_assistance()
1287- self.ui.password_edit.textEdited.connect(self.password_assistance)
1288- self.ui.confirm_password_edit.textEdited.connect(
1289- self.password_assistance)
1290- self.password_assistance()
1291-
1292- def name_assistance(self):
1293- """Show help for the name field."""
1294- text = unicode(self.ui.name_edit.text())
1295- if not text.strip():
1296- self.ui.name_assistance.setVisible(True)
1297- self.ui.name_assistance.setText(BAD % EMPTY_NAME)
1298- else:
1299- self.ui.name_assistance.setVisible(False)
1300-
1301- def email_assistance(self):
1302- """Show help for the email field."""
1303- text = unicode(self.ui.email_edit.text())
1304- if not is_correct_email(text):
1305- self.ui.email_assistance.setText(BAD % INVALID_EMAIL)
1306- self.ui.email_assistance.setVisible(True)
1307- else:
1308- self.ui.email_assistance.setVisible(False)
1309-
1310- def confirm_email_assistance(self):
1311- """Show help for the confirm email field."""
1312- text1 = unicode(self.ui.email_edit.text())
1313- text2 = unicode(self.ui.confirm_email_edit.text())
1314- if text1 != text2:
1315- self.ui.confirm_email_assistance.setText(BAD % EMAIL_MATCH)
1316- self.ui.confirm_email_assistance.setVisible(True)
1317- else:
1318- self.ui.confirm_email_assistance.setVisible(False)
1319-
1320- def password_assistance(self):
1321- """Show help for the password field."""
1322- text1 = unicode(self.ui.password_edit.text())
1323- text2 = unicode(self.ui.confirm_password_edit.text())
1324- label_text = [_("Your password must contain"), ]
1325-
1326- if len(text1) < 8:
1327- sign = BAD
1328- else:
1329- sign = GOOD
1330- label_text.append(sign % PASSWORD_LENGTH)
1331-
1332- if re.search('[A-Z]', text1) is None:
1333- sign = BAD
1334- else:
1335- sign = GOOD
1336- label_text.append(sign % PASSWORD_UPPER)
1337-
1338- if re.search('[\d+]', text1) is None:
1339- sign = BAD
1340- else:
1341- sign = GOOD
1342- label_text.append(sign % PASSWORD_DIGIT)
1343-
1344- if text1 != text2:
1345- label_text.append(BAD % PASSWORD_MATCH)
1346-
1347- self.ui.password_assistance.setText("<br>".join(label_text))
1348-
1349-
1350-def is_min_required_password(password):
1351- """Return if the password meets the minimum requirements."""
1352- if (len(password) < 8 or
1353- re.search('[A-Z]', password) is None or
1354- re.search('\d+', password) is None):
1355- return False
1356- return True
1357-
1358-
1359-# FIXME: this should do the same check as SSO's server side
1360-def is_correct_email(email_address):
1361- """Return if the email is correct."""
1362- return '@' in email_address
1363+# -*- coding: utf-8 -*-
1364+
1365+# Authors: Roberto Alsina <roberto.alsina@canonical.com>
1366+#
1367+# Copyright 2011 Canonical Ltd.
1368+#
1369+# This program is free software: you can redistribute it and/or modify it
1370+# under the terms of the GNU General Public License version 3, as published
1371+# by the Free Software Foundation.
1372+#
1373+# This program is distributed in the hope that it will be useful, but
1374+# WITHOUT ANY WARRANTY; without even the implied warranties of
1375+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1376+# PURPOSE. See the GNU General Public License for more details.
1377+#
1378+# You should have received a copy of the GNU General Public License along
1379+# with this program. If not, see <http://www.gnu.org/licenses/>.
1380+
1381+"""Customized Setup Account page for SSO."""
1382+
1383+import gettext
1384+import re
1385+
1386+from PyQt4 import QtGui
1387+
1388+from ubuntu_sso.qt import gui as sso_gui
1389+
1390+_ = gettext.gettext
1391+
1392+# pylint: disable=C0103
1393+BAD = u'<img src=":/password_hint_warning.png" /><font color="red"> %s </font>'
1394+GOOD = u'<img src=":/password_hint_ok.png" /><font color="green"> %s </font>'
1395+TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>"
1396+
1397+EMPTY_NAME = _("Please enter your name")
1398+INVALID_EMAIL = _("Please enter a valid email address")
1399+EMAIL_MATCH = _("The email addresses do not match")
1400+PASSWORD_LENGTH = _("At least 8 characters")
1401+PASSWORD_DIGIT = _("At least one number")
1402+PASSWORD_UPPER = _("At least one uppercase letter")
1403+PASSWORD_MATCH = _("Passwords don't match")
1404+
1405+
1406+class SetupAccountPage(sso_gui.SetupAccountPage):
1407+
1408+ """Customized Setup Account page for SSO"""
1409+
1410+ def initializePage(self):
1411+ """Setup UI details."""
1412+ # We need to override some texts from SSO
1413+ # to match our spec
1414+ title_page = TITLE_STYLE % _("Sign Up to Ubuntu One")
1415+ self.setTitle(title_page)
1416+ self.setSubTitle(_("You only need to set up your account "
1417+ "once to get access to Ubuntu One across your devices."))
1418+
1419+ self.ui.name_label.setText(_("Name"))
1420+ self.ui.email_label.setText(_("Email"))
1421+ self.ui.confirm_email_label.setText(_("Retype email"))
1422+ self.ui.password_label.setText(_("Create a password"))
1423+ self.ui.confirm_password_label.setText(_("Retype password"))
1424+ self.ui.terms_checkbox.setText(
1425+ _("By signing up to Ubuntu One you agree to our Terms "
1426+ "of Service and Privacy Policy"))
1427+ self.ui.terms_button.setText(_("Show Terms of Service"))
1428+ self.ui.password_info_label.hide()
1429+
1430+ # Button setup
1431+ self.wizard().setButtonLayout([
1432+ QtGui.QWizard.Stretch,
1433+ QtGui.QWizard.BackButton,
1434+ QtGui.QWizard.CancelButton,
1435+ ])
1436+
1437+ self.ui.name_edit.textEdited.connect(self.name_assistance)
1438+ self.name_assistance()
1439+ self.ui.email_edit.textEdited.connect(self.email_assistance)
1440+ self.ui.email_edit.textEdited.connect(self.confirm_email_assistance)
1441+ self.email_assistance()
1442+ self.ui.confirm_email_edit.textEdited.connect(
1443+ self.confirm_email_assistance)
1444+ self.confirm_email_assistance()
1445+ self.ui.password_edit.textEdited.connect(self.password_assistance)
1446+ self.ui.confirm_password_edit.textEdited.connect(
1447+ self.password_assistance)
1448+ self.password_assistance()
1449+
1450+ def name_assistance(self):
1451+ """Show help for the name field."""
1452+ text = unicode(self.ui.name_edit.text())
1453+ if not text.strip():
1454+ self.ui.name_assistance.setVisible(True)
1455+ self.ui.name_assistance.setText(BAD % EMPTY_NAME)
1456+ else:
1457+ self.ui.name_assistance.setVisible(False)
1458+
1459+ def email_assistance(self):
1460+ """Show help for the email field."""
1461+ text = unicode(self.ui.email_edit.text())
1462+ if not is_correct_email(text):
1463+ self.ui.email_assistance.setText(BAD % INVALID_EMAIL)
1464+ self.ui.email_assistance.setVisible(True)
1465+ else:
1466+ self.ui.email_assistance.setVisible(False)
1467+
1468+ def confirm_email_assistance(self):
1469+ """Show help for the confirm email field."""
1470+ text1 = unicode(self.ui.email_edit.text())
1471+ text2 = unicode(self.ui.confirm_email_edit.text())
1472+ if text1 != text2:
1473+ self.ui.confirm_email_assistance.setText(BAD % EMAIL_MATCH)
1474+ self.ui.confirm_email_assistance.setVisible(True)
1475+ else:
1476+ self.ui.confirm_email_assistance.setVisible(False)
1477+
1478+ def password_assistance(self):
1479+ """Show help for the password field."""
1480+ text1 = unicode(self.ui.password_edit.text())
1481+ text2 = unicode(self.ui.confirm_password_edit.text())
1482+ label_text = ["<b>%s</b>" % _("Your password must contain"), ]
1483+
1484+ if len(text1) < 8:
1485+ sign = BAD
1486+ else:
1487+ sign = GOOD
1488+ label_text.append(sign % PASSWORD_LENGTH)
1489+
1490+ if re.search('[A-Z]', text1) is None:
1491+ sign = BAD
1492+ else:
1493+ sign = GOOD
1494+ label_text.append(sign % PASSWORD_UPPER)
1495+
1496+ if re.search('[\d+]', text1) is None:
1497+ sign = BAD
1498+ else:
1499+ sign = GOOD
1500+ label_text.append(sign % PASSWORD_DIGIT)
1501+
1502+ if text1 != text2:
1503+ label_text.append(BAD % PASSWORD_MATCH)
1504+
1505+ self.ui.password_assistance.setText("<br>".join(label_text))
1506+
1507+
1508+def is_min_required_password(password):
1509+ """Return if the password meets the minimum requirements."""
1510+ if (len(password) < 8 or
1511+ re.search('[A-Z]', password) is None or
1512+ re.search('\d+', password) is None):
1513+ return False
1514+ return True
1515+
1516+
1517+# FIXME: this should do the same check as SSO's server side
1518+def is_correct_email(email_address):
1519+ """Return if the email is correct."""
1520+ return '@' in email_address
1521
1522=== modified file 'ubuntuone_installer/gui/qt/side_widget.py'
1523--- ubuntuone_installer/gui/qt/side_widget.py 2011-07-04 18:15:56 +0000
1524+++ ubuntuone_installer/gui/qt/side_widget.py 2011-07-22 16:39:49 +0000
1525@@ -1,49 +1,73 @@
1526-# -*- coding: utf-8 -*-
1527-
1528-# Authors: Roberto Alsina <roberto.alsina@canonical.com>
1529-#
1530-# Copyright 2011 Canonical Ltd.
1531-#
1532-# This program is free software: you can redistribute it and/or modify it
1533-# under the terms of the GNU General Public License version 3, as published
1534-# by the Free Software Foundation.
1535-#
1536-# This program is distributed in the hope that it will be useful, but
1537-# WITHOUT ANY WARRANTY; without even the implied warranties of
1538-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1539-# PURPOSE. See the GNU General Public License for more details.
1540-#
1541-# You should have received a copy of the GNU General Public License along
1542-# with this program. If not, see <http://www.gnu.org/licenses/>.
1543-
1544-"""Wizard's side widget."""
1545-
1546-from PyQt4 import QtGui
1547-
1548-from ubuntuone_installer.gui.qt.ui import side_widget_ui
1549-
1550-
1551-class SideWidget(QtGui.QWidget):
1552-
1553- """Wizard's side widget."""
1554-
1555- install_stage = 0
1556- signin_stage = 1
1557- choose_services_stage = 2
1558- select_sync_folders_stage = 3
1559- sync_stage = 4
1560-
1561- def __init__(self, *args, **kwargs):
1562- super(SideWidget, self).__init__(*args, **kwargs)
1563- self.ui = side_widget_ui.Ui_Form()
1564- self.ui.setupUi(self)
1565- self.stage = 0
1566-
1567- def set_stage(self, stage):
1568- """Switch to the desired stage."""
1569- self.stage = stage
1570- self.ui.install_label.setEnabled(stage >= 0)
1571- self.ui.sign_in_label.setEnabled(stage >= 1)
1572- self.ui.choose_services_label.setEnabled(stage >= 2)
1573- self.ui.select_folders_label.setEnabled(stage >= 3)
1574- self.ui.sync_label.setEnabled(stage >= 4)
1575+# -*- coding: utf-8 -*-
1576+
1577+# Authors: Roberto Alsina <roberto.alsina@canonical.com>
1578+#
1579+# Copyright 2011 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+"""Wizard's side widget."""
1594+
1595+from PyQt4 import QtGui
1596+
1597+from ubuntuone_installer.gui.qt.ui import side_widget_ui
1598+# Module used ti include the resources into this file
1599+# pylint: disable=W0611
1600+from ubuntuone_installer.gui.qt.ui import images_rc
1601+# pylint: enable=W0611
1602+
1603+
1604+class SideWidget(QtGui.QFrame):
1605+
1606+ """Wizard's side widget."""
1607+
1608+ install_stage = 0
1609+ signin_stage = 1
1610+ choose_services_stage = 2
1611+ select_sync_folders_stage = 3
1612+ sync_stage = 4
1613+
1614+ def __init__(self, *args, **kwargs):
1615+ super(SideWidget, self).__init__(*args, **kwargs)
1616+ self.ui = side_widget_ui.Ui_SideWidget()
1617+ self.ui.setupUi(self)
1618+ self.stage = 0
1619+
1620+ def set_stage(self, stage):
1621+ """Switch to the desired stage."""
1622+ self.stage = stage
1623+ self.ui.install_label.setEnabled(stage >= 0)
1624+ self.ui.sign_in_label.setEnabled(stage >= 1)
1625+ self.ui.choose_services_label.setEnabled(stage >= 2)
1626+ self.ui.select_folders_label.setEnabled(stage >= 3)
1627+ self.ui.sync_label.setEnabled(stage >= 4)
1628+ self.set_stage_icon(self.ui.install_icon_label, self.install_stage)
1629+ self.set_stage_icon(self.ui.sign_icon_label, self.signin_stage)
1630+ self.set_stage_icon(self.ui.choose_icon_label,
1631+ self.choose_services_stage)
1632+ self.set_stage_icon(self.ui.folders_icon_label,
1633+ self.select_sync_folders_stage)
1634+ self.set_stage_icon(self.ui.sync_icon_label, self.sync_stage)
1635+
1636+ def set_stage_icon(self, label, label_stage):
1637+ """Set the label icon depending on the proper state."""
1638+ if self.stage == label_stage and label == self.ui.sync_icon_label:
1639+ label.setPixmap(QtGui.QPixmap(":/progress_finish_orange.png"))
1640+ elif self.stage == label_stage:
1641+ label.setPixmap(QtGui.QPixmap(":/progress_arrow_orange.png"))
1642+ elif self.stage > label_stage:
1643+ label.setPixmap(QtGui.QPixmap(":/progress_tick.png"))
1644+ elif label == self.ui.sync_icon_label:
1645+ label.setPixmap(QtGui.QPixmap(":/progress_finish_grey.png"))
1646+ else:
1647+ label.setPixmap(QtGui.QPixmap(":/progress_arrow_grey.png"))
1648
1649=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
1650--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-19 17:16:11 +0000
1651+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-22 16:39:49 +0000
1652@@ -114,6 +114,10 @@
1653 self.ui.done(result=0)
1654 # world did not explode
1655
1656+ def test_main_window_general_config(self):
1657+ """Check if the main properties of the windows are set."""
1658+ self.assertEqual(self.ui.windowTitle(), APP_NAME)
1659+
1660 def test_start_control_panel_on_finishing(self):
1661 """Calling done with result=1, the control panel should be called."""
1662 gui.AreYouSure.result = 0
1663@@ -188,7 +192,7 @@
1664 def test_current_user_controller_parameters(self):
1665 """Compare controller parameters with expected values."""
1666 self.assertEqual(self.ui.current_user_controller.args,
1667- ((), {'title': gui.SIGN_IN,
1668+ ((), {'title': gui.TITLE_STYLE % gui.SIGN_IN,
1669 'subtitle': gui.SIGN_IN_SUBTITLE}))
1670
1671 def test_stage_progression_1(self):
1672@@ -652,3 +656,24 @@
1673 setup_account.BAD % setup_account.PASSWORD_MATCH in
1674 unicode(self.ui.ui.password_assistance.text()),
1675 )
1676+
1677+ def test_side_widget_state(self):
1678+ """Test if the side widget of the wizard has state frame visible."""
1679+ if type(self.ui) != gui.MainWindow:
1680+ return
1681+ self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE)
1682+ self.assertEqual(
1683+ True,
1684+ sideWidget().ui.states_frame.isVisible())
1685+ self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE)
1686+ self.assertEqual(
1687+ True,
1688+ sideWidget().ui.states_frame.isVisible())
1689+ self.ui.on_currentIdChanged(self.ui.local_folders_page_id)
1690+ self.assertEqual(
1691+ True,
1692+ sideWidget().ui.states_frame.isVisible())
1693+ self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE)
1694+ self.assertEqual(
1695+ True,
1696+ sideWidget().ui.states_frame.isVisible())
1697
1698=== modified file 'ubuntuone_installer/gui/qt/tests/test_side_widget.py'
1699--- ubuntuone_installer/gui/qt/tests/test_side_widget.py 2011-07-07 13:08:24 +0000
1700+++ ubuntuone_installer/gui/qt/tests/test_side_widget.py 2011-07-22 16:39:49 +0000
1701@@ -1,100 +1,155 @@
1702-# -*- coding: utf-8 -*-
1703-
1704-# Authors: Alejandro J. Cura <alecu@canonical.com>
1705-# Roberto Alsina <roberto.alsina@canonical.com>
1706-#
1707-# Copyright 2011 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-"""Tests for the Qt UI."""
1722-
1723-from ubuntuone_installer.gui.qt.tests import BaseTestCase
1724-from ubuntuone_installer.gui.qt.side_widget import SideWidget
1725-
1726-
1727-class SideWidgetTestCase(BaseTestCase):
1728-
1729- """Test the qt main window."""
1730-
1731- class_ui = SideWidget
1732-
1733- def test_stage_0(self):
1734- """Check that each stage in the widget enables the right labels."""
1735- self.ui.set_stage(0)
1736- self.assertEqual(
1737- self.ui.ui.install_label.isEnabled(), True)
1738- self.assertEqual(
1739- self.ui.ui.sign_in_label.isEnabled(), False)
1740- self.assertEqual(
1741- self.ui.ui.choose_services_label.isEnabled(), False)
1742- self.assertEqual(
1743- self.ui.ui.select_folders_label.isEnabled(), False)
1744- self.assertEqual(
1745- self.ui.ui.sync_label.isEnabled(), False)
1746-
1747- def test_stage_1(self):
1748- """Check that each stage in the widget enables the right labels."""
1749- self.ui.set_stage(1)
1750- self.assertEqual(
1751- self.ui.ui.install_label.isEnabled(), True)
1752- self.assertEqual(
1753- self.ui.ui.sign_in_label.isEnabled(), True)
1754- self.assertEqual(
1755- self.ui.ui.choose_services_label.isEnabled(), False)
1756- self.assertEqual(
1757- self.ui.ui.select_folders_label.isEnabled(), False)
1758- self.assertEqual(
1759- self.ui.ui.sync_label.isEnabled(), False)
1760-
1761- def test_stage_2(self):
1762- """Check that each stage in the widget enables the right labels."""
1763- self.ui.set_stage(2)
1764- self.assertEqual(
1765- self.ui.ui.install_label.isEnabled(), True)
1766- self.assertEqual(
1767- self.ui.ui.sign_in_label.isEnabled(), True)
1768- self.assertEqual(
1769- self.ui.ui.choose_services_label.isEnabled(), True)
1770- self.assertEqual(
1771- self.ui.ui.select_folders_label.isEnabled(), False)
1772- self.assertEqual(
1773- self.ui.ui.sync_label.isEnabled(), False)
1774-
1775- def test_stage_3(self):
1776- """Check that each stage in the widget enables the right labels."""
1777- self.ui.set_stage(3)
1778- self.assertEqual(
1779- self.ui.ui.install_label.isEnabled(), True)
1780- self.assertEqual(
1781- self.ui.ui.sign_in_label.isEnabled(), True)
1782- self.assertEqual(
1783- self.ui.ui.choose_services_label.isEnabled(), True)
1784- self.assertEqual(
1785- self.ui.ui.select_folders_label.isEnabled(), True)
1786- self.assertEqual(
1787- self.ui.ui.sync_label.isEnabled(), False)
1788-
1789- def test_stage_4(self):
1790- """Check that each stage in the widget enables the right labels."""
1791- self.ui.set_stage(4)
1792- self.assertEqual(
1793- self.ui.ui.install_label.isEnabled(), True)
1794- self.assertEqual(
1795- self.ui.ui.sign_in_label.isEnabled(), True)
1796- self.assertEqual(
1797- self.ui.ui.choose_services_label.isEnabled(), True)
1798- self.assertEqual(
1799- self.ui.ui.select_folders_label.isEnabled(), True)
1800- self.assertEqual(
1801- self.ui.ui.sync_label.isEnabled(), True)
1802+# -*- coding: utf-8 -*-
1803+
1804+# Authors: Alejandro J. Cura <alecu@canonical.com>
1805+# Roberto Alsina <roberto.alsina@canonical.com>
1806+#
1807+# Copyright 2011 Canonical Ltd.
1808+#
1809+# This program is free software: you can redistribute it and/or modify it
1810+# under the terms of the GNU General Public License version 3, as published
1811+# by the Free Software Foundation.
1812+#
1813+# This program is distributed in the hope that it will be useful, but
1814+# WITHOUT ANY WARRANTY; without even the implied warranties of
1815+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1816+# PURPOSE. See the GNU General Public License for more details.
1817+#
1818+# You should have received a copy of the GNU General Public License along
1819+# with this program. If not, see <http://www.gnu.org/licenses/>.
1820+
1821+"""Tests for the Qt UI."""
1822+
1823+from PyQt4 import QtGui, QtCore
1824+
1825+from ubuntuone_installer.gui.qt.tests import BaseTestCase
1826+from ubuntuone_installer.gui.qt.side_widget import SideWidget
1827+# Module used ti include the resources into this file
1828+# pylint: disable=W0611
1829+from ubuntuone_installer.gui.qt.ui import images_rc
1830+# pylint: enable=W0611
1831+
1832+
1833+class SideWidgetTestCase(BaseTestCase):
1834+
1835+ """Test the qt main window."""
1836+
1837+ class_ui = SideWidget
1838+
1839+ def test_stage_0(self):
1840+ """Check that each stage in the widget enables the right labels."""
1841+ self.ui.set_stage(0)
1842+ self.assertEqual(
1843+ self.ui.ui.install_label.isEnabled(), True)
1844+ self.assertEqual(
1845+ self.ui.ui.sign_in_label.isEnabled(), False)
1846+ self.assertEqual(
1847+ self.ui.ui.choose_services_label.isEnabled(), False)
1848+ self.assertEqual(
1849+ self.ui.ui.select_folders_label.isEnabled(), False)
1850+ self.assertEqual(
1851+ self.ui.ui.sync_label.isEnabled(), False)
1852+ self.check_state_pixmap(0)
1853+
1854+ def test_stage_1(self):
1855+ """Check that each stage in the widget enables the right labels."""
1856+ self.ui.set_stage(1)
1857+ self.assertEqual(
1858+ self.ui.ui.install_label.isEnabled(), True)
1859+ self.assertEqual(
1860+ self.ui.ui.sign_in_label.isEnabled(), True)
1861+ self.assertEqual(
1862+ self.ui.ui.choose_services_label.isEnabled(), False)
1863+ self.assertEqual(
1864+ self.ui.ui.select_folders_label.isEnabled(), False)
1865+ self.assertEqual(
1866+ self.ui.ui.sync_label.isEnabled(), False)
1867+ self.check_state_pixmap(1)
1868+
1869+ def test_stage_2(self):
1870+ """Check that each stage in the widget enables the right labels."""
1871+ self.ui.set_stage(2)
1872+ self.assertEqual(
1873+ self.ui.ui.install_label.isEnabled(), True)
1874+ self.assertEqual(
1875+ self.ui.ui.sign_in_label.isEnabled(), True)
1876+ self.assertEqual(
1877+ self.ui.ui.choose_services_label.isEnabled(), True)
1878+ self.assertEqual(
1879+ self.ui.ui.select_folders_label.isEnabled(), False)
1880+ self.assertEqual(
1881+ self.ui.ui.sync_label.isEnabled(), False)
1882+ self.check_state_pixmap(2)
1883+
1884+ def test_stage_3(self):
1885+ """Check that each stage in the widget enables the right labels."""
1886+ self.ui.set_stage(3)
1887+ self.assertEqual(
1888+ self.ui.ui.install_label.isEnabled(), True)
1889+ self.assertEqual(
1890+ self.ui.ui.sign_in_label.isEnabled(), True)
1891+ self.assertEqual(
1892+ self.ui.ui.choose_services_label.isEnabled(), True)
1893+ self.assertEqual(
1894+ self.ui.ui.select_folders_label.isEnabled(), True)
1895+ self.assertEqual(
1896+ self.ui.ui.sync_label.isEnabled(), False)
1897+ self.check_state_pixmap(3)
1898+
1899+ def test_stage_4(self):
1900+ """Check that each stage in the widget enables the right labels."""
1901+ self.ui.set_stage(4)
1902+ self.assertEqual(
1903+ self.ui.ui.install_label.isEnabled(), True)
1904+ self.assertEqual(
1905+ self.ui.ui.sign_in_label.isEnabled(), True)
1906+ self.assertEqual(
1907+ self.ui.ui.choose_services_label.isEnabled(), True)
1908+ self.assertEqual(
1909+ self.ui.ui.select_folders_label.isEnabled(), True)
1910+ self.assertEqual(
1911+ self.ui.ui.sync_label.isEnabled(), True)
1912+ self.check_state_pixmap(4)
1913+
1914+ def get_pixmap_data(self, pixmap):
1915+ """Get the raw data of a QPixmap."""
1916+ byte_array = QtCore.QByteArray()
1917+ array_buffer = QtCore.QBuffer(byte_array)
1918+ pixmap.save(array_buffer, "PNG")
1919+ return byte_array
1920+
1921+ # Invalid name "assertEqualPixmap"
1922+ # pylint: disable=C0103
1923+
1924+ def assertEqualPixmaps(self, pixmap1, pixmap2):
1925+ """Compare two Qt pixmaps."""
1926+ d1 = self.get_pixmap_data(pixmap1)
1927+ d2 = self.get_pixmap_data(pixmap2)
1928+ self.assertEqual(d1, d2)
1929+
1930+ def check_state_pixmap(self, stage):
1931+ """Check if each label has the proper pixmap depending on the state."""
1932+ print stage
1933+ active_pixmap = QtGui.QPixmap(":/progress_arrow_orange.png")
1934+ no_active_pixmap = QtGui.QPixmap(":/progress_arrow_grey.png")
1935+ complete_pixmap = QtGui.QPixmap(":/progress_tick.png")
1936+ sync_active_pixmap = QtGui.QPixmap(":/progress_finish_orange.png")
1937+ sync_no_active_pixmap = QtGui.QPixmap(":/progress_finish_grey.png")
1938+ labels = (
1939+ self.ui.ui.install_icon_label,
1940+ self.ui.ui.sign_icon_label,
1941+ self.ui.ui.choose_icon_label,
1942+ self.ui.ui.folders_icon_label,
1943+ self.ui.ui.sync_icon_label)
1944+
1945+ for item in labels[:stage]:
1946+ self.assertEqualPixmaps(complete_pixmap, item.pixmap())
1947+
1948+ if stage != 4:
1949+ self.assertEqualPixmaps(active_pixmap, labels[stage].pixmap())
1950+ else:
1951+ self.assertEqualPixmaps(sync_active_pixmap, labels[4].pixmap())
1952+
1953+ if stage < 4:
1954+ for item in labels[stage + 1:len(labels) - 1]:
1955+ self.assertEqualPixmaps(no_active_pixmap, item.pixmap())
1956+ self.assertEqualPixmaps(sync_no_active_pixmap, labels[4].pixmap())

Subscribers

People subscribed via source and target branches