src/updatemanager.py
author Shawn Walker <srw@sun.com>
Fri, 11 Sep 2009 05:01:08 -0500
changeset 1352 5c92c9d342ef
parent 1332 976aef7a657c
child 1366 23cf80f57e61
permissions -rw-r--r--
11065 client v1 catalog support for v0 catalogs 269 Catalog should include package dependencies 318 Unify depot and client pkg format 2763 pkg.catalog should have a function to split entries into appropriate fields 3045 pkg list tracebacks when installed state directory is out of sync with pkg directory 5562 catalog uses local time instead of UTC 8341 extract catalog cache from image 8473 cached catalog data can be wrong if mixing client versions 9248 client traceback if preferred publisher not in catalog cache 10041 catalog attrs can be out of sync with catalog 11071 pkg list -v doesn't show full FMRI for those from a preferred publisher 11072 client double instantiates image on startup 11074 manifests need sha-1 signature 11075 catalog should provide manifest signature data
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
from threading import Timer
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    37
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    38
try:
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
    39
        import gnome
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    40
        import gobject
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    41
        gobject.threads_init()        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    42
        import gtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    43
        import gtk.glade
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    44
        import pygtk
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    45
        pygtk.require("2.0")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    46
except ImportError:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    47
        sys.exit(1)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    48
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    49
import pkg.client.api as api
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
    50
import pkg.portable as portable
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    51
import pkg.client.progress as progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    52
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
    53
import pkg.gui.installupdate as installupdate
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
    54
import pkg.gui.enumerations as enumerations
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
    55
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
    56
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
    57
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
    58
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    59
# 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
    60
import __builtin__
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    61
__builtin__._ = gettext.gettext
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
    62
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    63
IMAGE_DIRECTORY_DEFAULT = "/"   # Image default directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    64
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
    65
1223
c83bf25dc7f3 10025 updatemanager dialog icon is missing
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1220
diff changeset
    66
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
    67
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
    68
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
    69
PKG_CLIENT_NAME = "updatemanager" # API client name
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    70
SELECTION_CHANGE_LIMIT = 0.5    # Time limit in seconds to cancel selection updates
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    71
IND_DELAY = 0.05                # Time delay for printing index progress
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    72
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
    73
                                # loop time to start and display main UI
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
    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
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
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()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   116
                self.fmri_description = None
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   117
                self.image_dir_arg = None
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   118
                self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   119
                self.selection_timer = None
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)
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   127
                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
   128
                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
   129
                self.ua_start = 0
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   130
                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
   131
                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
   132
                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
   133
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   134
                # Progress Dialog
