src/updatemanager.py
author Padraig O'Briain <padraig.obriain@sun.com>
Mon, 21 Sep 2009 09:12:03 +0100
changeset 1366 23cf80f57e61
parent 1352 5c92c9d342ef
child 1446 72569184fd0d
permissions -rw-r--r--
11163 Rework needed for details panel for Update Manager
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
#
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 927
diff changeset
    22
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
578
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
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
    29
import subprocess
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    30
import sys
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    31
import time
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    32
import locale
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    33
import gettext
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    34
import pango
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    35
from threading import Thread
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:
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
    38
        import gnome
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    39
        import gobject
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    40
        gobject.threads_init()        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    41
        import gtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    42
        import gtk.glade
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    43
        import pygtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    44
        pygtk.require("2.0")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    45
except ImportError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    46
        sys.exit(1)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    47
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
    48
import pkg.portable as portable
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    49
import pkg.client.progress as progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    50
import pkg.gui.beadmin as beadm
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
    51
import pkg.gui.installupdate as installupdate
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
    52
import pkg.gui.enumerations as enumerations
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
    53
import pkg.gui.misc as gui_misc
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
    54
import pkg.misc as misc
696
6bbfd2dece6f 4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents: 660
diff changeset
    55
from pkg.client import global_settings
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    56
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    57
# Put _() in the global namespace
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    58
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    59
__builtin__._ = gettext.gettext
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    60
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    61
IMAGE_DIRECTORY_DEFAULT = "/"   # Image default directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    62
IMAGE_DIR_COMMAND = "svcprop -p update/image_dir svc:/application/pkg/update"
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
    63
1223
c83bf25dc7f3 10025 updatemanager dialog icon is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1220
diff changeset
    64
PKG_ICON_LOCATION = "usr/share/package-manager/icons"
c83bf25dc7f3 10025 updatemanager dialog icon is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1220
diff changeset
    65
ICON_LOCATION = "usr/share/update-manager/icons"
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
    66
CHECK_FOR_UPDATES = "/usr/lib/pm-checkforupdates"
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
    67
PKG_CLIENT_NAME = "updatemanager" # API client name
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
    68
SHOW_INFO_DELAY = 500           # Delay in milliseconds before showing selected
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
    69
                                # package information
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    70
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
    71
                                # loop time to start and display main UI
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
    72
MAX_INFO_CACHE_LIMIT = 100      # Max numger of package descriptions to cache
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
    73
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    74
#UM Row Model
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    75
(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    76
UM_ID,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    77
UM_INSTALL_MARK,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    78
UM_STATUS,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    79
UM_NAME,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    80
UM_REBOOT,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    81
UM_LATEST_VER,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    82
UM_SIZE,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
    83
UM_STEM,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    84
) = range(8)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    85
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    86
class Updatemanager:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    87
        def __init__(self):
696
6bbfd2dece6f 4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents: 660
diff changeset
    88
                global_settings.client_name = PKG_CLIENT_NAME
6bbfd2dece6f 4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents: 660
diff changeset
    89
                    
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    90
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    91
                        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
    92
                except KeyError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    93
                        self.application_dir = "/"
791
123e9401e939 5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents: 771
diff changeset
    94
                misc.setlocale(locale.LC_ALL, "")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    95
                for module in (gettext, gtk.glade):
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
    96
                        module.bindtextdomain("pkg", os.path.join(
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
    97
                            self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
    98
                            "usr/share/locale"))
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    99
                        module.textdomain("pkg")
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   100
                gui_misc.init_for_help(self.application_dir)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   101
                # 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
   102
                self.um_list = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   103
                    gtk.ListStore(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   104
                        gobject.TYPE_INT,         # UM_ID
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   105
                        gobject.TYPE_BOOLEAN,     # UM_INSTALL_MARK
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   106
                        gtk.gdk.Pixbuf,           # UM_STATUS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   107
                        gobject.TYPE_STRING,      # UM_NAME
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   108
                        gtk.gdk.Pixbuf,           # UM_REBOOT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   109
                        gobject.TYPE_STRING,      # UM_LATEST_VER
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   110
                        gobject.TYPE_STRING,      # UM_SIZE
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   111
                        gobject.TYPE_STRING,      # UM_STEM
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   112
                        )
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   113
                self.progress_stop_thread = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   114
                self.last_select_time = 0
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   115
                self.user_rights = portable.is_admin()
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   116
                self.image_dir_arg = None
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   117
                self.toggle_counter = 0
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   118
                self.last_show_info_id = 0
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   119
                self.show_info_id = 0
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   120
                self.package_selection = None
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   121
                self.update_all_proceed = False
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   122
                self.ua_be_name = None
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   123
                self.application_path = None
