Merge lp:~nataliabidart/ubuntuone-control-panel/focus into lp:ubuntuone-control-panel
- focus
- Merge into trunk
Proposed by
Natalia Bidart
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Natalia Bidart | ||||||||
Approved revision: | 285 | ||||||||
Merged at revision: | 279 | ||||||||
Proposed branch: | lp:~nataliabidart/ubuntuone-control-panel/focus | ||||||||
Merge into: | lp:ubuntuone-control-panel | ||||||||
Diff against target: |
1035 lines (+291/-254) 15 files modified
data/qt/controlpanel.ui (+4/-4) data/qt/device.ui (+5/-2) data/qt/device_remote.ui (+0/-50) data/qt/devices.ui (+9/-3) data/qt/preferences.ui (+40/-27) data/qt/ubuntuone.qss (+88/-41) ubuntuone/controlpanel/gui/qt/device.py (+30/-30) ubuntuone/controlpanel/gui/qt/devices.py (+6/-21) ubuntuone/controlpanel/gui/qt/folders.py (+17/-14) ubuntuone/controlpanel/gui/qt/loadingoverlay.py (+1/-5) ubuntuone/controlpanel/gui/qt/tests/__init__.py (+1/-0) ubuntuone/controlpanel/gui/qt/tests/test_device.py (+35/-18) ubuntuone/controlpanel/gui/qt/tests/test_devices.py (+15/-35) ubuntuone/controlpanel/gui/qt/tests/test_folders.py (+22/-4) ubuntuone/controlpanel/gui/tests/__init__.py (+18/-0) |
||||||||
To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-control-panel/focus | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roberto Alsina (community) | Approve | ||
Diego Sarmentero (community) | Approve | ||
Review via email: mp+96654@code.launchpad.net |
Description of the change
To post a comment you must log in.
- 283. By Natalia Bidart
-
Less changes against trunk.
- 284. By Natalia Bidart
-
Restoring hack for tabs.
- 285. By Natalia Bidart
-
No need for controlpanel help buttons to be enabled/disabled for the style.
Revision history for this message
Roberto Alsina (ralsina) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'data/qt/controlpanel.ui' | |||
2 | --- data/qt/controlpanel.ui 2012-03-02 13:53:24 +0000 | |||
3 | +++ data/qt/controlpanel.ui 2012-03-08 21:13:18 +0000 | |||
4 | @@ -329,8 +329,8 @@ | |||
5 | 329 | </property> | 329 | </property> |
6 | 330 | <property name="maximumSize"> | 330 | <property name="maximumSize"> |
7 | 331 | <size> | 331 | <size> |
10 | 332 | <width>16</width> | 332 | <width>20</width> |
11 | 333 | <height>16</height> | 333 | <height>20</height> |
12 | 334 | </size> | 334 | </size> |
13 | 335 | </property> | 335 | </property> |
14 | 336 | <property name="cursor"> | 336 | <property name="cursor"> |
15 | @@ -352,8 +352,8 @@ | |||
16 | 352 | </property> | 352 | </property> |
17 | 353 | <property name="maximumSize"> | 353 | <property name="maximumSize"> |
18 | 354 | <size> | 354 | <size> |
21 | 355 | <width>16</width> | 355 | <width>20</width> |
22 | 356 | <height>16</height> | 356 | <height>20</height> |
23 | 357 | </size> | 357 | </size> |
24 | 358 | </property> | 358 | </property> |
25 | 359 | <property name="cursor"> | 359 | <property name="cursor"> |
26 | 360 | 360 | ||
27 | === modified file 'data/qt/device.ui' | |||
28 | --- data/qt/device.ui 2012-02-22 15:35:13 +0000 | |||
29 | +++ data/qt/device.ui 2012-03-08 21:13:18 +0000 | |||
30 | @@ -6,14 +6,17 @@ | |||
31 | 6 | <rect> | 6 | <rect> |
32 | 7 | <x>0</x> | 7 | <x>0</x> |
33 | 8 | <y>0</y> | 8 | <y>0</y> |
36 | 9 | <width>233</width> | 9 | <width>430</width> |
37 | 10 | <height>36</height> | 10 | <height>27</height> |
38 | 11 | </rect> | 11 | </rect> |
39 | 12 | </property> | 12 | </property> |
40 | 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
41 | 14 | <string notr="true">Form</string> | 14 | <string notr="true">Form</string> |
42 | 15 | </property> | 15 | </property> |
43 | 16 | <layout class="QHBoxLayout" name="horizontalLayout"> | 16 | <layout class="QHBoxLayout" name="horizontalLayout"> |
44 | 17 | <property name="margin"> | ||
45 | 18 | <number>0</number> | ||
46 | 19 | </property> | ||
47 | 17 | <item> | 20 | <item> |
48 | 18 | <widget class="QLabel" name="device_icon_label"> | 21 | <widget class="QLabel" name="device_icon_label"> |
49 | 19 | <property name="pixmap"> | 22 | <property name="pixmap"> |
50 | 20 | 23 | ||
51 | === removed file 'data/qt/device_remote.ui' | |||
52 | --- data/qt/device_remote.ui 2012-02-22 14:58:25 +0000 | |||
53 | +++ data/qt/device_remote.ui 1970-01-01 00:00:00 +0000 | |||
54 | @@ -1,50 +0,0 @@ | |||
55 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
56 | 2 | <ui version="4.0"> | ||
57 | 3 | <class>Form</class> | ||
58 | 4 | <widget class="QWidget" name="Form"> | ||
59 | 5 | <property name="geometry"> | ||
60 | 6 | <rect> | ||
61 | 7 | <x>0</x> | ||
62 | 8 | <y>0</y> | ||
63 | 9 | <width>264</width> | ||
64 | 10 | <height>45</height> | ||
65 | 11 | </rect> | ||
66 | 12 | </property> | ||
67 | 13 | <property name="windowTitle"> | ||
68 | 14 | <string notr="true">Form</string> | ||
69 | 15 | </property> | ||
70 | 16 | <layout class="QHBoxLayout" name="horizontalLayout"> | ||
71 | 17 | <item> | ||
72 | 18 | <widget class="QLabel" name="device_icon_label"> | ||
73 | 19 | <property name="pixmap"> | ||
74 | 20 | <pixmap resource="images.qrc">:/computer.png</pixmap> | ||
75 | 21 | </property> | ||
76 | 22 | </widget> | ||
77 | 23 | </item> | ||
78 | 24 | <item> | ||
79 | 25 | <widget class="QLabel" name="device_name_label"> | ||
80 | 26 | <property name="text"> | ||
81 | 27 | <string notr="true">Non local device</string> | ||
82 | 28 | </property> | ||
83 | 29 | </widget> | ||
84 | 30 | </item> | ||
85 | 31 | <item> | ||
86 | 32 | <spacer name="horizontalSpacer"> | ||
87 | 33 | <property name="orientation"> | ||
88 | 34 | <enum>Qt::Horizontal</enum> | ||
89 | 35 | </property> | ||
90 | 36 | <property name="sizeHint" stdset="0"> | ||
91 | 37 | <size> | ||
92 | 38 | <width>217</width> | ||
93 | 39 | <height>20</height> | ||
94 | 40 | </size> | ||
95 | 41 | </property> | ||
96 | 42 | </spacer> | ||
97 | 43 | </item> | ||
98 | 44 | </layout> | ||
99 | 45 | </widget> | ||
100 | 46 | <resources> | ||
101 | 47 | <include location="images.qrc"/> | ||
102 | 48 | </resources> | ||
103 | 49 | <connections/> | ||
104 | 50 | </ui> | ||
105 | 51 | 0 | ||
106 | === modified file 'data/qt/devices.ui' | |||
107 | --- data/qt/devices.ui 2012-03-02 13:53:24 +0000 | |||
108 | +++ data/qt/devices.ui 2012-03-08 21:13:18 +0000 | |||
109 | @@ -21,16 +21,16 @@ | |||
110 | 21 | <number>0</number> | 21 | <number>0</number> |
111 | 22 | </property> | 22 | </property> |
112 | 23 | <item> | 23 | <item> |
114 | 24 | <widget class="QGroupBox" name="local_device"> | 24 | <widget class="QGroupBox" name="local_device_box"> |
115 | 25 | <property name="title"> | 25 | <property name="title"> |
116 | 26 | <string notr="true">This device</string> | 26 | <string notr="true">This device</string> |
117 | 27 | </property> | 27 | </property> |
119 | 28 | <layout class="QVBoxLayout" name="verticalLayout"> | 28 | <layout class="QVBoxLayout" name="local_device_layout"> |
120 | 29 | <property name="margin"> | 29 | <property name="margin"> |
121 | 30 | <number>0</number> | 30 | <number>0</number> |
122 | 31 | </property> | 31 | </property> |
123 | 32 | <item> | 32 | <item> |
125 | 33 | <layout class="QVBoxLayout" name="local_device_box"/> | 33 | <widget class="DeviceWidget" name="local_device" native="true"/> |
126 | 34 | </item> | 34 | </item> |
127 | 35 | </layout> | 35 | </layout> |
128 | 36 | </widget> | 36 | </widget> |
129 | @@ -120,6 +120,12 @@ | |||
130 | 120 | <extends>QPushButton</extends> | 120 | <extends>QPushButton</extends> |
131 | 121 | <header>ubuntuone.controlpanel.gui.qt.gotoweb</header> | 121 | <header>ubuntuone.controlpanel.gui.qt.gotoweb</header> |
132 | 122 | </customwidget> | 122 | </customwidget> |
133 | 123 | <customwidget> | ||
134 | 124 | <class>DeviceWidget</class> | ||
135 | 125 | <extends>QWidget</extends> | ||
136 | 126 | <header>ubuntuone.controlpanel.gui.qt.device</header> | ||
137 | 127 | <container>1</container> | ||
138 | 128 | </customwidget> | ||
139 | 123 | </customwidgets> | 129 | </customwidgets> |
140 | 124 | <resources> | 130 | <resources> |
141 | 125 | <include location="images.qrc"/> | 131 | <include location="images.qrc"/> |
142 | 126 | 132 | ||
143 | === modified file 'data/qt/preferences.ui' | |||
144 | --- data/qt/preferences.ui 2012-03-02 19:42:17 +0000 | |||
145 | +++ data/qt/preferences.ui 2012-03-08 21:13:18 +0000 | |||
146 | @@ -6,8 +6,8 @@ | |||
147 | 6 | <rect> | 6 | <rect> |
148 | 7 | <x>0</x> | 7 | <x>0</x> |
149 | 8 | <y>0</y> | 8 | <y>0</y> |
152 | 9 | <width>512</width> | 9 | <width>520</width> |
153 | 10 | <height>328</height> | 10 | <height>342</height> |
154 | 11 | </rect> | 11 | </rect> |
155 | 12 | </property> | 12 | </property> |
156 | 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
157 | @@ -53,14 +53,27 @@ | |||
158 | 53 | </property> | 53 | </property> |
159 | 54 | </widget> | 54 | </widget> |
160 | 55 | </item> | 55 | </item> |
162 | 56 | <item row="2" column="0"> | 56 | <item row="0" column="3"> |
163 | 57 | <spacer name="horizontalSpacer_2"> | ||
164 | 58 | <property name="orientation"> | ||
165 | 59 | <enum>Qt::Horizontal</enum> | ||
166 | 60 | </property> | ||
167 | 61 | <property name="sizeHint" stdset="0"> | ||
168 | 62 | <size> | ||
169 | 63 | <width>40</width> | ||
170 | 64 | <height>20</height> | ||
171 | 65 | </size> | ||
172 | 66 | </property> | ||
173 | 67 | </spacer> | ||
174 | 68 | </item> | ||
175 | 69 | <item row="1" column="0"> | ||
176 | 57 | <widget class="QCheckBox" name="limit_downloads_checkbox"> | 70 | <widget class="QCheckBox" name="limit_downloads_checkbox"> |
177 | 58 | <property name="text"> | 71 | <property name="text"> |
178 | 59 | <string notr="true">Limit download speed to</string> | 72 | <string notr="true">Limit download speed to</string> |
179 | 60 | </property> | 73 | </property> |
180 | 61 | </widget> | 74 | </widget> |
181 | 62 | </item> | 75 | </item> |
183 | 63 | <item row="2" column="1"> | 76 | <item row="1" column="1"> |
184 | 64 | <widget class="QSpinBox" name="download_speed_spinbox"> | 77 | <widget class="QSpinBox" name="download_speed_spinbox"> |
185 | 65 | <property name="minimum"> | 78 | <property name="minimum"> |
186 | 66 | <number>-1</number> | 79 | <number>-1</number> |
187 | @@ -70,17 +83,17 @@ | |||
188 | 70 | </property> | 83 | </property> |
189 | 71 | </widget> | 84 | </widget> |
190 | 72 | </item> | 85 | </item> |
192 | 73 | <item row="2" column="2"> | 86 | <item row="1" column="2"> |
193 | 74 | <widget class="QLabel" name="kbps_label_2"> | 87 | <widget class="QLabel" name="kbps_label_2"> |
194 | 75 | <property name="text"> | 88 | <property name="text"> |
195 | 76 | <string notr="true">Kilobits per second</string> | 89 | <string notr="true">Kilobits per second</string> |
196 | 77 | </property> | 90 | </property> |
197 | 78 | </widget> | 91 | </widget> |
198 | 79 | </item> | 92 | </item> |
201 | 80 | <item row="0" column="3"> | 93 | <item row="2" column="0"> |
202 | 81 | <spacer name="horizontalSpacer_2"> | 94 | <spacer name="verticalSpacer_2"> |
203 | 82 | <property name="orientation"> | 95 | <property name="orientation"> |
205 | 83 | <enum>Qt::Horizontal</enum> | 96 | <enum>Qt::Vertical</enum> |
206 | 84 | </property> | 97 | </property> |
207 | 85 | <property name="sizeHint" stdset="0"> | 98 | <property name="sizeHint" stdset="0"> |
208 | 86 | <size> | 99 | <size> |
209 | @@ -90,7 +103,7 @@ | |||
210 | 90 | </property> | 103 | </property> |
211 | 91 | </spacer> | 104 | </spacer> |
212 | 92 | </item> | 105 | </item> |
214 | 93 | <item row="4" column="0" colspan="3"> | 106 | <item row="3" column="0" colspan="3"> |
215 | 94 | <widget class="QLabel" name="label_2"> | 107 | <widget class="QLabel" name="label_2"> |
216 | 95 | <property name="text"> | 108 | <property name="text"> |
217 | 96 | <string notr="true">Please note that your files will not sync if you set bandwidth to 0</string> | 109 | <string notr="true">Please note that your files will not sync if you set bandwidth to 0</string> |
218 | @@ -103,19 +116,6 @@ | |||
219 | 103 | </property> | 116 | </property> |
220 | 104 | </widget> | 117 | </widget> |
221 | 105 | </item> | 118 | </item> |
222 | 106 | <item row="3" column="0"> | ||
223 | 107 | <spacer name="verticalSpacer_2"> | ||
224 | 108 | <property name="orientation"> | ||
225 | 109 | <enum>Qt::Vertical</enum> | ||
226 | 110 | </property> | ||
227 | 111 | <property name="sizeHint" stdset="0"> | ||
228 | 112 | <size> | ||
229 | 113 | <width>40</width> | ||
230 | 114 | <height>20</height> | ||
231 | 115 | </size> | ||
232 | 116 | </property> | ||
233 | 117 | </spacer> | ||
234 | 118 | </item> | ||
235 | 119 | </layout> | 119 | </layout> |
236 | 120 | </widget> | 120 | </widget> |
237 | 121 | </item> | 121 | </item> |
238 | @@ -124,32 +124,45 @@ | |||
239 | 124 | <property name="title"> | 124 | <property name="title"> |
240 | 125 | <string notr="true">File Sync Settings</string> | 125 | <string notr="true">File Sync Settings</string> |
241 | 126 | </property> | 126 | </property> |
243 | 127 | <layout class="QVBoxLayout" name="verticalLayout_1"> | 127 | <layout class="QGridLayout" name="gridLayout_2"> |
244 | 128 | <property name="margin"> | 128 | <property name="margin"> |
245 | 129 | <number>0</number> | 129 | <number>0</number> |
246 | 130 | </property> | 130 | </property> |
248 | 131 | <item> | 131 | <item row="0" column="0"> |
249 | 132 | <widget class="QCheckBox" name="autoconnect_checkbox"> | 132 | <widget class="QCheckBox" name="autoconnect_checkbox"> |
250 | 133 | <property name="text"> | 133 | <property name="text"> |
251 | 134 | <string notr="true">Connect automatically when computer starts</string> | 134 | <string notr="true">Connect automatically when computer starts</string> |
252 | 135 | </property> | 135 | </property> |
253 | 136 | </widget> | 136 | </widget> |
254 | 137 | </item> | 137 | </item> |
256 | 138 | <item> | 138 | <item row="0" column="1"> |
257 | 139 | <spacer name="horizontalSpacer_3"> | ||
258 | 140 | <property name="orientation"> | ||
259 | 141 | <enum>Qt::Horizontal</enum> | ||
260 | 142 | </property> | ||
261 | 143 | <property name="sizeHint" stdset="0"> | ||
262 | 144 | <size> | ||
263 | 145 | <width>40</width> | ||
264 | 146 | <height>20</height> | ||
265 | 147 | </size> | ||
266 | 148 | </property> | ||
267 | 149 | </spacer> | ||
268 | 150 | </item> | ||
269 | 151 | <item row="1" column="0"> | ||
270 | 139 | <widget class="QCheckBox" name="udf_autosubscribe_checkbox"> | 152 | <widget class="QCheckBox" name="udf_autosubscribe_checkbox"> |
271 | 140 | <property name="text"> | 153 | <property name="text"> |
272 | 141 | <string notr="true">Automatically sync all new cloud folders to this computer</string> | 154 | <string notr="true">Automatically sync all new cloud folders to this computer</string> |
273 | 142 | </property> | 155 | </property> |
274 | 143 | </widget> | 156 | </widget> |
275 | 144 | </item> | 157 | </item> |
277 | 145 | <item> | 158 | <item row="2" column="0"> |
278 | 146 | <widget class="QCheckBox" name="share_autosubscribe_checkbox"> | 159 | <widget class="QCheckBox" name="share_autosubscribe_checkbox"> |
279 | 147 | <property name="text"> | 160 | <property name="text"> |
280 | 148 | <string notr="true">Automatically sync all folders shared with me to this computer</string> | 161 | <string notr="true">Automatically sync all folders shared with me to this computer</string> |
281 | 149 | </property> | 162 | </property> |
282 | 150 | </widget> | 163 | </widget> |
283 | 151 | </item> | 164 | </item> |
285 | 152 | <item> | 165 | <item row="3" column="0"> |
286 | 153 | <widget class="QCheckBox" name="show_all_notifications_checkbox"> | 166 | <widget class="QCheckBox" name="show_all_notifications_checkbox"> |
287 | 154 | <property name="text"> | 167 | <property name="text"> |
288 | 155 | <string notr="true">Allow all notifications to this device</string> | 168 | <string notr="true">Allow all notifications to this device</string> |
289 | 156 | 169 | ||
290 | === modified file 'data/qt/ubuntuone.qss' | |||
291 | --- data/qt/ubuntuone.qss 2012-03-02 17:33:38 +0000 | |||
292 | +++ data/qt/ubuntuone.qss 2012-03-08 21:13:18 +0000 | |||
293 | @@ -1,3 +1,11 @@ | |||
294 | 1 | /* Common colours: | ||
295 | 2 | |||
296 | 3 | orange: #dd4814 | ||
297 | 4 | dark grey: #333333 | ||
298 | 5 | light grey: #aea79f | ||
299 | 6 | |||
300 | 7 | */ | ||
301 | 8 | |||
302 | 1 | QMainWindow { | 9 | QMainWindow { |
303 | 2 | background-color: #aea79f; | 10 | background-color: #aea79f; |
304 | 3 | } | 11 | } |
305 | @@ -77,6 +85,18 @@ | |||
306 | 77 | border-width: 1px; | 85 | border-width: 1px; |
307 | 78 | } | 86 | } |
308 | 79 | 87 | ||
309 | 88 | QPushButton:focus { | ||
310 | 89 | border-width: 2px; | ||
311 | 90 | /* reduce the padding since we have a 2px border now */ | ||
312 | 91 | padding: 5px; | ||
313 | 92 | padding-left: 19px; | ||
314 | 93 | padding-right: 19px; | ||
315 | 94 | /* hack to make the mild-orange focused box dissapear */ | ||
316 | 95 | padding-top: 20px; | ||
317 | 96 | padding-bottom: 20px; | ||
318 | 97 | /* end of hack */ | ||
319 | 98 | } | ||
320 | 99 | |||
321 | 80 | QPushButton:disabled { | 100 | QPushButton:disabled { |
322 | 81 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 101 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
323 | 82 | stop: 0 #eaeaea, stop: 1.0 #cacaca); | 102 | stop: 0 #eaeaea, stop: 1.0 #cacaca); |
324 | @@ -91,19 +111,18 @@ | |||
325 | 91 | border-color: #999999; | 111 | border-color: #999999; |
326 | 92 | } | 112 | } |
327 | 93 | 113 | ||
329 | 94 | QPushButton:enabled:focus, | 114 | QPushButton:enabled:focus { |
330 | 115 | border-color: #dd4814; | ||
331 | 116 | } | ||
332 | 117 | |||
333 | 95 | QPushButton:enabled:hover { | 118 | QPushButton:enabled:hover { |
334 | 96 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 119 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
335 | 97 | stop: 0 #ffffff,stop: 1.0 #ededed); | 120 | stop: 0 #ffffff,stop: 1.0 #ededed); |
336 | 98 | color: #333333; | ||
337 | 99 | border-color: #999999; | ||
338 | 100 | } | 121 | } |
339 | 101 | 122 | ||
340 | 102 | QPushButton:enabled:pressed { | 123 | QPushButton:enabled:pressed { |
341 | 103 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 124 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
342 | 104 | stop: 0 #d9d9d9,stop: 1.0 #fefefe); | 125 | stop: 0 #d9d9d9,stop: 1.0 #fefefe); |
343 | 105 | color: #333333; | ||
344 | 106 | border-color: #999999; | ||
345 | 107 | } | 126 | } |
346 | 108 | 127 | ||
347 | 109 | QPushButton:default:enabled { | 128 | QPushButton:default:enabled { |
348 | @@ -113,55 +132,69 @@ | |||
349 | 113 | border-color: #999999; | 132 | border-color: #999999; |
350 | 114 | } | 133 | } |
351 | 115 | 134 | ||
353 | 116 | QPushButton:default:enabled:focus, | 135 | QPushButton:default:enabled:focus { |
354 | 136 | border-color: #333333; | ||
355 | 137 | } | ||
356 | 138 | |||
357 | 117 | QPushButton:default:enabled:hover { | 139 | QPushButton:default:enabled:hover { |
358 | 118 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 140 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
359 | 119 | stop: 0 #ffb19c,stop: 1.0 #dd4814); | 141 | stop: 0 #ffb19c,stop: 1.0 #dd4814); |
360 | 120 | color: white; | ||
361 | 121 | border-color: #999999; | ||
362 | 122 | } | 142 | } |
363 | 123 | 143 | ||
364 | 124 | QPushButton:default:enabled:pressed { | 144 | QPushButton:default:enabled:pressed { |
365 | 125 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 145 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
366 | 126 | stop: 0 #b93f14,stop: 1.0 #dd4814); | 146 | stop: 0 #b93f14,stop: 1.0 #dd4814); |
388 | 127 | color: white; | 147 | } |
389 | 128 | border-color: #999999; | 148 | |
390 | 129 | } | 149 | ExploreFolderButton { |
370 | 130 | |||
371 | 131 | QPushButton#help_button { | ||
372 | 132 | background: transparent; | ||
373 | 133 | border: none; | ||
374 | 134 | color: white; | ||
375 | 135 | text-decoration: underline; | ||
376 | 136 | padding: 0px; | ||
377 | 137 | } | ||
378 | 138 | |||
379 | 139 | QPushButton#explore_folder_button { | ||
380 | 140 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | ||
381 | 141 | stop: 0 #fbfbfb, stop: 1.0 #e6e6e6); | ||
382 | 142 | height: 15px; | ||
383 | 143 | border-radius: 7px; | ||
384 | 144 | border-color: #908e8d; | ||
385 | 145 | color: #595959; | ||
386 | 146 | padding-left: 10px; | ||
387 | 147 | padding-right: 10px; | ||
391 | 148 | margin-top: 5px; | 150 | margin-top: 5px; |
392 | 149 | margin-bottom: 5px; | 151 | margin-bottom: 5px; |
393 | 150 | margin-right: 20px; | 152 | margin-right: 20px; |
394 | 151 | margin-left: 20px; | 153 | margin-left: 20px; |
395 | 152 | } | 154 | } |
396 | 153 | 155 | ||
397 | 156 | ExploreFolderButton:enabled { | ||
398 | 157 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | ||
399 | 158 | stop: 0 #fbfbfb, stop: 1.0 #e6e6e6); | ||
400 | 159 | border-color: #908e8d; | ||
401 | 160 | color: #595959; | ||
402 | 161 | } | ||
403 | 162 | |||
404 | 154 | QPushButton#twitter_button, | 163 | QPushButton#twitter_button, |
405 | 155 | QPushButton#facebook_button { | 164 | QPushButton#facebook_button { |
406 | 165 | background: transparent; | ||
407 | 166 | } | ||
408 | 167 | |||
409 | 168 | QPushButton#twitter_button:focus, | ||
410 | 169 | QPushButton#facebook_button:focus { | ||
411 | 170 | border: 2px solid #dd4814; | ||
412 | 171 | } | ||
413 | 172 | |||
414 | 173 | GoToWebButton#help_button { | ||
415 | 174 | padding: 2px; | ||
416 | 175 | } | ||
417 | 176 | |||
418 | 177 | GoToWebButton#share_publish_button, | ||
419 | 178 | GoToWebButton#help_button { | ||
420 | 179 | background: transparent; | ||
421 | 156 | border: none; | 180 | border: none; |
422 | 181 | text-decoration: underline; | ||
423 | 157 | } | 182 | } |
424 | 158 | 183 | ||
425 | 159 | GoToWebButton#forgot_password_button, | ||
426 | 160 | GoToWebButton#share_publish_button { | 184 | GoToWebButton#share_publish_button { |
427 | 161 | background: transparent; | ||
428 | 162 | border: none; | ||
429 | 163 | color: #dd4814; | 185 | color: #dd4814; |
431 | 164 | text-decoration: underline; | 186 | } |
432 | 187 | |||
433 | 188 | GoToWebButton#help_button { | ||
434 | 189 | color: white; | ||
435 | 190 | } | ||
436 | 191 | |||
437 | 192 | GoToWebButton#share_publish_button:focus { | ||
438 | 193 | border: 2px solid #aea79f; | ||
439 | 194 | } | ||
440 | 195 | |||
441 | 196 | GoToWebButton#help_button:focus { | ||
442 | 197 | border: 2px solid #dd4814; | ||
443 | 165 | } | 198 | } |
444 | 166 | 199 | ||
445 | 167 | QTabBar::tab { | 200 | QTabBar::tab { |
446 | @@ -192,12 +225,7 @@ | |||
447 | 192 | border-width: 1px; | 225 | border-width: 1px; |
448 | 193 | } | 226 | } |
449 | 194 | 227 | ||
456 | 195 | QTabBar::tab:first:!selected { | 228 | QTabBar::tab:first { |
451 | 196 | border-left-color: #939389; | ||
452 | 197 | border-left-color: #939389; | ||
453 | 198 | } | ||
454 | 199 | |||
455 | 200 | QTabBar::tab:first:selected { | ||
457 | 201 | border-left-color: #939389; | 229 | border-left-color: #939389; |
458 | 202 | } | 230 | } |
459 | 203 | 231 | ||
460 | @@ -205,13 +233,21 @@ | |||
461 | 205 | border-left-color: #e4e0dd; | 233 | border-left-color: #e4e0dd; |
462 | 206 | } | 234 | } |
463 | 207 | 235 | ||
464 | 236 | QTabBar::tab:last:!selected { | ||
465 | 237 | border-left-color: #e4e0dd; | ||
466 | 238 | } | ||
467 | 239 | |||
468 | 208 | QTabBar::tab:hover { | 240 | QTabBar::tab:hover { |
469 | 209 | background: #f6f6f6; | 241 | background: #f6f6f6; |
470 | 210 | text-decoration: underline; | 242 | text-decoration: underline; |
471 | 211 | } | 243 | } |
472 | 212 | 244 | ||
475 | 213 | QTabBar::tab:last:!selected { | 245 | QTabBar::tab:focus { |
476 | 214 | border-left-color: #e4e0dd; | 246 | text-decoration: underline; |
477 | 247 | /* hack to make the mild-orange focused box dissapear */ | ||
478 | 248 | padding-left: 1000px; | ||
479 | 249 | padding-right: 1000px; | ||
480 | 250 | /* end of hack */ | ||
481 | 215 | } | 251 | } |
482 | 216 | 252 | ||
483 | 217 | QTabWidget { | 253 | QTabWidget { |
484 | @@ -259,6 +295,12 @@ | |||
485 | 259 | min-height: 48px; | 295 | min-height: 48px; |
486 | 260 | } | 296 | } |
487 | 261 | 297 | ||
488 | 298 | QGroupBox#local_device_box, | ||
489 | 299 | QListWidget#list_devices::item { | ||
490 | 300 | padding-left: 9px; | ||
491 | 301 | padding-right: 9px; | ||
492 | 302 | } | ||
493 | 303 | |||
494 | 262 | QLabel[OverQuota="false"] { | 304 | QLabel[OverQuota="false"] { |
495 | 263 | color: #333333; | 305 | color: #333333; |
496 | 264 | } | 306 | } |
497 | @@ -301,3 +343,8 @@ | |||
498 | 301 | alternate-background-color: #f7f6f5; | 343 | alternate-background-color: #f7f6f5; |
499 | 302 | background: #efedec; | 344 | background: #efedec; |
500 | 303 | } | 345 | } |
501 | 346 | |||
502 | 347 | QCheckBox:focus { | ||
503 | 348 | border-radius: 5px; | ||
504 | 349 | border: 2px solid #dd4814; | ||
505 | 350 | } | ||
506 | 304 | 351 | ||
507 | === modified file 'ubuntuone/controlpanel/gui/qt/device.py' | |||
508 | --- ubuntuone/controlpanel/gui/qt/device.py 2012-02-22 17:04:28 +0000 | |||
509 | +++ ubuntuone/controlpanel/gui/qt/device.py 2012-03-08 21:13:18 +0000 | |||
510 | @@ -34,7 +34,7 @@ | |||
511 | 34 | handle_errors, | 34 | handle_errors, |
512 | 35 | pixmap_from_name, | 35 | pixmap_from_name, |
513 | 36 | ) | 36 | ) |
515 | 37 | from ubuntuone.controlpanel.gui.qt.ui import device_ui, device_remote_ui | 37 | from ubuntuone.controlpanel.gui.qt.ui import device_ui |
516 | 38 | from ubuntuone.controlpanel.logger import setup_logging | 38 | from ubuntuone.controlpanel.logger import setup_logging |
517 | 39 | 39 | ||
518 | 40 | COMPUTER_ICON = "computer" | 40 | COMPUTER_ICON = "computer" |
519 | @@ -61,27 +61,35 @@ | |||
520 | 61 | 61 | ||
521 | 62 | 62 | ||
522 | 63 | class DeviceWidget(cache.Cache, QtGui.QWidget): | 63 | class DeviceWidget(cache.Cache, QtGui.QWidget): |
524 | 64 | """The widget for each device in the control panel.""" | 64 | """The widget for a local device in the control panel.""" |
525 | 65 | 65 | ||
526 | 66 | removed = QtCore.pyqtSignal() | 66 | removed = QtCore.pyqtSignal() |
527 | 67 | removeCanceled = QtCore.pyqtSignal() | 67 | removeCanceled = QtCore.pyqtSignal() |
528 | 68 | 68 | ||
530 | 69 | def __init__(self, device_id, *args, **kwargs): | 69 | def __init__(self, device_id=None, *args, **kwargs): |
531 | 70 | """Initialize the UI of the widget.""" | 70 | """Initialize the UI of the widget.""" |
532 | 71 | super(DeviceWidget, self).__init__(*args, **kwargs) | 71 | super(DeviceWidget, self).__init__(*args, **kwargs) |
533 | 72 | self.ui = device_ui.Ui_Form() | 72 | self.ui = device_ui.Ui_Form() |
534 | 73 | self.ui.setupUi(self) | 73 | self.ui.setupUi(self) |
535 | 74 | 74 | ||
542 | 75 | # The following is a hack to avoid having the faked self.ui failing | 75 | self.ui.remove_device_button.setText(REMOVE_BUTTON) |
543 | 76 | # with AttributeError in the tests. We need to improve the fake so we | 76 | self._id = None |
538 | 77 | # don't leak this to the production code. | ||
539 | 78 | if getattr(self.ui, 'remove_device_button', None) is not None: | ||
540 | 79 | self.ui.remove_device_button.setText(REMOVE_BUTTON) | ||
541 | 80 | |||
544 | 81 | self.id = device_id | 77 | self.id = device_id |
545 | 82 | 78 | ||
546 | 79 | def _get_id(self): | ||
547 | 80 | """Return this device's id.""" | ||
548 | 81 | return self._id | ||
549 | 82 | |||
550 | 83 | def _set_id(self, new_id): | ||
551 | 84 | """Set this device's id.""" | ||
552 | 85 | self._id = new_id | ||
553 | 86 | self.ui.remove_device_button.setEnabled(self._id is not None) | ||
554 | 87 | |||
555 | 88 | id = property(fget=_get_id, fset=_set_id) | ||
556 | 89 | |||
557 | 83 | def update_device_info(self, device_info): | 90 | def update_device_info(self, device_info): |
558 | 84 | """Update the device info.""" | 91 | """Update the device info.""" |
559 | 92 | self.id = device_info["device_id"] | ||
560 | 85 | self.ui.device_name_label.setText(device_info["name"]) | 93 | self.ui.device_name_label.setText(device_info["name"]) |
561 | 86 | icon_name = icon_name_from_type(device_info["type"]) | 94 | icon_name = icon_name_from_type(device_info["type"]) |
562 | 87 | pixmap = pixmap_from_name(icon_name) | 95 | pixmap = pixmap_from_name(icon_name) |
563 | @@ -102,28 +110,20 @@ | |||
564 | 102 | else: | 110 | else: |
565 | 103 | self.removeCanceled.emit() | 111 | self.removeCanceled.emit() |
566 | 104 | 112 | ||
567 | 105 | |||
568 | 106 | class DeviceRemoteWidget(QtGui.QWidget): | ||
569 | 107 | |||
570 | 108 | """Remote Device widget for Devices List.""" | ||
571 | 109 | |||
572 | 110 | def __init__(self, device_info): | ||
573 | 111 | super(DeviceRemoteWidget, self).__init__() | ||
574 | 112 | self.ui = device_remote_ui.Ui_Form() | ||
575 | 113 | self.ui.setupUi(self) | ||
576 | 114 | |||
577 | 115 | text = device_info["name"] | ||
578 | 116 | icon_name = icon_name_from_type(device_info["type"]) | ||
579 | 117 | pixmap = pixmap_from_name(icon_name) | ||
580 | 118 | self.ui.device_icon_label.setPixmap(pixmap) | ||
581 | 119 | self.ui.device_name_label.setText(text) | ||
582 | 120 | |||
583 | 121 | def text(self): | 113 | def text(self): |
584 | 122 | """Return the text displayed in the Widget.""" | 114 | """Return the text displayed in the Widget.""" |
585 | 123 | return self.ui.device_name_label.text() | 115 | return self.ui.device_name_label.text() |
586 | 124 | 116 | ||
592 | 125 | 117 | def clear(self): | |
593 | 126 | def get_device_for_list_widget(device_info): | 118 | """Clear this widget's info.""" |
594 | 127 | """Return a DeviceRemoteWidget with device proper info.""" | 119 | self.id = None |
595 | 128 | item = DeviceRemoteWidget(device_info) | 120 | self.ui.device_name_label.setText('') |
596 | 129 | return item | 121 | |
597 | 122 | |||
598 | 123 | class RemoteDeviceWidget(DeviceWidget): | ||
599 | 124 | |||
600 | 125 | """Remote device widget.""" | ||
601 | 126 | |||
602 | 127 | def __init__(self, *args, **kwargs): | ||
603 | 128 | super(RemoteDeviceWidget, self).__init__(*args, **kwargs) | ||
604 | 129 | self.ui.remove_device_button.hide() | ||
605 | 130 | 130 | ||
606 | === modified file 'ubuntuone/controlpanel/gui/qt/devices.py' | |||
607 | --- ubuntuone/controlpanel/gui/qt/devices.py 2012-02-22 15:35:13 +0000 | |||
608 | +++ ubuntuone/controlpanel/gui/qt/devices.py 2012-03-08 21:13:18 +0000 | |||
609 | @@ -50,7 +50,7 @@ | |||
610 | 50 | def _setup(self): | 50 | def _setup(self): |
611 | 51 | """Do some extra setupping for the UI.""" | 51 | """Do some extra setupping for the UI.""" |
612 | 52 | super(DevicesPanel, self)._setup() | 52 | super(DevicesPanel, self)._setup() |
614 | 53 | self.ui.local_device.setTitle(DEVICES_LOCAL_LABEL) | 53 | self.ui.local_device_box.setTitle(DEVICES_LOCAL_LABEL) |
615 | 54 | self.ui.other_devices.setTitle(DEVICES_REMOTE_LABEL) | 54 | self.ui.other_devices.setTitle(DEVICES_REMOTE_LABEL) |
616 | 55 | self.ui.manage_devices_button.setText(DEVICES_MANAGE_LABEL) | 55 | self.ui.manage_devices_button.setText(DEVICES_MANAGE_LABEL) |
617 | 56 | self.ui.manage_devices_button.uri = EDIT_DEVICES_LINK | 56 | self.ui.manage_devices_button.uri = EDIT_DEVICES_LINK |
618 | @@ -66,7 +66,6 @@ | |||
619 | 66 | @log_call(logger.debug) | 66 | @log_call(logger.debug) |
620 | 67 | def process_info(self, info): | 67 | def process_info(self, info): |
621 | 68 | """Process and display the devices info.""" | 68 | """Process and display the devices info.""" |
622 | 69 | self.clear_device_info(self.ui.local_device_box) | ||
623 | 70 | self.ui.list_devices.clear() | 69 | self.ui.list_devices.clear() |
624 | 71 | 70 | ||
625 | 72 | for device_info in info: | 71 | for device_info in info: |
626 | @@ -76,21 +75,9 @@ | |||
627 | 76 | 75 | ||
628 | 77 | def on_local_device_removed(self): | 76 | def on_local_device_removed(self): |
629 | 78 | """When the local device is removed, clear the box and emit signal.""" | 77 | """When the local device is removed, clear the box and emit signal.""" |
631 | 79 | self.clear_device_info(self.ui.local_device_box) | 78 | self.ui.local_device.clear() |
632 | 80 | self.localDeviceRemoved.emit() | 79 | self.localDeviceRemoved.emit() |
633 | 81 | 80 | ||
634 | 82 | def clear_device_info(self, box): | ||
635 | 83 | """Clear all the device info.""" | ||
636 | 84 | children = box.count() | ||
637 | 85 | # we need to reverse the index list to remove children because: | ||
638 | 86 | # "Items are numbered consecutively from 0. If an item is deleted, | ||
639 | 87 | # other items will be renumbered." | ||
640 | 88 | # http://doc.qt.nokia.com/latest/qlayout.html#itemAt | ||
641 | 89 | for i in reversed(range(children)): | ||
642 | 90 | widget = box.itemAt(i).widget() | ||
643 | 91 | box.removeWidget(widget) | ||
644 | 92 | widget.deleteLater() | ||
645 | 93 | |||
646 | 94 | def update_device_info(self, device_info): | 81 | def update_device_info(self, device_info): |
647 | 95 | """Update one device.""" | 82 | """Update one device.""" |
648 | 96 | if device_info["is_local"]: | 83 | if device_info["is_local"]: |
649 | @@ -100,15 +87,13 @@ | |||
650 | 100 | 87 | ||
651 | 101 | def update_local_device(self, device_info): | 88 | def update_local_device(self, device_info): |
652 | 102 | """Update the info for the local device.""" | 89 | """Update the info for the local device.""" |
658 | 103 | device_widget = device.DeviceWidget(device_id=device_info['device_id']) | 90 | self.ui.local_device.update_device_info(device_info) |
659 | 104 | device_widget.update_device_info(device_info) | 91 | self.ui.local_device.removed.connect(self.on_local_device_removed) |
655 | 105 | device_widget.removed.connect(self.on_local_device_removed) | ||
656 | 106 | |||
657 | 107 | self.ui.local_device_box.addWidget(device_widget) | ||
660 | 108 | 92 | ||
661 | 109 | def create_remote_device(self, device_info): | 93 | def create_remote_device(self, device_info): |
662 | 110 | """Add a remote device to the list.""" | 94 | """Add a remote device to the list.""" |
664 | 111 | widget = device.get_device_for_list_widget(device_info) | 95 | widget = device.RemoteDeviceWidget() |
665 | 96 | widget.update_device_info(device_info) | ||
666 | 112 | item = QtGui.QListWidgetItem() | 97 | item = QtGui.QListWidgetItem() |
667 | 113 | 98 | ||
668 | 114 | self.ui.list_devices.addItem(item) | 99 | self.ui.list_devices.addItem(item) |
669 | 115 | 100 | ||
670 | === modified file 'ubuntuone/controlpanel/gui/qt/folders.py' | |||
671 | --- ubuntuone/controlpanel/gui/qt/folders.py 2012-02-28 17:48:23 +0000 | |||
672 | +++ ubuntuone/controlpanel/gui/qt/folders.py 2012-03-08 21:13:18 +0000 | |||
673 | @@ -61,6 +61,21 @@ | |||
674 | 61 | YES = QtGui.QMessageBox.Yes | 61 | YES = QtGui.QMessageBox.Yes |
675 | 62 | 62 | ||
676 | 63 | 63 | ||
677 | 64 | class ExploreFolderButton(QtGui.QPushButton): | ||
678 | 65 | """A specialized button for the folder listing.""" | ||
679 | 66 | |||
680 | 67 | def __init__(self, folder_path, parent=None): | ||
681 | 68 | super(ExploreFolderButton, self).__init__(parent=parent) | ||
682 | 69 | self.folder_path = folder_path | ||
683 | 70 | self.setText(FOLDERS_COLUMN_EXPLORE) | ||
684 | 71 | self.clicked.connect(self.on_clicked) | ||
685 | 72 | |||
686 | 73 | def on_clicked(self): | ||
687 | 74 | """Open the folder_path in the default file manager.""" | ||
688 | 75 | uri = unicode(QtCore.QUrl.fromLocalFile(self.folder_path).toString()) | ||
689 | 76 | uri_hook(uri) | ||
690 | 77 | |||
691 | 78 | |||
692 | 64 | class FoldersPanel(UbuntuOneBin): | 79 | class FoldersPanel(UbuntuOneBin): |
693 | 65 | """The Folders Tab Panel widget""" | 80 | """The Folders Tab Panel widget""" |
694 | 66 | 81 | ||
695 | @@ -180,21 +195,9 @@ | |||
696 | 180 | 195 | ||
697 | 181 | # attach a third item with a button to explore the folder | 196 | # attach a third item with a button to explore the folder |
698 | 182 | model_index = self.ui.folders.indexFromItem(child, EXPLORE_COL) | 197 | model_index = self.ui.folders.indexFromItem(child, EXPLORE_COL) |
706 | 183 | button = QtGui.QPushButton(parent=self.ui.folders) | 198 | button = ExploreFolderButton(folder_path=child.volume_path, |
707 | 184 | button.setFlat(True) | 199 | parent=self.ui.folders) |
701 | 185 | button.setText(FOLDERS_COLUMN_EXPLORE) | ||
702 | 186 | button.setObjectName('explore_folder_button') | ||
703 | 187 | policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, | ||
704 | 188 | QtGui.QSizePolicy.Fixed) | ||
705 | 189 | button.setSizePolicy(policy) | ||
708 | 190 | button.setEnabled(bool(volume[u'subscribed'])) | 200 | button.setEnabled(bool(volume[u'subscribed'])) |
709 | 191 | |||
710 | 192 | # Operator not preceded by a space | ||
711 | 193 | # pylint: disable=C0322 | ||
712 | 194 | cb = lambda checked, item=child: \ | ||
713 | 195 | self.on_folders_itemActivated(item) | ||
714 | 196 | # pylint: enable=C0322 | ||
715 | 197 | button.clicked.connect(cb) | ||
716 | 198 | self.ui.folders.setIndexWidget(model_index, button) | 201 | self.ui.folders.setIndexWidget(model_index, button) |
717 | 199 | 202 | ||
718 | 200 | self.ui.folders.expandAll() | 203 | self.ui.folders.expandAll() |
719 | 201 | 204 | ||
720 | === modified file 'ubuntuone/controlpanel/gui/qt/loadingoverlay.py' | |||
721 | --- ubuntuone/controlpanel/gui/qt/loadingoverlay.py 2012-02-22 17:04:28 +0000 | |||
722 | +++ ubuntuone/controlpanel/gui/qt/loadingoverlay.py 2012-03-08 21:13:18 +0000 | |||
723 | @@ -45,11 +45,7 @@ | |||
724 | 45 | self.counter = 0 | 45 | self.counter = 0 |
725 | 46 | self.orientation = False | 46 | self.orientation = False |
726 | 47 | 47 | ||
732 | 48 | # The following is a hack to avoid having the faked self.ui failing | 48 | self.ui.label.setText(LOADING_OVERLAY) |
728 | 49 | # with AttributeError in the tests. We need to improve the fake so we | ||
729 | 50 | # don't leak this to the production code. | ||
730 | 51 | if getattr(self.ui, 'label', None) is not None: | ||
731 | 52 | self.ui.label.setText(LOADING_OVERLAY) | ||
733 | 53 | 49 | ||
734 | 54 | # Invalid name "paintEvent" | 50 | # Invalid name "paintEvent" |
735 | 55 | # pylint: disable=C0103 | 51 | # pylint: disable=C0103 |
736 | 56 | 52 | ||
737 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/__init__.py' | |||
738 | --- ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-03-02 13:53:24 +0000 | |||
739 | +++ ubuntuone/controlpanel/gui/qt/tests/__init__.py 2012-03-08 21:13:18 +0000 | |||
740 | @@ -96,6 +96,7 @@ | |||
741 | 96 | """A fake Ui object.""" | 96 | """A fake Ui object.""" |
742 | 97 | 97 | ||
743 | 98 | exposed_methods = ['setupUi'] | 98 | exposed_methods = ['setupUi'] |
744 | 99 | raise_attr_error = False | ||
745 | 99 | 100 | ||
746 | 100 | 101 | ||
747 | 101 | class FakedControlPanelBackend(FakedObject): | 102 | class FakedControlPanelBackend(FakedObject): |
748 | 102 | 103 | ||
749 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_device.py' | |||
750 | --- ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-01 22:05:51 +0000 | |||
751 | +++ ubuntuone/controlpanel/gui/qt/tests/test_device.py 2012-03-08 21:13:18 +0000 | |||
752 | @@ -1,8 +1,6 @@ | |||
753 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
754 | 2 | |||
755 | 3 | # Author: Alejandro J. Cura <alecu@canonical.com> | ||
756 | 4 | # | 2 | # |
758 | 5 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
759 | 6 | # | 4 | # |
760 | 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 |
761 | 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 |
762 | @@ -36,7 +34,7 @@ | |||
763 | 36 | 34 | ||
764 | 37 | 35 | ||
765 | 38 | class DeviceWidgetTestCase(BaseTestCase): | 36 | class DeviceWidgetTestCase(BaseTestCase): |
767 | 39 | """Test the qt control panel.""" | 37 | """Test the DeviceWidget class.""" |
768 | 40 | 38 | ||
769 | 41 | innerclass_ui = gui.device_ui | 39 | innerclass_ui = gui.device_ui |
770 | 42 | innerclass_name = "Ui_Form" | 40 | innerclass_name = "Ui_Form" |
771 | @@ -46,9 +44,28 @@ | |||
772 | 46 | logger = gui.logger | 44 | logger = gui.logger |
773 | 47 | 45 | ||
774 | 48 | def test_has_id(self): | 46 | def test_has_id(self): |
776 | 49 | """The device as an id, None by default.""" | 47 | """The device as an id accepted as creation param.""" |
777 | 50 | self.assertEqual(self.ui.id, self.device_id) | 48 | self.assertEqual(self.ui.id, self.device_id) |
778 | 51 | 49 | ||
779 | 50 | def test_id_can_be_none(self): | ||
780 | 51 | """The device id is None by default.""" | ||
781 | 52 | ui = self.class_ui() | ||
782 | 53 | self.assertEqual(ui.id, None) | ||
783 | 54 | |||
784 | 55 | def test_setting_id_to_none_disables_remove_button(self): | ||
785 | 56 | """If the id is set to None, the remove button is disabled.""" | ||
786 | 57 | self.ui.id = None | ||
787 | 58 | self.assertFalse(self.ui.ui.remove_device_button.isEnabled()) | ||
788 | 59 | |||
789 | 60 | def test_setting_id_to_not_none_enables_remove_button(self): | ||
790 | 61 | """If the id is set to not None, the remove button is enabled.""" | ||
791 | 62 | self.ui.id = 'not None' | ||
792 | 63 | self.assertTrue(self.ui.ui.remove_device_button.isEnabled()) | ||
793 | 64 | |||
794 | 65 | def test_remove_button(self): | ||
795 | 66 | """The remove button is visible.""" | ||
796 | 67 | self.assertTrue(self.ui.ui.remove_device_button.isVisible()) | ||
797 | 68 | |||
798 | 52 | def test_update_device_info(self): | 69 | def test_update_device_info(self): |
799 | 53 | """The widget is updated with the info.""" | 70 | """The widget is updated with the info.""" |
800 | 54 | info = SAMPLE_COMPUTER_INFO | 71 | info = SAMPLE_COMPUTER_INFO |
801 | @@ -68,7 +85,7 @@ | |||
802 | 68 | self.assertIconMatchesType(gui.DEVICE_TYPE_PHONE, gui.PHONE_ICON) | 85 | self.assertIconMatchesType(gui.DEVICE_TYPE_PHONE, gui.PHONE_ICON) |
803 | 69 | self.assertIconMatchesType("other random type", gui.COMPUTER_ICON) | 86 | self.assertIconMatchesType("other random type", gui.COMPUTER_ICON) |
804 | 70 | 87 | ||
806 | 71 | def _test_update_device_info_sets_right_icon(self, info): | 88 | def assert_update_device_info_sets_right_icon(self, info): |
807 | 72 | """The widget is updated with the right icon.""" | 89 | """The widget is updated with the right icon.""" |
808 | 73 | self.ui.update_device_info(info) | 90 | self.ui.update_device_info(info) |
809 | 74 | pixmap_name = gui.icon_name_from_type(info["type"]) | 91 | pixmap_name = gui.icon_name_from_type(info["type"]) |
810 | @@ -78,21 +95,11 @@ | |||
811 | 78 | 95 | ||
812 | 79 | def test_update_device_info_sets_computer_icon(self): | 96 | def test_update_device_info_sets_computer_icon(self): |
813 | 80 | """The computer icon is set.""" | 97 | """The computer icon is set.""" |
815 | 81 | self._test_update_device_info_sets_right_icon(SAMPLE_COMPUTER_INFO) | 98 | self.assert_update_device_info_sets_right_icon(SAMPLE_COMPUTER_INFO) |
816 | 82 | 99 | ||
817 | 83 | def test_update_device_info_sets_phone_icon(self): | 100 | def test_update_device_info_sets_phone_icon(self): |
818 | 84 | """The phone icon is set.""" | 101 | """The phone icon is set.""" |
830 | 85 | self._test_update_device_info_sets_right_icon(SAMPLE_PHONE_INFO) | 102 | self.assert_update_device_info_sets_right_icon(SAMPLE_PHONE_INFO) |
820 | 86 | |||
821 | 87 | def test_get_device_for_list_widget(self): | ||
822 | 88 | """The the item list values returned.""" | ||
823 | 89 | info = SAMPLE_COMPUTER_INFO | ||
824 | 90 | item = gui.get_device_for_list_widget(info) | ||
825 | 91 | self.assertEqual(item.text(), info["name"]) | ||
826 | 92 | |||
827 | 93 | info = SAMPLE_PHONE_INFO | ||
828 | 94 | item = gui.get_device_for_list_widget(info) | ||
829 | 95 | self.assertEqual(item.text(), info["name"]) | ||
831 | 96 | 103 | ||
832 | 97 | 104 | ||
833 | 98 | class RemoveDeviceTestCase(DeviceWidgetTestCase): | 105 | class RemoveDeviceTestCase(DeviceWidgetTestCase): |
834 | @@ -161,3 +168,13 @@ | |||
835 | 161 | yield self.ui.ui.remove_device_button.click() | 168 | yield self.ui.ui.remove_device_button.click() |
836 | 162 | 169 | ||
837 | 163 | self.assertTrue(self.memento.check_exception(CrashyBackendException)) | 170 | self.assertTrue(self.memento.check_exception(CrashyBackendException)) |
838 | 171 | |||
839 | 172 | |||
840 | 173 | class RemoteDeviceWidgetTestCase(DeviceWidgetTestCase): | ||
841 | 174 | """Test the RemoteDeviceWidget class.""" | ||
842 | 175 | |||
843 | 176 | class_ui = gui.RemoteDeviceWidget | ||
844 | 177 | |||
845 | 178 | def test_remove_button(self): | ||
846 | 179 | """The remove button is hidden.""" | ||
847 | 180 | self.assertFalse(self.ui.ui.remove_device_button.isVisible()) | ||
848 | 164 | 181 | ||
849 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_devices.py' | |||
850 | --- ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-01 22:05:51 +0000 | |||
851 | +++ ubuntuone/controlpanel/gui/qt/tests/test_devices.py 2012-03-08 21:13:18 +0000 | |||
852 | @@ -1,8 +1,6 @@ | |||
853 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
854 | 2 | |||
855 | 3 | # Author: Alejandro J. Cura <alecu@canonical.com> | ||
856 | 4 | # | 2 | # |
858 | 5 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
859 | 6 | # | 4 | # |
860 | 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 |
861 | 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 |
862 | @@ -63,7 +61,6 @@ | |||
863 | 63 | def test_no_devices_at_startup(self): | 61 | def test_no_devices_at_startup(self): |
864 | 64 | """The UI is reset at startup.""" | 62 | """The UI is reset at startup.""" |
865 | 65 | self.assertEqual(self.ui.ui.list_devices.count(), 0) | 63 | self.assertEqual(self.ui.ui.list_devices.count(), 0) |
866 | 66 | self.assertEqual(self.ui.ui.local_device_box.count(), 0) | ||
867 | 67 | 64 | ||
868 | 68 | def test_process_info(self): | 65 | def test_process_info(self): |
869 | 69 | """The widget is updated with the info.""" | 66 | """The widget is updated with the info.""" |
870 | @@ -71,10 +68,8 @@ | |||
871 | 71 | 68 | ||
872 | 72 | local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:] | 69 | local, remote = SAMPLE_DEVICES_INFO[0], SAMPLE_DEVICES_INFO[1:] |
873 | 73 | 70 | ||
878 | 74 | self.assertEqual(self.ui.ui.local_device_box.count(), 1) | 71 | local_device = self.ui.ui.local_device |
879 | 75 | local_device = self.ui.ui.local_device_box.itemAt(0).widget() | 72 | self.assertEqual(local_device.text(), local['name']) |
876 | 76 | self.assertEqual(local_device.ui.device_name_label.text(), | ||
877 | 77 | local['name']) | ||
880 | 78 | self.assertEqual(local_device.id, local['device_id']) | 73 | self.assertEqual(local_device.id, local['device_id']) |
881 | 79 | 74 | ||
882 | 80 | self.assertEqual(self.ui.ui.list_devices.count(), | 75 | self.assertEqual(self.ui.ui.list_devices.count(), |
883 | @@ -84,26 +79,12 @@ | |||
884 | 84 | device = self.ui.ui.list_devices.itemWidget(item) | 79 | device = self.ui.ui.list_devices.itemWidget(item) |
885 | 85 | self.assertEqual(device.text(), remote_device['name']) | 80 | self.assertEqual(device.text(), remote_device['name']) |
886 | 86 | 81 | ||
907 | 87 | def test_remove_device_and_check_layout_state(self): | 82 | def test_local_device(self): |
908 | 88 | """Test if the widget is properly removed.""" | 83 | """Test if the local_device widget is properly packed.""" |
909 | 89 | self.ui.process_info(SAMPLE_DEVICES_INFO) | 84 | self.ui.process_info(SAMPLE_DEVICES_INFO) |
910 | 90 | self.ui.show() | 85 | |
911 | 91 | 86 | local_device = self.ui.ui.local_device_layout.itemAt(0).widget() | |
912 | 92 | self.assertEqual(self.ui.ui.local_device_box.count(), 1) | 87 | self.assertIs(local_device, self.ui.ui.local_device) |
893 | 93 | local_device = self.ui.ui.local_device_box.itemAt(0).widget() | ||
894 | 94 | self.executed = False | ||
895 | 95 | |||
896 | 96 | def delete_later(reference=None): | ||
897 | 97 | """Fake delete later.""" | ||
898 | 98 | self.executed = True | ||
899 | 99 | self.patch(local_device, "deleteLater", delete_later) | ||
900 | 100 | self.ui.clear_device_info(self.ui.ui.local_device_box) | ||
901 | 101 | self.ui.process_info(SAMPLE_DEVICES_INFO) | ||
902 | 102 | self.assertEqual(self.ui.ui.local_device_box.count(), 1) | ||
903 | 103 | local_device2 = self.ui.ui.local_device_box.itemAt(0).widget() | ||
904 | 104 | self.assertNotEqual(local_device, local_device2) | ||
905 | 105 | self.assertTrue(self.executed) | ||
906 | 106 | self.assertFalse(local_device.isVisible()) | ||
913 | 107 | 88 | ||
914 | 108 | def test_process_info_twice(self): | 89 | def test_process_info_twice(self): |
915 | 109 | """The widget is updated with the info.""" | 90 | """The widget is updated with the info.""" |
916 | @@ -115,21 +96,20 @@ | |||
917 | 115 | self.assert_uri_hook_called(self.ui.ui.manage_devices_button, | 96 | self.assert_uri_hook_called(self.ui.ui.manage_devices_button, |
918 | 116 | gui.EDIT_DEVICES_LINK) | 97 | gui.EDIT_DEVICES_LINK) |
919 | 117 | 98 | ||
922 | 118 | def test_remove_device_widget_after_removal(self): | 99 | def test_local_device_removed_clears_the_widget(self): |
923 | 119 | """When a device widget was deleted, remove it from the UI.""" | 100 | """When the local device was deleted, clear it.""" |
924 | 120 | self.ui.process_info(SAMPLE_DEVICES_INFO) | 101 | self.ui.process_info(SAMPLE_DEVICES_INFO) |
925 | 121 | 102 | ||
928 | 122 | local_device = self.ui.ui.local_device_box.itemAt(0).widget() | 103 | self.ui.ui.local_device.removed.emit() |
927 | 123 | local_device.removed.emit() | ||
929 | 124 | 104 | ||
931 | 125 | self.assertTrue(self.ui.ui.local_device_box.itemAt(0) is None) | 105 | self.assertEqual(self.ui.ui.local_device.text(), '') |
932 | 106 | self.assertEqual(self.ui.ui.local_device.id, None) | ||
933 | 126 | 107 | ||
934 | 127 | def test_local_device_removed_signal(self): | 108 | def test_local_device_removed_signal(self): |
935 | 128 | """When the local device is removed, emit localDeviceRemoved signal.""" | 109 | """When the local device is removed, emit localDeviceRemoved signal.""" |
936 | 129 | self.ui.localDeviceRemoved.connect(self._set_called) | 110 | self.ui.localDeviceRemoved.connect(self._set_called) |
937 | 130 | self.ui.process_info(SAMPLE_DEVICES_INFO) | 111 | self.ui.process_info(SAMPLE_DEVICES_INFO) |
938 | 131 | 112 | ||
941 | 132 | local_device = self.ui.ui.local_device_box.itemAt(0).widget() | 113 | self.ui.ui.local_device.removed.emit() |
940 | 133 | local_device.removed.emit() | ||
942 | 134 | 114 | ||
943 | 135 | self.assertEqual(self._called, ((), {})) | 115 | self.assertEqual(self._called, ((), {})) |
944 | 136 | 116 | ||
945 | === modified file 'ubuntuone/controlpanel/gui/qt/tests/test_folders.py' | |||
946 | --- ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-02 16:56:10 +0000 | |||
947 | +++ ubuntuone/controlpanel/gui/qt/tests/test_folders.py 2012-03-08 21:13:18 +0000 | |||
948 | @@ -1,8 +1,6 @@ | |||
949 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
950 | 2 | |||
951 | 3 | # Authors: Natalia B Bidart <natalia.bidart@canonical.com> | ||
952 | 4 | # | 2 | # |
954 | 5 | # Copyright 2011 Canonical Ltd. | 3 | # Copyright 2011-2012 Canonical Ltd. |
955 | 6 | # | 4 | # |
956 | 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 |
957 | 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 |
958 | @@ -33,6 +31,7 @@ | |||
959 | 33 | ) | 31 | ) |
960 | 34 | from ubuntuone.controlpanel.gui.qt import folders as gui | 32 | from ubuntuone.controlpanel.gui.qt import folders as gui |
961 | 35 | from ubuntuone.controlpanel.gui.qt.tests import ( | 33 | from ubuntuone.controlpanel.gui.qt.tests import ( |
962 | 34 | BaseTestCase, | ||
963 | 36 | FakedDialog, | 35 | FakedDialog, |
964 | 37 | ) | 36 | ) |
965 | 38 | from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import ( | 37 | from ubuntuone.controlpanel.gui.qt.tests.test_ubuntuonebin import ( |
966 | @@ -54,6 +53,26 @@ | |||
967 | 54 | return name | 53 | return name |
968 | 55 | 54 | ||
969 | 56 | 55 | ||
970 | 56 | class ExploreFolderButtonTestCase(BaseTestCase): | ||
971 | 57 | """Test the ExploreFolderButton widget.""" | ||
972 | 58 | |||
973 | 59 | class_ui = gui.ExploreFolderButton | ||
974 | 60 | kwargs = dict(folder_path=u'foo') | ||
975 | 61 | |||
976 | 62 | def test_text(self): | ||
977 | 63 | """The button text is correct.""" | ||
978 | 64 | self.assertEqual(self.ui.text(), gui.FOLDERS_COLUMN_EXPLORE) | ||
979 | 65 | |||
980 | 66 | def test_clicked(self): | ||
981 | 67 | """Clicking the button opens the folder in the default file manager.""" | ||
982 | 68 | self.patch(gui, 'uri_hook', self._set_called) | ||
983 | 69 | self.ui.click() | ||
984 | 70 | |||
985 | 71 | url = gui.QtCore.QUrl.fromLocalFile(self.kwargs['folder_path']) | ||
986 | 72 | expected = unicode(url.toString()) | ||
987 | 73 | self.assertEqual(self._called, ((expected,), {})) | ||
988 | 74 | |||
989 | 75 | |||
990 | 57 | class FoldersPanelTestCase(UbuntuOneBinTestCase): | 76 | class FoldersPanelTestCase(UbuntuOneBinTestCase): |
991 | 58 | """Test the qt cloud folders tab.""" | 77 | """Test the qt cloud folders tab.""" |
992 | 59 | 78 | ||
993 | @@ -173,7 +192,6 @@ | |||
994 | 173 | # explore button is in place | 192 | # explore button is in place |
995 | 174 | model_index = folders.indexFromItem(item, gui.EXPLORE_COL) | 193 | model_index = folders.indexFromItem(item, gui.EXPLORE_COL) |
996 | 175 | button = folders.indexWidget(model_index) | 194 | button = folders.indexWidget(model_index) |
997 | 176 | self.assertEqual(button.isFlat(), True) | ||
998 | 177 | self.assertEqual(button.isEnabled(), | 195 | self.assertEqual(button.isEnabled(), |
999 | 178 | bool(volume['subscribed'])) | 196 | bool(volume['subscribed'])) |
1000 | 179 | 197 | ||
1001 | 180 | 198 | ||
1002 | === modified file 'ubuntuone/controlpanel/gui/tests/__init__.py' | |||
1003 | --- ubuntuone/controlpanel/gui/tests/__init__.py 2012-03-02 21:21:03 +0000 | |||
1004 | +++ ubuntuone/controlpanel/gui/tests/__init__.py 2012-03-08 21:13:18 +0000 | |||
1005 | @@ -134,6 +134,7 @@ | |||
1006 | 134 | next_result = None | 134 | next_result = None |
1007 | 135 | exposed_methods = [] | 135 | exposed_methods = [] |
1008 | 136 | exposed_results = {} | 136 | exposed_results = {} |
1009 | 137 | raise_attr_error = True | ||
1010 | 137 | 138 | ||
1011 | 138 | def __init__(self, *args, **kwargs): | 139 | def __init__(self, *args, **kwargs): |
1012 | 139 | self._args = args | 140 | self._args = args |
1013 | @@ -142,6 +143,23 @@ | |||
1014 | 142 | for i in self.exposed_methods: | 143 | for i in self.exposed_methods: |
1015 | 143 | setattr(self, i, self._record_call(i)) | 144 | setattr(self, i, self._record_call(i)) |
1016 | 144 | 145 | ||
1017 | 146 | def __call__(self, *args, **kwargs): | ||
1018 | 147 | """Skip.""" | ||
1019 | 148 | |||
1020 | 149 | def __getattribute__(self, attr_name): | ||
1021 | 150 | super_getattr = super(FakedObject, self).__getattribute__ | ||
1022 | 151 | |||
1023 | 152 | try: | ||
1024 | 153 | result = super_getattr(attr_name) | ||
1025 | 154 | except AttributeError: | ||
1026 | 155 | if super_getattr('raise_attr_error'): | ||
1027 | 156 | raise | ||
1028 | 157 | else: | ||
1029 | 158 | result = FakedObject() | ||
1030 | 159 | result.raise_attr_error = super_getattr('raise_attr_error') | ||
1031 | 160 | |||
1032 | 161 | return result | ||
1033 | 162 | |||
1034 | 145 | def _record_call(self, func_name): | 163 | def _record_call(self, func_name): |
1035 | 146 | """Store values when calling 'func_name'.""" | 164 | """Store values when calling 'func_name'.""" |
1036 | 147 | 165 |
+1