~diegosarmentero/ubuntuone-windows-installer/847796

« back to all changes in this revision

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

- Uninstall when the user chooses "Disagree & uninstall" (LP: #829361).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Authors: Diego Sarmentero <diego.sarmentero@canonical.com>
 
4
#
 
5
# Copyright 2011 Canonical Ltd.
 
6
#
 
7
# This program is free software: you can redistribute it and/or modify it
 
8
# under the terms of the GNU General Public License version 3, as published
 
9
# by the Free Software Foundation.
 
10
#
 
11
# This program is distributed in the hope that it will be useful, but
 
12
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
13
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
14
# PURPOSE.  See the GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along
 
17
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
"""Utils Functions Windows specific."""
 
20
 
 
21
 
 
22
import sys
 
23
import os
 
24
 
 
25
import win32api
 
26
 
 
27
 
 
28
def uninstall_application():
 
29
    """Uninstall Ubuntu One."""
 
30
    if hasattr(sys, "frozen"):
 
31
        exec_path = os.path.abspath(sys.executable)
 
32
    else:
 
33
        exec_path = os.path.dirname(__file__)
 
34
    folder = os.path.dirname(exec_path)
 
35
    uninstall_path = os.path.join(os.path.dirname(folder), "uninstall.exe")
 
36
    win32api.ShellExecute(None, 'runas',
 
37
        uninstall_path,
 
38
        '--mode=qt', '', 0)