Merge lp:~nataliabidart/ubuntuone-control-panel/uninstall into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 310
Merged at revision: 307
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/uninstall
Merge into: lp:ubuntuone-control-panel
Diff against target: 475 lines (+174/-122)
7 files modified
ubuntuone/controlpanel/gui/qt/controlpanel.py (+3/-4)
ubuntuone/controlpanel/gui/qt/gui.py (+1/-2)
ubuntuone/controlpanel/gui/qt/tests/test_wizard.py (+12/-1)
ubuntuone/controlpanel/gui/qt/wizard.py (+4/-8)
ubuntuone/controlpanel/utils/__init__.py (+8/-4)
ubuntuone/controlpanel/utils/tests/test_windows.py (+103/-69)
ubuntuone/controlpanel/utils/windows.py (+43/-34)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/uninstall
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Brian Curtin (community) Approve
Review via email: mp+100012@code.launchpad.net

Commit message

- When user rejects the License, also uninstall the application (LP: #968327).

To post a comment you must log in.
307. By Natalia Bidart

Merged trunk in.

308. By Natalia Bidart

Merged trunk in.

309. By Natalia Bidart

- No more runas as parameter to shellexecute.

310. By Natalia Bidart

Restoring the 'runas' param for autoupdate.

Revision history for this message
Brian Curtin (brian.curtin) wrote :

Looks fine, and IRL tests of uninstallation on Windows XP and Windows 7 both function properly with these changes.

review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

Everything looks good from spain.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/controlpanel/gui/qt/controlpanel.py'
--- ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-21 19:17:21 +0000
+++ ubuntuone/controlpanel/gui/qt/controlpanel.py 2012-03-30 17:37:31 +0000
@@ -1,5 +1,5 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
22#
3# Copyright 2012 Canonical Ltd.3# Copyright 2012 Canonical Ltd.
4#4#
5# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
@@ -174,7 +174,6 @@
174 @log_call(logger.info)174 @log_call(logger.info)
175 def start_from_license(self):175 def start_from_license(self):
176 """Use the license page as first page."""176 """Use the license page as first page."""
177 # license177 license_id = self.ui.wizard.pages[self.ui.wizard.license_page]
178 self.ui.wizard.setStartId(self.ui.wizard.pages[178 self.ui.wizard.setStartId(license_id)
179 self.ui.wizard.license_page])
180 self.ui.wizard.restart()179 self.ui.wizard.restart()
181180
=== modified file 'ubuntuone/controlpanel/gui/qt/gui.py'
--- ubuntuone/controlpanel/gui/qt/gui.py 2012-03-26 13:23:57 +0000
+++ ubuntuone/controlpanel/gui/qt/gui.py 2012-03-30 17:37:31 +0000
@@ -43,8 +43,7 @@
43 self.ui.setupUi(self)43 self.ui.setupUi(self)
44 self.close_callback = close_callback44 self.close_callback = close_callback
45 self._setup()45 self._setup()
46 self.quit_action = QtGui.QAction(self,46 self.quit_action = QtGui.QAction(self, triggered=self.close)
47 triggered=self.close)
48 self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"])47 self.quit_action.setShortcuts(["Ctrl+q", "Ctrl+w"])
49 self.addAction(self.quit_action)48 self.addAction(self.quit_action)
50 self.installer = installer49 self.installer = installer
5150
=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_wizard.py'
--- ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-26 21:00:47 +0000
+++ ubuntuone/controlpanel/gui/qt/tests/test_wizard.py 2012-03-30 17:37:31 +0000
@@ -157,6 +157,7 @@
157 @defer.inlineCallbacks157 @defer.inlineCallbacks
158 def setUp(self):158 def setUp(self):
159 yield super(UbuntuOneWizardTestCase, self).setUp()159 yield super(UbuntuOneWizardTestCase, self).setUp()
160 self.patch(gui.utils, 'uninstall_application', self.fail)
160 self.patch(self.ui.confirm_dialog, 'exec_',161 self.patch(self.ui.confirm_dialog, 'exec_',
161 lambda: self.confirm_response)162 lambda: self.confirm_response)
162163
@@ -260,7 +261,7 @@
260 button.click()261 button.click()
261262
262 self.assertEqual(self._called, (signal_args, {}),263 self.assertEqual(self._called, (signal_args, {}),
263 msg % (name, signal, signal_args))264 msg % (name, signal, signal_args))
264 self._called = False265 self._called = False
265266
266 def test_done_rejected(self):267 def test_done_rejected(self):
@@ -336,6 +337,16 @@
336 page_name = 'license'337 page_name = 'license'
337 stage_name = 'install'338 stage_name = 'install'
338339
340 @defer.inlineCallbacks
341 def setUp(self):
342 yield super(UbuntuOneWizardLicensePage, self).setUp()
343 self.patch(gui.utils, 'uninstall_application', self._set_called)
344
345 def test_done_rejected(self):
346 """When the wizard is closed on the final page, emit rejected."""
347 super(UbuntuOneWizardLicensePage, self).test_done_rejected()
348 self.assertEqual(self._called, ((), {}))
349
339350
340class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):351class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):
341 """Test the login through the wizard."""352 """Test the login through the wizard."""
342353
=== modified file 'ubuntuone/controlpanel/gui/qt/wizard.py'
--- ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-26 20:15:58 +0000
+++ ubuntuone/controlpanel/gui/qt/wizard.py 2012-03-30 17:37:31 +0000
@@ -23,7 +23,7 @@
23from ubuntu_sso.qt.sso_wizard_page import BaseWizardPage23from ubuntu_sso.qt.sso_wizard_page import BaseWizardPage
24from ubuntu_sso.utils.ui import CLOSE_AND_SETUP_LATER24from ubuntu_sso.utils.ui import CLOSE_AND_SETUP_LATER
2525
26from ubuntuone.controlpanel import cache26from ubuntuone.controlpanel import cache, utils
27from ubuntuone.controlpanel.logger import log_call, setup_logging27from ubuntuone.controlpanel.logger import log_call, setup_logging
28from ubuntuone.controlpanel.gui import (28from ubuntuone.controlpanel.gui import (
29 APP_NAME,29 APP_NAME,
@@ -342,13 +342,9 @@
342 response = self.confirm_dialog.exec_()342 response = self.confirm_dialog.exec_()
343 if response == QtGui.QDialog.Accepted:343 if response == QtGui.QDialog.Accepted:
344 logger.warning('UbuntuOneWizard: user canceled setup.')344 logger.warning('UbuntuOneWizard: user canceled setup.')
345 self.rejected.emit()345 if self.currentId() == self.pages[self.license_page]:
346 elif (self.currentId() == self.pages[self.license_page]):346 logger.warning('UbuntuOneWizard: user wants to uninstall.')
347 response = self.confirm_dialog.exec_()347 utils.uninstall_application()
348 if response == QtGui.QDialog.Accepted:
349 logger.warning('UbuntuOneWizard: user wants to uninstall.')
350 # TODO: needs implementation in this project
351 ##qt.utils.uninstall_application()
352 self.rejected.emit()348 self.rejected.emit()
353 else:349 else:
354 super(UbuntuOneWizard, self).done(result)350 super(UbuntuOneWizard, self).done(result)
355351
=== modified file 'ubuntuone/controlpanel/utils/__init__.py'
--- ubuntuone/controlpanel/utils/__init__.py 2012-03-22 23:28:19 +0000
+++ ubuntuone/controlpanel/utils/__init__.py 2012-03-30 17:37:31 +0000
@@ -32,19 +32,23 @@
32# ignore issues with the name of the method32# ignore issues with the name of the method
33# pylint: disable=C010333# pylint: disable=C0103
3434
35no_op = lambda *args, **kwargs: None
36
35# import the platform dependent code.37# import the platform dependent code.
36if sys.platform == 'win32':38if sys.platform == 'win32':
37 from ubuntuone.controlpanel.utils import windows39 from ubuntuone.controlpanel.utils import windows
40 add_to_autostart = windows.add_to_autostart
38 are_updates_present = windows.are_updates_present41 are_updates_present = windows.are_updates_present
39 default_folders = windows.default_folders42 default_folders = windows.default_folders
40 perform_update = windows.perform_update43 perform_update = windows.perform_update
41 add_to_autostart = windows.add_to_autostart44 uninstall_application = windows.uninstall_application
42else:45else:
43 from ubuntuone.controlpanel.utils import linux46 from ubuntuone.controlpanel.utils import linux
44 are_updates_present = lambda *args, **kwargs: False47 add_to_autostart = no_op
48 are_updates_present = no_op
45 default_folders = linux.default_folders49 default_folders = linux.default_folders
46 perform_update = lambda *args, **kwargs: None50 perform_update = no_op
47 add_to_autostart = lambda *args, **kwargs: None51 uninstall_application = no_op
4852
49# pylint: enable=C010353# pylint: enable=C0103
5054
5155
=== modified file 'ubuntuone/controlpanel/utils/tests/test_windows.py'
--- ubuntuone/controlpanel/utils/tests/test_windows.py 2012-03-27 18:55:37 +0000
+++ ubuntuone/controlpanel/utils/tests/test_windows.py 2012-03-30 17:37:31 +0000
@@ -1,7 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2
3#2#
4# Copyright 2011 Canonical Ltd.3# Copyright 2011-2012 Canonical Ltd.
5#4#
6# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -28,6 +27,34 @@
28# let me use protected methods27# let me use protected methods
29# pylint: disable=W021228# pylint: disable=W0212
3029
30SOME_EXE_NAME = 'foo.exe'
31
32
33class FrozenTestCase(TestCase):
34 """A base test case for handling frozen/not frozen systems."""
35
36 frozen = True
37 executable = 'path/to/current/exe/ubuntuone/dist/executable.exe'
38
39 @defer.inlineCallbacks
40 def setUp(self):
41 """Set the different tests."""
42 yield super(FrozenTestCase, self).setUp()
43
44 for attr_name in ('frozen', 'executable'):
45 value_not_set = object()
46 value = getattr(utils.windows.sys, attr_name, value_not_set)
47
48 if self.frozen is not None:
49 setattr(utils.windows.sys, attr_name, getattr(self, attr_name))
50 elif self.frozen is None and value is not value_not_set:
51 delattr(utils.windows.sys, attr_name)
52
53 if self.frozen is not None and value is value_not_set:
54 self.addCleanup(delattr, utils.windows.sys, attr_name)
55 elif value is not value_not_set:
56 self.addCleanup(setattr, utils.windows.sys, attr_name, value)
57
3158
32class AutoupdaterTestCase(TestCase):59class AutoupdaterTestCase(TestCase):
33 """Test the code that is used for the auto update process."""60 """Test the code that is used for the auto update process."""
@@ -36,7 +63,9 @@
36 def setUp(self):63 def setUp(self):
37 """Prepare for the diff tests."""64 """Prepare for the diff tests."""
38 yield super(AutoupdaterTestCase, self).setUp()65 yield super(AutoupdaterTestCase, self).setUp()
39 self.auto_update_path = r'path\to\exe'66 self._base_path = r'path\to\exe'
67 self.auto_update_path = os.path.join(self._base_path,
68 utils.windows.AUTOUPDATE_EXE_NAME)
40 self.return_from_call = 069 self.return_from_call = 0
41 self.command = None70 self.command = None
42 self.args = []71 self.args = []
@@ -48,8 +77,8 @@
48 return self.return_from_call77 return self.return_from_call
4978
50 self.patch(utils.windows, 'getProcessValue', fake_execute_process)79 self.patch(utils.windows, 'getProcessValue', fake_execute_process)
51 self.patch(utils.windows, '_get_update_path',80 self.patch(utils.windows, 'get_exe_path',
52 lambda: self.auto_update_path)81 lambda exe_name: os.path.join(self._base_path, exe_name))
5382
54 @defer.inlineCallbacks83 @defer.inlineCallbacks
55 def test_are_updates_present_true(self):84 def test_are_updates_present_true(self):
@@ -81,11 +110,9 @@
81 """Test the method that performs the update."""110 """Test the method that performs the update."""
82 self.patch(utils.windows.win32api, 'ShellExecute', self._set_called)111 self.patch(utils.windows.win32api, 'ShellExecute', self._set_called)
83 utils.perform_update()112 utils.perform_update()
84 self.assertIn(self.auto_update_path, self._called[0][2])113 args = (None, 'runas', self.auto_update_path,
85 self.assertEqual('runas', self._called[0][1])114 '--unattendedmodeui none', '', 0)
86 self.assertEqual('--unattendedmodeui none', self._called[0][3])115 self.assertEqual(self._called, (args, {}))
87 self.assertEqual('', self._called[0][4])
88 self.assertEqual(0, self._called[0][5])
89116
90117
91class FakeOpenKey(object):118class FakeOpenKey(object):
@@ -217,15 +244,14 @@
217 self.test_special_folders(names=('PERSONAL', 'MYMUSIC', 'MYPICTURES'))244 self.test_special_folders(names=('PERSONAL', 'MYMUSIC', 'MYPICTURES'))
218245
219246
220class GetPathTestCase(TestCase):247class GetExePathTestCase(FrozenTestCase):
221 """Test the code that is used for the auto update process."""248 """Test the path calculator when sys is frozen."""
222249
223 @defer.inlineCallbacks250 @defer.inlineCallbacks
224 def setUp(self):251 def setUp(self):
225 """Set the different tests."""252 """Set the different tests."""
226 yield super(GetPathTestCase, self).setUp()253 yield super(GetExePathTestCase, self).setUp()
227 self.called = []254 self.called = []
228 self.exec_path = 'path/to/current/exe'
229 self.exists = True255 self.exists = True
230256
231 def fake_abspath(path):257 def fake_abspath(path):
@@ -248,62 +274,70 @@
248 self.patch(utils.windows.os.path, 'dirname', fake_dirname)274 self.patch(utils.windows.os.path, 'dirname', fake_dirname)
249 self.patch(utils.windows.os.path, 'exists', fake_exists)275 self.patch(utils.windows.os.path, 'exists', fake_exists)
250276
251 def _delete_frozen_state(self):277 def test_get_exe_path(self):
252 """Delete the frozen state."""278 """Test the method used to get the autoupdate."""
253 del utils.windows.sys.frozen279 path = utils.windows.get_exe_path(exe_name=SOME_EXE_NAME)
254 del utils.windows.sys.executable280
255281 self.assertEqual(os.path.join(self.executable, SOME_EXE_NAME), path)
256 def test_get_auto_update_path_frozen(self):282
257 """Test the method used to get the autoupdate."""283 expected = ['os.path.abspath', 'os.path.dirname', 'os.path.dirname',
258 # patch the diff parts of sys so that we get fake paths284 'os.path.exists']
259 is_frozen = hasattr(utils.windows.sys, 'frozen')285 self.assertEqual(expected, self.called)
260 if not is_frozen:286
261 utils.windows.sys.frozen = True287 def test_get_exe_path_not_present(self):
262 utils.windows.sys.executable = self.exec_path
263 self.addCleanup(self._delete_frozen_state)
264
265 # called method and assert that we have the correct result
266 path = utils.windows._get_update_path()
267 self.assertEqual(os.path.join(self.exec_path,
268 utils.windows.AUTOUPDATE_EXE_NAME), path)
269 self.assertTrue('os.path.abspath' in self.called)
270 self.assertTrue('os.path.dirname' in self.called)
271 self.assertTrue('os.path.exists' in self.called)
272
273 def _reset_frozen_state(self, old_frozen, old_exec_path):
274 """Reset the frozen state."""
275 utils.windows.sys.frozen = old_frozen
276 utils.windows.sys.executable = old_exec_path
277
278 def _reset__file__(self, path):
279 """Reset the value of __file__."""
280 utils.windows.__file__ = path
281
282 def test_get_auto_update_path_not_frozen(self):
283 """Test the method used to get the autoupdate."""
284 is_frozen = hasattr(utils.windows.sys, 'frozen')
285 if is_frozen:
286 old_frozen = utils.windows.sys.frozen
287 old_exec_path = utils.windows.sys.executable
288 del utils.windows.sys.frozen
289 del utils.windows.sys.executable
290 self.addCleanup(self._reset_frozen_state, old_frozen,
291 old_exec_path)
292 # set a fake __file__ for the module
293 old_file = utils.windows.__file__
294 utils.windows.__file__ = self.exec_path
295 self.addCleanup(self._reset__file__, old_file)
296
297 path = utils.windows._get_update_path()
298 self.assertEqual(os.path.join(self.exec_path,
299 utils.windows.AUTOUPDATE_EXE_NAME), path)
300 self.assertEqual(2, self.called.count('os.path.dirname'))
301 self.assertTrue('os.path.exists' in self.called)
302
303 def test_get_auto_update_path_not_present(self):
304 """Test the method used to get the autoupdate."""288 """Test the method used to get the autoupdate."""
305 self.exists = False289 self.exists = False
306290
307 # called method and assert that we have the correct result291 # called method and assert that we have the correct result
308 path = utils.windows._get_update_path()292 path = utils.windows.get_exe_path(exe_name=SOME_EXE_NAME)
309 self.assertEqual(None, path)293 self.assertTrue(path is None)
294
295
296class GetExePathNotFrozenTestCase(GetExePathTestCase):
297 """Test the path calculator when sys is not frozen."""
298
299 frozen = None
300
301 def test_get_exe_path(self):
302 """Test the method used to get the autoupdate."""
303 self.patch(utils.windows, '__file__', self.executable)
304
305 path = utils.windows.get_exe_path(exe_name=SOME_EXE_NAME)
306 self.assertEqual(os.path.join(self.executable, SOME_EXE_NAME), path)
307
308 expected = ['os.path.dirname', 'os.path.dirname', 'os.path.dirname',
309 'os.path.exists']
310 self.assertEqual(expected, self.called)
311
312
313class UninstallApplicationTestCase(FrozenTestCase):
314 """Test the uninstall_application helper when sys is frozen."""
315
316 @defer.inlineCallbacks
317 def setUp(self):
318 yield super(UninstallApplicationTestCase, self).setUp()
319 self.patch(utils.windows.win32api, "ShellExecute", self._set_called)
320 self.patch(os.path, "exists", lambda path: True)
321
322 def test_uninstall(self):
323 """The uninstaller is run."""
324 utils.uninstall_application()
325
326 exe_name = utils.windows.UNINSTALL_EXE_NAME
327 uninstall_path = utils.windows.get_exe_path(exe_name=exe_name)
328 self.assertEqual(self._called,
329 ((None, '', uninstall_path, '--mode win32', '', 0), {}))
330
331 def test_uninstall_exe_not_present(self):
332 """The uninstaller is not run if not available."""
333 self.patch(os.path, "exists", lambda path: False)
334
335 utils.uninstall_application()
336
337 self.assertFalse(self._called)
338
339
340class UninstallApplicationNotFrozenTestCase(UninstallApplicationTestCase):
341 """Test the uninstall_application helper when sys is not frozen."""
342
343 frozen = None
310344
=== modified file 'ubuntuone/controlpanel/utils/windows.py'
--- ubuntuone/controlpanel/utils/windows.py 2012-03-23 21:48:53 +0000
+++ ubuntuone/controlpanel/utils/windows.py 2012-03-30 17:37:31 +0000
@@ -1,7 +1,6 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2
3#2#
4# Copyright 2011 Canonical Ltd.3# Copyright 2011-2012 Canonical Ltd.
5#4#
6# This program is free software: you can redistribute it and/or modify it5# This program is free software: you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
@@ -35,19 +34,41 @@
35logger = setup_logging('utils.windows')34logger = setup_logging('utils.windows')
36AUTOUPDATE_EXE_NAME = 'autoupdate-windows.exe'35AUTOUPDATE_EXE_NAME = 'autoupdate-windows.exe'
37AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"36AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
3837UNINSTALL_EXE_NAME = 'uninstall.exe'
3938
40def _get_update_path():39
40def get_exe_path(exe_name):
41 """Return the path in which the autoupdate command is found."""41 """Return the path in which the autoupdate command is found."""
42 if hasattr(sys, 'frozen'):42 if getattr(sys, 'frozen', False):
43 exec_path = os.path.abspath(sys.executable)43 exec_path = os.path.abspath(sys.executable)
44 else:44 else:
45 exec_path = os.path.dirname(__file__)45 exec_path = os.path.dirname(__file__)
46 folder = os.path.dirname(exec_path)46
47 update_path = os.path.join(folder, AUTOUPDATE_EXE_NAME)47 result = None
48 if os.path.exists(update_path):48 folder = os.path.dirname(os.path.dirname(exec_path))
49 return update_path49 exe_path = os.path.join(folder, exe_name)
50 return None50 if os.path.exists(exe_path):
51 result = exe_path
52
53 return result
54
55
56def add_to_autostart():
57 """Add syncdaemon to the session's autostart."""
58 if getattr(sys, "frozen", False):
59 sd_path = '"%s"' % os.path.join(os.path.dirname(
60 os.path.abspath(sys.executable)),
61 "ubuntuone-syncdaemon.exe")
62 u1cp_path = '"%s"' % os.path.join(os.path.dirname(
63 os.path.abspath(sys.executable)),
64 "ubuntuone-control-panel-qt.exe")
65
66 with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, AUTORUN_KEY,
67 0, _winreg.KEY_ALL_ACCESS) as key:
68 # pylint: disable=E0602
69 _winreg.SetValueEx(key, "Ubuntu One", 0, _winreg.REG_SZ, sd_path)
70 _winreg.SetValueEx(key, "Ubuntu One Icon", 0, _winreg.REG_SZ,
71 u1cp_path + " --minimized --with-icon")
5172
5273
53@defer.inlineCallbacks74@defer.inlineCallbacks
@@ -55,7 +76,7 @@
55 """Return if there are updates for Ubuntu One."""76 """Return if there are updates for Ubuntu One."""
56 result = False77 result = False
57 retcode = None78 retcode = None
58 update_path = _get_update_path()79 update_path = get_exe_path(exe_name=AUTOUPDATE_EXE_NAME)
59 if update_path is not None:80 if update_path is not None:
60 # If there is an update present we will get 0, non-zero otherwise81 # If there is an update present we will get 0, non-zero otherwise
61 retcode = yield getProcessValue(update_path, args=('--mode',82 retcode = yield getProcessValue(update_path, args=('--mode',
@@ -92,27 +113,15 @@
92113
93def perform_update():114def perform_update():
94 """Spawn the autoupdate process and call the stop function."""115 """Spawn the autoupdate process and call the stop function."""
95 update_path = _get_update_path()116 update_path = get_exe_path(exe_name=AUTOUPDATE_EXE_NAME)
96 if update_path is not None:117 if update_path is not None:
97 # lets call the updater with the commands that are required,118 # lets call the updater with the commands that are required,
98 win32api.ShellExecute(None, 'runas',119 win32api.ShellExecute(None, 'runas', update_path,
99 update_path,120 '--unattendedmodeui none', '', 0)
100 '--unattendedmodeui none', '', 0)121
101122
102123def uninstall_application():
103def add_to_autostart():124 """Uninstall Ubuntu One."""
104 """Add syncdaemon to the session's autostart."""125 uninstall_path = get_exe_path(exe_name=UNINSTALL_EXE_NAME)
105 if getattr(sys, "frozen", False):126 if uninstall_path is not None:
106 sd_path = '"%s"' % os.path.join(os.path.dirname(127 win32api.ShellExecute(None, '', uninstall_path, '--mode win32', '', 0)
107 os.path.abspath(sys.executable)),
108 "ubuntuone-syncdaemon.exe")
109 u1cp_path = '"%s"' % os.path.join(os.path.dirname(
110 os.path.abspath(sys.executable)),
111 "ubuntuone-control-panel-qt.exe")
112
113 with _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, AUTORUN_KEY,
114 0, _winreg.KEY_ALL_ACCESS) as key:
115 # pylint: disable=E0602
116 _winreg.SetValueEx(key, "Ubuntu One", 0, _winreg.REG_SZ, sd_path)
117 _winreg.SetValueEx(key, "Ubuntu One Icon", 0, _winreg.REG_SZ,
118 u1cp_path + " --minimized --with-icon")

Subscribers

People subscribed via source and target branches