1164
978947aae45f 9513 Some icons are installed in wrong locations
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1148
diff changeset
   124
                self.icon_theme = gtk.IconTheme()
1223
c83bf25dc7f3 10025 updatemanager dialog icon is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1220
diff changeset
   125
                pkg_icon_location = os.path.join(self.application_dir, PKG_ICON_LOCATION)
c83bf25dc7f3 10025 updatemanager dialog icon is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1220
diff changeset
   126
                self.icon_theme.append_search_path(pkg_icon_location)
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   127
                self.pkg_installed_icon = gui_misc.get_icon(self.icon_theme,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   128
                    'status_installed')
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   129
                self.pkg_not_installed_icon = gui_misc.get_icon(self.icon_theme,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   130
                    'status_installed')
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   131
                self.pkg_update_available_icon = gui_misc.get_icon(self.icon_theme,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   132
                    'status_newupdate')
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   133
                icon_location = os.path.join(self.application_dir, ICON_LOCATION)
1217
1e2405e83d3a 9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1215
diff changeset
   134
                self.icon_theme.append_search_path(icon_location)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   135
                self.ua_start = 0
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   136
                self.pylintstub = None
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   137
                self.api_obj = None
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   138
                self.release_notes_url = "http://www.opensolaris.org"
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   139
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   140
                # Progress Dialog
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   141
                self.gladefile = os.path.join(self.application_dir,
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   142
                    "usr/share/update-manager/updatemanager.glade")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   143
                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
   144
                self.w_progress_dialog = w_xmltree_progress.get_widget("progressdialog")
1103
04e93a722692 8564 Pressing Esc in Adding New Repository dialog should cancel the addition
John Rice <john.rice@sun.com>
parents: 1096
diff changeset
   145
                self.w_progress_dialog.connect('delete-event', lambda stub1, stub2: True)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   146
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   147
                self.w_progressinfo_label = w_xmltree_progress.get_widget("progressinfo")
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   148
                self.w_progressinfo_separator = w_xmltree_progress.get_widget(
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   149
                    "progressinfo_separator")                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   150
                self.w_progressinfo_expander = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   151
                    w_xmltree_progress.get_widget("progressinfo_expander")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   152
                self.w_progressinfo_textview = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   153
                    w_xmltree_progress.get_widget("progressinfo_textview")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   154
                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
   155
                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
   156
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   157
                self.w_progress_install_vbox = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   158
                    w_xmltree_progress.get_widget("progress_install_vbox")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   159
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   160
                self.w_progress_closeon_finish_chk = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   161
                    w_xmltree_progress.get_widget("closeon_finish_checkbutton")
