Merge lp:~nataliabidart/ubuntuone-control-panel/out-of-space-notif into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 86
Merged at revision: 84
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/out-of-space-notif
Merge into: lp:ubuntuone-control-panel
Diff against target: 132 lines (+45/-17)
2 files modified
ubuntuone/controlpanel/gtk/gui.py (+15/-7)
ubuntuone/controlpanel/gtk/tests/test_gui.py (+30/-10)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/out-of-space-notif
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Martin Albisetti (community) Approve
Review via email: mp+51484@code.launchpad.net

Commit message

  - Quota usage is now red when user is over quota (LP: #701729).
  - File sync status is now centered (LP: #715715).

Description of the change

Screenshot of how this looks IRL is: http://ubuntuone.com/p/fMq/

To post a comment you must log in.
Revision history for this message
Martin Albisetti (beuno) wrote :

14:46 < nessita> beuno: http://ubuntuone.com/p/fMq/
14:47 < beuno> nessita, looks good to me
14:48 < beuno> do we only want to go red when they're >= 100?
14:48 < beuno> maybe 98/99 is enough?
14:48 < nessita> beuno: hum, good idea
14:48 < nessita> beuno: maybe >= 95
14:48 < nessita> beuno: that's a very good idea!

\o/

review: Approve
85. By Natalia Bidart

Setting red quota label when usage reaches or exceeds QUOTA_THRESHOLD.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Quota usage 95% percent: http://ubuntuone.com/p/fNr/
Quota usage 94% percent: http://ubuntuone.com/p/fNs/

86. By Natalia Bidart

Merged trunk in.

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looking good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
--- ubuntuone/controlpanel/gtk/gui.py 2011-02-28 20:02:28 +0000
+++ ubuntuone/controlpanel/gtk/gui.py 2011-02-28 22:22:10 +0000
@@ -1161,7 +1161,7 @@
1161 ControlPanelMixin.__init__(self)1161 ControlPanelMixin.__init__(self)
11621162
1163 self.label = LabelLoading(LOADING)1163 self.label = LabelLoading(LOADING)
1164 self.pack_start(self.label, expand=False)1164 self.pack_start(self.label, expand=True)
11651165
1166 self.button = gtk.LinkButton(uri='')1166 self.button = gtk.LinkButton(uri='')
1167 self.button.connect('clicked', self._on_button_clicked)1167 self.button.connect('clicked', self._on_button_clicked)
@@ -1309,7 +1309,8 @@
1309 gobject.TYPE_NONE, ()),1309 gobject.TYPE_NONE, ()),
1310 }1310 }
13111311
1312 QUOTA_LABEL = _('Using %(used)s of %(total)s (%(percentage).1f%%)')1312 QUOTA_LABEL = _('Using %(used)s of %(total)s (%(percentage).0f%%)')
1313 QUOTA_THRESHOLD = 0.95
1313 DASHBOARD_BUTTON_NAME = 'Account'1314 DASHBOARD_BUTTON_NAME = 'Account'
1314 SERVICES_BUTTON_NAME = 'Devices' # Intentional until the theme is fixed1315 SERVICES_BUTTON_NAME = 'Devices' # Intentional until the theme is fixed
13151316
@@ -1339,7 +1340,7 @@
1339 self.quota_box.reorder_child(self.quota_label, 0)1340 self.quota_box.reorder_child(self.quota_label, 0)
13401341
1341 self.status_label = FileSyncStatus()1342 self.status_label = FileSyncStatus()
1342 self.status_box.pack_end(self.status_label, expand=False)1343 self.status_box.pack_end(self.status_label, expand=True)
13431344
1344 self.dashboard = DashboardPanel(main_window=main_window)1345 self.dashboard = DashboardPanel(main_window=main_window)
1345 self.volumes = VolumesPanel(main_window=main_window)1346 self.volumes = VolumesPanel(main_window=main_window)
@@ -1375,15 +1376,22 @@
13751376
1376 def _update_quota(self, msg, data=None):1377 def _update_quota(self, msg, data=None):
1377 """Update the quota info."""1378 """Update the quota info."""
1378 self.quota_label.set_markup(msg)
1379 self.quota_label.stop()
1380
1381 fraction = 0.01379 fraction = 0.0
1382 if data is not None:1380 if data is not None:
1383 fraction = data.get('percentage', 0.0) / 1001381 fraction = data.get('percentage', 0.0) / 100
1384 if fraction > 0 and fraction < 0.05:1382 if fraction > 0 and fraction < 0.05:
1385 fraction = 0.051383 fraction = 0.05
1386 self.quota_progressbar.set_fraction(fraction)1384 else:
1385 fraction = round(fraction, 2)
1386
1387 logger.debug('ManagementPanel: updating quota to %r.', fraction)
1388 if fraction >= self.QUOTA_THRESHOLD:
1389 self.quota_label.set_markup(WARNING_MARKUP % msg)
1390 else:
1391 self.quota_label.set_markup(msg)
1392 self.quota_label.stop()
1393
1394 self.quota_progressbar.set_fraction(min(fraction, 1))
13871395
1388 def load(self):1396 def load(self):
1389 """Load the account info and file sync status list."""1397 """Load the account info and file sync status list."""
13901398
=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui.py'
--- ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-02-28 19:53:50 +0000
+++ ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-02-28 22:22:10 +0000
@@ -2281,15 +2281,18 @@
2281 """Check that the displayed account info matches 'info'."""2281 """Check that the displayed account info matches 'info'."""
2282 used = int(info['quota_used'])2282 used = int(info['quota_used'])
2283 total = int(info['quota_total'])2283 total = int(info['quota_total'])
2284 percentage = (used / total) * 1002284 percentage = round((used / total) * 100, 2)
2285 expected = {'used': self.ui.humanize(used),2285 expected = {'used': self.ui.humanize(used),
2286 'total': self.ui.humanize(total),2286 'total': self.ui.humanize(total),
2287 'percentage': percentage}2287 'percentage': percentage}
2288 self.assertEqual(self.ui.quota_label.get_text(),2288 msg = self.ui.QUOTA_LABEL % expected
2289 self.ui.QUOTA_LABEL % expected)2289 self.assertEqual(self.ui.quota_label.get_text(), msg)
2290
2291 if percentage >= self.ui.QUOTA_THRESHOLD * 100:
2292 self.assert_warning_correct(self.ui.quota_label, msg)
22902293
2291 if progressbar_fraction is None:2294 if progressbar_fraction is None:
2292 progressbar_fraction = percentage / 1002295 progressbar_fraction = min(percentage / 100, 1)
2293 self.assertEqual(self.ui.quota_progressbar.get_fraction(),2296 self.assertEqual(self.ui.quota_progressbar.get_fraction(),
2294 progressbar_fraction)2297 progressbar_fraction)
22952298
@@ -2408,16 +2411,13 @@
2408 """The account info is processed when ready."""2411 """The account info is processed when ready."""
2409 self.ui.on_account_info_ready(FAKE_ACCOUNT_INFO)2412 self.ui.on_account_info_ready(FAKE_ACCOUNT_INFO)
2410 self.assert_account_info_correct(FAKE_ACCOUNT_INFO)2413 self.assert_account_info_correct(FAKE_ACCOUNT_INFO)
24112414 self.assertFalse(self.ui.quota_label.active)
2412 for widget in (self.ui.quota_label,):
2413 self.assertFalse(widget.active)
24142415
2415 def test_on_account_info_error(self):2416 def test_on_account_info_error(self):
2416 """The account info couldn't be retrieved."""2417 """The account info couldn't be retrieved."""
2417 self.ui.on_account_info_error()2418 self.ui.on_account_info_error()
2418 for widget in (self.ui.quota_label,):2419 self.assert_warning_correct(self.ui.quota_label, gui.VALUE_ERROR)
2419 self.assert_warning_correct(widget, gui.VALUE_ERROR)2420 self.assertFalse(self.ui.quota_label.active)
2420 self.assertFalse(widget.active)
24212421
2422 def test_on_account_info_ready_quota_unused(self):2422 def test_on_account_info_ready_quota_unused(self):
2423 """The used quota is correct when unused."""2423 """The used quota is correct when unused."""
@@ -2434,6 +2434,26 @@
24342434
2435 self.assert_account_info_correct(info, progressbar_fraction=0.05)2435 self.assert_account_info_correct(info, progressbar_fraction=0.05)
24362436
2437 def test_on_account_info_ready_quota_used_at_threshold(self):
2438 """Show red notification when quota usage is same as threshold."""
2439 info = FAKE_ACCOUNT_INFO.copy()
2440
2441 info['quota_total'] = '12345678'
2442 info['quota_used'] = str(int(int(info['quota_total']) *
2443 self.ui.QUOTA_THRESHOLD))
2444 self.ui.on_account_info_ready(info)
2445
2446 self.assert_account_info_correct(info)
2447
2448 def test_on_account_info_ready_quota_over_threshold(self):
2449 """Show red notification when quota usage is higher than threshold."""
2450 info = FAKE_ACCOUNT_INFO.copy()
2451 info['quota_total'] = '12345678'
2452 info['quota_used'] = info['quota_total'] + '0'
2453 self.ui.on_account_info_ready(info)
2454
2455 self.assert_account_info_correct(info)
2456
2437 def test_file_sync_status(self):2457 def test_file_sync_status(self):
2438 """The file sync status is shown correctly."""2458 """The file sync status is shown correctly."""
2439 self.assertIsInstance(self.ui.status_label, gui.FileSyncStatus)2459 self.assertIsInstance(self.ui.status_label, gui.FileSyncStatus)

Subscribers

People subscribed via source and target branches