src/updatemanager.py
author John Rice <john.rice@sun.com>
Wed, 29 Oct 2008 15:46:31 +0000
changeset 638 53b78e3428fc
parent 636 a8306e269861
child 641 f8001bcf3d09
permissions -rw-r--r--
4126 I10n update for IPS GUI and UM
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     2
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     4
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     8
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    13
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    19
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    21
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    22
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    23
# Use is subject to license terms.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    24
#
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    25
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    26
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    27
import getopt
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    28
import os
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    29
import sys
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    30
import time
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    31
import locale
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    32
import gettext
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    33
import pango
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    34
from threading import Thread
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    35
from threading import Timer
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    36
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    37
try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    38
        import gobject
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    39
        gobject.threads_init()        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    40
        import gtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    41
        import gtk.glade
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    42
        import pygtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    43
        pygtk.require("2.0")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    44
except ImportError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    45
        sys.exit(1)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    46
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    47
import pkg.client.image as image
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    48
import pkg.client.api as api
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    49
import pkg.client.api_errors as api_errors
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    50
import pkg.client.progress as progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    51
import pkg.gui.beadmin as beadm
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    52
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    53
IMAGE_DIRECTORY_DEFAULT = "/"   # Image default directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    54
IMAGE_DIR_COMMAND = "svcprop -p update/image_dir svc:/application/pkg/update"
636
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 603
diff changeset
    55
CLIENT_API_VERSION = 4          # API version
a8306e269861 4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents: 603
diff changeset
    56
