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