Merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.91.1 into lp:ubuntuone-control-panel/stable-3-0
- stable-3-0-update-2.99.91.1
- Merge into stable-3-0
Status: | Merged | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | dobey | ||||||||||||||||||||||||||||
Approved revision: | 257 | ||||||||||||||||||||||||||||
Merged at revision: | 256 | ||||||||||||||||||||||||||||
Proposed branch: | lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.91.1 | ||||||||||||||||||||||||||||
Merge into: | lp:ubuntuone-control-panel/stable-3-0 | ||||||||||||||||||||||||||||
Diff against target: |
1286 lines (+425/-177) 22 files modified
data/qt/images.qrc (+1/-0) data/qt/linux.qss (+16/-0) data/qt/preferences.ui (+3/-0) data/qt/side_widget.ui (+22/-1) data/qt/ubuntuone.qss (+71/-102) data/qt/windows.qss (+11/-0) ubuntuone/controlpanel/gui/qt/__init__.py (+33/-5) ubuntuone/controlpanel/gui/qt/controlpanel.py (+8/-0) ubuntuone/controlpanel/gui/qt/gui.py (+10/-4) ubuntuone/controlpanel/gui/qt/main/__init__.py (+7/-2) ubuntuone/controlpanel/gui/qt/main/tests/test_main.py (+10/-4) ubuntuone/controlpanel/gui/qt/tests/__init__.py (+14/-6) ubuntuone/controlpanel/gui/qt/tests/test_common.py (+3/-2) ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py (+11/-3) ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+23/-4) ubuntuone/controlpanel/gui/qt/tests/test_gui.py (+16/-0) ubuntuone/controlpanel/gui/qt/tests/test_start.py (+1/-1) ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+33/-24) ubuntuone/controlpanel/gui/qt/wizard.py (+22/-19) ubuntuone/controlpanel/utils/__init__.py (+2/-0) ubuntuone/controlpanel/utils/tests/test_windows.py (+88/-0) ubuntuone/controlpanel/utils/windows.py (+20/-0) |
||||||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-control-panel/stable-3-0-update-2.99.91.1 | ||||||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manuel de la Peña (community) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+99551@code.launchpad.net |
Commit message
[ Natalia B. Bidart <email address hidden> ]
- Isolate linux specific styling hacks to avoid weird side effects
on windows (LP: #961229).
- Handle errors from backend on the signin wizard page (LP: #945078).
- Avoid the 'show/hide details' button to grow when focused (LP: #961348).
- Modified stylesheet to use the new colours from brand, and to also ease
the reading of white text (LP: #956077).
- Fixed the gap tab outlines (LP: #822629).
[ Brian Curtin <email address hidden> ]
- Add Ubuntu One to the Windows auto-start registry key.
- Made the creation of symlinks a separated test case so it can be
skipped on Windows.
- Better cleanup in tests -- allow the rest of the test suite to
complete. Fix courtesy of Natalia Bidart.
[ Roberto Alsina <email address hidden> ]
- Made the license page from the wizard be shown (only when called
with --installer) (LP: #933697).
- Forced white background (LP: #961346).
Description of the change
Manuel de la Peña (mandel) : | # |
Preview Diff
1 | === added file 'data/external_icon_dark_grey.png' | |||
2 | 0 | Binary files data/external_icon_dark_grey.png 1970-01-01 00:00:00 +0000 and data/external_icon_dark_grey.png 2012-03-27 15:50:42 +0000 differ | 0 | Binary files data/external_icon_dark_grey.png 1970-01-01 00:00:00 +0000 and data/external_icon_dark_grey.png 2012-03-27 15:50:42 +0000 differ |
3 | === modified file 'data/qt/images.qrc' | |||
4 | --- data/qt/images.qrc 2012-03-15 01:25:08 +0000 | |||
5 | +++ data/qt/images.qrc 2012-03-27 15:50:42 +0000 | |||
6 | @@ -2,6 +2,7 @@ | |||
7 | 2 | <qresource prefix="/"> | 2 | <qresource prefix="/"> |
8 | 3 | <file>../banner.png</file> | 3 | <file>../banner.png</file> |
9 | 4 | <file>../computer.png</file> | 4 | <file>../computer.png</file> |
10 | 5 | <file>../external_icon_dark_grey.png</file> | ||
11 | 5 | <file>../external_icon_orange.png</file> | 6 | <file>../external_icon_orange.png</file> |
12 | 6 | <file>../external_icon_white.png</file> | 7 | <file>../external_icon_white.png</file> |
13 | 7 | <file>../icon.png</file> | 8 | <file>../icon.png</file> |
14 | 8 | 9 | ||
15 | === modified file 'data/qt/linux.qss' | |||
16 | --- data/qt/linux.qss 2012-03-16 21:10:54 +0000 | |||
17 | +++ data/qt/linux.qss 2012-03-27 15:50:42 +0000 | |||
18 | @@ -1,2 +1,18 @@ | |||
19 | 1 | /* Styles specific to the linux platform */ | 1 | /* Styles specific to the linux platform */ |
20 | 2 | 2 | ||
21 | 3 | QPushButton:focus, | ||
22 | 4 | GoToWebButton#help_button:focus, | ||
23 | 5 | GoToWebButton#share_publish_button:focus { | ||
24 | 6 | /* hack to make the mild-orange focused box dissapear */ | ||
25 | 7 | padding-top: 100%; | ||
26 | 8 | padding-bottom: 100%; | ||
27 | 9 | /* end of hack */ | ||
28 | 10 | } | ||
29 | 11 | |||
30 | 12 | QTabBar::tab:hover, | ||
31 | 13 | QTabBar::tab:focus { | ||
32 | 14 | /* hack to make the mild-orange focused box dissapear */ | ||
33 | 15 | padding-left: 1000px; | ||
34 | 16 | padding-right: 1000px; | ||
35 | 17 | /* end of hack */ | ||
36 | 18 | } | ||
37 | 3 | 19 | ||
38 | === modified file 'data/qt/preferences.ui' | |||
39 | --- data/qt/preferences.ui 2012-03-14 18:37:40 +0000 | |||
40 | +++ data/qt/preferences.ui 2012-03-27 15:50:42 +0000 | |||
41 | @@ -95,6 +95,9 @@ | |||
42 | 95 | <property name="orientation"> | 95 | <property name="orientation"> |
43 | 96 | <enum>Qt::Vertical</enum> | 96 | <enum>Qt::Vertical</enum> |
44 | 97 | </property> | 97 | </property> |
45 | 98 | <property name="sizeType"> | ||
46 | 99 | <enum>QSizePolicy::Minimum</enum> | ||
47 | 100 | </property> | ||
48 | 98 | <property name="sizeHint" stdset="0"> | 101 | <property name="sizeHint" stdset="0"> |
49 | 99 | <size> | 102 | <size> |
50 | 100 | <width>40</width> | 103 | <width>40</width> |
51 | 101 | 104 | ||
52 | === modified file 'data/qt/side_widget.ui' | |||
53 | --- data/qt/side_widget.ui 2012-03-14 15:11:19 +0000 | |||
54 | +++ data/qt/side_widget.ui 2012-03-27 15:50:42 +0000 | |||
55 | @@ -20,7 +20,16 @@ | |||
56 | 20 | <property name="spacing"> | 20 | <property name="spacing"> |
57 | 21 | <number>40</number> | 21 | <number>40</number> |
58 | 22 | </property> | 22 | </property> |
60 | 23 | <property name="margin"> | 23 | <property name="leftMargin"> |
61 | 24 | <number>0</number> | ||
62 | 25 | </property> | ||
63 | 26 | <property name="topMargin"> | ||
64 | 27 | <number>0</number> | ||
65 | 28 | </property> | ||
66 | 29 | <property name="rightMargin"> | ||
67 | 30 | <number>10</number> | ||
68 | 31 | </property> | ||
69 | 32 | <property name="bottomMargin"> | ||
70 | 24 | <number>0</number> | 33 | <number>0</number> |
71 | 25 | </property> | 34 | </property> |
72 | 26 | <item> | 35 | <item> |
73 | @@ -83,6 +92,9 @@ | |||
74 | 83 | <property name="text"> | 92 | <property name="text"> |
75 | 84 | <string notr="true">Install</string> | 93 | <string notr="true">Install</string> |
76 | 85 | </property> | 94 | </property> |
77 | 95 | <property name="wordWrap"> | ||
78 | 96 | <bool>true</bool> | ||
79 | 97 | </property> | ||
80 | 86 | </widget> | 98 | </widget> |
81 | 87 | </item> | 99 | </item> |
82 | 88 | </layout> | 100 | </layout> |
83 | @@ -125,6 +137,9 @@ | |||
84 | 125 | <property name="text"> | 137 | <property name="text"> |
85 | 126 | <string notr="true">Sign In</string> | 138 | <string notr="true">Sign In</string> |
86 | 127 | </property> | 139 | </property> |
87 | 140 | <property name="wordWrap"> | ||
88 | 141 | <bool>true</bool> | ||
89 | 142 | </property> | ||
90 | 128 | </widget> | 143 | </widget> |
91 | 129 | </item> | 144 | </item> |
92 | 130 | </layout> | 145 | </layout> |
93 | @@ -164,6 +179,9 @@ | |||
94 | 164 | <property name="text"> | 179 | <property name="text"> |
95 | 165 | <string notr="true">Select sync folders</string> | 180 | <string notr="true">Select sync folders</string> |
96 | 166 | </property> | 181 | </property> |
97 | 182 | <property name="wordWrap"> | ||
98 | 183 | <bool>true</bool> | ||
99 | 184 | </property> | ||
100 | 167 | </widget> | 185 | </widget> |
101 | 168 | </item> | 186 | </item> |
102 | 169 | </layout> | 187 | </layout> |
103 | @@ -203,6 +221,9 @@ | |||
104 | 203 | <property name="text"> | 221 | <property name="text"> |
105 | 204 | <string notr="true">Sync, stream, share!</string> | 222 | <string notr="true">Sync, stream, share!</string> |
106 | 205 | </property> | 223 | </property> |
107 | 224 | <property name="wordWrap"> | ||
108 | 225 | <bool>true</bool> | ||
109 | 226 | </property> | ||
110 | 206 | </widget> | 227 | </widget> |
111 | 207 | </item> | 228 | </item> |
112 | 208 | </layout> | 229 | </layout> |
113 | 209 | 230 | ||
114 | === modified file 'data/qt/ubuntuone.qss' | |||
115 | --- data/qt/ubuntuone.qss 2012-03-20 13:05:20 +0000 | |||
116 | +++ data/qt/ubuntuone.qss 2012-03-27 15:50:42 +0000 | |||
117 | @@ -7,7 +7,7 @@ | |||
118 | 7 | */ | 7 | */ |
119 | 8 | 8 | ||
120 | 9 | QMainWindow { | 9 | QMainWindow { |
122 | 10 | background-color: #aea79f; | 10 | background-color: #adadad; |
123 | 11 | } | 11 | } |
124 | 12 | 12 | ||
125 | 13 | QWidget { | 13 | QWidget { |
126 | @@ -16,6 +16,7 @@ | |||
127 | 16 | 16 | ||
128 | 17 | QFrame { | 17 | QFrame { |
129 | 18 | border: none; | 18 | border: none; |
130 | 19 | border-color: #333333; | ||
131 | 19 | } | 20 | } |
132 | 20 | 21 | ||
133 | 21 | UbuntuOneWizard, | 22 | UbuntuOneWizard, |
134 | @@ -23,13 +24,12 @@ | |||
135 | 23 | background: white; | 24 | background: white; |
136 | 24 | border-radius: 5px; | 25 | border-radius: 5px; |
137 | 25 | border-style: solid; | 26 | border-style: solid; |
138 | 26 | border-color: #939389; | ||
139 | 27 | border-width: 1px; | 27 | border-width: 1px; |
140 | 28 | min-height: 90px; | 28 | min-height: 90px; |
141 | 29 | } | 29 | } |
142 | 30 | 30 | ||
143 | 31 | QFrame#frame_greeting { | 31 | QFrame#frame_greeting { |
145 | 32 | margin 0px; | 32 | margin: 0px; |
146 | 33 | padding-left: 15px; | 33 | padding-left: 15px; |
147 | 34 | padding-top: 10px; | 34 | padding-top: 10px; |
148 | 35 | padding-right: 10px; | 35 | padding-right: 10px; |
149 | @@ -39,7 +39,6 @@ | |||
150 | 39 | QFrame#frame_status, | 39 | QFrame#frame_status, |
151 | 40 | QFrame#frame_storage { | 40 | QFrame#frame_storage { |
152 | 41 | border-style: dotted; | 41 | border-style: dotted; |
153 | 42 | border-color: #939389; | ||
154 | 43 | border-left-width: 1px; | 42 | border-left-width: 1px; |
155 | 44 | padding: 10px; | 43 | padding: 10px; |
156 | 45 | min-width: 40px; | 44 | min-width: 40px; |
157 | @@ -47,24 +46,21 @@ | |||
158 | 47 | 46 | ||
159 | 48 | QFrame#account_separator { | 47 | QFrame#account_separator { |
160 | 49 | border-style: dotted; | 48 | border-style: dotted; |
161 | 50 | border-color: #939389; | ||
162 | 51 | border-bottom-width: 1px; | 49 | border-bottom-width: 1px; |
163 | 52 | } | 50 | } |
164 | 53 | 51 | ||
165 | 54 | QFrame#frm_box { /*The Loading Overlay frame.*/ | 52 | QFrame#frm_box { /*The Loading Overlay frame.*/ |
167 | 55 | background: #ffffff; | 53 | background: white; |
168 | 56 | border-radius: 5px; | 54 | border-radius: 5px; |
169 | 57 | border-style: solid; | 55 | border-style: solid; |
170 | 58 | border-color: #939389; | ||
171 | 59 | border-width: 1px; | 56 | border-width: 1px; |
172 | 60 | color: white; | 57 | color: white; |
173 | 61 | min-height: 100px; | 58 | min-height: 100px; |
174 | 62 | } | 59 | } |
175 | 63 | 60 | ||
177 | 64 | SideWidget { | 61 | SideWidget { /* is a QFrame, so border color is already set */ |
178 | 65 | background-color: white; | 62 | background-color: white; |
179 | 66 | border-style: dotted; | 63 | border-style: dotted; |
180 | 67 | border-color: #939389; | ||
181 | 68 | border-right-width: 1px; | 64 | border-right-width: 1px; |
182 | 69 | color: white; | 65 | color: white; |
183 | 70 | min-height: 100px; | 66 | min-height: 100px; |
184 | @@ -85,10 +81,6 @@ | |||
185 | 85 | padding: 5px; | 81 | padding: 5px; |
186 | 86 | padding-left: 19px; | 82 | padding-left: 19px; |
187 | 87 | padding-right: 19px; | 83 | padding-right: 19px; |
188 | 88 | /* hack to make the mild-orange focused box dissapear */ | ||
189 | 89 | padding-top: 100%; | ||
190 | 90 | padding-bottom: 100%; | ||
191 | 91 | /* end of hack */ | ||
192 | 92 | } | 84 | } |
193 | 93 | 85 | ||
194 | 94 | QPushButton:disabled { | 86 | QPushButton:disabled { |
195 | @@ -100,7 +92,7 @@ | |||
196 | 100 | 92 | ||
197 | 101 | QPushButton:enabled { | 93 | QPushButton:enabled { |
198 | 102 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 94 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
200 | 103 | stop: 0 #ffffff,stop: 1.0 #e6e6e6); | 95 | stop: 0 white, stop: 1.0 #e6e6e6); |
201 | 104 | color: #333333; | 96 | color: #333333; |
202 | 105 | border-color: #999999; | 97 | border-color: #999999; |
203 | 106 | } | 98 | } |
204 | @@ -111,7 +103,7 @@ | |||
205 | 111 | 103 | ||
206 | 112 | QPushButton:enabled:hover { | 104 | QPushButton:enabled:hover { |
207 | 113 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 105 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
209 | 114 | stop: 0 #ffffff,stop: 1.0 #ededed); | 106 | stop: 0 white, stop: 1.0 #ededed); |
210 | 115 | } | 107 | } |
211 | 116 | 108 | ||
212 | 117 | QPushButton:enabled:pressed { | 109 | QPushButton:enabled:pressed { |
213 | @@ -169,10 +161,9 @@ | |||
214 | 169 | background: transparent; | 161 | background: transparent; |
215 | 170 | border: none; | 162 | border: none; |
216 | 171 | text-decoration: underline; | 163 | text-decoration: underline; |
221 | 172 | color: white; | 164 | padding-left: 2px; /* 2px border buffer when focused */ |
222 | 173 | padding-left: 10px; | 165 | padding-right: 15px; |
223 | 174 | padding-right: 25px; | 166 | background-image: url(:/external_icon_dark_grey.png); |
220 | 175 | background-image: url(:/external_icon_white.png); | ||
224 | 176 | background-repeat: no-repeat; | 167 | background-repeat: no-repeat; |
225 | 177 | background-position: right; | 168 | background-position: right; |
226 | 178 | background-origin: margin; | 169 | background-origin: margin; |
227 | @@ -180,13 +171,9 @@ | |||
228 | 180 | 171 | ||
229 | 181 | GoToWebButton#help_button:focus { | 172 | GoToWebButton#help_button:focus { |
230 | 182 | border: 2px solid #dd4814; | 173 | border: 2px solid #dd4814; |
231 | 183 | /* hack to make the mild-orange focused box dissapear */ | ||
232 | 184 | padding-top: 100%; | ||
233 | 185 | padding-bottom: 100%; | ||
234 | 186 | /* end of hack */ | ||
235 | 187 | /* Compensate for border so text doesn't move */ | 174 | /* Compensate for border so text doesn't move */ |
238 | 188 | padding-left: 8px; | 175 | padding-left: 0px; |
239 | 189 | padding-right: 23px; | 176 | padding-right: 13px; |
240 | 190 | } | 177 | } |
241 | 191 | 178 | ||
242 | 192 | GoToWebButton#share_publish_button { | 179 | GoToWebButton#share_publish_button { |
243 | @@ -204,84 +191,72 @@ | |||
244 | 204 | 191 | ||
245 | 205 | GoToWebButton#share_publish_button:focus { | 192 | GoToWebButton#share_publish_button:focus { |
246 | 206 | border: 2px solid #aea79f; | 193 | border: 2px solid #aea79f; |
247 | 207 | /* hack to make the mild-orange focused box dissapear */ | ||
248 | 208 | padding-top: 100%; | ||
249 | 209 | padding-bottom: 100%; | ||
250 | 210 | /* end of hack */ | ||
251 | 211 | /* Compensate for border so text doesn't move */ | 194 | /* Compensate for border so text doesn't move */ |
252 | 212 | padding-left: 8px; | 195 | padding-left: 8px; |
253 | 213 | padding-right: 23px; | 196 | padding-right: 23px; |
254 | 214 | } | 197 | } |
255 | 215 | 198 | ||
256 | 199 | GoToWebButton#edit_profile_button, | ||
257 | 200 | GoToWebButton#edit_services_button, | ||
258 | 201 | GoToWebButton#get_more_space_button { | ||
259 | 202 | padding-left: 8px; | ||
260 | 203 | padding-right: 25px; | ||
261 | 204 | background-image: url(:/external_icon_white.png); | ||
262 | 205 | background-repeat: no-repeat; | ||
263 | 206 | background-position: right; | ||
264 | 207 | background-origin: margin; | ||
265 | 208 | } | ||
266 | 209 | |||
267 | 210 | QTabWidget { | ||
268 | 211 | border-bottom-left-radius: 5px; | ||
269 | 212 | border-bottom-right-radius: 5px; | ||
270 | 213 | border-style: solid; | ||
271 | 214 | padding: 10px; | ||
272 | 215 | } | ||
273 | 216 | |||
274 | 217 | QTabWidget::pane { | ||
275 | 218 | border-bottom-left-radius: 5px; | ||
276 | 219 | border-bottom-right-radius: 5px; | ||
277 | 220 | border-top-right-radius: 5px; | ||
278 | 221 | border-style: solid; | ||
279 | 222 | border-color: #333333; | ||
280 | 223 | border-width: 1px; | ||
281 | 224 | background: white; | ||
282 | 225 | position: absolute; | ||
283 | 226 | top: -2px; | ||
284 | 227 | } | ||
285 | 228 | |||
286 | 216 | QTabBar::tab { | 229 | QTabBar::tab { |
290 | 217 | height: 15px; | 230 | background-color: #e3e0dd; |
288 | 218 | color: #333333; | ||
289 | 219 | background-color: #e4e0dd; | ||
291 | 220 | border-top-left-radius: 5px; | 231 | border-top-left-radius: 5px; |
292 | 221 | border-top-right-radius: 5px; | 232 | border-top-right-radius: 5px; |
293 | 233 | border-bottom-right-radius: 1px; | ||
294 | 234 | border-bottom-left-radius: 1px; | ||
295 | 222 | border-style: solid; | 235 | border-style: solid; |
296 | 223 | padding: 12px; | 236 | padding: 12px; |
301 | 224 | border-top-color: #939389; | 237 | border-color: #898989; |
302 | 225 | border-right-color: #939389; | 238 | border-left-color: #e3e0dd; /* same as background */ |
299 | 226 | border-left-color: white; | ||
300 | 227 | border-bottom-color: #939389; | ||
303 | 228 | border-width: 1px; | 239 | border-width: 1px; |
304 | 240 | margin-bottom: 1px; /* to be able to override the QTabWidget border */ | ||
305 | 241 | border-bottom-color: #333333; /* same as background for QTabWidget */ | ||
306 | 242 | } | ||
307 | 243 | |||
308 | 244 | QTabBar::tab:first { | ||
309 | 245 | border-left-color: #898989; /* same as border-color */ | ||
310 | 246 | border-bottom-left-radius: 0px; | ||
311 | 229 | } | 247 | } |
312 | 230 | 248 | ||
313 | 231 | QTabBar::tab:selected { | 249 | QTabBar::tab:selected { |
314 | 232 | background-color: white; | 250 | background-color: white; |
343 | 233 | border-top-left-radius: 5px; | 251 | border-color: #333333; |
344 | 234 | border-top-right-radius: 5px; | 252 | border-bottom-color: white; /* same as background for selected */ |
345 | 235 | border-style: solid; | 253 | border-bottom-right-radius: 0px; |
346 | 236 | padding: 12px; | 254 | border-bottom-left-radius: 0px; |
347 | 237 | border-top-color: #939389; | 255 | } |
348 | 238 | border-right-color: #939389; | 256 | |
349 | 239 | border-left-color: white; | 257 | QTabBar::tab:hover, |
322 | 240 | border-bottom-color: white; | ||
323 | 241 | border-width: 1px; | ||
324 | 242 | } | ||
325 | 243 | |||
326 | 244 | QTabBar::tab:first { | ||
327 | 245 | border-left-color: #939389; | ||
328 | 246 | } | ||
329 | 247 | |||
330 | 248 | QTabBar::tab:middle:!selected { | ||
331 | 249 | border-left-color: #e4e0dd; | ||
332 | 250 | } | ||
333 | 251 | |||
334 | 252 | QTabBar::tab:last:!selected { | ||
335 | 253 | border-left-color: #e4e0dd; | ||
336 | 254 | } | ||
337 | 255 | |||
338 | 256 | QTabBar::tab:hover { | ||
339 | 257 | background: #f6f6f6; | ||
340 | 258 | text-decoration: underline; | ||
341 | 259 | } | ||
342 | 260 | |||
350 | 261 | QTabBar::tab:focus { | 258 | QTabBar::tab:focus { |
351 | 262 | text-decoration: underline; | 259 | text-decoration: underline; |
352 | 263 | /* hack to make the mild-orange focused box dissapear */ | ||
353 | 264 | padding-left: 1000px; | ||
354 | 265 | padding-right: 1000px; | ||
355 | 266 | /* end of hack */ | ||
356 | 267 | } | ||
357 | 268 | |||
358 | 269 | QTabWidget { | ||
359 | 270 | border-bottom-left-radius: 5px; | ||
360 | 271 | border-bottom-right-radius: 5px; | ||
361 | 272 | border-style: solid; | ||
362 | 273 | padding: 10px; | ||
363 | 274 | } | ||
364 | 275 | |||
365 | 276 | QTabWidget::pane { | ||
366 | 277 | border-bottom-left-radius: 5px; | ||
367 | 278 | border-bottom-right-radius: 5px; | ||
368 | 279 | border-top-right-radius: 5px; | ||
369 | 280 | border-style: solid; | ||
370 | 281 | border-color: #939389; | ||
371 | 282 | border-width: 1px; | ||
372 | 283 | background: white; | ||
373 | 284 | border-top: 2px solid white; | ||
374 | 285 | } | 260 | } |
375 | 286 | 261 | ||
376 | 287 | QGroupBox { | 262 | QGroupBox { |
377 | @@ -332,10 +307,6 @@ | |||
378 | 332 | margin-top: -4px; | 307 | margin-top: -4px; |
379 | 333 | } | 308 | } |
380 | 334 | 309 | ||
381 | 335 | QLabel#follow_us_label { | ||
382 | 336 | color: white; | ||
383 | 337 | } | ||
384 | 338 | |||
385 | 339 | QLabel[OverQuota="true"], | 310 | QLabel[OverQuota="true"], |
386 | 340 | QLabel#warning_label { | 311 | QLabel#warning_label { |
387 | 341 | color: #df2d1f; | 312 | color: #df2d1f; |
388 | @@ -343,7 +314,6 @@ | |||
389 | 343 | 314 | ||
390 | 344 | QAbstractItemView { | 315 | QAbstractItemView { |
391 | 345 | border-style: solid; | 316 | border-style: solid; |
392 | 346 | border-color: #898989; | ||
393 | 347 | border-top-width: 1px; | 317 | border-top-width: 1px; |
394 | 348 | border-bottom-width: 1px; | 318 | border-bottom-width: 1px; |
395 | 349 | alternate-background-color: #f7f6f5; | 319 | alternate-background-color: #f7f6f5; |
396 | @@ -363,19 +333,9 @@ | |||
397 | 363 | padding-right: 0px; | 333 | padding-right: 0px; |
398 | 364 | } | 334 | } |
399 | 365 | 335 | ||
400 | 366 | GoToWebButton#edit_profile_button, | ||
401 | 367 | GoToWebButton#edit_services_button, | ||
402 | 368 | GoToWebButton#get_more_space_button { | ||
403 | 369 | padding-left: 8px; | ||
404 | 370 | padding-right: 25px; | ||
405 | 371 | background-image: url(:/external_icon_white.png); | ||
406 | 372 | background-repeat: no-repeat; | ||
407 | 373 | background-position: right; | ||
408 | 374 | background-origin: margin; | ||
409 | 375 | } | ||
410 | 376 | |||
411 | 377 | QSpinBox { | 336 | QSpinBox { |
412 | 378 | padding: 3px; | 337 | padding: 3px; |
413 | 338 | background-color: white; | ||
414 | 379 | } | 339 | } |
415 | 380 | 340 | ||
416 | 381 | QSpinBox:focus { | 341 | QSpinBox:focus { |
417 | @@ -389,3 +349,12 @@ | |||
418 | 389 | background: #fcece7; | 349 | background: #fcece7; |
419 | 390 | color: black; | 350 | color: black; |
420 | 391 | } | 351 | } |
421 | 352 | |||
422 | 353 | |||
423 | 354 | QMessageBox > QWidget > QPushButton:focus { | ||
424 | 355 | /* use the same padding from the original QPushButton:focus setting */ | ||
425 | 356 | /* hack to make the mild-orange focused box dissapear */ | ||
426 | 357 | padding-top: 5px; | ||
427 | 358 | padding-bottom: 5px; | ||
428 | 359 | /* end of hack */ | ||
429 | 360 | } | ||
430 | 392 | 361 | ||
431 | === modified file 'data/qt/windows.qss' | |||
432 | --- data/qt/windows.qss 2012-03-15 01:25:08 +0000 | |||
433 | +++ data/qt/windows.qss 2012-03-27 15:50:42 +0000 | |||
434 | @@ -3,3 +3,14 @@ | |||
435 | 3 | QWidget { | 3 | QWidget { |
436 | 4 | font-family: "Ubuntu"; | 4 | font-family: "Ubuntu"; |
437 | 5 | } | 5 | } |
438 | 6 | |||
439 | 7 | QTabBar::tab:hover, | ||
440 | 8 | QTabBar::tab:focus { | ||
441 | 9 | padding-left: 0px; | ||
442 | 10 | padding-right: 0px; | ||
443 | 11 | } | ||
444 | 12 | |||
445 | 13 | QPushButton#twitter_button:focus, | ||
446 | 14 | QPushButton#facebook_button:focus { | ||
447 | 15 | padding: 0px; | ||
448 | 16 | } | ||
449 | 6 | 17 | ||
450 | === modified file 'ubuntuone/controlpanel/gui/qt/__init__.py' | |||
451 | --- ubuntuone/controlpanel/gui/qt/__init__.py 2012-03-02 13:53:24 +0000 | |||
452 | +++ ubuntuone/controlpanel/gui/qt/__init__.py 2012-03-27 15:50:42 +0000 | |||
453 | @@ -70,6 +70,12 @@ | |||
454 | 70 | return icon | 70 | return icon |
455 | 71 | 71 | ||
456 | 72 | 72 | ||
457 | 73 | # Invalid name "box" | ||
458 | 74 | # pylint: disable=C0103 | ||
459 | 75 | box = None | ||
460 | 76 | # pylint: enable=C0103 | ||
461 | 77 | |||
462 | 78 | |||
463 | 73 | def handle_errors(error_handler=None, logger=None): | 79 | def handle_errors(error_handler=None, logger=None): |
464 | 74 | """Decorator to handle errors when calling a function. | 80 | """Decorator to handle errors when calling a function. |
465 | 75 | 81 | ||
466 | @@ -107,13 +113,35 @@ | |||
467 | 107 | else: | 113 | else: |
468 | 108 | msgs = [e.__class__.__name__] + map(repr, e.args) | 114 | msgs = [e.__class__.__name__] + map(repr, e.args) |
469 | 109 | msg = '\n'.join(msgs) | 115 | msg = '\n'.join(msgs) |
470 | 116 | |||
471 | 117 | # hack to avoid the QMessageBox being gargabe-collected too soon | ||
472 | 118 | # Using the global statement, pylint: disable=W0603 | ||
473 | 119 | global box | ||
474 | 120 | # pylint: enable=W0603 | ||
475 | 110 | box = QtGui.QMessageBox(QtGui.QMessageBox.Critical, | 121 | box = QtGui.QMessageBox(QtGui.QMessageBox.Critical, |
479 | 111 | GENERAL_ERROR_TITLE, GENERAL_ERROR_MSG, | 122 | GENERAL_ERROR_TITLE, GENERAL_ERROR_MSG, |
480 | 112 | QtGui.QMessageBox.Close, | 123 | QtGui.QMessageBox.Close, parent=None) |
481 | 113 | parent=None) | 124 | box.setDefaultButton(QtGui.QMessageBox.Close) |
482 | 114 | box.setDetailedText(msg) | 125 | box.setDetailedText(msg) |
485 | 115 | box.setDefaultButton(QtGui.QMessageBox.Close) | 126 | |
486 | 116 | box.exec_() | 127 | # can not exec_() on the QMessageBox since that will block the Qt |
487 | 128 | # mainloop | ||
488 | 129 | |||
489 | 130 | d = defer.Deferred() | ||
490 | 131 | |||
491 | 132 | def box_finished(result): | ||
492 | 133 | """The QMessageBox finished.""" | ||
493 | 134 | logger.info('The warning dialog was shown and also closed ' | ||
494 | 135 | '(message was %r).', msg) | ||
495 | 136 | box.finished.disconnect(box_finished) | ||
496 | 137 | box.hide() | ||
497 | 138 | box.deleteLater() | ||
498 | 139 | d.callback(result) | ||
499 | 140 | |||
500 | 141 | box.finished.connect(box_finished) | ||
501 | 142 | box.show() | ||
502 | 143 | |||
503 | 144 | yield d | ||
504 | 117 | 145 | ||
505 | 118 | return inner | 146 | return inner |
506 | 119 | 147 | ||
507 | 120 | 148 | ||
508 | === modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py' | |||
509 | --- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-19 20:55:52 +0000 | |||
510 | +++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-27 15:50:42 +0000 | |||
511 | @@ -170,3 +170,11 @@ | |||
512 | 170 | def on_wizard_finished(self, status): | 170 | def on_wizard_finished(self, status): |
513 | 171 | """Move to controlpanel if wizard ended successfully.""" | 171 | """Move to controlpanel if wizard ended successfully.""" |
514 | 172 | self.on_credentials_found() | 172 | self.on_credentials_found() |
515 | 173 | |||
516 | 174 | @log_call(logger.info) | ||
517 | 175 | def start_from_license(self): | ||
518 | 176 | """Use the license page as first page.""" | ||
519 | 177 | # license | ||
520 | 178 | self.ui.wizard.setStartId(self.ui.wizard.pages[ | ||
521 | 179 | self.ui.wizard.license_page]) | ||
522 | 180 | self.ui.wizard.restart() | ||
523 | 173 | 181 | ||
524 | === modified file 'ubuntuone/controlpanel/gui/qt/gui.py' | |||
525 | --- ubuntuone/controlpanel/gui/qt/gui.py 2012-03-06 21:33:23 +0000 | |||
526 | +++ ubuntuone/controlpanel/gui/qt/gui.py 2012-03-27 15:50:42 +0000 | |||
527 | @@ -20,6 +20,7 @@ | |||
528 | 20 | 20 | ||
529 | 21 | from ubuntuone.controlpanel.gui.qt.systray import TrayIcon | 21 | from ubuntuone.controlpanel.gui.qt.systray import TrayIcon |
530 | 22 | from ubuntuone.controlpanel.gui.qt.ui import mainwindow_ui | 22 | from ubuntuone.controlpanel.gui.qt.ui import mainwindow_ui |
531 | 23 | from ubuntuone.controlpanel.utils import add_to_autostart | ||
532 | 23 | 24 | ||
533 | 24 | # pylint: disable=E0611 | 25 | # pylint: disable=E0611 |
534 | 25 | try: | 26 | try: |
535 | @@ -35,7 +36,7 @@ | |||
536 | 35 | class MainWindow(QtGui.QMainWindow): | 36 | class MainWindow(QtGui.QMainWindow): |
537 | 36 | """The Main Window of the Control Panel.""" | 37 | """The Main Window of the Control Panel.""" |
538 | 37 | 38 | ||
540 | 38 | def __init__(self, close_callback=None): | 39 | def __init__(self, close_callback=None, installer=False): |
541 | 39 | """Initialize this instance with the UI layout.""" | 40 | """Initialize this instance with the UI layout.""" |
542 | 40 | super(MainWindow, self).__init__() | 41 | super(MainWindow, self).__init__() |
543 | 41 | self.ui = mainwindow_ui.Ui_MainWindow() | 42 | self.ui = mainwindow_ui.Ui_MainWindow() |
544 | @@ -46,6 +47,10 @@ | |||
545 | 46 | triggered=self.close) | 47 | triggered=self.close) |
546 | 47 | self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"]) | 48 | self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"]) |
547 | 48 | self.addAction(self.quit_action) | 49 | self.addAction(self.quit_action) |
548 | 50 | self.installer = installer | ||
549 | 51 | if installer: | ||
550 | 52 | self.ui.control_panel.start_from_license() | ||
551 | 53 | add_to_autostart() | ||
552 | 49 | if USE_LIBUNITY: | 54 | if USE_LIBUNITY: |
553 | 50 | self.entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP) | 55 | self.entry = Unity.LauncherEntry.get_for_desktop_id(U1_DOTDESKTOP) |
554 | 51 | else: | 56 | else: |
555 | @@ -84,14 +89,15 @@ | |||
556 | 84 | # pylint: enable=C0103 | 89 | # pylint: enable=C0103 |
557 | 85 | 90 | ||
558 | 86 | 91 | ||
560 | 87 | def start(close_callback, minimized=False, with_icon=False): | 92 | def start(close_callback, minimized=False, with_icon=False, installer=False): |
561 | 88 | """Show the UI elements.""" | 93 | """Show the UI elements.""" |
562 | 89 | # pylint: disable=W0404, F0401 | 94 | # pylint: disable=W0404, F0401 |
563 | 90 | if not minimized: | 95 | if not minimized: |
564 | 91 | if with_icon or minimized: | 96 | if with_icon or minimized: |
566 | 92 | window = MainWindow() | 97 | window = MainWindow(installer=installer) |
567 | 93 | else: | 98 | else: |
569 | 94 | window = MainWindow(close_callback=close_callback) | 99 | window = MainWindow(close_callback=close_callback, |
570 | 100 | installer=installer) | ||
571 | 95 | app = QtGui.QApplication.instance() | 101 | app = QtGui.QApplication.instance() |
572 | 96 | style = QtGui.QStyle.alignedRect( | 102 | style = QtGui.QStyle.alignedRect( |
573 | 97 | QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter, | 103 | QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter, |
574 | 98 | 104 | ||
575 | === modified file 'ubuntuone/controlpanel/gui/qt/main/__init__.py' | |||
576 | --- ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-03-16 21:09:40 +0000 | |||
577 | +++ ubuntuone/controlpanel/gui/qt/main/__init__.py 2012-03-27 15:50:42 +0000 | |||
578 | @@ -55,6 +55,9 @@ | |||
579 | 55 | default=False, | 55 | default=False, |
580 | 56 | help="Start Ubuntu One " | 56 | help="Start Ubuntu One " |
581 | 57 | "with an icon in the notification area.") | 57 | "with an icon in the notification area.") |
582 | 58 | result.add_argument("--installer", dest="installer", action="store_true", | ||
583 | 59 | default=False, | ||
584 | 60 | help="Show the license agreement page first.") | ||
585 | 58 | return result | 61 | return result |
586 | 59 | 62 | ||
587 | 60 | 63 | ||
588 | @@ -82,17 +85,19 @@ | |||
589 | 82 | switch_to = args.switch_to | 85 | switch_to = args.switch_to |
590 | 83 | minimized = args.minimized | 86 | minimized = args.minimized |
591 | 84 | with_icon = args.with_icon | 87 | with_icon = args.with_icon |
592 | 88 | installer = args.installer | ||
593 | 85 | source.main(app) | 89 | source.main(app) |
594 | 86 | 90 | ||
595 | 87 | data = [] | 91 | data = [] |
597 | 88 | for qss_name in (source.PLATFORM_QSS, ":/ubuntuone.qss"): | 92 | for qss_name in (":/ubuntuone.qss", source.PLATFORM_QSS): |
598 | 89 | qss = QtCore.QResource(qss_name) | 93 | qss = QtCore.QResource(qss_name) |
599 | 90 | data.append(unicode(qss.data())) | 94 | data.append(unicode(qss.data())) |
600 | 91 | app.setStyleSheet('\n'.join(data)) | 95 | app.setStyleSheet('\n'.join(data)) |
601 | 92 | 96 | ||
602 | 93 | # Unused variable 'window', 'icon', pylint: disable=W0612 | 97 | # Unused variable 'window', 'icon', pylint: disable=W0612 |
603 | 94 | icon, window = start(lambda: source.main_quit(app), | 98 | icon, window = start(lambda: source.main_quit(app), |
605 | 95 | minimized=minimized, with_icon=with_icon) | 99 | minimized=minimized, with_icon=with_icon, |
606 | 100 | installer=installer) | ||
607 | 96 | window.switch_to(switch_to) | 101 | window.switch_to(switch_to) |
608 | 97 | # pylint: enable=W0612 | 102 | # pylint: enable=W0612 |
609 | 98 | if icon: | 103 | if icon: |
610 | 99 | 104 | ||
611 | === modified file 'ubuntuone/controlpanel/gui/qt/main/tests/test_main.py' | |||
612 | --- ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-03-16 21:14:20 +0000 | |||
613 | +++ ubuntuone/controlpanel/gui/qt/main/tests/test_main.py 2012-03-27 15:50:42 +0000 | |||
614 | @@ -132,25 +132,25 @@ | |||
615 | 132 | """Ensure the binary name is not given to argparse.""" | 132 | """Ensure the binary name is not given to argparse.""" |
616 | 133 | main.main(["foo", "bar", sys.argv[0], "--minimized"]) | 133 | main.main(["foo", "bar", sys.argv[0], "--minimized"]) |
617 | 134 | self.assertEqual(self.start.args[1], | 134 | self.assertEqual(self.start.args[1], |
619 | 135 | {'minimized': True, 'with_icon': False}) | 135 | {'minimized': True, 'with_icon': False, 'installer': False}) |
620 | 136 | 136 | ||
621 | 137 | def test_minimized_option(self): | 137 | def test_minimized_option(self): |
622 | 138 | """Ensure the --minimized option is parsed and passed correctly.""" | 138 | """Ensure the --minimized option is parsed and passed correctly.""" |
623 | 139 | main.main([sys.argv[0], "--minimized"]) | 139 | main.main([sys.argv[0], "--minimized"]) |
624 | 140 | self.assertEqual(self.start.args[1], | 140 | self.assertEqual(self.start.args[1], |
626 | 141 | {'minimized': True, 'with_icon': False}) | 141 | {'minimized': True, 'with_icon': False, 'installer': False}) |
627 | 142 | 142 | ||
628 | 143 | def test_with_icon_option(self): | 143 | def test_with_icon_option(self): |
629 | 144 | """Ensure the --minimized option is parsed and passed correctly.""" | 144 | """Ensure the --minimized option is parsed and passed correctly.""" |
630 | 145 | main.main([sys.argv[0], "--with-icon"]) | 145 | main.main([sys.argv[0], "--with-icon"]) |
631 | 146 | self.assertEqual(self.start.args[1], | 146 | self.assertEqual(self.start.args[1], |
633 | 147 | {'minimized': False, 'with_icon': True}) | 147 | {'minimized': False, 'with_icon': True, 'installer': False}) |
634 | 148 | 148 | ||
635 | 149 | def test_all_styles_load(self): | 149 | def test_all_styles_load(self): |
636 | 150 | """Ensure the platform style is loaded.""" | 150 | """Ensure the platform style is loaded.""" |
637 | 151 | main.main([sys.argv[0]]) | 151 | main.main([sys.argv[0]]) |
638 | 152 | data = [] | 152 | data = [] |
640 | 153 | for qss_name in (main.source.PLATFORM_QSS, ":/ubuntuone.qss"): | 153 | for qss_name in (":/ubuntuone.qss", main.source.PLATFORM_QSS): |
641 | 154 | qss = QtCore.QResource(qss_name) | 154 | qss = QtCore.QResource(qss_name) |
642 | 155 | data.append(unicode(qss.data())) | 155 | data.append(unicode(qss.data())) |
643 | 156 | self.assertEqual((('\n'.join(data),), {}), self.app.style) | 156 | self.assertEqual((('\n'.join(data),), {}), self.app.style) |
644 | @@ -160,6 +160,12 @@ | |||
645 | 160 | main.main([sys.argv[0], "--switch-to", "folders"]) | 160 | main.main([sys.argv[0], "--switch-to", "folders"]) |
646 | 161 | self.assertEqual(self.start.window.tabname, "folders") | 161 | self.assertEqual(self.start.window.tabname, "folders") |
647 | 162 | 162 | ||
648 | 163 | def test_installer_option(self): | ||
649 | 164 | """Ensure the --installer option is parsed and passed correctly.""" | ||
650 | 165 | main.main([sys.argv[0], "--installer"]) | ||
651 | 166 | self.assertEqual(self.start.args[1], | ||
652 | 167 | {'minimized': False, 'with_icon': False, 'installer': True}) | ||
653 | 168 | |||
654 | 163 | def test_translator(self): | 169 | def test_translator(self): |
655 | 164 | """Ensure the Qt translator is loaded.""" | 170 | """Ensure the Qt translator is loaded.""" |
656 | 165 | main.main([sys.argv[0]]) | 171 | main.main([sys.argv[0]]) |
657 | 166 | 172 | ||
658 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py' | |||
659 | --- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-03-08 20:46:13 +0000 | |||
660 | +++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-03-27 15:50:42 +0000 | |||
661 | @@ -187,17 +187,16 @@ | |||
662 | 187 | return inner | 187 | return inner |
663 | 188 | 188 | ||
664 | 189 | 189 | ||
666 | 190 | class FakedDialog(object): | 190 | class FakedDialog(QtGui.QMessageBox): |
667 | 191 | """Fake a confirmation dialog.""" | 191 | """Fake a confirmation dialog.""" |
668 | 192 | 192 | ||
669 | 193 | Close = object() | ||
670 | 194 | Critical = object() | ||
671 | 195 | properties = response = args = kwargs = None | 193 | properties = response = args = kwargs = None |
672 | 196 | 194 | ||
673 | 197 | def __init__(self, *a, **kw): | 195 | def __init__(self, *a, **kw): |
674 | 196 | super(FakedDialog, self).__init__(*a, **kw) | ||
675 | 198 | FakedDialog.args = a | 197 | FakedDialog.args = a |
676 | 199 | FakedDialog.kwargs = kw | 198 | FakedDialog.kwargs = kw |
678 | 200 | FakedDialog.properties = {'exec_': 0} | 199 | FakedDialog.properties = {'shown': 0} |
679 | 201 | 200 | ||
680 | 202 | @classmethod | 201 | @classmethod |
681 | 203 | def reset(cls, *a, **kw): | 202 | def reset(cls, *a, **kw): |
682 | @@ -216,17 +215,24 @@ | |||
683 | 216 | 215 | ||
684 | 217 | def setDetailedText(self, text): | 216 | def setDetailedText(self, text): |
685 | 218 | """Fake the setDetailedText.""" | 217 | """Fake the setDetailedText.""" |
686 | 218 | super(FakedDialog, self).setDetailedText(text) | ||
687 | 219 | FakedDialog.properties['detailed_text'] = text | 219 | FakedDialog.properties['detailed_text'] = text |
688 | 220 | 220 | ||
689 | 221 | def setDefaultButton(self, button): | 221 | def setDefaultButton(self, button): |
690 | 222 | """Fake the setDefaultButton.""" | 222 | """Fake the setDefaultButton.""" |
691 | 223 | super(FakedDialog, self).setDefaultButton(button) | ||
692 | 223 | FakedDialog.properties['default_button'] = button | 224 | FakedDialog.properties['default_button'] = button |
693 | 224 | 225 | ||
694 | 225 | # pylint: enable=C0103 | 226 | # pylint: enable=C0103 |
695 | 226 | 227 | ||
696 | 228 | def show(self): | ||
697 | 229 | """Fake show.""" | ||
698 | 230 | FakedDialog.properties['shown'] += 1 | ||
699 | 231 | self.finished.emit(0) | ||
700 | 232 | |||
701 | 227 | def exec_(self): | 233 | def exec_(self): |
702 | 228 | """Fake exec_.""" | 234 | """Fake exec_.""" |
704 | 229 | FakedDialog.properties['exec_'] += 1 | 235 | FakedDialog.properties['shown'] += 1 |
705 | 230 | 236 | ||
706 | 231 | 237 | ||
707 | 232 | class FakedFileDialog(object): | 238 | class FakedFileDialog(object): |
708 | @@ -275,7 +281,9 @@ | |||
709 | 275 | self.ui = self.class_ui(**self.kwargs) | 281 | self.ui = self.class_ui(**self.kwargs) |
710 | 276 | # pylint: enable=E1102 | 282 | # pylint: enable=E1102 |
711 | 277 | self.ui.show() | 283 | self.ui.show() |
713 | 278 | self.addCleanup(self.ui.destroy) | 284 | self.addCleanup(self.ui.hide) |
714 | 285 | self.addCleanup(self.ui.deleteLater) | ||
715 | 286 | self.addCleanup(QtCore.QCoreApplication.instance().processEvents) | ||
716 | 279 | 287 | ||
717 | 280 | if getattr(self.ui, 'backend', None) is not None: | 288 | if getattr(self.ui, 'backend', None) is not None: |
718 | 281 | self.addCleanup(self.ui.backend._called.clear) | 289 | self.addCleanup(self.ui.backend._called.clear) |
719 | 282 | 290 | ||
720 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_common.py' | |||
721 | --- ubuntuone/controlpanel/gui/qt/tests/test_common.py 2011-10-05 16:35:59 +0000 | |||
722 | +++ ubuntuone/controlpanel/gui/qt/tests/test_common.py 2012-03-27 15:50:42 +0000 | |||
723 | @@ -132,7 +132,8 @@ | |||
724 | 132 | yield self.decorate_me() | 132 | yield self.decorate_me() |
725 | 133 | 133 | ||
726 | 134 | logged = self.memento.check_exception(self.failure.__class__, msg) | 134 | logged = self.memento.check_exception(self.failure.__class__, msg) |
728 | 135 | recs = '\n'.join(rec.exc_text for rec in self.memento.records) | 135 | recs = '\n'.join(rec.exc_text for rec in self.memento.records |
729 | 136 | if rec.exc_text is not None) | ||
730 | 136 | self.assertTrue(logged, 'Exception must be logged, got:\n%s' % recs) | 137 | self.assertTrue(logged, 'Exception must be logged, got:\n%s' % recs) |
731 | 137 | 138 | ||
732 | 138 | @defer.inlineCallbacks | 139 | @defer.inlineCallbacks |
733 | @@ -147,7 +148,7 @@ | |||
734 | 147 | QtGui.QMessageBox.Close) | 148 | QtGui.QMessageBox.Close) |
735 | 148 | self.assertEqual(FakedDialog.args, args) | 149 | self.assertEqual(FakedDialog.args, args) |
736 | 149 | self.assertEqual(FakedDialog.kwargs, {'parent': None}) | 150 | self.assertEqual(FakedDialog.kwargs, {'parent': None}) |
738 | 150 | self.assertEqual(FakedDialog.properties['exec_'], 1) | 151 | self.assertEqual(FakedDialog.properties['shown'], 1) |
739 | 151 | 152 | ||
740 | 152 | @defer.inlineCallbacks | 153 | @defer.inlineCallbacks |
741 | 153 | def test_show_error_message_default_button(self): | 154 | def test_show_error_message_default_button(self): |
742 | 154 | 155 | ||
743 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py' | |||
744 | --- ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-19 15:50:31 +0000 | |||
745 | +++ ubuntuone/controlpanel/gui/qt/tests/test_controlpanel.py 2012-03-27 15:50:42 +0000 | |||
746 | @@ -1,8 +1,6 @@ | |||
747 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
748 | 2 | |||
749 | 3 | # Authors: Natalia B Bidart <natalia.bidart@canonical.com> | ||
750 | 4 | # | 2 | # |
752 | 5 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
753 | 6 | # | 4 | # |
754 | 7 | # This program is free software: you can redistribute it and/or modify it | 5 | # This program is free software: you can redistribute it and/or modify it |
755 | 8 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
756 | @@ -186,6 +184,16 @@ | |||
757 | 186 | remote = self.ui.ui.folders_tab.remote_folders | 184 | remote = self.ui.ui.folders_tab.remote_folders |
758 | 187 | self.assertFalse(remote) | 185 | self.assertFalse(remote) |
759 | 188 | 186 | ||
760 | 187 | def test_start_from_license(self): | ||
761 | 188 | """Ensure we change the starting page correctly.""" | ||
762 | 189 | # Before, we start on sign_in | ||
763 | 190 | self.assertEqual(self.ui.ui.wizard.startId(), | ||
764 | 191 | self.ui.ui.wizard.pages[self.ui.ui.wizard.signin_page]) | ||
765 | 192 | # After, we start on license_page | ||
766 | 193 | self.ui.start_from_license() | ||
767 | 194 | self.assertEqual(self.ui.ui.wizard.startId(), | ||
768 | 195 | self.ui.ui.wizard.pages[self.ui.ui.wizard.license_page]) | ||
769 | 196 | |||
770 | 189 | 197 | ||
771 | 190 | class ExternalLinkButtonsTestCase(ControlPanelTestCase): | 198 | class ExternalLinkButtonsTestCase(ControlPanelTestCase): |
772 | 191 | """The link in the go-to-web buttons are correct.""" | 199 | """The link in the go-to-web buttons are correct.""" |
773 | 192 | 200 | ||
774 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py' | |||
775 | --- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-19 20:51:26 +0000 | |||
776 | +++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-27 15:50:42 +0000 | |||
777 | @@ -26,6 +26,7 @@ | |||
778 | 26 | from PyQt4 import QtGui | 26 | from PyQt4 import QtGui |
779 | 27 | from twisted.internet import defer | 27 | from twisted.internet import defer |
780 | 28 | from ubuntuone.devtools.handlers import MementoHandler | 28 | from ubuntuone.devtools.handlers import MementoHandler |
781 | 29 | from ubuntuone.devtools.testcases import skipIfOS | ||
782 | 29 | 30 | ||
783 | 30 | from ubuntuone.controlpanel.tests import helper_fail | 31 | from ubuntuone.controlpanel.tests import helper_fail |
784 | 31 | from ubuntuone.controlpanel.gui.tests import ( | 32 | from ubuntuone.controlpanel.gui.tests import ( |
785 | @@ -694,10 +695,6 @@ | |||
786 | 694 | empty_dir = os.path.join(dir_path, 'empty') | 695 | empty_dir = os.path.join(dir_path, 'empty') |
787 | 695 | os.mkdir(empty_dir) | 696 | os.mkdir(empty_dir) |
788 | 696 | 697 | ||
789 | 697 | # add a symlink to confirm those are avoided | ||
790 | 698 | a_link = os.path.join(dir_path, 'some_link') | ||
791 | 699 | os.symlink(a_file, a_link) | ||
792 | 700 | |||
793 | 701 | return total_size | 698 | return total_size |
794 | 702 | 699 | ||
795 | 703 | 700 | ||
796 | @@ -733,6 +730,28 @@ | |||
797 | 733 | self.assertRaises(Queue.Empty, self.queue.get, block=True, timeout=0.5) | 730 | self.assertRaises(Queue.Empty, self.queue.get, block=True, timeout=0.5) |
798 | 734 | 731 | ||
799 | 735 | 732 | ||
800 | 733 | @skipIfOS("win32", "Windows does not easily support symlinks") | ||
801 | 734 | class CalculateSizeWithSymlinksTestCase(BaseLocalFoldersTestCase): | ||
802 | 735 | """Test suite for the CalculateSize thread implementation.""" | ||
803 | 736 | |||
804 | 737 | def build_test_dir(self, dir_path): | ||
805 | 738 | """Build a testing directory hierarchy.""" | ||
806 | 739 | total_size = super(CalculateSizeWithSymlinksTestCase, | ||
807 | 740 | self).build_test_dir(dir_path) | ||
808 | 741 | |||
809 | 742 | a_file = os.path.join(dir_path, 'to_be_symlinked') | ||
810 | 743 | with open(a_file, 'wb') as f: | ||
811 | 744 | f.write('y' * 5000) | ||
812 | 745 | |||
813 | 746 | total_size += os.path.getsize(a_file) | ||
814 | 747 | |||
815 | 748 | # add a symlink to confirm those are avoided | ||
816 | 749 | a_link = os.path.join(dir_path, 'some_link') | ||
817 | 750 | os.symlink(a_file, a_link) | ||
818 | 751 | |||
819 | 752 | return total_size | ||
820 | 753 | |||
821 | 754 | |||
822 | 736 | class FakedCalculateSize(object): | 755 | class FakedCalculateSize(object): |
823 | 737 | """A faked CalculateSize thread.""" | 756 | """A faked CalculateSize thread.""" |
824 | 738 | 757 | ||
825 | 739 | 758 | ||
826 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_gui.py' | |||
827 | --- ubuntuone/controlpanel/gui/qt/tests/test_gui.py 2012-03-09 01:05:49 +0000 | |||
828 | +++ ubuntuone/controlpanel/gui/qt/tests/test_gui.py 2012-03-27 15:50:42 +0000 | |||
829 | @@ -18,6 +18,8 @@ | |||
830 | 18 | 18 | ||
831 | 19 | """Tests for the Qt UI.""" | 19 | """Tests for the Qt UI.""" |
832 | 20 | 20 | ||
833 | 21 | from twisted.internet import defer | ||
834 | 22 | |||
835 | 21 | from ubuntuone.controlpanel.gui.qt import gui | 23 | from ubuntuone.controlpanel.gui.qt import gui |
836 | 22 | from ubuntuone.controlpanel.gui.qt.tests import BaseTestCase | 24 | from ubuntuone.controlpanel.gui.qt.tests import BaseTestCase |
837 | 23 | 25 | ||
838 | @@ -115,3 +117,17 @@ | |||
839 | 115 | self.patch(self.ui, "entry", entry) | 117 | self.patch(self.ui, "entry", entry) |
840 | 116 | self.ui.set_urgent("foo") | 118 | self.ui.set_urgent("foo") |
841 | 117 | self.assertEqual(entry.called, (('urgent', "foo"), {})) | 119 | self.assertEqual(entry.called, (('urgent', "foo"), {})) |
842 | 120 | |||
843 | 121 | |||
844 | 122 | class AutoStartTestCase(MainWindowTestCase): | ||
845 | 123 | """Test the add_to_autostart call.""" | ||
846 | 124 | |||
847 | 125 | @defer.inlineCallbacks | ||
848 | 126 | def setUp(self): | ||
849 | 127 | # Be sure to patch add_to_autostart *before* class_ui creation occurs. | ||
850 | 128 | self.patch(gui, "add_to_autostart", self._set_called) | ||
851 | 129 | yield super(AutoStartTestCase, self).setUp() | ||
852 | 130 | |||
853 | 131 | def test_add_to_autostart(self): | ||
854 | 132 | """Test that the add_to_autostart function is called when CP opens.""" | ||
855 | 133 | self.assertTrue(self._called) | ||
856 | 118 | 134 | ||
857 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_start.py' | |||
858 | --- ubuntuone/controlpanel/gui/qt/tests/test_start.py 2012-02-17 14:42:57 +0000 | |||
859 | +++ ubuntuone/controlpanel/gui/qt/tests/test_start.py 2012-03-27 15:50:42 +0000 | |||
860 | @@ -78,7 +78,7 @@ | |||
861 | 78 | gui.start(close_callback=self.close_cb, | 78 | gui.start(close_callback=self.close_cb, |
862 | 79 | with_icon=True, minimized=False) | 79 | with_icon=True, minimized=False) |
863 | 80 | kwargs = {'close_callback': self.close_cb, 'window': self.main_window} | 80 | kwargs = {'close_callback': self.close_cb, 'window': self.main_window} |
865 | 81 | self.assertEqual(self.main_window.args, [((), {})]) | 81 | self.assertEqual(self.main_window.args, [((), {'installer': False})]) |
866 | 82 | self.assertEqual(self.tray_icon.args, [((), kwargs)]) | 82 | self.assertEqual(self.tray_icon.args, [((), kwargs)]) |
867 | 83 | 83 | ||
868 | 84 | def test_both_false(self): | 84 | def test_both_false(self): |
869 | 85 | 85 | ||
870 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py' | |||
871 | --- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-20 15:14:24 +0000 | |||
872 | +++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-27 15:50:42 +0000 | |||
873 | @@ -89,7 +89,7 @@ | |||
874 | 89 | # Finish button is visible (and enabled if isComplete() returns true). | 89 | # Finish button is visible (and enabled if isComplete() returns true). |
875 | 90 | 90 | ||
876 | 91 | # After calling setFinalPage(false), isFinalPage() returns true if | 91 | # After calling setFinalPage(false), isFinalPage() returns true if |
878 | 92 | #nextId() returns -1; otherwise, it returns false. | 92 | # nextId() returns -1; otherwise, it returns false. |
879 | 93 | 93 | ||
880 | 94 | self.patch(self.ui, 'nextId', lambda *a: 0) | 94 | self.patch(self.ui, 'nextId', lambda *a: 0) |
881 | 95 | self.assertFalse(self.ui.isFinalPage()) | 95 | self.assertFalse(self.ui.isFinalPage()) |
882 | @@ -153,11 +153,9 @@ | |||
883 | 153 | 153 | ||
884 | 154 | class_ui = gui.UbuntuOneWizard | 154 | class_ui = gui.UbuntuOneWizard |
885 | 155 | confirm_response = gui.QtGui.QDialog.Accepted | 155 | confirm_response = gui.QtGui.QDialog.Accepted |
886 | 156 | show_license = False | ||
887 | 157 | 156 | ||
888 | 158 | @defer.inlineCallbacks | 157 | @defer.inlineCallbacks |
889 | 159 | def setUp(self): | 158 | def setUp(self): |
890 | 160 | self.patch(self.class_ui, 'show_license', self.show_license) | ||
891 | 161 | yield super(UbuntuOneWizardTestCase, self).setUp() | 159 | yield super(UbuntuOneWizardTestCase, self).setUp() |
892 | 162 | self.patch(self.ui.confirm_dialog, 'exec_', | 160 | self.patch(self.ui.confirm_dialog, 'exec_', |
893 | 163 | lambda: self.confirm_response) | 161 | lambda: self.confirm_response) |
894 | @@ -186,11 +184,7 @@ | |||
895 | 186 | 184 | ||
896 | 187 | def test_first_page(self): | 185 | def test_first_page(self): |
897 | 188 | """The first page is the correct one.""" | 186 | """The first page is the correct one.""" |
903 | 189 | if self.show_license: | 187 | expected = self.ui.pages[self.ui.signin_page] |
899 | 190 | expected = self.ui.pages[self.ui.license_page] | ||
900 | 191 | else: | ||
901 | 192 | expected = self.ui.pages[self.ui.signin_page] | ||
902 | 193 | |||
904 | 194 | self.assertEqual(self.ui.startId(), expected) | 188 | self.assertEqual(self.ui.startId(), expected) |
905 | 195 | 189 | ||
906 | 196 | def test_done_accepted(self): | 190 | def test_done_accepted(self): |
907 | @@ -202,12 +196,6 @@ | |||
908 | 202 | self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {})) | 196 | self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {})) |
909 | 203 | 197 | ||
910 | 204 | 198 | ||
911 | 205 | class LicensedUbuntuOneWizardTestCase(UbuntuOneWizardTestCase): | ||
912 | 206 | """Test the LicensedUbuntuOneWizard.""" | ||
913 | 207 | |||
914 | 208 | show_license = True | ||
915 | 209 | |||
916 | 210 | |||
917 | 211 | class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase): | 199 | class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase): |
918 | 212 | """Test the SignInPage wizard page.""" | 200 | """Test the SignInPage wizard page.""" |
919 | 213 | 201 | ||
920 | @@ -267,12 +255,13 @@ | |||
921 | 267 | if text is not None: | 255 | if text is not None: |
922 | 268 | self.assertEqual(unicode(button.text()), text) | 256 | self.assertEqual(unicode(button.text()), text) |
923 | 269 | 257 | ||
926 | 270 | getattr(self.ui, signal).connect(self._set_called) | 258 | if signal: |
927 | 271 | button.click() | 259 | getattr(self.ui, signal).connect(self._set_called) |
928 | 260 | button.click() | ||
929 | 272 | 261 | ||
933 | 273 | self.assertEqual(self._called, (signal_args, {}), | 262 | self.assertEqual(self._called, (signal_args, {}), |
934 | 274 | msg % (name, signal, signal_args)) | 263 | msg % (name, signal, signal_args)) |
935 | 275 | self._called = False | 264 | self._called = False |
936 | 276 | 265 | ||
937 | 277 | def test_done_rejected(self): | 266 | def test_done_rejected(self): |
938 | 278 | """When the wizard was cancelled and user confirmed, finish.""" | 267 | """When the wizard was cancelled and user confirmed, finish.""" |
939 | @@ -300,7 +289,7 @@ | |||
940 | 300 | class UbuntuOneWizardCloudToComputerTestCase(UbuntuOneWizardSignInTestCase): | 289 | class UbuntuOneWizardCloudToComputerTestCase(UbuntuOneWizardSignInTestCase): |
941 | 301 | """Test the CloudToComputerPage wizard page.""" | 290 | """Test the CloudToComputerPage wizard page.""" |
942 | 302 | 291 | ||
944 | 303 | buttons = {'NextButton': (None, 'currentIdChanged', (3,))} | 292 | buttons = {'NextButton': (None, 'currentIdChanged', (4,))} |
945 | 304 | page_name = 'cloud_folders' | 293 | page_name = 'cloud_folders' |
946 | 305 | stage_name = 'folders' | 294 | stage_name = 'folders' |
947 | 306 | 295 | ||
948 | @@ -308,7 +297,7 @@ | |||
949 | 308 | class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase): | 297 | class UbuntuOneWizardSettingsTestCase(UbuntuOneWizardSignInTestCase): |
950 | 309 | """Test the CloudToComputerPage wizard page.""" | 298 | """Test the CloudToComputerPage wizard page.""" |
951 | 310 | 299 | ||
953 | 311 | buttons = {'BackButton': (None, 'currentIdChanged', (0,))} | 300 | buttons = {'BackButton': (None, 'currentIdChanged', (1,))} |
954 | 312 | page_name = 'settings' | 301 | page_name = 'settings' |
955 | 313 | stage_name = 'folders' | 302 | stage_name = 'folders' |
956 | 314 | 303 | ||
957 | @@ -318,7 +307,7 @@ | |||
958 | 318 | 307 | ||
959 | 319 | buttons = { | 308 | buttons = { |
960 | 320 | 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)), | 309 | 'FinishButton': (None, 'finished', (gui.QtGui.QDialog.Accepted,)), |
962 | 321 | 'BackButton': (None, 'currentIdChanged', (0,)), | 310 | 'BackButton': (None, 'currentIdChanged', (1,)), |
963 | 322 | } | 311 | } |
964 | 323 | page_name = 'local_folders' | 312 | page_name = 'local_folders' |
965 | 324 | stage_name = 'sync' | 313 | stage_name = 'sync' |
966 | @@ -341,11 +330,10 @@ | |||
967 | 341 | """Test the LicensePage wizard page.""" | 330 | """Test the LicensePage wizard page.""" |
968 | 342 | 331 | ||
969 | 343 | buttons = { | 332 | buttons = { |
971 | 344 | 'NextButton': (gui.LICENSE_AGREE, 'currentIdChanged', (1,)), | 333 | 'CommitButton': (gui.LICENSE_AGREE, None, ()), |
972 | 345 | 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()), | 334 | 'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()), |
973 | 346 | } | 335 | } |
974 | 347 | page_name = 'license' | 336 | page_name = 'license' |
975 | 348 | show_license = True | ||
976 | 349 | stage_name = 'install' | 337 | stage_name = 'install' |
977 | 350 | 338 | ||
978 | 351 | 339 | ||
979 | @@ -397,6 +385,27 @@ | |||
980 | 397 | self.assertTrue(self.ui.signin_page.isEnabled()) | 385 | self.assertTrue(self.ui.signin_page.isEnabled()) |
981 | 398 | self.assertFalse(self._called) | 386 | self.assertFalse(self._called) |
982 | 399 | 387 | ||
983 | 388 | @defer.inlineCallbacks | ||
984 | 389 | def test_with_error(self): | ||
985 | 390 | """Wizard is enabled after an error was handled.""" | ||
986 | 391 | self.ui.currentIdChanged.connect(self._set_called) | ||
987 | 392 | d = defer.fail(ValueError()) | ||
988 | 393 | |||
989 | 394 | def check(): | ||
990 | 395 | """Confirm the ui is disabled while processing.""" | ||
991 | 396 | self.assertFalse(self.ui.signin_page.isEnabled()) | ||
992 | 397 | return d | ||
993 | 398 | |||
994 | 399 | self.patch(self.ui.backend, self.method, check) | ||
995 | 400 | button = getattr(self.ui.signin_page.panel.ui, | ||
996 | 401 | '%s_button' % self.method) | ||
997 | 402 | button.click() | ||
998 | 403 | |||
999 | 404 | yield d | ||
1000 | 405 | |||
1001 | 406 | self.assertTrue(self.ui.signin_page.isEnabled()) | ||
1002 | 407 | self.assertFalse(self._called) # the wizard page was not changed | ||
1003 | 408 | |||
1004 | 400 | 409 | ||
1005 | 401 | class UbuntuOneWizardRegisterTestCase(UbuntuOneWizardLoginTestCase): | 410 | class UbuntuOneWizardRegisterTestCase(UbuntuOneWizardLoginTestCase): |
1006 | 402 | """Test the register through the wizard.""" | 411 | """Test the register through the wizard.""" |
1007 | 403 | 412 | ||
1008 | === modified file 'ubuntuone/controlpanel/gui/qt/wizard.py' | |||
1009 | --- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-20 15:11:56 +0000 | |||
1010 | +++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-27 15:50:42 +0000 | |||
1011 | @@ -44,6 +44,7 @@ | |||
1012 | 44 | LICENSE_LINK, | 44 | LICENSE_LINK, |
1013 | 45 | UBUNTUONE_LINK, | 45 | UBUNTUONE_LINK, |
1014 | 46 | ) | 46 | ) |
1015 | 47 | from ubuntuone.controlpanel.gui.qt import handle_errors | ||
1016 | 47 | from ubuntuone.controlpanel.gui.qt.folders import ( | 48 | from ubuntuone.controlpanel.gui.qt.folders import ( |
1017 | 48 | RemoteFoldersPanel, | 49 | RemoteFoldersPanel, |
1018 | 49 | LocalFoldersPanel, | 50 | LocalFoldersPanel, |
1019 | @@ -167,8 +168,6 @@ | |||
1020 | 167 | class UbuntuOneWizard(cache.Cache, QtGui.QWizard): | 168 | class UbuntuOneWizard(cache.Cache, QtGui.QWizard): |
1021 | 168 | """The Ubuntu One wizard.""" | 169 | """The Ubuntu One wizard.""" |
1022 | 169 | 170 | ||
1023 | 170 | show_license = False # do not change unless you know what you're doing | ||
1024 | 171 | |||
1025 | 172 | def __init__(self, *args, **kwargs): | 171 | def __init__(self, *args, **kwargs): |
1026 | 173 | super(UbuntuOneWizard, self).__init__(*args, **kwargs) | 172 | super(UbuntuOneWizard, self).__init__(*args, **kwargs) |
1027 | 174 | self.pages = {} | 173 | self.pages = {} |
1028 | @@ -185,9 +184,8 @@ | |||
1029 | 185 | 184 | ||
1030 | 186 | # license | 185 | # license |
1031 | 187 | self.license_page = LicensePage() | 186 | self.license_page = LicensePage() |
1035 | 188 | self.next_button_text = self.button(self.NextButton).text() | 187 | self.license_page.setCommitPage(True) |
1036 | 189 | if self.show_license: | 188 | self.addPage(self.license_page) |
1034 | 190 | self.addPage(self.license_page) | ||
1037 | 191 | 189 | ||
1038 | 192 | # sign in | 190 | # sign in |
1039 | 193 | self.signin_page = SignInPage() | 191 | self.signin_page = SignInPage() |
1040 | @@ -213,7 +211,7 @@ | |||
1041 | 213 | self.addPage(self.local_folders_page) | 211 | self.addPage(self.local_folders_page) |
1042 | 214 | 212 | ||
1043 | 215 | self._next_id = self.pages[self.signin_page] | 213 | self._next_id = self.pages[self.signin_page] |
1045 | 216 | self.next() | 214 | self.setStartId(self._next_id) |
1046 | 217 | 215 | ||
1047 | 218 | # pylint: disable=C0103 | 216 | # pylint: disable=C0103 |
1048 | 219 | 217 | ||
1049 | @@ -231,12 +229,14 @@ | |||
1050 | 231 | button_layout = button_to = button = stage = None | 229 | button_layout = button_to = button = stage = None |
1051 | 232 | 230 | ||
1052 | 233 | if page is self.license_page: | 231 | if page is self.license_page: |
1055 | 234 | button_layout = [self.Stretch, self.CancelButton, self.NextButton] | 232 | button_layout = [self.Stretch, self.CancelButton, |
1056 | 235 | button = self.button(self.NextButton) | 233 | self.CommitButton] |
1057 | 234 | button = self.button(self.CommitButton) | ||
1058 | 236 | button_to = self.button(self.CancelButton) | 235 | button_to = self.button(self.CancelButton) |
1059 | 237 | stage = self.side_widget.install_stage | 236 | stage = self.side_widget.install_stage |
1060 | 237 | self._next_id = self.pages[self.signin_page] | ||
1061 | 238 | 238 | ||
1063 | 239 | self.setButtonText(self.NextButton, LICENSE_AGREE) | 239 | self.setButtonText(self.CommitButton, LICENSE_AGREE) |
1064 | 240 | self.setButtonText(self.CancelButton, LICENSE_DISAGREE) | 240 | self.setButtonText(self.CancelButton, LICENSE_DISAGREE) |
1065 | 241 | 241 | ||
1066 | 242 | elif page is self.signin_page: | 242 | elif page is self.signin_page: |
1067 | @@ -250,8 +250,6 @@ | |||
1068 | 250 | self.setTabOrder(self.signin_page.panel.ui.login_button, button) | 250 | self.setTabOrder(self.signin_page.panel.ui.login_button, button) |
1069 | 251 | 251 | ||
1070 | 252 | elif page is self.cloud_folders_page: | 252 | elif page is self.cloud_folders_page: |
1071 | 253 | self.setButtonText(self.NextButton, self.next_button_text) | ||
1072 | 254 | |||
1073 | 255 | button_layout = [self.Stretch, self.NextButton] | 253 | button_layout = [self.Stretch, self.NextButton] |
1074 | 256 | button = self.cloud_folders_page.panel.ui.check_settings_button | 254 | button = self.cloud_folders_page.panel.ui.check_settings_button |
1075 | 257 | button_to = self.button(self.NextButton) | 255 | button_to = self.button(self.NextButton) |
1076 | @@ -303,22 +301,28 @@ | |||
1077 | 303 | self.next() | 301 | self.next() |
1078 | 304 | 302 | ||
1079 | 305 | @QtCore.pyqtSlot() | 303 | @QtCore.pyqtSlot() |
1080 | 304 | @handle_errors(logger=logger) | ||
1081 | 306 | @defer.inlineCallbacks | 305 | @defer.inlineCallbacks |
1082 | 307 | def login(self): | 306 | def login(self): |
1083 | 308 | """Show the login dialog.""" | 307 | """Show the login dialog.""" |
1084 | 309 | self.setEnabled(False) | 308 | self.setEnabled(False) |
1088 | 310 | credentials = yield self.backend.login() | 309 | try: |
1089 | 311 | self._process_credentials(credentials) | 310 | credentials = yield self.backend.login() |
1090 | 312 | self.setEnabled(True) | 311 | self._process_credentials(credentials) |
1091 | 312 | finally: | ||
1092 | 313 | self.setEnabled(True) | ||
1093 | 313 | 314 | ||
1094 | 314 | @QtCore.pyqtSlot() | 315 | @QtCore.pyqtSlot() |
1095 | 316 | @handle_errors(logger=logger) | ||
1096 | 315 | @defer.inlineCallbacks | 317 | @defer.inlineCallbacks |
1097 | 316 | def register(self): | 318 | def register(self): |
1098 | 317 | """Show the register dialog.""" | 319 | """Show the register dialog.""" |
1099 | 318 | self.setEnabled(False) | 320 | self.setEnabled(False) |
1103 | 319 | credentials = yield self.backend.register() | 321 | try: |
1104 | 320 | self._process_credentials(credentials) | 322 | credentials = yield self.backend.register() |
1105 | 321 | self.setEnabled(True) | 323 | self._process_credentials(credentials) |
1106 | 324 | finally: | ||
1107 | 325 | self.setEnabled(True) | ||
1108 | 322 | 326 | ||
1109 | 323 | @QtCore.pyqtSlot() | 327 | @QtCore.pyqtSlot() |
1110 | 324 | def check_settings(self): | 328 | def check_settings(self): |
1111 | @@ -339,8 +343,7 @@ | |||
1112 | 339 | if response == QtGui.QDialog.Accepted: | 343 | if response == QtGui.QDialog.Accepted: |
1113 | 340 | logger.warning('UbuntuOneWizard: user canceled setup.') | 344 | logger.warning('UbuntuOneWizard: user canceled setup.') |
1114 | 341 | self.rejected.emit() | 345 | self.rejected.emit() |
1117 | 342 | elif (self.show_license and | 346 | elif (self.currentId() == self.pages[self.license_page]): |
1116 | 343 | self.currentId() == self.pages[self.license_page]): | ||
1118 | 344 | response = self.confirm_dialog.exec_() | 347 | response = self.confirm_dialog.exec_() |
1119 | 345 | if response == QtGui.QDialog.Accepted: | 348 | if response == QtGui.QDialog.Accepted: |
1120 | 346 | logger.warning('UbuntuOneWizard: user wants to uninstall.') | 349 | logger.warning('UbuntuOneWizard: user wants to uninstall.') |
1121 | 347 | 350 | ||
1122 | === modified file 'ubuntuone/controlpanel/utils/__init__.py' | |||
1123 | --- ubuntuone/controlpanel/utils/__init__.py 2012-03-16 16:40:27 +0000 | |||
1124 | +++ ubuntuone/controlpanel/utils/__init__.py 2012-03-27 15:50:42 +0000 | |||
1125 | @@ -38,11 +38,13 @@ | |||
1126 | 38 | are_updates_present = windows.are_updates_present | 38 | are_updates_present = windows.are_updates_present |
1127 | 39 | default_folders = windows.default_folders | 39 | default_folders = windows.default_folders |
1128 | 40 | perform_update = windows.perform_update | 40 | perform_update = windows.perform_update |
1129 | 41 | add_to_autostart = windows.add_to_autostart | ||
1130 | 41 | else: | 42 | else: |
1131 | 42 | from ubuntuone.controlpanel.utils import linux | 43 | from ubuntuone.controlpanel.utils import linux |
1132 | 43 | are_updates_present = lambda *args, **kwargs: False | 44 | are_updates_present = lambda *args, **kwargs: False |
1133 | 44 | default_folders = linux.default_folders | 45 | default_folders = linux.default_folders |
1134 | 45 | perform_update = lambda *args, **kwargs: None | 46 | perform_update = lambda *args, **kwargs: None |
1135 | 47 | add_to_autostart = lambda *args, **kwargs: None | ||
1136 | 46 | 48 | ||
1137 | 47 | # pylint: enable=C0103 | 49 | # pylint: enable=C0103 |
1138 | 48 | 50 | ||
1139 | 49 | 51 | ||
1140 | === modified file 'ubuntuone/controlpanel/utils/tests/test_windows.py' | |||
1141 | --- ubuntuone/controlpanel/utils/tests/test_windows.py 2012-03-16 19:55:22 +0000 | |||
1142 | +++ ubuntuone/controlpanel/utils/tests/test_windows.py 2012-03-27 15:50:42 +0000 | |||
1143 | @@ -18,6 +18,7 @@ | |||
1144 | 18 | """Test the windows utils functions.""" | 18 | """Test the windows utils functions.""" |
1145 | 19 | 19 | ||
1146 | 20 | import os | 20 | import os |
1147 | 21 | import sys | ||
1148 | 21 | 22 | ||
1149 | 22 | from twisted.internet import defer | 23 | from twisted.internet import defer |
1150 | 23 | 24 | ||
1151 | @@ -87,6 +88,93 @@ | |||
1152 | 87 | self.assertEqual(0, self._called[0][5]) | 88 | self.assertEqual(0, self._called[0][5]) |
1153 | 88 | 89 | ||
1154 | 89 | 90 | ||
1155 | 91 | class FakeOpenKey(object): | ||
1156 | 92 | |||
1157 | 93 | """A Fake OpenKey class. | ||
1158 | 94 | |||
1159 | 95 | This class becomes a method-like callable on FakeRegistry, allowing | ||
1160 | 96 | FakeRegistry.OpenKey to operate as a context manager.""" | ||
1161 | 97 | |||
1162 | 98 | def __init__(self): | ||
1163 | 99 | self.openkey_args = None | ||
1164 | 100 | super(FakeOpenKey, self).__init__() | ||
1165 | 101 | |||
1166 | 102 | def __call__(self, *args, **kwargs): | ||
1167 | 103 | self.openkey_args = (args, kwargs) | ||
1168 | 104 | return self | ||
1169 | 105 | |||
1170 | 106 | def __enter__(self, *args, **kwargs): | ||
1171 | 107 | #self.openkey_args = (args, kwargs) | ||
1172 | 108 | return self | ||
1173 | 109 | |||
1174 | 110 | def __exit__(self, *args): | ||
1175 | 111 | pass | ||
1176 | 112 | |||
1177 | 113 | |||
1178 | 114 | class FakeRegistry(object): | ||
1179 | 115 | |||
1180 | 116 | """A fake registry.""" | ||
1181 | 117 | |||
1182 | 118 | # pylint: disable=C0103 | ||
1183 | 119 | HKEY_CURRENT_USER = 2 | ||
1184 | 120 | KEY_ALL_ACCESS = 4 | ||
1185 | 121 | REG_SZ = 1 | ||
1186 | 122 | |||
1187 | 123 | def __init__(self): | ||
1188 | 124 | self.HKEY_CURRENT_USER = 2 | ||
1189 | 125 | self.KEY_ALL_ACCESS = 4 | ||
1190 | 126 | self.openkey_args = None | ||
1191 | 127 | self.query_args = None | ||
1192 | 128 | self.set_args = [] | ||
1193 | 129 | |||
1194 | 130 | self.OpenKey = FakeOpenKey() | ||
1195 | 131 | |||
1196 | 132 | def QueryValueEx(self, *args, **kwargs): | ||
1197 | 133 | """Fake QueryValueEx.""" | ||
1198 | 134 | self.query_args = (args, kwargs) | ||
1199 | 135 | |||
1200 | 136 | def SetValueEx(self, *args, **kwargs): | ||
1201 | 137 | """Fake SetValueEx.""" | ||
1202 | 138 | self.set_args.append((args, kwargs)) | ||
1203 | 139 | |||
1204 | 140 | |||
1205 | 141 | class AutostartTestCase(TestCase): | ||
1206 | 142 | |||
1207 | 143 | """Test add_syncdaemon_to_autostart.""" | ||
1208 | 144 | |||
1209 | 145 | @defer.inlineCallbacks | ||
1210 | 146 | def setUp(self): | ||
1211 | 147 | """Initialize this test instance.""" | ||
1212 | 148 | self.registry = FakeRegistry() | ||
1213 | 149 | self.patch(utils.windows, "_winreg", self.registry) | ||
1214 | 150 | yield super(AutostartTestCase, self).setUp() | ||
1215 | 151 | |||
1216 | 152 | def test_add_syncdaemon_to_autostart(self): | ||
1217 | 153 | """Check that the registry is updated correctly.""" | ||
1218 | 154 | # I can't patch sys because frozen is not there by default | ||
1219 | 155 | sys.frozen = True | ||
1220 | 156 | self.addCleanup(delattr, sys, 'frozen') | ||
1221 | 157 | utils.windows.add_to_autostart() | ||
1222 | 158 | self.assertEqual(self.registry.OpenKey.openkey_args, | ||
1223 | 159 | ((self.registry.HKEY_CURRENT_USER, utils.windows.AUTORUN_KEY, 0, | ||
1224 | 160 | self.registry.KEY_ALL_ACCESS), {})) | ||
1225 | 161 | self.assertEqual(self.registry.query_args, None) | ||
1226 | 162 | path = os.path.dirname(os.path.abspath(sys.executable)) | ||
1227 | 163 | self.assertEqual(self.registry.set_args, | ||
1228 | 164 | [((self.registry.OpenKey, 'Ubuntu One', 0, 1, | ||
1229 | 165 | '"%s\\ubuntuone-syncdaemon.exe"' % path), {}), | ||
1230 | 166 | ((self.registry.OpenKey, 'Ubuntu One Icon', 0, 1, | ||
1231 | 167 | '"%s\\ubuntuone-control-panel-qt.exe" --minimized' % path), | ||
1232 | 168 | {})]) | ||
1233 | 169 | |||
1234 | 170 | def test_not_added_if_not_frozen(self): | ||
1235 | 171 | """Not frozen binaries are not added to the registry.""" | ||
1236 | 172 | utils.windows.add_to_autostart() | ||
1237 | 173 | self.assertEqual(self.registry.openkey_args, None) | ||
1238 | 174 | self.assertEqual(self.registry.query_args, None) | ||
1239 | 175 | self.assertEqual(self.registry.set_args, []) | ||
1240 | 176 | |||
1241 | 177 | |||
1242 | 90 | class DefaultFoldersTestCase(TestCase): | 178 | class DefaultFoldersTestCase(TestCase): |
1243 | 91 | """Test the default_folders method.""" | 179 | """Test the default_folders method.""" |
1244 | 92 | 180 | ||
1245 | 93 | 181 | ||
1246 | === modified file 'ubuntuone/controlpanel/utils/windows.py' | |||
1247 | --- ubuntuone/controlpanel/utils/windows.py 2012-03-16 19:55:22 +0000 | |||
1248 | +++ ubuntuone/controlpanel/utils/windows.py 2012-03-27 15:50:42 +0000 | |||
1249 | @@ -23,6 +23,7 @@ | |||
1250 | 23 | # Avoid pylint error on Linux | 23 | # Avoid pylint error on Linux |
1251 | 24 | # pylint: disable=F0401 | 24 | # pylint: disable=F0401 |
1252 | 25 | import win32api | 25 | import win32api |
1253 | 26 | import _winreg | ||
1254 | 26 | 27 | ||
1255 | 27 | from win32com.shell import shell, shellcon | 28 | from win32com.shell import shell, shellcon |
1256 | 28 | # pylint: enable=F0401 | 29 | # pylint: enable=F0401 |
1257 | @@ -33,6 +34,7 @@ | |||
1258 | 33 | 34 | ||
1259 | 34 | logger = setup_logging('utils.windows') | 35 | logger = setup_logging('utils.windows') |
1260 | 35 | AUTOUPDATE_EXE_NAME = 'autoupdate-windows.exe' | 36 | AUTOUPDATE_EXE_NAME = 'autoupdate-windows.exe' |
1261 | 37 | AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run" | ||
1262 | 36 | 38 | ||
1263 | 37 | 39 | ||
1264 | 38 | def _get_update_path(): | 40 | def _get_update_path(): |
1265 | @@ -96,3 +98,21 @@ | |||
1266 | 96 | win32api.ShellExecute(None, 'runas', | 98 | win32api.ShellExecute(None, 'runas', |
1267 | 97 | update_path, | 99 | update_path, |
1268 | 98 | '--unattendedmodeui none', '', 0) | 100 | '--unattendedmodeui none', '', 0) |
1269 | 101 | |||
1270 | 102 | |||
1271 | 103 | def add_to_autostart(): | ||
1272 | 104 | """Add syncdaemon to the session's autostart.""" | ||
1273 | 105 | if getattr(sys, "frozen", False): | ||
1274 | 106 | sd_path = '"%s"' % os.path.join(os.path.dirname( | ||
1275 | 107 | os.path.abspath(sys.executable)), | ||
1276 | 108 | "ubuntuone-syncdaemon.exe") | ||
1277 | 109 | u1cp_path = '"%s"' % os.path.join(os.path.dirname( | ||
1278 | 110 | os.path.abspath(sys.executable)), | ||
1279 | 111 | "ubuntuone-control-panel-qt.exe") | ||
1280 | 112 | |||
1281 | 113 | with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, AUTORUN_KEY, | ||
1282 | 114 | 0, _winreg.KEY_ALL_ACCESS) as key: | ||
1283 | 115 | # pylint: disable=E0602 | ||
1284 | 116 | _winreg.SetValueEx(key, "Ubuntu One", 0, _winreg.REG_SZ, sd_path) | ||
1285 | 117 | _winreg.SetValueEx(key, "Ubuntu One Icon", 0, _winreg.REG_SZ, | ||
1286 | 118 | u1cp_path + " --minimized --with-icon") |
+1