PKG_CLIENT_NAME = "updatemanager" # API client name
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    57
SELECTION_CHANGE_LIMIT = 0.5    # Time limit in seconds to cancel selection updates
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    58
IND_DELAY = 0.05                # Time delay for printing index progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    59
UPDATES_FETCH_DELAY = 200       # Time to wait before fetching updates, allows gtk main
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    60
                                # loop time to start and display main UI
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    61
EX_DISC_QUOTA_EXCEEDED = 49     # Disc quota exceeded exception
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    62
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    63
#UM Row Model
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    64
(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    65
UM_ID,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    66
UM_INSTALL_MARK,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    67
UM_STATUS,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    68
UM_NAME,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    69
UM_REBOOT,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    70
UM_LATEST_VER,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    71
UM_SIZE,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    72
UM_FMRI,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    73
) = range(8)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    74
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    75
#UPDATE STEPS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    76
(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    77
UPDATE_EVAL,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    78
UPDATE_DOWNLOAD,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    79
UPDATE_INSTALL,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    80
UPDATE_INDEX,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    81
) = range(4)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    82
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    83
#UPDATE TYPES
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    84
(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    85
UPDATE_ACTIVE,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    86
UPDATE_INACTIVE,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    87
UPDATE_DONE,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    88
) = range(3)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    89
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    90
class GUIProgressTracker(progress.ProgressTracker):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    91
        """ This progress tracker is designed for Gnome GUI's
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    92
        The parent must provide a number of callback methods to render progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    93
        in the GUI context. """
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    94
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    95
        def __init__(self, parent):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    96
                progress.ProgressTracker.__init__(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    97
                self.parent = parent
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
    98
                gettext.bindtextdomain("pkg", "/usr/share/locale")
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
    99
                gettext.textdomain("pkg")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   100
                locale.setlocale(locale.LC_ALL, '')
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   101
                self._ = gettext.gettext
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   102
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   103
                self.act_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   104
                self.ind_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   105
                self.last_print_time = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   106
                self.dl_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   107
                self.dl_cur_pkg = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   108
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   109
        def reset(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   110
                progress.ProgressTracker.reset(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   111
                self.act_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   112
                self.ind_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   113
                self.last_print_time = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   114
                self.dl_started = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   115
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   116
        def cat_output_start(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   117
                catstr = self._("Fetching catalog: '%s' ..." % (self.cat_cur_catalog))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   118
                gobject.idle_add(self.parent.output, "%s" % catstr)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   119
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   120
        def cat_output_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   121
                gobject.idle_add(self.parent.output_done, self._("Fetching catalog"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   122
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   123
        def eval_output_start(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   124
                s = self._("Creating Plan ... ")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   125
                gobject.idle_add(self.parent.output, "%s" % s)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   126
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   127
        def eval_output_progress(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   128
                if (time.time() - self.last_print_time) >= 0.10:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   129
                        self.last_print_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   130
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   131
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   132
                gobject.idle_add(self.parent.progress_pulse)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   133
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   134
        def eval_output_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   135
                gobject.idle_add(self.parent.output_done, self._("Creating Plan"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   136
                self.last_print_time = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   137
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   138
        def ver_output(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   139
                if self.ver_cur_fmri != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   140
                        if (time.time() - self.last_print_time) >= 0.10:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   141
                                self.last_print_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   142
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   143
                                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   144
                        gobject.idle_add(self.parent.progress_pulse)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   145
                        gobject.idle_add(self.parent.output, \
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   146
                                self._("Verifying: %s ...") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   147
                                self.ver_cur_fmri.get_pkg_stem())
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   148
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   149
                        gobject.idle_add(self.parent.output, "")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   150
                        self.last_print_time = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   151
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   152
        def ver_output_error(self, actname, errors):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   153
                gobject.idle_add(self.parent.output_done, self._("Verifying"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   154
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   155
        def dl_output(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   156
                gobject.idle_add(self.parent.dl_progress, 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   157
                        self.dl_started, self.dl_cur_pkg, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   158
                        self.dl_cur_npkgs, self.dl_goal_npkgs, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   159
                        self.dl_cur_nfiles, self.dl_goal_nfiles, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   160
                        self.dl_cur_nbytes / 1024.0 / 1024.0, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   161
                        self.dl_goal_nbytes / 1024.0 / 1024.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   162
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   163
                if not self.dl_started:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   164
                        self.dl_started = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   165
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   166
        def dl_output_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   167
                self.dl_cur_pkg = self._("Completed")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   168
                self.dl_output()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   169
                gobject.idle_add(self.parent.output_done, self._("Download"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   170
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   171
        def act_output(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   172
                if (time.time() - self.last_print_time) >= 0.05:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   173
                        self.last_print_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   174
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   175
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   176
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   177
                gobject.idle_add(self.parent.act_progress, self.act_started, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   178
                        self.act_phase, self.act_cur_nactions, self.act_goal_nactions)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   179
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   180
                if not self.act_started:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   181
                        self.act_started = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   182
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   183
        def act_output_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   184
                self.act_output()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   185
                gobject.idle_add(self.parent.output_done, self._("Install"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   186
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   187
        def ind_output(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   188
                if (time.time() - self.last_print_time) >= IND_DELAY:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   189
                        self.last_print_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   190
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   191
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   192
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   193
                gobject.idle_add(self.parent.ind_progress, self.ind_started, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   194
                        self.ind_phase, self.ind_cur_nitems, self.ind_goal_nitems)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   195
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   196
                if not self.ind_started:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   197
                        self.ind_started = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   198
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   199
        def ind_output_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   200
                self.act_output()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   201
                gobject.idle_add(self.parent.output_done, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   202
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   203
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   204
class Updatemanager:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   205
        def __init__(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   206
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   207
                        self.application_dir = os.environ["UPDATE_MANAGER_ROOT"]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   208
                except KeyError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   209
                        self.application_dir = "/"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   210
                locale.setlocale(locale.LC_ALL, '')
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   211
                # UpdateManager can call BE Management Dialog that uses the
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   212
                # packagemanager.glade file, so we wanta  single domain for strings from
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   213
                # updatemanager.glade and packagemanager.glade
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   214
                for module in (gettext, gtk.glade):
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   215
                        module.bindtextdomain("pkg", self.application_dir +
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   216
                            "/usr/share/locale")
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   217
                        module.textdomain("pkg")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   218
                # Required for pkg strings used in pkg API
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   219
                self._ = gettext.gettext                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   220
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   221
                # Duplicate ListStore setup in get_updates_to_list()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   222
                self.um_list = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   223
                    gtk.ListStore(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   224
                        gobject.TYPE_INT,         # UM_ID
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   225
                        gobject.TYPE_BOOLEAN,     # UM_INSTALL_MARK
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   226
                        gtk.gdk.Pixbuf,           # UM_STATUS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   227
                        gobject.TYPE_STRING,      # UM_NAME
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   228
                        gtk.gdk.Pixbuf,           # UM_REBOOT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   229
                        gobject.TYPE_STRING,      # UM_LATEST_VER
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   230
                        gobject.TYPE_STRING,      # UM_SIZE
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   231
                        gobject.TYPE_STRING,      # UM_FMRI                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   232
                        )
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   233
                self.progress_stop_thread = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   234
                self.initial_active = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   235
                self.initial_default = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   236
                self.last_select_time = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   237
                self.size_thread_running = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   238
                self.cancelled = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   239
                self.fmri_description = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   240
                self.install = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   241
                self.install_error = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   242
                self.done_icon = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   243
                self.blank_icon = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   244
                self.update_stage = UPDATE_EVAL
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   245
                self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   246
                self.selection_timer = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   247
                self.package_selection = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   248
                self.cur_pkg = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   249
                self.show_all_opts = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   250
                self.show_install_updates_only = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   251
                self.do_refresh = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   252
                self.ua_start = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   253
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   254
                # Progress Dialog
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   255
                self.gladefile = self.application_dir + \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   256
                    "/usr/share/update-manager/updatemanager.glade"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   257
                w_xmltree_progress = gtk.glade.XML(self.gladefile, "progressdialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   258
                self.w_progress_dialog = w_xmltree_progress.get_widget("progressdialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   259
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   260
                self.w_progressinfo_label = w_xmltree_progress.get_widget("progressinfo")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   261
                self.w_progressinfo_separator = w_xmltree_progress.get_widget(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   262
                        "progressinfo_separator")                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   263
                self.w_progressinfo_expander = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   264
                        w_xmltree_progress.get_widget("progressinfo_expander")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   265
                self.w_progressinfo_textview = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   266
                        w_xmltree_progress.get_widget("progressinfo_textview")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   267
                infobuffer = self.w_progressinfo_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   268
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   269
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   270
                self.w_progressinfo_expander_label = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   271
                        w_xmltree_progress.get_widget("progressinfo_expander_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   272
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   273
                self.w_progress_install_vbox = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   274
                        w_xmltree_progress.get_widget("progress_install_vbox")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   275
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   276
                self.w_progress_eval_img = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   277
                        w_xmltree_progress.get_widget("progress_eval_img")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   278
                self.w_progress_eval_label = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   279
                        w_xmltree_progress.get_widget("progress_eval_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   280
                self.w_progress_download_img = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   281
                        w_xmltree_progress.get_widget("progress_download_img")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   282
                self.w_progress_download_label = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   283
                        w_xmltree_progress.get_widget("progress_download_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   284
                self.w_progress_install_img = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   285
                        w_xmltree_progress.get_widget("progress_install_img")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   286
                self.w_progress_install_label = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   287
                        w_xmltree_progress.get_widget("progress_install_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   288
                self.w_progress_index_img = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   289
                        w_xmltree_progress.get_widget("progress_index_img")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   290
                self.w_progress_index_label = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   291
                        w_xmltree_progress.get_widget("progress_index_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   292
                self.w_progress_closeon_finish_chk = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   293
                        w_xmltree_progress.get_widget("closeon_finish_checkbutton")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   294
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   295
                self.w_progress_cancel = w_xmltree_progress.get_widget("progresscancel")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   296
                self.w_progress_ok = w_xmltree_progress.get_widget("progressok")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   297
                self.w_progressbar = w_xmltree_progress.get_widget("progressbar")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   298
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   299
                # UM Dialog
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   300
                w_xmltree_um = gtk.glade.XML(self.gladefile, "um_dialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   301
                self.w_um_dialog = w_xmltree_um.get_widget("um_dialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   302
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   303
                self.w_um_dialog.connect("destroy", self.__on_um_dialog_close)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   304
                self.w_um_intro_label = w_xmltree_um.get_widget("um_intro_label")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   305
                self.w_um_install_button = w_xmltree_um.get_widget("um_install_button")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   306
                self.w_um_updateall_button = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   307
                        w_xmltree_um.get_widget("um_updateall_button")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   308
                self.w_um_expander = w_xmltree_um.get_widget("um_expander")
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   309
                self.w_um_expander.set_expanded(True)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   310
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   311
                self.w_progress_dialog.set_transient_for(self.w_um_dialog)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   312
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   313
                self.w_um_scrolledwindow = w_xmltree_um.get_widget("um_scrolledwindow")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   314
                self.w_um_treeview = w_xmltree_um.get_widget("um_treeview")  
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   315
                self.w_um_textview = w_xmltree_um.get_widget("um_textview")  
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   316
                infobuffer = self.w_um_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   317
                infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   318
                self.w_select_checkbox = w_xmltree_um.get_widget("selectall_checkbutton")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   319
                self.w_delete_button = w_xmltree_um.get_widget("cancel_button")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   320
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   321
                # ua_confirm_dialog
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   322
                w_xmltree_ua = gtk.glade.XML(self.gladefile, "ua_confirm_dialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   323
                self.w_ua_confirm_dialog = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   324
                        w_xmltree_ua.get_widget("ua_confirm_dialog")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   325
                self.w_ua_be_name_entry = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   326
                        w_xmltree_ua.get_widget("ua_be_name_entry")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   327
                self.w_ua_proceed_button = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   328
                        w_xmltree_ua.get_widget("ua_proceed_button")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   329
                self.w_ua_cancel_button = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   330
                        w_xmltree_ua.get_widget("ua_cancel_button")                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   331
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   332
                self.details_cache = {}
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   333
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   334
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   335
                        dic = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   336
                            {
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   337
                                "on_um_dialog_close": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   338
                                    self.__on_um_dialog_close,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   339
                                "on_cancel_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   340
                                    self.__on_cancel_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   341
                                "on_install_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   342
                                    self.__on_install_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   343
                                "on_um_updateall_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   344
                                    self.__on_updateall_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   345
                                "on_um_expander_activate": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   346
                                    self.__on_um_expander_activate,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   347
                                "on_selectall_checkbutton_toggled": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   348
                                    self.__on_selectall_checkbutton_toggled,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   349
                            }
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   350
                        w_xmltree_um.signal_autoconnect(dic)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   351
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   352
                        dic_progress = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   353
                            {
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   354
                                "on_progresscancel_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   355
                                    self.__on_progresscancel_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   356
                                "on_progressok_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   357
                                    self.__on_progressok_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   358
                            }
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   359
                        w_xmltree_progress.signal_autoconnect(dic_progress)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   360
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   361
                        dic_ua = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   362
                            {
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   363
                                "on_ua_cancel_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   364
                                    self.__on_ua_cancel_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   365
                                "on_ua_proceed_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   366
                                    self.__on_ua_proceed_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   367
                            }
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   368
                        w_xmltree_ua.signal_autoconnect(dic_ua)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   369
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   370
                except AttributeError, error:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   371
                        print self._('GUI will not respond to any event! %s. \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   372
                            Check updatemanager.py signals') \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   373
                            % error
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   374
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   375
                self.pr = GUIProgressTracker(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   376
                self.api_obj = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   377
 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   378
                self.w_um_dialog.show_all()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   379
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   380
        def __set_cancel_state(self, status):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   381
                if self.install_error:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   382
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   383
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   384
                if status:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   385
                        gobject.idle_add(self.w_progress_cancel.grab_focus)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   386
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   387
                gobject.idle_add(self.w_progress_cancel.set_sensitive, status)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   388
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   389
        def __progress_step(self, type_step, img, label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   390
                if type_step == UPDATE_ACTIVE:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   391
                        self.__progress_active_step(img, label, str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   392
                elif type_step == UPDATE_DONE:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   393
                        self.__progress_done_step(img, label, str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   394
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   395
                        self.__progress_inactive_step(img, label, str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   396
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   397
        def __progress_steps(self, eval_type, evaluate, dl_type, download, install_type, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   398
                install, index_type, index):                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   399
                self.__progress_step(eval_type, self.w_progress_eval_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   400
                        self.w_progress_eval_label, evaluate)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   401
                self.__progress_step(dl_type, self.w_progress_download_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   402
                        self.w_progress_download_label,download)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   403
                self.__progress_step(install_type, self.w_progress_install_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   404
                        self.w_progress_install_label, install)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   405
                self.__progress_step(index_type, self.w_progress_index_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   406
                        self.w_progress_index_label, index)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   407
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   408
        def __progress_steps_start(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   409
                self.__progress_steps(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   410
                        UPDATE_ACTIVE, self._("Evaluate"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   411
                        UPDATE_INACTIVE, self._("Download"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   412
                        UPDATE_INACTIVE, self._("Install"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   413
                        UPDATE_INACTIVE, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   414
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   415
        def __progress_steps_download(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   416
                self.__progress_steps(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   417
                        UPDATE_DONE, self._("Evaluate"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   418
                        UPDATE_ACTIVE, self._("Download"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   419
                        UPDATE_INACTIVE, self._("Install"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   420
                        UPDATE_INACTIVE, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   421
 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   422
        def __progress_steps_install(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   423
                self.__progress_steps(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   424
                        UPDATE_DONE, self._("Evaluate"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   425
                        UPDATE_DONE, self._("Download"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   426
                        UPDATE_ACTIVE, self._("Install"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   427
                        UPDATE_INACTIVE, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   428
 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   429
        def __progress_steps_index(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   430
                self.__progress_steps(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   431
                        UPDATE_DONE, self._("Evaluate"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   432
                        UPDATE_DONE, self._("Download"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   433
                        UPDATE_DONE, self._("Install"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   434
                        UPDATE_ACTIVE, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   435
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   436
        def __progress_steps_done(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   437
                self.__progress_steps(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   438
                        UPDATE_DONE, self._("Evaluate"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   439
                        UPDATE_DONE, self._("Download"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   440
                        UPDATE_DONE, self._("Install"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   441
                        UPDATE_DONE, self._("Index"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   442
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   443
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   444
        def __progress_cancel_eval(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   445
                self.__progress_cancel_step(self.w_progress_eval_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   446
                        self.w_progress_eval_label, self._("Evaluate - canceling..."))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   447
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   448
        def __progress_cancel_download(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   449
                self.__progress_cancel_step(self.w_progress_download_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   450
                        self.w_progress_download_label, self._("Download - canceling..."))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   451
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   452
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   453
        def __progress_error_eval(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   454
                self.__progress_error_step(self.w_progress_eval_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   455
                        self.w_progress_eval_label, self._("Evaluate - failed"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   456
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   457
        def __progress_error_download(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   458
                self.__progress_error_step(self.w_progress_download_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   459
                        self.w_progress_download_label, self._("Download - failed"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   460
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   461
        def __progress_error_install(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   462
                self.__progress_error_step(self.w_progress_install_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   463
                        self.w_progress_install_label, self._("Install - failed"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   464
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   465
        def __progress_error_index(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   466
                self.__progress_error_step(self.w_progress_index_img, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   467
                        self.w_progress_index_label, self._("Index - failed"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   468
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   469
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   470
        def __progress_active_step(widget_image, widget_label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   471
                widget_label.set_markup("<b>%s</b>" % str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   472
                widget_image.set_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_MENU) 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   473
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   474
        def __progress_inactive_step(self, widget_image, widget_label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   475
                widget_label.set_text("%s" % str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   476
                widget_image.set_from_pixbuf(self.blank_icon)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   477
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   478
        def __progress_done_step(self, widget_image, widget_label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   479
                widget_label.set_markup("<b>%s</b>" % str_step)                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   480
                widget_image.set_from_pixbuf(self.done_icon)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   481
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   482
        def __progress_error_step(self, widget_image, widget_label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   483
                widget_label.set_markup("<b>%s</b>" % str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   484
                widget_image.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   485
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   486
                # On error open the Details panel and make sure the Window is visible
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   487
                # to the user, even if it has been minimized
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   488
                self.w_progressinfo_expander.set_expanded(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   489
                self.w_progress_cancel.set_sensitive(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   490
                self.w_um_dialog.present()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   491
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   492
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   493
        def __progress_cancel_step(widget_image, widget_label, str_step):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   494
                widget_label.set_markup("<b>%s</b>" % str_step)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   495
                widget_image.set_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU) 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   496
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   497
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   498
        def __set_initial_selection(self):
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   499
                if len(self.um_list) == 0:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   500
                        return                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   501
                self.w_um_treeview.set_cursor(0, None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   502
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   503
        def __remove_installed(self, installed_fmris):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   504
                model = self.w_um_treeview.get_model()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   505
                iter_next = model.get_iter_first()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   506
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   507
                installed_fmris_dic = dict([(k, None) for k in installed_fmris])
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   508
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   509
                while iter_next != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   510
                        if model.get_value(iter_next, UM_NAME) in installed_fmris_dic:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   511
                                self.um_list.remove(iter_next)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   512
                                self.toggle_counter -= 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   513
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   514
                                iter_next = model.iter_next(iter_next)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   515
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   516
        def __mark_cell_data_default_function(self, column, renderer, model, itr, data):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   517
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   518
                        if model.get_value(itr, UM_STATUS) != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   519
                                self.__set_renderer_active(renderer, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   520
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   521
                                self.__set_renderer_active(renderer, True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   522
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   523
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   524
        def __set_renderer_active(renderer, active):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   525
                if active:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   526
                        renderer.set_property("sensitive", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   527
                        renderer.set_property("mode", gtk.CELL_RENDERER_MODE_ACTIVATABLE)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   528
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   529
                        renderer.set_property("sensitive", False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   530
                        renderer.set_property("mode", gtk.CELL_RENDERER_MODE_INERT)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   531
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   532
        def __get_icon_pixbuf(self, icon_name):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   533
                return self.__get_pixbuf_from_path(self.application_dir + \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   534
                    "/usr/share/icons/update-manager/", icon_name)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   535
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   536
        #
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   537
        def get_icon_pixbuf(self, icon_name):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   538
                return self.__get_pixbuf_from_path(self.application_dir + \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   539
                    "/usr/share/icons/package-manager/", icon_name)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   540
                    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   541
        def __get_app_pixbuf(self, icon_name):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   542
                return self.__get_pixbuf_from_path(self.application_dir + \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   543
                    "/usr/share/update-manager/", icon_name)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   544
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   545
        def __get_pixbuf_from_path(self, path, icon_name):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   546
                icon = icon_name.replace(' ', '_')
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   547
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   548
                # Performance: Faster to check if files exist rather than catching
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   549
                # exceptions when they do not. Picked up open failures using dtrace
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   550
                png_exists = os.path.exists(self.application_dir + path + icon + ".png")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   551
                svg_exists = os.path.exists(self.application_dir + path + icon + ".svg")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   552
                       
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   553
                if not png_exists and not svg_exists:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   554
                        return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   555
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   556
                        return gtk.gdk.pixbuf_new_from_file( \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   557
                            self.application_dir + path + icon + ".png")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   558
                except gobject.GError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   559
                        try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   560
                                return gtk.gdk.pixbuf_new_from_file( \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   561
                                    self.application_dir + path + icon + ".svg")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   562
                        except gobject.GError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   563
                                iconview = gtk.IconView()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   564
                                icon = iconview.render_icon(getattr(gtk, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   565
                                    "STOCK_MISSING_IMAGE"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   566
                                    size = gtk.ICON_SIZE_MENU,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   567
                                    detail = None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   568
                                # XXX Could return image-we don't want to show ugly icon.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   569
                                return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   570
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   571
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   572
        def __get_selected_fmris(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   573
                model = self.w_um_treeview.get_model()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   574
                iter_next = model.get_iter_first()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   575
                list_of_selected_fmris = []
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   576
                while iter_next != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   577
                        if model.get_value(iter_next, UM_INSTALL_MARK):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   578
                                list_of_selected_fmris.append(model.get_value(iter_next, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   579
                                    UM_NAME))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   580
                        iter_next = model.iter_next(iter_next)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   581
                return list_of_selected_fmris
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   582
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   583
        def init_tree_views(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   584
                model = self.w_um_treeview.get_model()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   585
                toggle_renderer = gtk.CellRendererToggle()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   586
                toggle_renderer.connect('toggled', self.__active_pane_toggle, model)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   587
                column = gtk.TreeViewColumn("", toggle_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   588
                    active = UM_INSTALL_MARK)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   589
                column.set_cell_data_func(toggle_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   590
                    self.__mark_cell_data_default_function, None)                    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   591
                toggle_renderer.set_property("activatable", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   592
                column.set_expand(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   593
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   594
                # Show Canceland Install Updates + selection column + checkbox
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   595
                if self.show_install_updates_only:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   596
                        self.w_um_updateall_button.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   597
                        self.show_all_opts = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   598
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   599
                # Show Cancel, Update All and Install Updates + selection column+checkbox
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   600
                if self.show_all_opts:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   601
                        self.w_select_checkbox.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   602
                        self.w_um_install_button.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   603
                        self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   604
                        self.w_um_intro_label.set_text(self._(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   605
                        "Updates are available for the following packages.\n" \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   606
                        "Select the packages you want to update and click Install."))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   607
                # Show Cancel, Update All only
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   608
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   609
                        self.w_select_checkbox.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   610
                        self.w_um_install_button.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   611
                        self.w_um_intro_label.set_text(self._(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   612
                        "Updates are available for the following packages.\n" \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   613
                        "Click Update All to create a new boot environment and " \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   614
                        "install all packages into it."))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   615
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   616
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   617
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   618
                column.pack_start(render_pixbuf, expand = False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   619
                column.add_attribute(render_pixbuf, "pixbuf", UM_STATUS)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   620
                column.set_title("   ")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   621
                # Hiding Status column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   622
                #self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   623
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   624
                name_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   625
                column = gtk.TreeViewColumn(self._("Name"), name_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   626
                    text = UM_NAME)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   627
                column.set_cell_data_func(name_renderer, self.__cell_data_function, None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   628
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   629
                self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   630
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   631
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   632
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   633
                column.pack_start(render_pixbuf, expand = True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   634
                column.add_attribute(render_pixbuf, "pixbuf", UM_REBOOT)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   635
                # Hiding Reboot required column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   636
                # self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   637
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   638
                version_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   639
                version_renderer.set_property('xalign', 0.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   640
                column = gtk.TreeViewColumn(self._("Latest Version"), version_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   641
                    text = UM_LATEST_VER) 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   642
                column.set_cell_data_func(version_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   643
                        self.__cell_data_function, None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   644
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   645
                self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   646
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   647
                size_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   648
                size_renderer.set_property('xalign', 0.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   649
                column = gtk.TreeViewColumn(self._("Size (Meg)"), size_renderer, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   650
                    text = UM_SIZE)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   651
                column.set_cell_data_func(size_renderer, self.__cell_data_function, None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   652
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   653
                # XXX Hiding Size as it takes too long to fetch at the minute
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   654
                #self.w_um_treeview.append_column(column)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   655
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   656
                #Added selection listener
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   657
                self.package_selection = self.w_um_treeview.get_selection()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   658
                self.package_selection.set_mode(gtk.SELECTION_SINGLE)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   659
                self.package_selection.connect("changed", \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   660
                    self.__on_package_selection_changed, None)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   661
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   662
                # Setup Icons
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   663
                self.done_icon = self.__get_icon_pixbuf("status_checkmark")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   664
                self.blank_icon = self.__get_icon_pixbuf("status_blank")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   665
                self.w_um_dialog.set_icon(self.__get_app_pixbuf("PM_package_36x"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   666
                self.w_ua_confirm_dialog.set_icon(self.__get_app_pixbuf("PM_package_36x"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   667
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   668
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   669
        def __get_image_path():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   670
                '''This function gets the image path or the default'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   671
                if local_image_dir != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   672
                        return local_image_dir
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   673
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   674
                image_directory = os.popen(IMAGE_DIR_COMMAND).readline().rstrip()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   675
                if len(image_directory) == 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   676
                        image_directory = IMAGE_DIRECTORY_DEFAULT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   677
                return image_directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   678
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   679
        def get_updates_to_list(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   680
                '''This function fetches a list of the updates
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   681
                        that are available to list'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   682
                # MUST match self.um_list ListStore setup in __init__
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   683
                um_list = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   684
                    gtk.ListStore(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   685
                        gobject.TYPE_INT,         # UM_ID
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   686
                        gobject.TYPE_BOOLEAN,     # UM_INSTALL_MARK
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   687
                        gtk.gdk.Pixbuf,           # UM_STATUS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   688
                        gobject.TYPE_STRING,      # UM_NAME
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   689
                        gtk.gdk.Pixbuf,           # UM_REBOOT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   690
                        gobject.TYPE_STRING,      # UM_LATEST_VER
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   691
                        gobject.TYPE_STRING,      # UM_SIZE
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   692
                        gobject.TYPE_STRING,      # UM_FMRI                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   693
                        )
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   694
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   695
                image_obj = self.__get_image_obj_from_directory(self.__get_image_path())
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   696
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   697
                count = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   698
                pkg_upgradeable = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   699
                for pkg, state in sorted(image_obj.inventory(all_known = True)):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   700
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   701
                                gtk.main_iteration(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   702
                        if state["upgradable"] and state["state"] == "installed":
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   703
                                pkg_upgradeable = pkg
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   704
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   705
                        # Allow testing by listing uninstalled packages, -u option
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   706
                        add_package = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   707
                        if pkg_upgradeable != None and not state["upgradable"]:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   708
                                if list_uninstalled:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   709
                                        add_package = not \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   710
                                        image_obj.fmri_is_same_pkg(pkg_upgradeable, pkg)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   711
                                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   712
                                        add_package = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   713
                                        image_obj.fmri_is_same_pkg(pkg_upgradeable, pkg)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   714
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   715
                        if add_package:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   716
                                count += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   717
                                # XXX: Would like to caputre if package for upgrade is
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   718
                                # incorporated, could then indicate this to user
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   719
                                # and take action when doing install to run image-update.
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   720
                                #if state["incorporated"]:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   721
                                #        incState = self._("Inc")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   722
                                #else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   723
                                #        incState = "--"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   724
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   725
                                um_list.insert(count, [count, False, None, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   726
                                        pkg.get_name(), None, pkg.get_version(), None, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   727
                                        pkg.get_fmri()])
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   728
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   729
                if debug:
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   730
                        print self._("count: %d") % count
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   731
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   732
                self.progress_stop_thread = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   733
                gobject.idle_add(self.w_um_treeview.set_model, um_list)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   734
                gobject.idle_add(self.__set_initial_selection)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   735
                self.um_list = um_list                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   736
                self.__selectall_toggle(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   737
                if len(self.um_list) == 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   738
                        self.__display_noupdates()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   739
                        return          
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   740
                        
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   741
                # XXX: Currently this will fetch the sizes but it really slows down the
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   742
                # app responsiveness - until we get caching I think we should just hide
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   743
                # the size column
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   744
                # gobject.timeout_add(1000, self.__setup_sizes)
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   745
                
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   746
        def __get_api_obj(self):
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   747
                if self.api_obj != None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   748
                        return self.api_obj
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   749
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   750
                        self.api_obj = api.ImageInterface(self.__get_image_path(), \
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   751
                                CLIENT_API_VERSION, self.pr, self.__set_cancel_state, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   752
                                PKG_CLIENT_NAME)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   753
                        return self.api_obj
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   754
                except api_errors.ImageNotFoundException, ine:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   755
                        self.w_um_expander.set_expanded(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   756
                        infobuffer = self.w_um_textview.get_buffer()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   757
                        infobuffer.set_text("")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   758
                        textiter = infobuffer.get_end_iter()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   759
                        infobuffer.insert_with_tags_by_name(textiter, self._("Error\n"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   760
                                "bold")
603
4000e193b337 4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents: 601
diff changeset
   761
                        infobuffer.insert(textiter, \
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   762
                                self._("'%s' is not an install image\n") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   763
                                ine.user_specified)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   764
                except api_errors.VersionException, ve:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   765
                        self.w_um_expander.set_expanded(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   766
                        infobuffer = self.w_um_textview.get_buffer()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   767
                        infobuffer.set_text("")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   768
                        textiter = infobuffer.get_end_iter()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   769
                        infobuffer.insert_with_tags_by_name(textiter, self._("Error\n"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   770
                                "bold")
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   771
                        infobuffer.insert(textiter, 
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   772
                                self._("Version mismatch: expected %s received %s\n") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   773
                                (ve.expected_version, ve.received_version))
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   774
                return None
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   775
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   776
        def __display_noupdates(self):
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   777
                self.w_um_scrolledwindow.set_policy(gtk.POLICY_NEVER, \
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   778
                        gtk.POLICY_AUTOMATIC)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   779
                self.w_um_expander.set_expanded(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   780
                infobuffer = self.w_um_textview.get_buffer()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   781
                textiter = infobuffer.get_end_iter()
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   782
                infobuffer.insert_with_tags_by_name(textiter, \
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   783
                        "\nNo Updates available", "bold")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   784
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   785
                self.w_um_install_button.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   786
                self.w_um_updateall_button.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   787
                self.w_select_checkbox.set_active(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   788
                self.w_select_checkbox.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   789
                self.w_um_dialog.present()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   790
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   791
        def __get_info_from_name(self, name):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   792
                local = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   793
                get_license = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   794
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   795
                if self.fmri_description != name:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   796
                        return None
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   797
                if self.__get_api_obj() == None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   798
                        return None
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   799
                        
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   800
                ret = self.__get_api_obj().info([name], local, get_license)
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   801
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   802
                pis = ret[api.ImageInterface.INFO_FOUND]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   803
                if len(pis) == 1:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   804
                        return pis[0]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   805
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   806
                        return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   807
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   808
        def __get_details_from_name(self, name):                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   809
                info = self.__get_info_from_name(name)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   810
                if info is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   811
                        return self.__update_details_from_info(name, info)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   812
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   813
                        return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   814
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   815
        def __update_details_from_info(self, name, info):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   816
                ver = "%s-%s" % (info.version, info.branch)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   817
                str_details = self._(\
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   818
                '\nDescription:\t\t%s\nFMRI:       \t\t%s' + \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   819
                '\nVersion:    \t\t%s\nPackaged on:\t\t%s' + \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   820
                '\nSize:       \t\t\t%.3f MB\n') \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   821
                        % (info.summary, info.fmri, ver, info.packaging_date, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   822
                        info.size/ 1024.0 / 1024.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   823
                self.details_cache[name] = str_details
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   824
                return str_details
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   825
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   826
        # This is copied from a similar function in packagemanager.py 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   827
        def __get_image_obj_from_directory(self, image_directory):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   828
                image_obj = image.Image()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   829
                dr = "/"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   830
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   831
                        image_obj.find_root(image_directory)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   832
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   833
                                gtk.main_iteration(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   834
                        image_obj.load_config()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   835
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   836
                                gtk.main_iteration(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   837
                        image_obj.load_catalogs(self.pr)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   838
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   839
                                gtk.main_iteration(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   840
                except ValueError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   841
                        print self._('%s is not valid image, trying root image') \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   842
                            % image_directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   843
                        try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   844
                                dr = os.environ["PKG_IMAGE"]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   845
                        except KeyError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   846
                                print
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   847
                        try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   848
                                image_obj.find_root(dr)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   849
                                image_obj.load_config()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   850
                        except ValueError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   851
                                print self._('%s is not valid root image, return None') \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   852
                                    % dr
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   853
                                image_obj = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   854
                return image_obj
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   855
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   856
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   857
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   858
        def __removed_filter(model, itr):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   859
                '''This function filters category in the main application view'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   860
                return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   861
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   862
        def __on_package_selection_changed(self, selection, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   863
                '''This function is for handling package selection changes'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   864
                model, itr = selection.get_selected()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   865
                if itr:                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   866
                        fmri = model.get_value(itr, UM_NAME) 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   867
                        delta = time.time() - self.last_select_time
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   868
                        if delta < SELECTION_CHANGE_LIMIT:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   869
                                if self.selection_timer is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   870
                                        self.selection_timer.cancel()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   871
                                        self.selection_timer = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   872
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   873
                        self.fmri_description = fmri
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   874
                        self.last_select_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   875
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   876
                        if self.details_cache.has_key(fmri):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   877
                                if self.selection_timer is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   878
                                        self.selection_timer.cancel()  
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   879
                                        self.selection_timer = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   880
                                infobuffer = self.w_um_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   881
                                infobuffer.set_text(self.details_cache[fmri])
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   882
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   883
                                infobuffer = self.w_um_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   884
                                infobuffer.set_text(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
   885
                                        self._("\nFetching details for %s ...") % fmri)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   886
                                self.selection_timer = Timer(SELECTION_CHANGE_LIMIT, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   887
                                        self.__show_package_info_thread, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   888
                                                args=(fmri, )).start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   889
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   890
        def __show_package_info_thread(self, fmri):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   891
                Thread(target = self.__show_package_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   892
                        args = (fmri, )).start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   893
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   894
        def __show_package_info(self, fmri):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   895
                details = self.__get_details_from_name(fmri)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   896
                if self.fmri_description == fmri and details != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   897
                        infobuffer = self.w_um_textview.get_buffer()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   898
                        infobuffer.set_text("")
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   899
                        textiter = infobuffer.get_end_iter()
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   900
                        infobuffer.insert_with_tags_by_name(textiter, \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   901
                                "\n%s\n" % fmri, "bold")
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   902
                        infobuffer.insert(textiter, details)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   903
                elif self.fmri_description == fmri and details == None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   904
                        infobuffer = self.w_um_textview.get_buffer()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   905
                        textiter = infobuffer.get_end_iter()
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   906
                        infobuffer.insert_with_tags_by_name(textiter, \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   907
                                "\nNo details available", "bold")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   908
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   909
        def __on_um_dialog_close(self, widget):
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   910
                self.__exit_app()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   911
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   912
        def __on_cancel_button_clicked(self, widget):
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   913
                self.__exit_app()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   914
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   915
        def __exit_app(self):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   916
                self.cancelled = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   917
                gtk.main_quit()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   918
                sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   919
                return True
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   920
        
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   921
        def __on_progressok_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   922
                self.w_progress_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   923
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   924
        def __on_progresscancel_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   925
                if self.install_error:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   926
                        self.w_progress_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   927
                        self.w_progressinfo_expander.set_expanded(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   928
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   929
                if self.api_obj != None and self.api_obj.can_be_canceled():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   930
                        if self.update_stage == UPDATE_EVAL:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   931
                                self.__progress_cancel_eval()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   932
                        elif  self.update_stage == UPDATE_DOWNLOAD:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   933
                                self.__progress_cancel_download()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   934
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   935
                        self.__update_progress_info(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   936
                                self._("\nCanceling update, please wait ..."))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   937
                        self.w_progress_cancel.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   938
                        Thread(target = self.api_obj.cancel).start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   939
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   940
                        self.__update_progress_info(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   941
                                self._("\nUnable to cancel at this time."))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   942
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   943
        def __on_install_button_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   944
                self.setup_progressdialog_show(self._("Installing Updates"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   945
                        showCancel = True, showOK = True, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   946
                        isInstall = True, showCloseOnFinish = debug)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   947
                Thread(target = self.__install).start()   
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   948
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   949
        def __on_ua_cancel_button_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   950
                self.w_ua_confirm_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   951
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   952
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   953
        def __on_ua_proceed_button_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   954
                self.w_ua_confirm_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   955
                self.ua_start = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   956
                self.setup_progressdialog_show(self._("Update All"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   957
                        showCancel = True, showOK = True, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   958
                        isInstall = True, showCloseOnFinish = debug)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   959
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   960
                Thread(target = self.__update_image, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   961
                        args = (self.w_ua_be_name_entry.get_text(),)).start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   962
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   963
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   964
        def __on_updateall_button_clicked(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   965
                self.__selectall_toggle(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   966
                date_str = time.strftime("%m/%d/%Y", time.localtime())
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   967
                self.w_ua_be_name_entry.set_text("opensolaris-ua-%s" % date_str)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   968
                self.w_ua_proceed_button.grab_focus()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   969
                self.w_ua_confirm_dialog.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   970
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   971
               
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   972
        def __on_selectall_checkbutton_toggled(self, widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   973
                self.__selectall_toggle(widget.get_active())
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   974
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   975
        def __handle_incorporated_error(self, list_incorp):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   976
                self.__update_progress_info(self._("ERROR"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   977
                self.__update_progress_info(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   978
                        self._("Following Incorporated package(s) cannot be updated:"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   979
                for i in list_incorp:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   980
                        self.__update_progress_info("\t%s" % i)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   981
                self.__update_progress_info(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   982
                        self._("Update using: Update All\n"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   983
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   984
        def __handle_update_progress_error(self, str_error, ex = None, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   985
                stage = UPDATE_EVAL):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   986
                self.install_error = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   987
                if stage == UPDATE_EVAL:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   988
                        gobject.idle_add(self.__progress_error_eval)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   989
                elif stage == UPDATE_DOWNLOAD:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   990
                        gobject.idle_add(self.__progress_error_download)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   991
                elif stage == UPDATE_INSTALL:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   992
                        gobject.idle_add(self.__progress_error_install)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   993
                elif stage == UPDATE_INDEX:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   994
                        gobject.idle_add(self.__progress_error_index)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   995
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   996
                        gobject.idle_add(self.__progress_error_eval)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   997
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   998
                gobject.idle_add(self.__update_progress_info,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   999
                        self._("\nERROR"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1000
                if ex != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1001
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1002
                                self._("%s\n%s" % (str_error, ex)))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1003
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1004
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1005
                                self._("%s\n" % str_error))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1006
                self.__cleanup()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1007
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1008
        def __update_image(self, be_name = None):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1009
                self.install = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1010
                self.install_error = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1011
                self.update_stage = UPDATE_EVAL
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1012
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1013
                # Evaluate
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1014
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1015
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1016
                                self._("\nEvaluate\n"), True)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1017
                        if self.__get_api_obj() == None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1018
                                return
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1019
                                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1020
                        stuff_to_do, opensolaris_image, cre = \
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1021
                            self.__get_api_obj().plan_update_all(sys.argv[0],
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1022
                                refresh_catalogs = self.do_refresh)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1023
                            #XXX waiting for change to API to allow be name to be passed
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1024
                            # self.api_obj.plan_update_all(sys.argv[0], be_name)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1025
                        if cre:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1026
                                self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1027
                                        self._(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1028
                                        "Update All failed during catalog refresh\n"\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1029
                                        "while determining what to update:"), cre, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1030
                                        stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1031
                                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1032
                        if not opensolaris_image:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1033
                                self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1034
                                        self._("This is not an opensolaris image\n"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1035
                                        stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1036
                                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1037
                        if not stuff_to_do:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1038
                                self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1039
                                        self._("No updates available for this image."), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1040
                                        stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1041
                                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1042
                except (api_errors.CanceledException):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1043
                        self.__handle_cancel_exception()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1044
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1045
                except api_errors.CatalogRefreshException, cre:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1046
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1047
                                self._("Update All failed during catalog refresh\n"\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1048
                                "while determining what to update:"), cre, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1049
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1050
                except api_errors.PlanCreationException, pce:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1051
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1052
                                self._("Update All failure in plan creation:"), pce, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1053
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1054
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1055
                except api_errors.IpkgOutOfDateException:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1056
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1057
                                self._( \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1058
                                "pkg(5) appears to be out of date and should be\n" +\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1059
                                "updated before running Update All.\n" + \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1060
                                "Please update pkg(5) using:\n" +\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1061
                                "\t'pfexec pkg install SUNWipkg' " +\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1062
                                "and then retry Update All."), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1063
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1064
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1065
                except api_errors.ApiException, aex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1066
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1067
                                self._("Update All API failure in evaluation:"), aex, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1068
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1069
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1070
                except Exception, uex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1071
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1072
                                self._("Update All unexpected error in evaluation:"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1073
                                uex, stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1074
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1075
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1076
                if self.__shared_update_steps(self._("Update All"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1077
                        self._("Update All finished successfully.\n")) != 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1078
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1079
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1080
                gobject.idle_add(self.__display_update_image_success)       
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1081
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1082
        def __display_update_image_success(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1083
                elapsed = (time.time() - self.ua_start)/ 60.0 
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1084
                info_str = ""
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1085
                if elapsed >= 1.0:
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1086
                        info_str = \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1087
                                self._(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1088
                                "\nUpdate All finished successfully in %1.f mins\n\n" % \
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1089
                                elapsed)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1090
                else:
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1091
                        info_str = \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1092
                                self._(
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1093
                                "\nUpdate All finished successfully in < 1 min\n\n")
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1094
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1095
                info_str += self._(\
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1096
                        "Please reboot after reviewing the release notes posted at:\n" +\
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1097
                        "\thttp://opensolaris.org/os/project/indiana/resources/rn3/")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1098
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1099
                self.w_um_dialog.hide()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1100
                msgbox = gtk.MessageDialog(parent = self.w_um_dialog, \
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1101
                        buttons = gtk.BUTTONS_CLOSE, flags = gtk.DIALOG_MODAL, \
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1102
                        type = gtk.MESSAGE_INFO, \
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1103
                        message_format = info_str)
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1104
                msgbox.set_title(self._("Update All Completed"))
603
4000e193b337 4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents: 601
diff changeset
  1105
                msgbox.run()
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1106
                msgbox.destroy()                        
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1107
                self.__exit_app()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
  1108
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1109
        def __handle_cancel_exception(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1110
                gobject.idle_add(self.w_progress_dialog.hide)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1111
                gobject.idle_add(self.w_progressinfo_expander.set_expanded, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1112
                self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1113
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1114
        def __install(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1115
                self.install = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1116
                self.install_error = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1117
                self.update_stage = UPDATE_EVAL
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1118
                list_fmris_to_install = self.__get_selected_fmris()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1119
                if len(list_fmris_to_install) == 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1120
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1121
                                self._("Nothing selected to update."))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1122
                        return
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1123
                        
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1124
                if self.__get_api_obj() == None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1125
                        return
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1126
      
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1127
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1128
                        print self._("Updating ...")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1129
                        print list_fmris_to_install
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1130
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1131
                # Evaluate
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1132
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1133
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1134
                                self._("\nEvaluate\n"), True)
603
4000e193b337 4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents: 601
diff changeset
  1135
                        ret, exception_caught = \
4000e193b337 4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents: 601
diff changeset
  1136
                                self.__get_api_obj().plan_install(list_fmris_to_install, \
4000e193b337 4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents: 601
diff changeset
  1137
                                [], refresh_catalogs = self.do_refresh)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1138
                        if exception_caught != None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1139
                                self.__handle_update_progress_error(\
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1140
                                        self._("Update error in plan install:"), \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1141
                                        exception_caught, \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1142
                                        stage = self.update_stage)
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1143
                        return
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1144
                                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1145
                except (api_errors.CanceledException):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1146
                        self.__handle_cancel_exception()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1147
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1148
                except (api_errors.ApiException), aex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1149
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1150
                                self._("Update unexpected API error:"), aex, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1151
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1152
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1153
                except (Exception), uex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1154
                        self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1155
                                self._("Update unexpected error:"), uex, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1156
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1157
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1158
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1159
                if not ret:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1160
                        #XXX Nothing to do, must be an incorporated package
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1161
                        # need to offer Update All to user
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1162
                        self.install_error = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1163
                        gobject.idle_add(self.__progress_error_eval)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1164
                        gobject.idle_add(self.__handle_incorporated_error, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1165
                                list_fmris_to_install)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1166
                        self.__cleanup()    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1167
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1168
                        
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1169
                list_changes = self.__get_api_obj().describe().get_changes()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1170
                list_planned = [x[1].pkg_stem for x in list_changes]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1171
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1172
                if len(list_planned) != len(list_fmris_to_install):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1173
                        list_incorp = self.__unique(list_fmris_to_install, list_planned)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1174
                        gobject.idle_add(self.__progress_error_eval)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1175
                        gobject.idle_add(self.__handle_incorporated_error, list_incorp)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1176
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1177
                gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1178
                        self._("Packages to be installed:"))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1179
                for i in list_planned:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1180
                        gobject.idle_add(self.__update_progress_info, "\t%s" % i)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1181
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1182
                if self.__shared_update_steps(self._("Update"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1183
                        self._("Update finished successfully.")) != 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1184
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1185
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1186
                gobject.idle_add(self.__remove_installed, list_planned)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1187
                gobject.idle_add(self.w_um_install_button.set_sensitive, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1188
                gobject.idle_add(self.w_progressinfo_expander.set_expanded, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1189
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1190
        def __shared_update_steps(self, what_msg, success_msg):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1191
                # Download
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1192
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1193
                        self.update_stage = UPDATE_DOWNLOAD
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1194
                        self.__get_api_obj().prepare()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1195
                except (api_errors.CanceledException):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1196
                        self.__handle_cancel_exception()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1197
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1198
                except (api_errors.ApiException), aex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1199
                        self.install_error = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1200
                        gobject.idle_add(self.__progress_error_download)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1201
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1202
                                self._("\nERROR"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1203
                        gobject.idle_add(self.__update_progress_info, \
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1204
                                self._("%s Download failed:\n%s") % (what_msg, aex))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1205
                        self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1206
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1207
                except (Exception), uex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1208
                        if uex.args[0] == EX_DISC_QUOTA_EXCEEDED:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1209
                                self.__handle_update_progress_error(\
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1210
                                        self._(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1211
                                        "%s exceded available disc quota") % what_msg, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1212
                                        stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1213
                                gobject.idle_add(self.__prompt_to_load_beadm)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1214
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1215
                                self.__handle_update_progress_error(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1216
                                        self._("%s unexpected error:") % (what_msg), \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1217
                                        uex, stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1218
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1219
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1220
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1221
                # Install
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1222
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1223
                        self.update_stage = UPDATE_INSTALL
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1224
                        gobject.idle_add(self.w_progress_cancel.set_sensitive, False)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1225
                        self.__get_api_obj().execute_plan()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1226
                except (api_errors.CanceledException):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1227
                        self.__handle_cancel_exception()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1228
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1229
                except (api_errors.ApiException), aex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1230
                        self.install_error = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1231
                        gobject.idle_add(self.__progress_error_install)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1232
                        gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1233
                                self._("\nERROR"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1234
                        gobject.idle_add(self.__update_progress_info, \
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1235
                                self._("%s Execute plan failed:\n%s") % (what_msg, aex))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1236
                        self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1237
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1238
                except (Exception), uex:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1239
                        self.__handle_update_progress_error(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1240
                                self._("%s unexpected error:") % (what_msg), uex, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1241
                                stage = self.update_stage)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1242
                        return 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1243
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1244
                self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1245
                gobject.idle_add(self.__progress_steps_done)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1246
                gobject.idle_add(self.__update_progress_info, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1247
                        self._(success_msg), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1248
                gobject.idle_add(self.w_progress_ok.set_sensitive, True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1249
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1250
                return 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1251
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1252
        def __prompt_to_load_beadm(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1253
                msgbox = gtk.MessageDialog(parent = self.w_progress_dialog, \
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1254
                        buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL, \
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1255
                        type = gtk.MESSAGE_ERROR, \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1256
                        message_format = self._(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1257
                        "Not enough disc space: the Update All action cannot " \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1258
                        "be performed.\n\n" \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1259
                        "Click OK to launch BE Management to manage your " \
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1260
                        "existing BE's and free up disc space."))
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1261
                msgbox.set_title(self._("Not Enough Disc Space"))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1262
                result = msgbox.run()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1263
                msgbox.destroy()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
  1264
                if result == gtk.RESPONSE_OK:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1265
                        gobject.idle_add(self.__create_beadm)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1266
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1267
        def __create_beadm(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1268
                self.gladefile = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1269
                        "/usr/share/package-manager/packagemanager.glade"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1270
                beadm.Beadmin(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1271
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1272
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1273
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1274
        def __unique(list1, list2):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1275
                """Return a list containing all items
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1276
                        in 'list1' that are not in 'list2'"""
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1277
                list2 = dict([(k, None) for k in list2])
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1278
                return [item for item in list1 if item not in list2]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1279
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1280
        def __cleanup(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1281
                self.install = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1282
                self.api_obj.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1283
                self.pr.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1284
                self.progress_stop_thread = True   
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1285
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1286
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1287
        def __on_um_expander_activate(widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1288
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1289
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1290
        def __selectall_toggle(self, select):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1291
                for row in self.um_list:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1292
                        row[UM_INSTALL_MARK] = select
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1293
                if select:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1294
                        self.toggle_counter += len(self.um_list)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1295
                        self.w_um_install_button.set_sensitive(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1296
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1297
                        self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1298
                        self.w_um_install_button.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1299
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1300
        def __active_pane_toggle(self, cell, filtered_path, filtered_model):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1301
                model = self.w_um_treeview.get_model()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1302
                itr = model.get_iter(filtered_path)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1303
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1304
                        installed = model.get_value(itr, UM_STATUS)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1305
                        if installed is None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1306
                                modified = model.get_value(itr, UM_INSTALL_MARK)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1307
                                model.set_value(itr, UM_INSTALL_MARK, not modified)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1308
                        if not modified:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1309
                                self.toggle_counter += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1310
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1311
                                self.toggle_counter -= 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1312
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1313
                        if self.toggle_counter > 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1314
                                self.w_um_install_button.set_sensitive(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1315
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1316
                                self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1317
                                self.w_um_install_button.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1318
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1319
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1320
        def __cell_data_function(column, renderer, model, itr, data):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1321
                '''Function which sets the background colour to black if package is 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1322
                selected'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1323
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1324
                        if model.get_value(itr, 1):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1325
                                #XXX Setting BOLD looks too noisy - disable for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1326
                                # renderer.set_property("weight", pango.WEIGHT_BOLD)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1327
                                renderer.set_property("weight", pango.WEIGHT_NORMAL)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1328
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1329
                                renderer.set_property("weight", pango.WEIGHT_NORMAL)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1330
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1331
        def __on_progressdialog_progress(self, isInstall):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1332
                if not self.progress_stop_thread:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1333
                        self.w_progressbar.pulse()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1334
                        return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1335
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1336
                        if isInstall:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1337
                                self.w_progressbar.set_fraction(0.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1338
                                if not self.install_error and \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1339
                                        self.w_progress_closeon_finish_chk.get_active():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1340
                                        self.w_progress_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1341
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1342
                                self.w_progress_dialog.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1343
                        return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1344
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1345
        def setup_progressdialog_show(self, title, info = None, showDetails = True, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1346
                showCancel = False, showOK = False, isInstall = False, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1347
                showCloseOnFinish = False):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1348
                infobuffer = self.w_progressinfo_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1349
                infobuffer.set_text("")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1350
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1351
                if info != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1352
                        self.w_progressinfo_label.set_text(info)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1353
                        self.w_progressinfo_label.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1354
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1355
                        self.w_progressinfo_label.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1356
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1357
                if showDetails:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1358
                        self.w_progressinfo_expander.show()    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1359
                        self.w_progressinfo_separator.show()    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1360
                        self.w_progressinfo_expander.set_expanded(False)  
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1361
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1362
                        self.w_progressinfo_expander.hide()    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1363
                        self.w_progressinfo_separator.hide()    
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1364
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1365
                if showCancel:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1366
                        self.w_progress_cancel.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1367
                        self.w_progress_cancel.set_sensitive(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1368
                        self.w_progress_cancel.grab_focus()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1369
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1370
                        self.w_progress_cancel.hide() 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1371
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1372
                if showOK:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1373
                        self.w_progress_ok.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1374
                        self.w_progress_ok.set_sensitive(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1375
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1376
                        self.w_progress_ok.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1377
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1378
                if isInstall:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1379
                        self.__progress_steps_start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1380
                        self.w_progress_install_vbox.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1381
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1382
                        self.w_progress_install_vbox.hide()   
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1383
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1384
                if showCloseOnFinish:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1385
                        self.w_progress_closeon_finish_chk.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1386
                        self.w_progress_ok.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1387
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1388
                        self.w_progress_closeon_finish_chk.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1389
                        self.w_progress_ok.hide()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1390
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1391
                self.w_progress_dialog.set_title(title)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1392
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1393
                self.w_progress_dialog.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1394
                self.progress_stop_thread = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1395
                gobject.timeout_add(100, self.__on_progressdialog_progress, isInstall)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1396
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1397
        def setup_updates(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1398
                Thread(target = self.get_updates_to_list(), args = ()).start()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1399
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1400
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1401
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1402
        def __update_size(size, pkg):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1403
                pkg[UM_SIZE] = size/ 1024.0 /1024.0 # Display in MB
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1404
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1405
        # Handle GUI Progress Output
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1406
        def output(self, str_out): 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1407
                self.__update_progress_info(str_out)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1408
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1409
                        print str_out
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1410
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1411
        def output_done(self, what="not specified"): 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1412
                self.__update_progress_info(" ")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1413
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1414
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1415
                        print "%s: finished" % what
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1416
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1417
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1418
        def progress_pulse():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1419
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1420
                        print "pulse: \n"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1421
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1422
        def dl_progress(self, dl_started, dl_cur_pkg, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1423
                        dl_cur_npkgs, dl_goal_npkgs, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1424
                        dl_cur_nfiles, dl_goal_nfiles, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1425
                        dl_cur_nmegbytes, dl_goal_nmegbytes): 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1426
                if not dl_started:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1427
                        self.cur_pkg = ""
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1428
                        self.__progress_steps_download()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1429
                        self.__update_progress_info(self._("\nDownload\n"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1430
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1431
                if self.cur_pkg != dl_cur_pkg:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1432
                        self.__update_progress_info("%s" % dl_cur_pkg)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1433
                self.cur_pkg = dl_cur_pkg
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1434
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1435
                self.__update_progress_info(\
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1436
                        self._("\tpkg %d/%d: \tfiles %d/%d \txfer %.2f/%.2f(meg)") % \
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1437
                        (dl_cur_npkgs, dl_goal_npkgs, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1438
                        dl_cur_nfiles, dl_goal_nfiles, \
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1439
                        dl_cur_nmegbytes, dl_goal_nmegbytes))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1440
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1441
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1442
                        print "DL: %s - %s\npkg %d/%d: files %d/%d: megs %.2f/%.2f\n" % \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1443
                                (dl_started, dl_cur_pkg, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1444
                                dl_cur_npkgs, dl_goal_npkgs, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1445
                                dl_cur_nfiles, dl_goal_nfiles, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1446
                                dl_cur_nmegbytes, dl_goal_nmegbytes)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1447
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1448
        def act_progress(self, act_started, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1449
                        act_phase, act_cur_nactions, act_goal_nactions): 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1450
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1451
                if not act_started:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1452
                        self.__progress_steps_install()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1453
                        self.__update_progress_info(self._("\nInstall\n"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1454
                        self.__update_progress_info(
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1455
                                self._("\t%s\t%d/%d actions") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1456
                                (act_phase, act_cur_nactions, act_goal_nactions))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1457
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1458
                        self.__update_progress_info(
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1459
                                self._("\t%s\t%d/%d actions") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1460
                                (act_phase, act_cur_nactions, act_goal_nactions))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1461
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1462
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1463
                        print "Install: %s - %s\nact %d/%d\n" % \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1464
                                (act_started, act_phase, act_cur_nactions, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1465
                                act_goal_nactions)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1466
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1467
        def ind_progress(self, ind_started, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1468
                        ind_phase, ind_cur_nitems, ind_goal_nitems):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1469
                if not self.install:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1470
                        return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1471
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1472
                if not ind_started:
601
bed1b73cabbd 4094 UpdateManager displaying index stage twice
John Rice <john.rice@sun.com>
parents: 600
diff changeset
  1473
                        if self.update_stage != UPDATE_INSTALL:
bed1b73cabbd 4094 UpdateManager displaying index stage twice
John Rice <john.rice@sun.com>
parents: 600
diff changeset
  1474
                                return
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1475
                        self.update_stage = UPDATE_INDEX
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1476
                        self.__progress_steps_index()                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1477
                        self.__update_progress_info(self._("Index\n"), True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1478
                        self.__update_progress_info(self._("\t%-25s\t%d/%d actions" % \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1479
                                (ind_phase, ind_cur_nitems, ind_goal_nitems)))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1480
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1481
                        self.__update_progress_info(
638
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1482
                                self._("\t%-25s\t%d/%d actions") % \
53b78e3428fc 4126 I10n update for IPS GUI and UM
John Rice <john.rice@sun.com>
parents: 636
diff changeset
  1483
                                (ind_phase, ind_cur_nitems, ind_goal_nitems))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1484
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1485
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1486
                        print "Index: %s - %s\nact %d/%d\n" % \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1487
                                (ind_started, ind_phase, ind_cur_nitems, ind_goal_nitems)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1488
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1489
        def __update_progress_info(self, str_out, bold = False):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1490
                infobuffer = self.w_progressinfo_textview.get_buffer()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1491
                textiter = infobuffer.get_end_iter()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1492
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1493
                # Requires TextView tag to be setup once in __init__
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1494
                # infobuffer.create_tag("bold", weight=pango.WEIGHT_BOLD)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1495
                if bold:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1496
                        infobuffer.insert_with_tags_by_name(textiter, \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1497
                                "%s\n" % str_out, "bold")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1498
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1499
                        infobuffer.insert(textiter, "%s\n" % str_out)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1500
                self.w_progressinfo_textview.scroll_to_iter(textiter, 0.0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1501
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1502
#-------------------- remove those
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1503
def main():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1504
        gtk.main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1505
        return 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1506
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1507
if __name__ == "__main__":
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1508
        list_uninstalled = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1509
        debug = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1510
        show_all_opts = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1511
        show_install_updates_only = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1512
        local_image_dir = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1513
        do_refresh = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1514
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1515
        try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1516
                opts, args = getopt.getopt(sys.argv[1:], "hdualir", \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1517
                        ["help", "debug","uninstalled"])
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1518
        except getopt.error, msg:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1519
                print "%s, for help use --help" % msg
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1520
                sys.exit(2)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1521
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1522
        for option, argument in opts:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1523
                if option in ("-h", "--help"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1524
                        print "Use -d (--debug) to run in debug mode."
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1525
                        sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1526
                if option in ("-d", "--debug"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1527
                        debug = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1528
                if option in ("-u", "--uninstalled"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1529
                        list_uninstalled = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1530
                if option in ("-a", "--all"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1531
                        show_all_opts = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1532
                if option in ("-i", "--install_updates"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1533
                        show_install_updates_only = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1534
                if option in ("-l", "--local_image"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1535
                        local_image_dir = os.getcwd()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1536
                # Refresh catalogs during plan_install and plan_update_all
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1537
                if option in ("-r", "--refresh"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1538
                        do_refresh = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1539
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1540
        um = Updatemanager()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1541
        um.show_all_opts = show_all_opts
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1542
        um.show_install_updates_only = show_install_updates_only
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1543
        um.do_refresh = do_refresh
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1544
        um.init_tree_views()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1545
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1546
        um.setup_progressdialog_show(um._("Checking for new software"), \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1547
                showDetails = False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1548
        gobject.timeout_add(UPDATES_FETCH_DELAY, um.setup_updates)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1549
        main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
  1550