~nataliabidart/ubuntu/oneiric/ubuntuone-control-panel/ubuntuone-control-panel-2.0.0

« back to all changes in this revision

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

  • Committer: Sebastien Bacher
  • Date: 2011-07-25 13:17:38 UTC
  • mfrom: (25.1.2 ubuntuone-control-panel)
  • Revision ID: seb128@ubuntu.com-20110725131738-yuevatnd859d1phs
Tags: 1.1.1-0ubuntu1
releasing version 1.1.1-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Authors: Alejandro J. Cura <alecu@canonical.com>
 
4
#          Natalia B. Bidart <natalia.bidart@canonical.com>
 
5
#
 
6
# Copyright 2011 Canonical Ltd.
 
7
#
 
8
# This program is free software: you can redistribute it and/or modify it
 
9
# under the terms of the GNU General Public License version 3, as published
 
10
# by the Free Software Foundation.
 
11
#
 
12
# This program is distributed in the hope that it will be useful, but
 
13
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
14
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
15
# PURPOSE.  See the GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License along
 
18
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
"""The user interface for the control panel for Ubuntu One."""
 
21
 
 
22
from twisted.internet import defer
 
23
 
 
24
from ubuntuone.controlpanel.logger import setup_logging, log_call
 
25
from ubuntuone.controlpanel.gui import (
 
26
    EDIT_ACCOUNT_LINK,
 
27
    EDIT_PROFILE_LINK,
 
28
)
 
29
from ubuntuone.controlpanel.gui.qt.ubuntuonebin import UbuntuOneBin
 
30
from ubuntuone.controlpanel.gui.qt.ui import account_ui
 
31
 
 
32
 
 
33
logger = setup_logging('qt.account')
 
34
 
 
35
 
 
36
class AccountPanel(UbuntuOneBin):
 
37
    """The Account Tab Panel widget"""
 
38
 
 
39
    ui_class = account_ui
 
40
 
 
41
    def _setup(self):
 
42
        """Do some extra setupping for the UI."""
 
43
        self.ui.edit_profile_button.uri = EDIT_PROFILE_LINK
 
44
        self.ui.edit_services_button.uri = EDIT_ACCOUNT_LINK
 
45
 
 
46
    @defer.inlineCallbacks
 
47
    def load(self):
 
48
        """Load info."""
 
49
        self.is_processing = True
 
50
        info = yield self.backend.account_info()
 
51
        self.process_info(info)
 
52
 
 
53
    @log_call(logger.debug)
 
54
    def process_info(self, info):
 
55
        """Process and display the account info."""
 
56
        self.ui.name_label.setText(info["name"])
 
57
        self.ui.email_label.setText(info["email"])
 
58
        self.ui.services_description_label.setText(info["type"])
 
59
 
 
60
        self.is_processing = False