~diegosarmentero/ubuntuone-windows-installer/successful-page

« back to all changes in this revision

Viewing changes to ubuntuone_installer/gui/qt/utils/windows.py

  • Committer: diego.sarmentero at canonical
  • Date: 2011-10-24 12:33:36 UTC
  • mfrom: (81.1.1 ubuntuone-windows-installer)
  • Revision ID: diego.sarmentero@canonical.com-20111024123336-r8a12tg2fb2ert8h
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
from twisted.internet.utils import getProcessValue
39
39
from twisted.internet.threads import deferToThread
40
40
 
 
41
# pylint: disable=E0611
41
42
from ubuntuone.platform import tools
 
43
# pylint: enable=E0611
 
44
from ubuntuone.platform.credentials import CredentialsManagementTool
42
45
 
43
46
AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
44
47
 
98
101
 
99
102
 
100
103
@defer.inlineCallbacks
 
104
def check_credentials(gui, logger, success_cb, error_cb,
 
105
                      installer=False):
 
106
    """Check credentials and either start u1cp or show the wizard."""
 
107
    credtool = CredentialsManagementTool()
 
108
    # pylint: disable=W0703
 
109
    try:
 
110
        creds = yield credtool.find_credentials()
 
111
    except Exception, exc:
 
112
        error_cb(exc, logger)
 
113
    else:
 
114
        yield success_cb(creds, gui, installer, logger, start_control_panel,
 
115
                         check_updates)
 
116
 
 
117
 
 
118
@defer.inlineCallbacks
101
119
def are_updates_present(logger):
102
120
    """Return if there are updates for Ubuntu One."""
103
121
    update_path = _get_update_path()
125
143
            '--unattendedmodeui none', '', 0)
126
144
 
127
145
 
 
146
@defer.inlineCallbacks
 
147
def check_updates(gui, logger):
 
148
    """Check for updates."""
 
149
    logger.info('Checking for updates.')
 
150
    # the idea is simple, check if there are updates, ask user if we perform
 
151
    # the update and continue.
 
152
    are_present = yield are_updates_present(logger)
 
153
    logger.debug('Updates present: %r', are_updates_present)
 
154
    if are_present:
 
155
        logger.info('Updates are present.')
 
156
        if gui.user_wants_to_update():
 
157
            logger.info('Performing auto-update in diff process.')
 
158
            perform_update()
 
159
    else:
 
160
        logger.info('No updates are present.')
 
161
 
 
162
 
128
163
def start_control_panel(with_icon=True):
129
164
    """Start the control panel."""
130
165
    # If we are in windows and "frozen", assume it's in