578
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
                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
   164
                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
   165
                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
   166
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   167
                # UM Dialog
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   168
                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
   169
                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
   170
                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
   171
                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
   172
                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
   173
                self.w_um_updateall_button = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   174
                    w_xmltree_um.get_widget("um_updateall_button")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   175
                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
   176
                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
   177
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   178
                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
   179
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   180
                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
   181
                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
   182
                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
   183
                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
   184
                self.w_select_checkbox = w_xmltree_um.get_widget("selectall_checkbutton")
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   185
                self.w_um_cancel_button = w_xmltree_um.get_widget("cancel_button")
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   186
                self.w_um_close_button = w_xmltree_um.get_widget("close_button")
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   187
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   188
                # UM Completed Dialog
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   189
                w_xmltree_um_completed = gtk.glade.XML(self.gladefile, 
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   190
                    "um_completed_dialog")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   191
                self.w_um_completed_dialog = w_xmltree_um_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   192
                    "um_completed_dialog")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   193
                self.w_um_completed_dialog .connect("destroy", self.__on_um_dialog_close)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   194
                self.w_um_completed_time_label = w_xmltree_um_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   195
                    "um_completed_time_label")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   196
                self.w_um_completed_release_label = w_xmltree_um_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   197
                    "um_completed_release_label")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   198
                self.w_um_completed_linkbutton = w_xmltree_um_completed.get_widget(
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   199
                    "um_completed_linkbutton")
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   200
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   201
                self.details_cache = {}
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
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   204
                        dic = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   205
                            {
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   206
                                "on_um_dialog_close": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   207
                                    self.__on_um_dialog_close,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   208
                                "on_cancel_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   209
                                    self.__on_cancel_button_clicked,
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   210
                                "on_close_button_clicked": \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   211
                                    self.__on_cancel_button_clicked,
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   212
                                "on_help_button_clicked": \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   213
                                    self.__on_help_button_clicked,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   214
                                "on_um_updateall_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   215
                                    self.__on_updateall_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   216
                                "on_um_expander_activate": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   217
                                    self.__on_um_expander_activate,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   218
                                "on_selectall_checkbutton_toggled": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   219
                                    self.__on_selectall_checkbutton_toggled,
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
                        w_xmltree_um.signal_autoconnect(dic)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   222
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   223
                        dic_completed = \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   224
                            {
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   225
                                "on_um_complete_close_button_clicked": \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   226
                                     self.__on_um_dialog_close,
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   227
                                "on_um_completed_linkbutton_clicked": \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   228
                                     self.__on_um_completed_linkbutton_clicked,
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   229
                                     
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   230
                            }
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   231
                        w_xmltree_um_completed.signal_autoconnect(dic_completed)
578
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
                except AttributeError, error:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   234
                        print _("GUI will not respond to any event! %s. "
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   235
                            "Check updatemanager.py signals") % error
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   236
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   237
                self.pr = progress.NullProgressTracker()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   238
 
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   239
                self.w_um_dialog.show_all()
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   240
                self.w_um_dialog.resize(620, 500)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   241
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   242
        def __set_cancel_state(self, status):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   243
                if status:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   244
                        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
   245
                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
   246
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   247
        def __set_initial_selection(self):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   248
                self.__selectall_toggle(True)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   249
                if len(self.um_list) == 0:
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   250
                        self.__display_noupdates()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   251
                else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   252
                        self.w_um_treeview.set_cursor(0, None)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   253
                        if self.update_all_proceed:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   254
                                self.__on_updateall_button_clicked(None)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   255
                                self.update_all_proceed = False
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   256
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   257
        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
   258
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   259
                        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
   260
                                self.__set_renderer_active(renderer, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   261
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   262
                                self.__set_renderer_active(renderer, True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   263
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   264
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   265
        def __set_renderer_active(renderer, active):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   266
                if active:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   267
                        renderer.set_property("sensitive", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   268
                        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
   269
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   270
                        renderer.set_property("sensitive", False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   271
                        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
   272
                
1204
0d3de1d0a4d8 9833 updatemanager dialog icon is missing after upgrading Desktop packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1168
diff changeset
   273
        def __get_icon_pixbuf(self, icon_name, size=16):
0d3de1d0a4d8 9833 updatemanager dialog icon is missing after upgrading Desktop packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1168
diff changeset
   274
                return gui_misc.get_icon(self.icon_theme, icon_name, size)
578
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
        def __get_selected_fmris(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   277
                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
   278
                iter_next = model.get_iter_first()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   279
                list_of_selected_fmris = []
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   280
                while iter_next != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   281
                        if model.get_value(iter_next, UM_INSTALL_MARK):
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   282
                                list_of_selected_fmris.append(model.get_value(iter_next,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   283
                                    UM_NAME))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   284
                        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
   285
                return list_of_selected_fmris
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   286
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   287
        def init_tree_views(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   288
                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
   289
                toggle_renderer = gtk.CellRendererToggle()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   290
                toggle_renderer.connect('toggled', self.__active_pane_toggle, model)
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   291
                column = gtk.TreeViewColumn("", toggle_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   292
                    active = UM_INSTALL_MARK)
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   293
                column.set_cell_data_func(toggle_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   294
                    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
   295
                toggle_renderer.set_property("activatable", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   296
                column.set_expand(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   297
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   298
                # Show Cancel, Update All only
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   299
                self.w_select_checkbox.hide()
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   300
                self.w_um_install_button.hide()
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   301
                self.w_um_intro_label.set_text(_(
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   302
                    "Updates are available for the following packages.\n"
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   303
                    "Click Update All to create a new boot environment and "
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   304
                    "install all packages into it."))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   305
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   306
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   307
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   308
                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
   309
                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
   310
                column.set_title("   ")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   311
                # Hiding Status column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   312
                #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
   313
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   314
                name_renderer = gtk.CellRendererText()
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   315
                column = gtk.TreeViewColumn(_("Name"), name_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   316
                    text = UM_NAME)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   317
                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
   318
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   319
                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
   320
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   321
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   322
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   323
                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
   324
                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
   325
                # Hiding Reboot required column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   326
                # 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
   327
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   328
                version_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   329
                version_renderer.set_property('xalign', 0.0)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   330
                column = gtk.TreeViewColumn(_("Latest Version"), version_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   331
                    text = UM_LATEST_VER) 
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   332
                column.set_cell_data_func(version_renderer,
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   333
                    self.__cell_data_function, None)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   334
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   335
                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
   336
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   337
                size_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   338
                size_renderer.set_property('xalign', 0.0)
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   339
                column = gtk.TreeViewColumn(_("Size (Meg)"), size_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   340
                    text = UM_SIZE)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   341
                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
   342
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   343
                # 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
   344
                #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
   345
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   346
                #Added selection listener
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   347
                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
   348
                self.package_selection.set_mode(gtk.SELECTION_SINGLE)
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   349
                self.package_selection.connect("changed",
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   350
                    self.__on_package_selection_changed, None)
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
                # Setup Icons
1204
0d3de1d0a4d8 9833 updatemanager dialog icon is missing after upgrading Desktop packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1168
diff changeset
   353
                self.w_um_dialog.set_icon(self.__get_icon_pixbuf("UM_package", 36))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   354
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   355
        def __get_image_path(self):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   356
                '''This function gets the image path or the default'''
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   357
                if self.image_dir_arg != None:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   358
                        return self.image_dir_arg
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   359
1215
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   360
                try:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   361
                        image_directory = os.environ["PKG_IMAGE"]
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   362
                except KeyError:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   363
                        image_directory = \
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   364
                            os.popen(IMAGE_DIR_COMMAND).readline().rstrip()
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   365
                        if len(image_directory) == 0:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   366
                                image_directory = IMAGE_DIRECTORY_DEFAULT
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   367
                return image_directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   368
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   369
        def get_updates_to_list(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   370
                '''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
   371
                        that are available to list'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   372
                # 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
   373
                um_list = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   374
                    gtk.ListStore(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   375
                        gobject.TYPE_INT,         # UM_ID
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   376
                        gobject.TYPE_BOOLEAN,     # UM_INSTALL_MARK
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   377
                        gtk.gdk.Pixbuf,           # UM_STATUS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   378
                        gobject.TYPE_STRING,      # UM_NAME
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   379
                        gtk.gdk.Pixbuf,           # UM_REBOOT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   380
                        gobject.TYPE_STRING,      # UM_LATEST_VER
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   381
                        gobject.TYPE_STRING,      # UM_SIZE
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   382
                        gobject.TYPE_STRING,      # UM_STEM
578
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
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   385
                # Use check_for_updates to determine whether updates
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   386
                # are available
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   387
                return_code = subprocess.call([CHECK_FOR_UPDATES,
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   388
                    self.__get_image_path()])
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   389
                if return_code == enumerations.NO_UPDATES_AVAILABLE:
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   390
                        self.progress_stop_thread = True
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   391
                        gobject.idle_add(self.__display_noupdates)
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   392
                        return
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1223
diff changeset
   393
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   394
                self.api_obj = self.__get_api_obj()
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   395
                image_obj = self.api_obj.img
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   396
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   397
                count = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   398
                pkg_upgradeable = None
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   399
                for pkg, state in sorted(misc.get_inventory_list(
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   400
                    image_obj, [], all_known = True, all_versions = False)):
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   401
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   402
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   403
                                gtk.main_iteration(False)
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   404
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1332
diff changeset
   405
                        if state["upgradable"] and \
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1332
diff changeset
   406
                            state["state"] == image_obj.PKG_STATE_INSTALLED:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   407
                                pkg_upgradeable = pkg
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   408
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   409
                        # 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
   410
                        add_package = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   411
                        if pkg_upgradeable != None and not state["upgradable"]:
1288
4248f27af42a 10417 rename v0 support should be removed everywhere
Shawn Walker <srw@sun.com>
parents: 1261
diff changeset
   412
                                add_package = pkg_upgradeable.is_same_pkg(pkg)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   413
                                if list_uninstalled:
1288
4248f27af42a 10417 rename v0 support should be removed everywhere
Shawn Walker <srw@sun.com>
parents: 1261
diff changeset
   414
                                        add_package = not add_package
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   415
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   416
                        if add_package:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   417
                                count += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   418
                                # 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
   419
                                # 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
   420
                                # 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
   421
                                #if state["incorporated"]:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   422
                                #        incState = _("Inc")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   423
                                #else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   424
                                #        incState = "--"
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   425
                                pkg_name = gui_misc.get_pkg_name(pkg.get_name())
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   426
                                um_list.insert(count, [count, False, None,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   427
                                    pkg_name, None, pkg.get_version(), None,
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   428
                                    pkg.get_pkg_stem()])
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   429
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   430
                if debug:
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   431
                        print _("count: %d") % count
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   432
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   433
                self.progress_stop_thread = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   434
                gobject.idle_add(self.w_um_treeview.set_model, um_list)
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   435
                self.um_list = um_list                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   436
                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
   437
                        
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   438
                # 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
   439
                # 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
   440
                # the size column
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   441
                # 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
   442
                
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   443
        def __get_api_obj(self):
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   444
                if self.api_obj == None:
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   445
                        self.api_obj = gui_misc.get_api_object(self.__get_image_path(),
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   446
                            progress.NullProgressTracker(), self.w_um_dialog)
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   447
                return self.api_obj
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   448
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   449
        def __display_nopermissions(self):
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   450
                self.w_um_intro_label.set_markup(
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   451
                    _("<b>You do not have sufficient permissions.</b>"
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   452
                    "\n\nPlease restart pm-updatemanager using pfexec."))
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   453
                self.__setup_display()
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   454
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   455
        def __display_noupdates(self):
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   456
                self.w_um_intro_label.set_markup(_("<b>No Updates available.</b>"))
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   457
                self.__setup_display()
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   458
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   459
        def __setup_display(self):
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   460
                self.w_um_treeview.hide()
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   461
                self.w_um_expander.hide()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   462
                self.w_um_install_button.set_sensitive(False)
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   463
                self.w_um_updateall_button.hide()
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   464
                self.w_um_cancel_button.hide()
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   465
                self.w_um_close_button.show()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   466
                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
   467
                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
   468
                self.w_um_dialog.present()
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   469
                self.w_um_dialog.resize(420, 100)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   470
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   471
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   472
        def __removed_filter(model, itr):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   473
                '''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
   474
                return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   475
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   476
        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
   477
                '''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
   478
                model, itr = selection.get_selected()
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   479
                if self.show_info_id != 0:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   480
                        gobject.source_remove(self.show_info_id)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   481
                        self.show_info_id = 0
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   482
                if itr:                        
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   483
                        fmri = model.get_value(itr, UM_STEM)
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   484
                        if self.__setting_from_cache(fmri):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   485
                                return
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   486
                        pkg_name =  model.get_value(itr, UM_NAME)
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   487
                        infobuffer = self.w_um_textview.get_buffer()
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   488
                        infobuffer.set_text(
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   489
                            _("\nFetching details for %s ...") % pkg_name)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   490
                        self.last_show_info_id = self.show_info_id = \
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   491
                            gobject.timeout_add(SHOW_INFO_DELAY,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   492
                            self.__show_info, model, model.get_path(itr))
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   493
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   494
        def __setting_from_cache(self, fmri):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   495
                if len(self.details_cache) > MAX_INFO_CACHE_LIMIT:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   496
                        self.details_cache = {}
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   497
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   498
                if self.details_cache.has_key(fmri):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   499
                        labs = self.details_cache[fmri][0]
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   500
                        text = self.details_cache[fmri][1]
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   501
                        gui_misc.set_package_details_text(labs, text,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   502
                            self.w_um_textview, self.pkg_installed_icon,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   503
                            self.pkg_not_installed_icon, 
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   504
                            self.pkg_update_available_icon)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   505
                        return True
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   506
                else:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   507
                        return False
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   508
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   509
        def __show_info(self, model, path):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   510
                self.show_info_id = 0
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   511
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   512
                itr = model.get_iter(path)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   513
                fmri = model.get_value(itr, UM_STEM)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   514
                pkg_name =  model.get_value(itr, UM_NAME)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   515
                Thread(target = self.__show_package_info,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   516
                    args=(fmri, pkg_name, self.last_show_info_id)).start()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   517
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   518
        def __show_package_info(self, fmri, pkg_name, info_id):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   519
                local_info = None
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   520
                remote_info = None
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   521
                if info_id == self.last_show_info_id:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   522
                        local_info = gui_misc.get_pkg_info(self.__get_api_obj(),
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   523
                            fmri, True) 
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   524
                if info_id == self.last_show_info_id:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   525
                        remote_info = gui_misc.get_pkg_info(self.__get_api_obj(),
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   526
                            fmri, False) 
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   527
                if info_id == self.last_show_info_id:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   528
                        gobject.idle_add(self.__update_package_info, fmri,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   529
                            pkg_name, local_info, remote_info, info_id)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   530
                return 
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   531
 
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   532
        def  __update_package_info(self, fmri, pkg_name, local_info, remote_info,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   533
            info_id):
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   534
                if info_id != self.last_show_info_id:
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   535
                        return
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   536
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   537
                if not local_info and not remote_info:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   538
                        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
   539
                        infobuffer.set_text("")
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   540
                        textiter = infobuffer.get_end_iter()
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   541
                        infobuffer.insert_with_tags_by_name(textiter,
1366
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   542
                            _("\nNo details available"), "bold")
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   543
                        return
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   544
                labs, text = gui_misc.set_package_details(pkg_name, local_info,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   545
                    remote_info, self.w_um_textview, self.pkg_installed_icon,
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   546
                    self.pkg_not_installed_icon, self.pkg_update_available_icon)
23cf80f57e61 11163 Rework needed for details panel for Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1352
diff changeset
   547
                self.details_cache[fmri] = (labs, text)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   548
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   549
        def __on_um_completed_linkbutton_clicked(self, widget):
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   550
                try:
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   551
                        gnome.url_show(self.release_notes_url)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   552
                except gobject.GError:
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   553
                        gui_misc.error_occurred(self.w_um_dialog,
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   554
                            _("Unable to navigate to:\n\t%s") % 
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   555
                            self.release_notes_url,
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   556
                            msg_title=_("Update Manager"))
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   557
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   558
        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
   559
                self.__exit_app()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   560
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   561
        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
   562
                self.__exit_app()
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   563
                
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   564
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   565
        def __on_help_button_clicked(widget):
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   566
                gui_misc.display_help("um_info")
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   567
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   568
        def __exit_app(self, be_name = None):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   569
                if be_name:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   570
                        if self.image_dir_arg:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   571
                                gobject.spawn_async([self.application_path, "-R",
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   572
                                    self.image_dir_arg, "-U", be_name])
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   573
                        else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   574
                                gobject.spawn_async([self.application_path, 
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   575
                                    "-U", be_name])
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   576
796
bcd90655ad83 4019 Package Manager close bug
Padraig O'Briain <padraig.obriain@sun.com>
parents: 791
diff changeset
   577
                self.w_um_dialog.hide()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   578
                gtk.main_quit()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   579
                sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   580
                return True
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   581
        
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   582
        def restart_after_ips_update(self, be_name):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   583
                self.__exit_app(be_name)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   584
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   585
        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
   586
                self.__selectall_toggle(True)
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   587
                self.__get_api_obj().reset()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   588
                self.ua_start = time.time()
1259
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1228
diff changeset
   589
                skip_be_dlg = False
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1228
diff changeset
   590
                if self.__get_image_path() != IMAGE_DIRECTORY_DEFAULT:
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1228
diff changeset
   591
                        skip_be_dlg = True
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   592
                installupdate.InstallUpdate([], self,
1332
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1288
diff changeset
   593
                    self.__get_image_path(), ips_update = False,
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   594
                    action = enumerations.IMAGE_UPDATE,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   595
                    be_name = self.ua_be_name,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   596
                    parent_name = _("Update Manager"),
1124
6cbf082b5bf4 8882 exception during upgrade with update manager gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1103
diff changeset
   597
                    pkg_list = ["SUNWipkg", "SUNWipkg-gui", "SUNWipkg-um"],
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   598
                    main_window = self.w_um_dialog,
1259
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1228
diff changeset
   599
                    icon_confirm_dialog = self.__get_icon_pixbuf("UM_package", 36),
ee4f1901712e 9363 pm-updatemanager thoroughly broken when used with -R option
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1228
diff changeset
   600
                    skip_be_dialog = skip_be_dlg)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   601
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   602
               
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   603
        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
   604
                self.__selectall_toggle(widget.get_active())
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   605
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   606
        def __display_update_image_success(self):
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   607
                elapsed_sec = int(time.time() - self.ua_start)
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   608
                elapsed_min = elapsed_sec / 60
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   609
                info_str = ""
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   610
                if elapsed_sec >= 120:
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   611
                        info_str = _(
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   612
                           "Update All finished successfully in %d minutes.") \
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   613
                           % elapsed_min
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   614
                else:
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   615
                        info_str = _(
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   616
                            "Update All finished successfully in %d seconds.") \
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   617
                             % elapsed_sec
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   618
                self.w_um_completed_time_label.set_text(info_str)
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   619
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   620
                info_str = _(
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   621
                    "Review the posted release notes before rebooting your system:"
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   622
                    )
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   623
                self.w_um_completed_release_label.set_text(info_str)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   624
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   625
                info_str = misc.get_release_notes_url()
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   626
                self.w_um_completed_linkbutton.set_uri(info_str)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   627
                self.w_um_completed_linkbutton.set_label(info_str)
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   628
                self.release_notes_url = info_str
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   629
                
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   630
                self.w_um_dialog.hide()
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   631
                self.w_um_completed_dialog.set_title(_("Update All Completed"))
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   632
                self.w_um_completed_dialog.show()
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   633
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   634
        def __handle_cancel_exception(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   635
                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
   636
                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
   637
                self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   638
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   639
        def __prompt_to_load_beadm(self):
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   640
                msgbox = gtk.MessageDialog(parent = self.w_progress_dialog,
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   641
                    buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL,
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   642
                    type = gtk.MESSAGE_ERROR,
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   643
                    message_format = _(
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   644
                    "Not enough disc space, the Update All action cannot "
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   645
                    "be performed.\n\n"
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   646
                    "Click OK to manage your existing BEs and free up disk space or "
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   647
                    "Cancel to cancel Update All."))
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   648
                msgbox.set_title(_("Not Enough Disc Space"))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   649
                result = msgbox.run()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   650
                msgbox.destroy()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   651
                if result == gtk.RESPONSE_OK:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   652
                        gobject.idle_add(self.__create_beadm)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   653
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   654
        def __create_beadm(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   655
                self.gladefile = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   656
                        "/usr/share/package-manager/packagemanager.glade"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   657
                beadm.Beadmin(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   658
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   659
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   660
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   661
        def __unique(list1, list2):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   662
                """Return a list containing all items
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   663
                        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
   664
                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
   665
                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
   666
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   667
        def __cleanup(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   668
                self.api_obj.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   669
                self.pr.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   670
                self.progress_stop_thread = True   
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   671
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   672
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   673
        def __on_um_expander_activate(widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   674
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   675
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   676
        def __selectall_toggle(self, select):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   677
                for row in self.um_list:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   678
                        row[UM_INSTALL_MARK] = select
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   679
                if select:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   680
                        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
   681
                        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
   682
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   683
                        self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   684
                        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
   685
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   686
        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
   687
                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
   688
                itr = model.get_iter(filtered_path)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   689
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   690
                        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
   691
                        if installed is None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   692
                                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
   693
                                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
   694
                        if not modified:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   695
                                self.toggle_counter += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   696
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   697
                                self.toggle_counter -= 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   698
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   699
                        if self.toggle_counter > 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   700
                                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
   701
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   702
                                self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   703
                                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
   704
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   705
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   706
        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
   707
                '''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
   708
                selected'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   709
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   710
                        if model.get_value(itr, 1):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   711
                                #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
   712
                                # 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
   713
                                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
   714
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   715
                                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
   716
        
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   717
        def __on_progressdialog_progress(self):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   718
                if not self.progress_stop_thread:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   719
                        self.w_progressbar.pulse()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   720
                        return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   721
                else:
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   722
                        self.w_progress_dialog.hide()
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   723
                return False
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   724
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   725
        def setup_progressdialog_show(self, title):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   726
                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
   727
                infobuffer.set_text("")
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   728
                self.w_progressinfo_label.hide()                        
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   729
                self.w_progressinfo_expander.hide()    
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   730
                self.w_progressinfo_separator.hide()                            
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   731
                self.w_progress_cancel.hide() 
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   732
                self.w_progress_ok.hide()
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   733
                self.w_progress_install_vbox.hide()   
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   734
                self.w_progress_closeon_finish_chk.hide()
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   735
                self.w_progress_ok.hide()                        
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   736
                self.w_progress_dialog.set_title(title)                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   737
                self.w_progress_dialog.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   738
                self.progress_stop_thread = False
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   739
                gobject.timeout_add(100, self.__on_progressdialog_progress)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   740
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   741
        def setup_updates(self):
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   742
                if self.user_rights:
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   743
                        Thread(target = self.get_updates_to_list(), args = ()).start()
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   744
                else:
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   745
                        self.progress_stop_thread = True
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   746
                        self.__display_nopermissions()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   747
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   748
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   749
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   750
        def progress_pulse():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   751
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   752
                        print "pulse: \n"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   753
                
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   754
        def update_package_list(self, update_list):
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   755
                self.pylintstub = update_list
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   756
                return
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   757
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   758
        def shutdown_after_image_update(self):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   759
                self.__display_update_image_success()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   760
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   761
#-------------------- remove those
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   762
def main():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   763
        gtk.main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   764
        return 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   765
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   766
if __name__ == "__main__":
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   767
        um = Updatemanager()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   768
        list_uninstalled = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   769
        debug = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   770
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   771
        try:
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   772
                opts, args = getopt.getopt(sys.argv[1:], "huR:U:",
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   773
                    ["help", "uninstalled", "image-dir=", "update-all="])
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   774
        except getopt.error, msg:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   775
                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
   776
                sys.exit(2)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   777
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   778
        if os.path.isabs(sys.argv[0]):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   779
                um.application_path = sys.argv[0]
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   780
        else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   781
                cmd = os.path.join(os.getcwd(), sys.argv[0])
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   782
                um.application_path = os.path.realpath(cmd)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   783
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   784
        for option, argument in opts:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   785
                if option in ("-h", "--help"):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   786
                        print """\
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
   787
Use -r (--refresh) to force a refresh before checking for updates.
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   788
Use -R (--image-dir) to specify image directory.
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   789
Use -U (--update-all) to proceed with Update All"""
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   790
                        sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   791
                if option in ("-u", "--uninstalled"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   792
                        list_uninstalled = True
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   793
                if option in ("-R", "--image-dir"):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   794
                        um.image_dir_arg = argument
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   795
                if option in ("-U", "--update-all"):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   796
                        um.update_all_proceed = True
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   797
                        um.ua_be_name = argument
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   798
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   799
        um.init_tree_views()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   800
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   801
        um.setup_progressdialog_show(_("Checking for new software"))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   802
        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
   803
        main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   804