1137
f6c7c39981aa 8660 packagemanager traceback if PACKAGE_MANAGER_ROOT missing trailing '/'
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1136
diff changeset
   135
                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
   136
                    "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
   137
                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
   138
                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
   139
                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
   140
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   141
                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
   142
                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
   143
                    "progressinfo_separator")                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   144
                self.w_progressinfo_expander = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   145
                    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
   146
                self.w_progressinfo_textview = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   147
                    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
   148
                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
   149
                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
   150
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   151
                self.w_progress_install_vbox = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   152
                    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
   153
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   154
                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
   155
                    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
   156
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   157
                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
   158
                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
   159
                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
   160
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   161
                # UM Dialog
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   162
                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
   163
                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
   164
                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
   165
                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
   166
                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
   167
                self.w_um_updateall_button = \
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   168
                    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
   169
                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
   170
                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
   171
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   172
                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
   173
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   174
                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
   175
                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
   176
                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
   177
                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
   178
                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
   179
                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
   180
                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
   181
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   182
                # 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
   183
                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
   184
                    "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
   185
                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
   186
                    "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
   187
                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
   188
                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
   189
                    "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
   190
                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
   191
                    "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
   192
                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
   193
                    "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
   194
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   195
                self.details_cache = {}
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   196
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   197
                try:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   198
                        dic = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   199
                            {
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   200
                                "on_um_dialog_close": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   201
                                    self.__on_um_dialog_close,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   202
                                "on_cancel_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   203
                                    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
   204
                                "on_close_button_clicked": \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   205
                                    self.__on_cancel_button_clicked,
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   206
                                "on_help_button_clicked": \
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   207
                                    self.__on_help_button_clicked,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   208
                                "on_um_updateall_button_clicked": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   209
                                    self.__on_updateall_button_clicked,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   210
                                "on_um_expander_activate": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   211
                                    self.__on_um_expander_activate,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   212
                                "on_selectall_checkbutton_toggled": \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   213
                                    self.__on_selectall_checkbutton_toggled,
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   214
                            }
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   215
                        w_xmltree_um.signal_autoconnect(dic)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   216
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   217
                        dic_completed = \
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   218
                            {
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   219
                                "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
   220
                                     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
   221
                                "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
   222
                                     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
   223
                                     
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
                        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
   226
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   227
                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
   228
                        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
   229
                            "Check updatemanager.py signals") % error
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   230
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   231
                self.pr = progress.NullProgressTracker()
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
                self.w_um_dialog.show_all()
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   234
                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
   235
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   236
        def __set_cancel_state(self, status):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   237
                if status:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   238
                        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
   239
                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
   240
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   241
        def __set_initial_selection(self):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   242
                self.__selectall_toggle(True)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   243
                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
   244
                        self.__display_noupdates()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   245
                else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   246
                        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
   247
                        if self.update_all_proceed:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   248
                                self.__on_updateall_button_clicked(None)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   249
                                self.update_all_proceed = False
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   250
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   251
        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
   252
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   253
                        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
   254
                                self.__set_renderer_active(renderer, False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   255
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   256
                                self.__set_renderer_active(renderer, True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   257
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   258
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   259
        def __set_renderer_active(renderer, active):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   260
                if active:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   261
                        renderer.set_property("sensitive", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   262
                        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
   263
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   264
                        renderer.set_property("sensitive", False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   265
                        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
   266
                
1204
0d3de1d0a4d8 9833 updatemanager dialog icon is missing after upgrading Desktop packages
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1168
diff changeset
   267
        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
   268
                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
   269
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   270
        def __get_selected_fmris(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   271
                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
   272
                iter_next = model.get_iter_first()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   273
                list_of_selected_fmris = []
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   274
                while iter_next != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   275
                        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
   276
                                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
   277
                                    UM_NAME))
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   278
                        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
   279
                return list_of_selected_fmris
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   280
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   281
        def init_tree_views(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   282
                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
   283
                toggle_renderer = gtk.CellRendererToggle()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   284
                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
   285
                column = gtk.TreeViewColumn("", toggle_renderer,
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   286
                    active = UM_INSTALL_MARK)
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   287
                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
   288
                    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
   289
                toggle_renderer.set_property("activatable", True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   290
                column.set_expand(False)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   291
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   292
                # 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
   293
                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
   294
                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
   295
                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
   296
                    "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
   297
                    "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
   298
                    "install all packages into it."))
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   299
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   300
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   301
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   302
                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
   303
                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
   304
                column.set_title("   ")
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   305
                # Hiding Status column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   306
                #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
   307
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   308
                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
   309
                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
   310
                    text = UM_NAME)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   311
                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
   312
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   313
                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
   314
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   315
                column = gtk.TreeViewColumn()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   316
                render_pixbuf = gtk.CellRendererPixbuf()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   317
                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
   318
                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
   319
                # Hiding Reboot required column for now
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   320
                # 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
   321
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   322
                version_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   323
                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
   324
                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
   325
                    text = UM_LATEST_VER) 
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   326
                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
   327
                    self.__cell_data_function, None)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   328
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   329
                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
   330
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   331
                size_renderer = gtk.CellRendererText()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   332
                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
   333
                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
   334
                    text = UM_SIZE)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   335
                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
   336
                column.set_expand(True)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   337
                # 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
   338
                #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
   339
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   340
                #Added selection listener
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   341
                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
   342
                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
   343
                self.package_selection.connect("changed",
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   344
                    self.__on_package_selection_changed, None)
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
                # 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
   347
                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
   348
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   349
        def __get_image_path(self):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   350
                '''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
   351
                if self.image_dir_arg != None:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   352
                        return self.image_dir_arg
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   353
1215
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   354
                try:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   355
                        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
   356
                except KeyError:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   357
                        image_directory = \
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   358
                            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
   359
                        if len(image_directory) == 0:
a302cf70ad94 9364 pm-updatemanager should support PKG_IMAGE
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1209
diff changeset
   360
                                image_directory = IMAGE_DIRECTORY_DEFAULT
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   361
                return image_directory
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   362
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   363
        def get_updates_to_list(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   364
                '''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
   365
                        that are available to list'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   366
                # 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
   367
                um_list = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   368
                    gtk.ListStore(
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   369
                        gobject.TYPE_INT,         # UM_ID
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   370
                        gobject.TYPE_BOOLEAN,     # UM_INSTALL_MARK
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   371
                        gtk.gdk.Pixbuf,           # UM_STATUS
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   372
                        gobject.TYPE_STRING,      # UM_NAME
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   373
                        gtk.gdk.Pixbuf,           # UM_REBOOT
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   374
                        gobject.TYPE_STRING,      # UM_LATEST_VER
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   375
                        gobject.TYPE_STRING,      # 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
   376
                        gobject.TYPE_STRING,      # UM_STEM                        
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   377
                        )
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   378
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
   379
                # 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
   380
                # 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
   381
                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
   382
                    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
   383
                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
   384
                        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
   385
                        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
   386
                        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
   387
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   388
                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
   389
                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
   390
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   391
                count = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   392
                pkg_upgradeable = None
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   393
                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
   394
                    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
   395
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   396
                        while gtk.events_pending():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   397
                                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
   398
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1332
diff changeset
   399
                        if state["upgradable"] and \
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1332
diff changeset
   400
                            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
   401
                                pkg_upgradeable = pkg
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   402
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   403
                        # 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
   404
                        add_package = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   405
                        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
   406
                                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
   407
                                if list_uninstalled:
1288
4248f27af42a 10417 rename v0 support should be removed everywhere
Shawn Walker <srw@sun.com>
parents: 1261
diff changeset
   408
                                        add_package = not add_package
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   409
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   410
                        if add_package:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   411
                                count += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   412
                                # 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
   413
                                # 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
   414
                                # 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
   415
                                #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
   416
                                #        incState = _("Inc")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   417
                                #else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   418
                                #        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
   419
                                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
   420
                                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
   421
                                    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
   422
                                    pkg.get_pkg_stem()])
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   423
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   424
                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
   425
                        print _("count: %d") % count
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   426
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   427
                self.progress_stop_thread = True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   428
                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
   429
                self.um_list = um_list                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   430
                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
   431
                        
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   432
                # 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
   433
                # 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
   434
                # the size column
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   435
                # 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
   436
                
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   437
        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
   438
                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
   439
                        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
   440
                            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
   441
                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
   442
1261
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   443
        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
   444
                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
   445
                    _("<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
   446
                    "\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
   447
                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
   448
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   449
        def __display_noupdates(self):
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   450
                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
   451
                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
   452
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   453
        def __setup_display(self):
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   454
                self.w_um_treeview.hide()
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   455
                self.w_um_expander.hide()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   456
                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
   457
                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
   458
                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
   459
                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
   460
                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
   461
                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
   462
                self.w_um_dialog.present()
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   463
                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
   464
                
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   465
        def __get_info_from_name(self, name, local):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   466
                if self.fmri_description != name:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   467
                        return None
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   468
                if self.__get_api_obj() == None:
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   469
                        return None
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   470
                        
917
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 869
diff changeset
   471
                ret = self.__get_api_obj().info([name], local,
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 869
diff changeset
   472
                    (api.PackageInfo.ALL_OPTIONS -
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 869
diff changeset
   473
                    frozenset([api.PackageInfo.LICENSES])) -
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 869
diff changeset
   474
                    api.PackageInfo.ACTION_OPTIONS)
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   475
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   476
                pis = ret[api.ImageInterface.INFO_FOUND]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   477
                if len(pis) == 1:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   478
                        return pis[0]
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   479
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   480
                        return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   481
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   482
        def __get_details_from_name(self, name):                        
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   483
                info = self.__get_info_from_name(name, False)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   484
                if info is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   485
                        return self.__update_details_from_info(name, info)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   486
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   487
                        return None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   488
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   489
        def __update_details_from_info(self, name, info):
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   490
                local_info = self.__get_info_from_name(name, True)
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   491
                categories = _("None")
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   492
                if info.category_info_list:
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   493
                        verbose = len(info.category_info_list) > 1
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   494
                        categories = ""
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   495
                        categories += info.category_info_list[0].__str__(verbose)
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   496
                        if len(info.category_info_list) > 1:
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   497
                                for ci in info.category_info_list[1:]:
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   498
                                        categories += ", " + ci.__str__(verbose)
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   499
                try:
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   500
                        installed_ver = "%s-%s" % (local_info.version, local_info.branch)
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   501
                except AttributeError:
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   502
                        installed_ver = ""
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   503
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   504
                ver = "%s-%s" % (info.version, info.branch)
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   505
                summary = _("None")
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   506
                if info.summary:
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   507
                        summary = info.summary
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   508
 
808
6c89385ac9ff 4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents: 796
diff changeset
   509
                str_details = _(
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   510
                    '\nSummary:\t\t\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   511
                    '\nSize:       \t\t\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   512
                    '\nCategory:\t\t\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   513
                    '\nLatest Version:\t\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   514
                    '\nInstalled Version:\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   515
                    '\nPackaging Date:\t%s'
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   516
                    '\nFMRI:       \t\t\t%s'
962
d7897f87708d 7488 Information about publisher needed in GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 942
diff changeset
   517
                    '\nRepository:       \t\t%s'
860
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   518
                    '\n') \
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   519
                    % (summary, misc.bytes_to_str(info.size), 
5c86e593ed4d 5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents: 809
diff changeset
   520
                    categories, ver, installed_ver,
962
d7897f87708d 7488 Information about publisher needed in GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents: 942
diff changeset
   521
                    info.packaging_date, info.fmri, info.publisher)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   522
                self.details_cache[name] = str_details
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   523
                return str_details
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   524
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   525
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   526
        def __removed_filter(model, itr):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   527
                '''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
   528
                return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   529
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   530
        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
   531
                '''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
   532
                model, itr = selection.get_selected()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   533
                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
   534
                        fmri = model.get_value(itr, UM_STEM)
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   535
                        pkg_name =  model.get_value(itr, UM_NAME)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   536
                        delta = time.time() - self.last_select_time
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   537
                        if delta < SELECTION_CHANGE_LIMIT:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   538
                                if self.selection_timer is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   539
                                        self.selection_timer.cancel()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   540
                                        self.selection_timer = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   541
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   542
                        self.fmri_description = fmri
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   543
                        self.last_select_time = time.time()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   544
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   545
                        if self.details_cache.has_key(fmri):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   546
                                if self.selection_timer is not None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   547
                                        self.selection_timer.cancel()  
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   548
                                        self.selection_timer = None
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   549
                                infobuffer = self.w_um_textview.get_buffer()
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   550
                                infobuffer.set_text("")
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   551
                                textiter = infobuffer.get_end_iter()
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   552
                                infobuffer.insert_with_tags_by_name(textiter,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   553
                                    "\n%s" % pkg_name, "bold")
660
ea2809ad4582 4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents: 653
diff changeset
   554
                                infobuffer.insert(textiter, self.details_cache[fmri])
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   555
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   556
                                infobuffer = self.w_um_textview.get_buffer()
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   557
                                infobuffer.set_text(
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   558
                                    _("\nFetching details for %s ...") % pkg_name)
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   559
                                self.selection_timer = Timer(SELECTION_CHANGE_LIMIT,
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   560
                                    self.__show_package_info_thread,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   561
                                    args=(fmri, pkg_name )).start()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   562
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   563
        def __show_package_info_thread(self, fmri, pkg_name):
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   564
                Thread(target = self.__show_package_info,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   565
                    args = (fmri, pkg_name)).start()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   566
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   567
        def __show_package_info(self, fmri, pkg_name):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   568
                details = self.__get_details_from_name(fmri)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   569
                if self.fmri_description == fmri and details != None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   570
                        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
   571
                        infobuffer.set_text("")
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   572
                        textiter = infobuffer.get_end_iter()
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   573
                        infobuffer.insert_with_tags_by_name(textiter,
1031
5c130cc07e44 7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1024
diff changeset
   574
                            "\n%s" % pkg_name, "bold")
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   575
                        infobuffer.insert(textiter, details)
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   576
                elif self.fmri_description == fmri and details == None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   577
                        infobuffer = self.w_um_textview.get_buffer()
771
24696e0e0a92 5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 731
diff changeset
   578
                        infobuffer.set_text("")
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   579
                        textiter = infobuffer.get_end_iter()
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   580
                        if textiter != None: #Gtk race condition seems to cause this
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   581
                                infobuffer.insert_with_tags_by_name(textiter,
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   582
                                        _("\nNo details available"), "bold")
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   583
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   584
        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
   585
                try:
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   586
                        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
   587
                except gobject.GError:
1168
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   588
                        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
   589
                            _("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
   590
                            self.release_notes_url,
6ca02b55d252 5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1164
diff changeset
   591
                            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
   592
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   593
        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
   594
                self.__exit_app()
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   595
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   596
        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
   597
                self.__exit_app()
985
bcc30bb98888 5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents: 962
diff changeset
   598
                
1220
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   599
        @staticmethod
81379363d2ca 9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1217
diff changeset
   600
        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
   601
                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
   602
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   603
        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
   604
                if be_name:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   605
                        if self.image_dir_arg:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   606
                                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
   607
                                    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
   608
                        else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   609
                                gobject.spawn_async([self.application_path, 
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   610
                                    "-U", be_name])
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   611
796
bcd90655ad83 4019 Package Manager close bug
Padraig O'Briain <padraig.obriain@sun.com>
parents: 791
diff changeset
   612
                self.w_um_dialog.hide()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   613
                gtk.main_quit()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   614
                sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   615
                return True
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   616
        
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   617
        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
   618
                self.__exit_app(be_name)
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   619
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   620
        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
   621
                self.__selectall_toggle(True)
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   622
                self.__get_api_obj().reset()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   623
                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
   624
                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
   625
                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
   626
                        skip_be_dlg = True
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   627
                installupdate.InstallUpdate([], self,
1332
976aef7a657c 10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1288
diff changeset
   628
                    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
   629
                    action = enumerations.IMAGE_UPDATE,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   630
                    be_name = self.ua_be_name,
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   631
                    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
   632
                    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
   633
                    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
   634
                    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
   635
                    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
   636
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   637
               
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   638
        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
   639
                self.__selectall_toggle(widget.get_active())
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   640
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   641
        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
   642
                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
   643
                elapsed_min = elapsed_sec / 60
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   644
                info_str = ""
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   645
                if elapsed_sec >= 120:
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   646
                        info_str = _(
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   647
                           "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
   648
                           % elapsed_min
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   649
                else:
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   650
                        info_str = _(
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   651
                            "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
   652
                             % elapsed_sec
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   653
                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
   654
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   655
                info_str = _(
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   656
                    "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
   657
                    )
1136
27b3bc1f4768 8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1124
diff changeset
   658
                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
   659
1023
73f73773b4c9 6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents: 997
diff changeset
   660
                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
   661
                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
   662
                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
   663
                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
   664
                
600
dc1db5978b68 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 597
diff changeset
   665
                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
   666
                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
   667
                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
   668
                
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   669
        def __handle_cancel_exception(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   670
                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
   671
                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
   672
                self.__cleanup()                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   673
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   674
        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
   675
                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
   676
                    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
   677
                    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
   678
                    message_format = _(
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   679
                    "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
   680
                    "be performed.\n\n"
942
cb2774668721 6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents: 941
diff changeset
   681
                    "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
   682
                    "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
   683
                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
   684
                result = msgbox.run()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   685
                msgbox.destroy()
597
7c6e4f5a442a 3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents: 578
diff changeset
   686
                if result == gtk.RESPONSE_OK:
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   687
                        gobject.idle_add(self.__create_beadm)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   688
                        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   689
        def __create_beadm(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   690
                self.gladefile = \
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   691
                        "/usr/share/package-manager/packagemanager.glade"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   692
                beadm.Beadmin(self)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   693
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   694
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   695
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   696
        def __unique(list1, list2):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   697
                """Return a list containing all items
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   698
                        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
   699
                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
   700
                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
   701
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   702
        def __cleanup(self):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   703
                self.api_obj.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   704
                self.pr.reset()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   705
                self.progress_stop_thread = True   
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   706
                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   707
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   708
        def __on_um_expander_activate(widget):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   709
                return
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   710
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   711
        def __selectall_toggle(self, select):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   712
                for row in self.um_list:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   713
                        row[UM_INSTALL_MARK] = select
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   714
                if select:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   715
                        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
   716
                        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
   717
                else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   718
                        self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   719
                        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
   720
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   721
        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
   722
                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
   723
                itr = model.get_iter(filtered_path)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   724
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   725
                        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
   726
                        if installed is None:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   727
                                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
   728
                                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
   729
                        if not modified:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   730
                                self.toggle_counter += 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   731
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   732
                                self.toggle_counter -= 1
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   733
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   734
                        if self.toggle_counter > 0:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   735
                                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
   736
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   737
                                self.toggle_counter = 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   738
                                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
   739
                                
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   740
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   741
        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
   742
                '''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
   743
                selected'''
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   744
                if itr:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   745
                        if model.get_value(itr, 1):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   746
                                #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
   747
                                # 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
   748
                                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
   749
                        else:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   750
                                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
   751
        
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   752
        def __on_progressdialog_progress(self):
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   753
                if not self.progress_stop_thread:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   754
                        self.w_progressbar.pulse()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   755
                        return True
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   756
                else:
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   757
                        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
   758
                return False
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   759
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   760
        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
   761
                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
   762
                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
   763
                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
   764
                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
   765
                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
   766
                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
   767
                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
   768
                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
   769
                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
   770
                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
   771
                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
   772
                self.w_progress_dialog.show()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   773
                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
   774
                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
   775
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   776
        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
   777
                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
   778
                        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
   779
                else:
9c949ec238b6 7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1259
diff changeset
   780
                        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
   781
                        self.__display_nopermissions()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   782
                return False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   783
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   784
        @staticmethod
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   785
        def progress_pulse():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   786
                if debug:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   787
                        print "pulse: \n"
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   788
                
997
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   789
        def update_package_list(self, update_list):
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   790
                self.pylintstub = update_list
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   791
                return
4c5d85a87ea2 7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 985
diff changeset
   792
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   793
        def shutdown_after_image_update(self):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   794
                self.__display_update_image_success()
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   795
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   796
#-------------------- remove those
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   797
def main():
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   798
        gtk.main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   799
        return 0
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   800
        
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   801
if __name__ == "__main__":
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   802
        um = Updatemanager()
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   803
        list_uninstalled = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   804
        debug = False
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   805
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   806
        try:
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   807
                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
   808
                    ["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
   809
        except getopt.error, msg:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   810
                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
   811
                sys.exit(2)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   812
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   813
        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
   814
                um.application_path = sys.argv[0]
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   815
        else:
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   816
                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
   817
                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
   818
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   819
        for option, argument in opts:
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   820
                if option in ("-h", "--help"):
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   821
                        print """\
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1023
diff changeset
   822
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
   823
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
   824
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
   825
                        sys.exit(0)
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   826
                if option in ("-u", "--uninstalled"):
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   827
                        list_uninstalled = True
869
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   828
                if option in ("-R", "--image-dir"):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   829
                        um.image_dir_arg = argument
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   830
                if option in ("-U", "--update-all"):
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   831
                        um.update_all_proceed = True
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   832
                        um.ua_be_name = argument
0197953cd88a 5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents: 860
diff changeset
   833
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   834
        um.init_tree_views()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   835
1209
640c256cb2a3 9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents: 1204
diff changeset
   836
        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
   837
        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
   838
        main()
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff changeset
   839