~chipaca/ubuntuone-control-panel/diego-sarmentero-delivers

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/controlpanel.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2011-06-23 13:01:38 UTC
  • mfrom: (168.1.3 greet-and-report-quota)
  • Revision ID: tarmac-20110623130138-pf1j6zoot25fcllu
  - Added control panel's gretting and glogal quota usage information
    (LP: #800683).
  
  - Improved Cloud Folders tab to match spec:
    - Removed contact icon.
    - Removed checkbox for Root folder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
"""The user interface for the control panel for Ubuntu One."""
21
21
 
 
22
from __future__ import division
 
23
 
22
24
from PyQt4 import QtGui, QtCore
23
25
from twisted.internet import defer
24
26
 
25
27
from ubuntuone.controlpanel import backend
26
28
from ubuntuone.controlpanel.logger import setup_logging, log_call
27
 
from ubuntuone.controlpanel.gui import EDIT_ACCOUNT_LINK
 
29
from ubuntuone.controlpanel.gui import (
 
30
    humanize,
 
31
    EDIT_ACCOUNT_LINK,
 
32
    GREETING,
 
33
    QUOTA_LABEL,
 
34
)
28
35
from ubuntuone.controlpanel.gui.qt import uri_hook
29
36
from ubuntuone.controlpanel.gui.qt.ui import controlpanel_ui
30
37
 
61
68
    @log_call(logger.debug)
62
69
    def process_info(self, info):
63
70
        """Process and display the account info."""
64
 
        # TODO: update storage usage
 
71
        name = info['name']
 
72
        self.ui.greeting_label.setText(GREETING % {'user_display_name': name})
 
73
 
 
74
        used = int(info['quota_used'])
 
75
        total = int(info['quota_total'])
 
76
        data = {'used': humanize(used), 'total': humanize(total),
 
77
                'percentage': (used / total) * 100}
 
78
        self.ui.quota_usage_label.setText(QUOTA_LABEL % data)
65
79
 
66
80
    @QtCore.pyqtSlot()
67
81
    def on_get_more_space_button_clicked(self):