author | Padraig O'Briain <padraig.obriain@sun.com> |
Wed, 02 Sep 2009 13:59:04 +0100 | |
changeset 1332 | 976aef7a657c |
parent 1288 | 4248f27af42a |
child 1352 | 5c92c9d342ef |
permissions | -rw-r--r-- |
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 |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
390 |
#TODO: This part is required so misc.get_inventory_list |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
391 |
# is returning desired list of packages. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
392 |
# After the list api (bug #5872) is in place |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
393 |
# this part should be replaced. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
394 |
image_obj.load_catalogs(self.pr) |
1168
6ca02b55d252
5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1164
diff
changeset
|
395 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
396 |
count = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
397 |
pkg_upgradeable = None |
1168
6ca02b55d252
5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1164
diff
changeset
|
398 |
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
|
399 |
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
|
400 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
401 |
while gtk.events_pending(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
402 |
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
|
403 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
404 |
if state["upgradable"] and state["state"] == "installed": |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
405 |
pkg_upgradeable = pkg |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
406 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
407 |
# 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
|
408 |
add_package = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
409 |
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
|
410 |
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
|
411 |
if list_uninstalled: |
1288
4248f27af42a
10417 rename v0 support should be removed everywhere
Shawn Walker <srw@sun.com>
parents:
1261
diff
changeset
|
412 |
add_package = not add_package |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
413 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
414 |
if add_package: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
415 |
count += 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
416 |
# 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
|
417 |
# 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
|
418 |
# 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
|
419 |
#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
|
420 |
# incState = _("Inc") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
421 |
#else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
422 |
# 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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
pkg.get_pkg_stem()]) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
427 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
428 |
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
|
429 |
print _("count: %d") % count |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
430 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
431 |
self.progress_stop_thread = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
432 |
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
|
433 |
self.um_list = um_list |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
434 |
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
|
435 |
|
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
436 |
# 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
|
437 |
# 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
|
438 |
# the size column |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
439 |
# 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
|
440 |
|
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
441 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
|
1261
9c949ec238b6
7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1259
diff
changeset
|
447 |
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
|
448 |
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
|
449 |
_("<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
|
450 |
"\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
|
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 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
453 |
def __display_noupdates(self): |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
454 |
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
|
455 |
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
|
456 |
|
9c949ec238b6
7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1259
diff
changeset
|
457 |
def __setup_display(self): |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
458 |
self.w_um_treeview.hide() |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
459 |
self.w_um_expander.hide() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
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
|
465 |
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
|
466 |
self.w_um_dialog.present() |
997
4c5d85a87ea2
7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
985
diff
changeset
|
467 |
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
|
468 |
|
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
469 |
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
|
470 |
if self.fmri_description != name: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
471 |
return None |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
472 |
if self.__get_api_obj() == None: |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
473 |
return None |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
474 |
|
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
|
475 |
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
|
476 |
(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
|
477 |
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
|
478 |
api.PackageInfo.ACTION_OPTIONS) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
479 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
480 |
pis = ret[api.ImageInterface.INFO_FOUND] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
481 |
if len(pis) == 1: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
482 |
return pis[0] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
483 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
484 |
return None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
485 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
486 |
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
|
487 |
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
|
488 |
if info is not None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
489 |
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
|
490 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
491 |
return None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
492 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
493 |
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
|
494 |
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
|
495 |
categories = _("None") |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
496 |
if info.category_info_list: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
497 |
verbose = len(info.category_info_list) > 1 |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
498 |
categories = "" |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
499 |
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
|
500 |
if len(info.category_info_list) > 1: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
501 |
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
|
502 |
categories += ", " + ci.__str__(verbose) |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
503 |
try: |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
504 |
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
|
505 |
except AttributeError: |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
506 |
installed_ver = "" |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
507 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
508 |
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
|
509 |
summary = _("None") |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
510 |
if info.summary: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
511 |
summary = info.summary |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
512 |
|
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
513 |
str_details = _( |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
514 |
'\nSummary:\t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
515 |
'\nSize: \t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
516 |
'\nCategory:\t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
517 |
'\nLatest Version:\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
518 |
'\nInstalled Version:\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
519 |
'\nPackaging Date:\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
520 |
'\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
|
521 |
'\nRepository: \t\t%s' |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
522 |
'\n') \ |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
523 |
% (summary, misc.bytes_to_str(info.size), |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
524 |
categories, ver, installed_ver, |
962
d7897f87708d
7488 Information about publisher needed in GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents:
942
diff
changeset
|
525 |
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
|
526 |
self.details_cache[name] = str_details |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
527 |
return str_details |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
528 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
529 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
530 |
def __removed_filter(model, itr): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
531 |
'''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
|
532 |
return True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
533 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
534 |
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
|
535 |
'''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
|
536 |
model, itr = selection.get_selected() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
537 |
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
|
538 |
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
|
539 |
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
|
540 |
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
|
541 |
if delta < SELECTION_CHANGE_LIMIT: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
542 |
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
|
543 |
self.selection_timer.cancel() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
544 |
self.selection_timer = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
545 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
546 |
self.fmri_description = fmri |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
547 |
self.last_select_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
548 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
549 |
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
|
550 |
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
|
551 |
self.selection_timer.cancel() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
552 |
self.selection_timer = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
553 |
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
|
554 |
infobuffer.set_text("") |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
555 |
textiter = infobuffer.get_end_iter() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
556 |
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
|
557 |
"\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
|
558 |
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
|
559 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
560 |
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
|
561 |
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
|
562 |
_("\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
|
563 |
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
|
564 |
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
|
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_thread(self, fmri, pkg_name): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
568 |
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
|
569 |
args = (fmri, pkg_name)).start() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
570 |
|
1031
5c130cc07e44
7037 GUI to cut last all but part of new Category Path
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1024
diff
changeset
|
571 |
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
|
572 |
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
|
573 |
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
|
574 |
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
|
575 |
infobuffer.set_text("") |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
576 |
textiter = infobuffer.get_end_iter() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
577 |
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
|
578 |
"\n%s" % pkg_name, "bold") |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
579 |
infobuffer.insert(textiter, details) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
580 |
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
|
581 |
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
|
582 |
infobuffer.set_text("") |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
583 |
textiter = infobuffer.get_end_iter() |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
584 |
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
|
585 |
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
|
586 |
_("\nNo details available"), "bold") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
587 |
|
1023
73f73773b4c9
6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents:
997
diff
changeset
|
588 |
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
|
589 |
try: |
73f73773b4c9
6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents:
997
diff
changeset
|
590 |
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
|
591 |
except gobject.GError: |
1168
6ca02b55d252
5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1164
diff
changeset
|
592 |
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
|
593 |
_("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
|
594 |
self.release_notes_url, |
6ca02b55d252
5197 gui should not manipulate image objects
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1164
diff
changeset
|
595 |
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
|
596 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
597 |
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
|
598 |
self.__exit_app() |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
599 |
|
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
600 |
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
|
601 |
self.__exit_app() |
985
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
602 |
|
1220
81379363d2ca
9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
603 |
@staticmethod |
81379363d2ca
9889 Help doesn't work on UpdateManager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
604 |
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
|
605 |
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
|
606 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
607 |
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
|
608 |
if be_name: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
609 |
if self.image_dir_arg: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
610 |
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
|
611 |
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
|
612 |
else: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
613 |
gobject.spawn_async([self.application_path, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
614 |
"-U", be_name]) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
615 |
|
796
bcd90655ad83
4019 Package Manager close bug
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
616 |
self.w_um_dialog.hide() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
617 |
gtk.main_quit() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
618 |
sys.exit(0) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
619 |
return True |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
620 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
621 |
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
|
622 |
self.__exit_app(be_name) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
623 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
624 |
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
|
625 |
self.__selectall_toggle(True) |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
626 |
self.__get_api_obj().reset() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
627 |
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
|
628 |
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
|
629 |
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
|
630 |
skip_be_dlg = True |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
631 |
installupdate.InstallUpdate([], self, |
1332
976aef7a657c
10523 progress bar don't move when downloading
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1288
diff
changeset
|
632 |
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
|
633 |
action = enumerations.IMAGE_UPDATE, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
634 |
be_name = self.ua_be_name, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
635 |
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
|
636 |
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
|
637 |
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
|
638 |
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
|
639 |
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
|
640 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
641 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
642 |
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
|
643 |
self.__selectall_toggle(widget.get_active()) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
644 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
645 |
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
|
646 |
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
|
647 |
elapsed_min = elapsed_sec / 60 |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
648 |
info_str = "" |
1136
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
649 |
if elapsed_sec >= 120: |
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 minutes.") \ |
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
652 |
% elapsed_min |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
653 |
else: |
1136
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
654 |
info_str = _( |
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
655 |
"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
|
656 |
% elapsed_sec |
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
657 |
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
|
658 |
|
1023
73f73773b4c9
6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents:
997
diff
changeset
|
659 |
info_str = _( |
1136
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
660 |
"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
|
661 |
) |
1136
27b3bc1f4768
8505 minor messaging fixups in gui
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1124
diff
changeset
|
662 |
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
|
663 |
|
1023
73f73773b4c9
6358 Release Notes message after Update All needs to be updated
John Rice <john.rice@sun.com>
parents:
997
diff
changeset
|
664 |
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
|
665 |
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
|
666 |
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
|
667 |
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
|
668 |
|
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
669 |
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
|
670 |
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
|
671 |
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
|
672 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
673 |
def __handle_cancel_exception(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
674 |
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
|
675 |
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
|
676 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
677 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
678 |
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
|
679 |
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
|
680 |
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
|
681 |
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
|
682 |
message_format = _( |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
683 |
"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
|
684 |
"be performed.\n\n" |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
685 |
"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
|
686 |
"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
|
687 |
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
|
688 |
result = msgbox.run() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
689 |
msgbox.destroy() |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
690 |
if result == gtk.RESPONSE_OK: |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
691 |
gobject.idle_add(self.__create_beadm) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
692 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
693 |
def __create_beadm(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
694 |
self.gladefile = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
695 |
"/usr/share/package-manager/packagemanager.glade" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
696 |
beadm.Beadmin(self) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
697 |
return False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
698 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
699 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
700 |
def __unique(list1, list2): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
701 |
"""Return a list containing all items |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
702 |
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
|
703 |
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
|
704 |
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
|
705 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
706 |
def __cleanup(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
707 |
self.api_obj.reset() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
708 |
self.pr.reset() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
709 |
self.progress_stop_thread = True |
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 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
712 |
def __on_um_expander_activate(widget): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
713 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
714 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
715 |
def __selectall_toggle(self, select): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
716 |
for row in self.um_list: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
717 |
row[UM_INSTALL_MARK] = select |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
718 |
if select: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
719 |
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
|
720 |
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
|
721 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
722 |
self.toggle_counter = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
723 |
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
|
724 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
725 |
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
|
726 |
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
|
727 |
itr = model.get_iter(filtered_path) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
728 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
729 |
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
|
730 |
if installed is None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
731 |
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
|
732 |
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
|
733 |
if not modified: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
734 |
self.toggle_counter += 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
735 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
736 |
self.toggle_counter -= 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
737 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
738 |
if self.toggle_counter > 0: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
739 |
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
|
740 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
741 |
self.toggle_counter = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
742 |
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
|
743 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
744 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
745 |
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
|
746 |
'''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
|
747 |
selected''' |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
748 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
749 |
if model.get_value(itr, 1): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
750 |
#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
|
751 |
# 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
|
752 |
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
|
753 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
754 |
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
|
755 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
756 |
def __on_progressdialog_progress(self): |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
757 |
if not self.progress_stop_thread: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
758 |
self.w_progressbar.pulse() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
759 |
return True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
760 |
else: |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
761 |
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
|
762 |
return False |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
763 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
764 |
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
|
765 |
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
|
766 |
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
|
767 |
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
|
768 |
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
|
769 |
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
|
770 |
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
|
771 |
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
|
772 |
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
|
773 |
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
|
774 |
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
|
775 |
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
|
776 |
self.w_progress_dialog.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
777 |
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
|
778 |
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
|
779 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
780 |
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
|
781 |
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
|
782 |
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
|
783 |
else: |
9c949ec238b6
7172 Update All button status is incorrect for non-authorized users
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1259
diff
changeset
|
784 |
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
|
785 |
self.__display_nopermissions() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
786 |
return False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
787 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
788 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
789 |
def progress_pulse(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
790 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
791 |
print "pulse: \n" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
792 |
|
997
4c5d85a87ea2
7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
985
diff
changeset
|
793 |
def update_package_list(self, update_list): |
4c5d85a87ea2
7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
985
diff
changeset
|
794 |
self.pylintstub = update_list |
4c5d85a87ea2
7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
985
diff
changeset
|
795 |
return |
4c5d85a87ea2
7791 Exception in updatemanager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
985
diff
changeset
|
796 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
797 |
def shutdown_after_image_update(self): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
798 |
self.__display_update_image_success() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
799 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
800 |
#-------------------- remove those |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
801 |
def main(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
802 |
gtk.main() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
803 |
return 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
804 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
805 |
if __name__ == "__main__": |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
806 |
um = Updatemanager() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
807 |
list_uninstalled = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
808 |
debug = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
809 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
810 |
try: |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
811 |
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
|
812 |
["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
|
813 |
except getopt.error, msg: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
814 |
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
|
815 |
sys.exit(2) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
816 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
817 |
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
|
818 |
um.application_path = sys.argv[0] |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
819 |
else: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
820 |
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
|
821 |
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
|
822 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
823 |
for option, argument in opts: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
824 |
if option in ("-h", "--help"): |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
825 |
print """\ |
1024
e83271f2e133
7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1023
diff
changeset
|
826 |
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
|
827 |
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
|
828 |
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
|
829 |
sys.exit(0) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
830 |
if option in ("-u", "--uninstalled"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
831 |
list_uninstalled = True |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
832 |
if option in ("-R", "--image-dir"): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
833 |
um.image_dir_arg = argument |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
834 |
if option in ("-U", "--update-all"): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
835 |
um.update_all_proceed = True |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
836 |
um.ua_be_name = argument |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
837 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
838 |
um.init_tree_views() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
839 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
1204
diff
changeset
|
840 |
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
|
841 |
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
|
842 |
main() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
843 |