~ubuntu-core-dev/update-manager/main

450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
1
#  Copyright (c) 2004-2007 Canonical
2511.1.9 by Michael Terry
more pep8 fixes
2
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
2511.1.14 by Michael Terry
auto-pep8'd some warnings
3
#
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
4
#  Author: Michael Vogt <michael.vogt@ubuntu.com>
2511.1.14 by Michael Terry
auto-pep8'd some warnings
5
#
6
#  This program is free software; you can redistribute it and/or
7
#  modify it under the terms of the GNU General Public License as
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
8
#  published by the Free Software Foundation; either version 2 of the
9
#  License, or (at your option) any later version.
2511.1.14 by Michael Terry
auto-pep8'd some warnings
10
#
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
11
#  This program is distributed in the hope that it will be useful,
12
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
#  GNU General Public License for more details.
2511.1.14 by Michael Terry
auto-pep8'd some warnings
15
#
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
16
#  You should have received a copy of the GNU General Public License
17
#  along with this program; if not, write to the Free Software
18
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19
#  USA
20
2409 by Colin Watson
Tell Python to use absolute imports by default, and annotate cases where
21
from __future__ import absolute_import
22
2567 by Michael Terry
Use GLib.timeout_add_seconds instead of deprecated GObject.timeout_add
23
from gi.repository import GLib
2119.1.1 by Robert Roth
Porting to PyGI
24
from gi.repository import GObject
2409 by Colin Watson
Tell Python to use absolute imports by default, and annotate cases where
25
from .Core.MetaRelease import MetaReleaseCore
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
26
2511.1.9 by Michael Terry
more pep8 fixes
27
28
class MetaRelease(MetaReleaseCore, GObject.GObject):
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
29
2511.1.14 by Michael Terry
auto-pep8'd some warnings
30
    __gsignals__ = {
2511.1.9 by Michael Terry
more pep8 fixes
31
        'new_dist_available': (GObject.SignalFlags.RUN_LAST,
32
                               None,
33
                               (GObject.TYPE_PYOBJECT,)),
34
        'dist_no_longer_supported': (GObject.SignalFlags.RUN_LAST,
35
                                     None,
36
                                     ()),
37
        'done_downloading': (GObject.SignalFlags.RUN_LAST,
38
                             None,
39
                             ())
40
    }
450 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
41
2933 by Brian Murray
If --debug is used on the command line pass it along to the metarelease
42
    def __init__(self, useDevelopmentRelease=False, useProposed=False,
43
                 debug=False):
2119.1.1 by Robert Roth
Porting to PyGI
44
        GObject.GObject.__init__(self)
2933 by Brian Murray
If --debug is used on the command line pass it along to the metarelease
45
        MetaReleaseCore.__init__(self, useDevelopmentRelease, useProposed,
46
                                 debug)
453 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
47
        # in the gtk space to test if the download already finished
48
        # this is needed because gtk is not thread-safe
2567 by Michael Terry
Use GLib.timeout_add_seconds instead of deprecated GObject.timeout_add
49
        GLib.timeout_add_seconds(1, self.check)
453 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
50
51
    def check(self):
52
        # check if we have a metarelease_information file
53
        if self.no_longer_supported is not None:
1385 by Michael Vogt
* UpdateManager/Core/MetaRelease.py, UpdateManager/MetaReleaseGObject.py:
54
            self.emit("dist_no_longer_supported")
453 by Michael Vogt
* UpdateManager/MetaReleaseGObject.py:
55
        if self.new_dist is not None:
2428.4.5 by Michael Terry
move meta release checking into main UpdateManager class; use dialog panes for those interactions rather than popup dialogs
56
            self.emit("new_dist_available", self.new_dist)
57
        if self.downloading:
58
            return True
59
        else:
60
            self.emit("done_downloading")
61
            return False