3
# Copyright (c) 2004-2010 Canonical
5
# 2005 Martin Willemoes Hansen
6
# 2010 Mohamed Amine IL Idrissi
8
# Author: Michiel Sikkes <michiel@eyesopened.nl>
9
# Michael Vogt <mvo@debian.org>
10
# Martin Willemoes Hansen <mwh@sysrq.dk>
11
# Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com>
12
# Alex Launi <alex.launi@canonical.com>
14
# This program is free software; you can redistribute it and/or
15
# modify it under the terms of the GNU General Public License as
16
# published by the Free Software Foundation; either version 2 of the
17
# License, or (at your option) any later version.
19
# This program is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU General Public License for more details.
24
# You should have received a copy of the GNU General Public License
25
# along with this program; if not, write to the Free Software
26
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29
from __future__ import absolute_import, print_function
31
from gi.repository import Gtk
34
warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning)
39
from .backend import get_backend
41
from gettext import gettext as _
42
from gettext import ngettext
44
from .Core.utils import (inhibit_sleep,
47
class UpdateProgress(object):
50
# Used for inhibiting power management
51
self.sleep_cookie = None
54
# get the install backend
55
self.install_backend = get_backend(None)
56
self.install_backend.connect("action-done", self._on_backend_done)
58
def invoke_manager(self):
59
# don't display apt-listchanges
60
os.environ["APT_LISTCHANGES_FRONTEND"]="none"
62
# Do not suspend during the update process
63
(self.sleep_dev, self.sleep_cookie) = inhibit_sleep()
65
self.install_backend.update()
67
def _on_backend_done(self, backend, action, authorized, success):
68
# Allow suspend after synaptic is finished
70
allow_sleep(self.sleep_dev, self.sleep_cookie)
71
self.sleep_cookie = self.sleep_dev = None
73
# Either quit the current blocking loop and continue or quit altogether