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

« back to all changes in this revision

Viewing changes to UpdateManager/MetaReleaseGObject.py

  • Committer: Michael Vogt
  • Date: 2005-11-15 14:44:23 UTC
  • Revision ID: egon@top-20051115144423-5d01f44d63b99ecc
* build-system tweaks

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#  Copyright (c) 2004-2007 Canonical
2
 
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
3
 
#
4
 
#  Author: Michael Vogt <michael.vogt@ubuntu.com>
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
8
 
#  published by the Free Software Foundation; either version 2 of the
9
 
#  License, or (at your option) any later version.
10
 
#
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.
15
 
#
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
 
 
21
 
from __future__ import absolute_import
22
 
 
23
 
from gi.repository import GLib
24
 
from gi.repository import GObject
25
 
from .Core.MetaRelease import MetaReleaseCore
26
 
 
27
 
 
28
 
class MetaRelease(MetaReleaseCore, GObject.GObject):
29
 
 
30
 
    __gsignals__ = {
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
 
    }
41
 
 
42
 
    def __init__(self, useDevelopmentRelease=False, useProposed=False,
43
 
                 debug=False):
44
 
        GObject.GObject.__init__(self)
45
 
        MetaReleaseCore.__init__(self, useDevelopmentRelease, useProposed,
46
 
                                 debug)
47
 
        # in the gtk space to test if the download already finished
48
 
        # this is needed because gtk is not thread-safe
49
 
        GLib.timeout_add_seconds(1, self.check)
50
 
 
51
 
    def check(self):
52
 
        # check if we have a metarelease_information file
53
 
        if self.no_longer_supported is not None:
54
 
            self.emit("dist_no_longer_supported")
55
 
        if self.new_dist is not None:
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