Merge lp:~nataliabidart/ubuntuone-control-panel/disable-limits into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 85
Merged at revision: 85
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/disable-limits
Merge into: lp:ubuntuone-control-panel
Diff against target: 479 lines (+178/-123)
3 files modified
data/device.ui (+156/-118)
ubuntuone/controlpanel/gtk/gui.py (+9/-3)
ubuntuone/controlpanel/gtk/tests/test_gui.py (+13/-2)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/disable-limits
Reviewer Review Type Date Requested Status
Martin Albisetti (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+51659@code.launchpad.net

Commit message

- Throttling limits are disabled when limit bandwidth is disabled (LP: #715812).

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good, and works as advertised

review: Approve
Revision history for this message
Martin Albisetti (beuno) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/device.ui'
2--- data/device.ui 2011-02-17 15:05:14 +0000
3+++ data/device.ui 2011-02-28 23:28:53 +0000
4@@ -12,174 +12,203 @@
5 </object>
6 <object class="GtkVBox" id="itself">
7 <property name="visible">True</property>
8+ <property name="can_focus">False</property>
9 <property name="border_width">10</property>
10 <property name="spacing">5</property>
11 <child>
12 <object class="GtkHBox" id="hbox1">
13 <property name="visible">True</property>
14+ <property name="can_focus">False</property>
15 <property name="spacing">10</property>
16 <child>
17 <object class="GtkVBox" id="vbox1">
18 <property name="visible">True</property>
19+ <property name="can_focus">False</property>
20 <property name="spacing">5</property>
21 <child>
22 <object class="GtkHBox" id="hbox2">
23 <property name="visible">True</property>
24+ <property name="can_focus">False</property>
25 <child>
26 <object class="GtkImage" id="device_type">
27 <property name="visible">True</property>
28+ <property name="can_focus">False</property>
29 <property name="icon_name">computer</property>
30 </object>
31 <packing>
32 <property name="expand">False</property>
33+ <property name="fill">True</property>
34 <property name="position">0</property>
35 </packing>
36 </child>
37 <child>
38 <object class="GtkLabel" id="device_name">
39 <property name="visible">True</property>
40+ <property name="can_focus">False</property>
41 <property name="xalign">0</property>
42 <property name="xpad">5</property>
43 <property name="label">My Laptop</property>
44 <property name="wrap">True</property>
45 </object>
46 <packing>
47+ <property name="expand">True</property>
48+ <property name="fill">True</property>
49 <property name="position">1</property>
50 </packing>
51 </child>
52 </object>
53 <packing>
54+ <property name="expand">True</property>
55+ <property name="fill">True</property>
56 <property name="position">0</property>
57 </packing>
58 </child>
59 <child>
60 <object class="GtkAlignment" id="alignment1">
61 <property name="visible">True</property>
62+ <property name="can_focus">False</property>
63 <property name="left_padding">25</property>
64 <child>
65- <object class="GtkTable" id="throttling">
66+ <object class="GtkVBox" id="config_settings">
67 <property name="visible">True</property>
68- <property name="n_rows">4</property>
69- <property name="n_columns">3</property>
70- <property name="column_spacing">3</property>
71- <property name="row_spacing">3</property>
72+ <property name="can_focus">False</property>
73 <child>
74 <object class="GtkCheckButton" id="show_all_notifications">
75 <property name="label" translatable="yes">Show notifications</property>
76 <property name="visible">True</property>
77 <property name="can_focus">True</property>
78 <property name="receives_default">False</property>
79- <property name="draw_indicator">True</property>
80- <signal name="toggled" handler="on_show_all_notifications_toggled"/>
81- </object>
82- </child>
83- <child>
84- <object class="GtkCheckButton" id="limit_bandwidth">
85- <property name="label" translatable="yes">Limit bandwidth usage</property>
86- <property name="visible">True</property>
87- <property name="can_focus">True</property>
88- <property name="receives_default">False</property>
89- <property name="draw_indicator">True</property>
90- <signal name="toggled" handler="on_limit_bandwidth_toggled"/>
91- </object>
92- <packing>
93- <property name="top_attach">1</property>
94- <property name="bottom_attach">2</property>
95- </packing>
96- </child>
97- <child>
98- <object class="GtkLabel" id="max_upload_speed_label">
99- <property name="visible">True</property>
100- <property name="xalign">0</property>
101- <property name="label" translatable="yes">Max upload speed:</property>
102- <property name="track_visited_links">False</property>
103- </object>
104- <packing>
105- <property name="top_attach">2</property>
106- <property name="bottom_attach">3</property>
107- </packing>
108- </child>
109- <child>
110- <object class="GtkLabel" id="max_download_speed_label">
111- <property name="visible">True</property>
112- <property name="xalign">0</property>
113- <property name="label" translatable="yes">Max download speed:</property>
114- </object>
115- <packing>
116- <property name="top_attach">3</property>
117- <property name="bottom_attach">4</property>
118- </packing>
119- </child>
120- <child>
121- <object class="GtkSpinButton" id="max_upload_speed">
122- <property name="visible">True</property>
123- <property name="can_focus">True</property>
124- <property name="invisible_char">•</property>
125- <property name="activates_default">True</property>
126- <property name="invisible_char_set">True</property>
127- <property name="adjustment">adjustment1</property>
128- <signal name="value_changed" handler="on_max_upload_speed_value_changed"/>
129- </object>
130- <packing>
131- <property name="left_attach">1</property>
132- <property name="right_attach">2</property>
133- <property name="top_attach">2</property>
134- <property name="bottom_attach">3</property>
135- <property name="x_options">GTK_FILL</property>
136- <property name="y_options">GTK_FILL</property>
137- </packing>
138- </child>
139- <child>
140- <object class="GtkSpinButton" id="max_download_speed">
141- <property name="visible">True</property>
142- <property name="can_focus">True</property>
143- <property name="invisible_char">•</property>
144- <property name="activates_default">True</property>
145- <property name="invisible_char_set">True</property>
146- <property name="adjustment">adjustment2</property>
147- <signal name="value_changed" handler="on_max_download_speed_value_changed"/>
148- </object>
149- <packing>
150- <property name="left_attach">1</property>
151- <property name="right_attach">2</property>
152- <property name="top_attach">3</property>
153- <property name="bottom_attach">4</property>
154- </packing>
155- </child>
156- <child>
157- <placeholder/>
158- </child>
159- <child>
160- <placeholder/>
161- </child>
162- <child>
163- <placeholder/>
164- </child>
165- <child>
166- <placeholder/>
167- </child>
168- <child>
169- <object class="GtkLabel" id="label1">
170- <property name="visible">True</property>
171- <property name="label" translatable="yes">KiB/s</property>
172- </object>
173- <packing>
174- <property name="left_attach">2</property>
175- <property name="right_attach">3</property>
176- <property name="top_attach">2</property>
177- <property name="bottom_attach">3</property>
178- </packing>
179- </child>
180- <child>
181- <object class="GtkLabel" id="label2">
182- <property name="visible">True</property>
183- <property name="label" translatable="yes">KiB/s</property>
184- </object>
185- <packing>
186- <property name="left_attach">2</property>
187- <property name="right_attach">3</property>
188- <property name="top_attach">3</property>
189- <property name="bottom_attach">4</property>
190+ <property name="use_action_appearance">False</property>
191+ <property name="draw_indicator">True</property>
192+ <signal name="toggled" handler="on_show_all_notifications_toggled" swapped="no"/>
193+ </object>
194+ <packing>
195+ <property name="expand">True</property>
196+ <property name="fill">True</property>
197+ <property name="position">0</property>
198+ </packing>
199+ </child>
200+ <child>
201+ <object class="GtkVBox" id="throttling">
202+ <property name="visible">True</property>
203+ <property name="can_focus">False</property>
204+ <child>
205+ <object class="GtkCheckButton" id="limit_bandwidth">
206+ <property name="label" translatable="yes">Limit bandwidth usage</property>
207+ <property name="visible">True</property>
208+ <property name="can_focus">True</property>
209+ <property name="receives_default">False</property>
210+ <property name="use_action_appearance">False</property>
211+ <property name="draw_indicator">True</property>
212+ <signal name="toggled" handler="on_limit_bandwidth_toggled" swapped="no"/>
213+ </object>
214+ <packing>
215+ <property name="expand">True</property>
216+ <property name="fill">True</property>
217+ <property name="position">0</property>
218+ </packing>
219+ </child>
220+ <child>
221+ <object class="GtkTable" id="throttling_limits">
222+ <property name="visible">True</property>
223+ <property name="can_focus">False</property>
224+ <property name="n_rows">2</property>
225+ <property name="n_columns">3</property>
226+ <property name="column_spacing">3</property>
227+ <property name="row_spacing">3</property>
228+ <child>
229+ <object class="GtkLabel" id="max_upload_speed_label">
230+ <property name="visible">True</property>
231+ <property name="can_focus">False</property>
232+ <property name="xalign">0</property>
233+ <property name="xpad">22</property>
234+ <property name="label" translatable="yes">Max upload speed:</property>
235+ <property name="track_visited_links">False</property>
236+ </object>
237+ </child>
238+ <child>
239+ <object class="GtkLabel" id="max_download_speed_label">
240+ <property name="visible">True</property>
241+ <property name="can_focus">False</property>
242+ <property name="xalign">0</property>
243+ <property name="xpad">22</property>
244+ <property name="label" translatable="yes">Max download speed:</property>
245+ </object>
246+ <packing>
247+ <property name="top_attach">1</property>
248+ <property name="bottom_attach">2</property>
249+ </packing>
250+ </child>
251+ <child>
252+ <object class="GtkSpinButton" id="max_upload_speed">
253+ <property name="visible">True</property>
254+ <property name="can_focus">True</property>
255+ <property name="invisible_char">•</property>
256+ <property name="activates_default">True</property>
257+ <property name="invisible_char_set">True</property>
258+ <property name="adjustment">adjustment1</property>
259+ <signal name="value-changed" handler="on_max_upload_speed_value_changed" swapped="no"/>
260+ </object>
261+ <packing>
262+ <property name="left_attach">1</property>
263+ <property name="right_attach">2</property>
264+ <property name="x_options">GTK_FILL</property>
265+ <property name="y_options">GTK_FILL</property>
266+ </packing>
267+ </child>
268+ <child>
269+ <object class="GtkSpinButton" id="max_download_speed">
270+ <property name="visible">True</property>
271+ <property name="can_focus">True</property>
272+ <property name="invisible_char">•</property>
273+ <property name="activates_default">True</property>
274+ <property name="invisible_char_set">True</property>
275+ <property name="adjustment">adjustment2</property>
276+ <signal name="value-changed" handler="on_max_download_speed_value_changed" swapped="no"/>
277+ </object>
278+ <packing>
279+ <property name="left_attach">1</property>
280+ <property name="right_attach">2</property>
281+ <property name="top_attach">1</property>
282+ <property name="bottom_attach">2</property>
283+ </packing>
284+ </child>
285+ <child>
286+ <object class="GtkLabel" id="label1">
287+ <property name="visible">True</property>
288+ <property name="can_focus">False</property>
289+ <property name="label" translatable="yes">KiB/s</property>
290+ </object>
291+ <packing>
292+ <property name="left_attach">2</property>
293+ <property name="right_attach">3</property>
294+ </packing>
295+ </child>
296+ <child>
297+ <object class="GtkLabel" id="label2">
298+ <property name="visible">True</property>
299+ <property name="can_focus">False</property>
300+ <property name="label" translatable="yes">KiB/s</property>
301+ </object>
302+ <packing>
303+ <property name="left_attach">2</property>
304+ <property name="right_attach">3</property>
305+ <property name="top_attach">1</property>
306+ <property name="bottom_attach">2</property>
307+ </packing>
308+ </child>
309+ </object>
310+ <packing>
311+ <property name="expand">True</property>
312+ <property name="fill">True</property>
313+ <property name="position">1</property>
314+ </packing>
315+ </child>
316+ </object>
317+ <packing>
318+ <property name="expand">True</property>
319+ <property name="fill">True</property>
320+ <property name="position">1</property>
321 </packing>
322 </child>
323 </object>
324@@ -187,18 +216,21 @@
325 </object>
326 <packing>
327 <property name="expand">False</property>
328+ <property name="fill">True</property>
329 <property name="position">1</property>
330 </packing>
331 </child>
332 </object>
333 <packing>
334 <property name="expand">False</property>
335+ <property name="fill">True</property>
336 <property name="position">0</property>
337 </packing>
338 </child>
339 <child>
340 <object class="GtkVButtonBox" id="vbuttonbox1">
341 <property name="visible">True</property>
342+ <property name="can_focus">False</property>
343 <property name="layout_style">start</property>
344 <child>
345 <object class="GtkButton" id="remove">
346@@ -206,9 +238,10 @@
347 <property name="visible">True</property>
348 <property name="can_focus">True</property>
349 <property name="receives_default">True</property>
350+ <property name="use_action_appearance">False</property>
351 <property name="use_stock">True</property>
352- <signal name="clicked" handler="on_remove_clicked"/>
353- <signal name="activate" handler="on_remove_clicked"/>
354+ <signal name="activate" handler="on_remove_clicked" swapped="no"/>
355+ <signal name="clicked" handler="on_remove_clicked" swapped="no"/>
356 </object>
357 <packing>
358 <property name="expand">False</property>
359@@ -219,6 +252,7 @@
360 </object>
361 <packing>
362 <property name="expand">False</property>
363+ <property name="fill">True</property>
364 <property name="pack_type">end</property>
365 <property name="position">1</property>
366 </packing>
367@@ -226,14 +260,18 @@
368 </object>
369 <packing>
370 <property name="expand">False</property>
371+ <property name="fill">True</property>
372 <property name="position">0</property>
373 </packing>
374 </child>
375 <child>
376 <object class="GtkLabel" id="warning_label">
377 <property name="visible">True</property>
378+ <property name="can_focus">False</property>
379 </object>
380 <packing>
381+ <property name="expand">True</property>
382+ <property name="fill">True</property>
383 <property name="position">1</property>
384 </packing>
385 </child>
386
387=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
388--- ubuntuone/controlpanel/gtk/gui.py 2011-02-28 22:19:29 +0000
389+++ ubuntuone/controlpanel/gtk/gui.py 2011-02-28 23:28:53 +0000
390@@ -625,10 +625,14 @@
391 return inner
392
393 on_show_all_notifications_toggled = _change_device_settings
394- on_limit_bandwidth_toggled = _change_device_settings
395 on_max_upload_speed_value_changed = _change_device_settings
396 on_max_download_speed_value_changed = _change_device_settings
397
398+ def on_limit_bandwidth_toggled(self, *args, **kwargs):
399+ """The limit bandwidth checkbox was toggled."""
400+ self.throttling_limits.set_sensitive(self.limit_bandwidth.get_active())
401+ self._change_device_settings()
402+
403 def on_remove_clicked(self, widget):
404 """Remove button was clicked or activated."""
405 response = gtk.RESPONSE_YES
406@@ -677,14 +681,16 @@
407
408 if 'configurable' in kwargs:
409 self.configurable = bool(kwargs['configurable'])
410- self.throttling.set_visible(self.configurable)
411+ self.config_settings.set_visible(self.configurable)
412
413 if 'show_all_notifications' in kwargs:
414 value = bool(kwargs['show_all_notifications'])
415 self.show_all_notifications.set_active(value)
416
417 if 'limit_bandwidth' in kwargs:
418- self.limit_bandwidth.set_active(bool(kwargs['limit_bandwidth']))
419+ enabled = bool(kwargs['limit_bandwidth'])
420+ self.limit_bandwidth.set_active(enabled)
421+ self.throttling_limits.set_sensitive(enabled)
422
423 for speed in ('max_upload_speed', 'max_download_speed'):
424 if speed in kwargs:
425
426=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui.py'
427--- ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-02-28 22:19:29 +0000
428+++ ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-02-28 23:28:53 +0000
429@@ -989,6 +989,12 @@
430 self.assertEqual(device.limit_bandwidth.get_active(),
431 bool(expected['limit_bandwidth']))
432
433+ config_enabled = self.ui.config_settings.get_sensitive()
434+ self.assertEqual(device.configurable, config_enabled)
435+
436+ limit_enabled = self.ui.throttling_limits.get_sensitive()
437+ self.assertEqual(device.limit_bandwidth.get_active(), limit_enabled)
438+
439 value = int(expected['max_upload_speed']) // gui.KILOBYTES
440 self.assertEqual(device.max_upload_speed.get_value_as_int(), value)
441 value = int(expected['max_download_speed']) // gui.KILOBYTES
442@@ -1001,6 +1007,9 @@
443 (self.ui.id, expected))
444 self.assertEqual(self.ui.warning_label.get_text(), '')
445
446+ limit_enabled = self.ui.throttling_limits.get_sensitive()
447+ self.assertEqual(self.ui.limit_bandwidth.get_active(), limit_enabled)
448+
449 def modify_settings(self):
450 """Modify settings so values actually change."""
451 new_val = not self.ui.show_all_notifications.get_active()
452@@ -1092,13 +1101,13 @@
453 """A device can be updated from a dict."""
454 self.ui.update(configurable='')
455 self.assertFalse(self.ui.configurable)
456- self.assertFalse(self.ui.throttling.get_visible())
457+ self.assertFalse(self.ui.config_settings.get_visible())
458
459 def test_update_configurable(self):
460 """A device can be updated from a dict."""
461 self.ui.update(configurable='True')
462 self.assertTrue(self.ui.configurable)
463- self.assertTrue(self.ui.throttling.get_visible())
464+ self.assertTrue(self.ui.config_settings.get_visible())
465
466 def test_update_show_all_notifications(self):
467 """A device can be updated from a dict."""
468@@ -1112,9 +1121,11 @@
469 """A device can be updated from a dict."""
470 self.ui.update(limit_bandwidth='')
471 self.assertFalse(self.ui.limit_bandwidth.get_active())
472+ self.assertFalse(self.ui.throttling_limits.get_sensitive())
473
474 self.ui.update(limit_bandwidth='True')
475 self.assertTrue(self.ui.limit_bandwidth.get_active())
476+ self.assertTrue(self.ui.throttling_limits.get_sensitive())
477
478 def test_update_upload_speed(self):
479 """A device can be updated from a dict."""

Subscribers

People subscribed via source and target branches