author | John Rice <john.rice@sun.com> |
Fri, 27 Mar 2009 16:41:07 +0000 | |
changeset 985 | bcc30bb98888 |
parent 962 | d7897f87708d |
child 997 | 4c5d85a87ea2 |
permissions | -rw-r--r-- |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/python2.4 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
2 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
4 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
8 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
13 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
19 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
21 |
# |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
927
diff
changeset
|
22 |
# Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
23 |
# Use is subject to license terms. |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
24 |
# |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
25 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
26 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
27 |
import getopt |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
28 |
import os |
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 |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
53 |
import pkg.gui.installupdate as installupdate |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
54 |
import pkg.gui.enumerations as enumerations |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
55 |
import pkg.gui.misc as gui_misc |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
56 |
import pkg.misc as misc |
696
6bbfd2dece6f
4371 user-agent string needs to be different for different client front-ends
Danek Duvall <danek.duvall@sun.com>
parents:
660
diff
changeset
|
57 |
from pkg.client import global_settings |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
58 |
|
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
59 |
# Put _() in the global namespace |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
60 |
import __builtin__ |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
61 |
__builtin__._ = gettext.gettext |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
62 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
63 |
IMAGE_DIRECTORY_DEFAULT = "/" # Image default directory |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
64 |
IMAGE_DIR_COMMAND = "svcprop -p update/image_dir svc:/application/pkg/update" |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
65 |
CLIENT_API_VERSION = gui_misc.get_client_api_version() |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
66 |
|
636
a8306e269861
4008 Client API api.info is slow and appears to be consuming a...
John Rice <john.rice@sun.com>
parents:
603
diff
changeset
|
67 |
PKG_CLIENT_NAME = "updatemanager" # API client name |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
68 |
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
|
69 |
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
|
70 |
UPDATES_FETCH_DELAY = 200 # Time to wait before fetching updates, allows gtk main |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
71 |
# loop time to start and display main UI |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
72 |
#UM Row Model |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
73 |
( |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
74 |
UM_ID, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
75 |
UM_INSTALL_MARK, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
76 |
UM_STATUS, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
77 |
UM_NAME, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
78 |
UM_REBOOT, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
79 |
UM_LATEST_VER, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
80 |
UM_SIZE, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
81 |
UM_FMRI, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
82 |
) = range(8) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
83 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
84 |
#UPDATE STEPS |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
85 |
( |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
86 |
UPDATE_EVAL, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
87 |
UPDATE_DOWNLOAD, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
88 |
UPDATE_INSTALL, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
89 |
UPDATE_INDEX, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
90 |
) = range(4) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
91 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
92 |
#UPDATE TYPES |
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 |
UPDATE_ACTIVE, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
95 |
UPDATE_INACTIVE, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
96 |
UPDATE_DONE, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
97 |
) = range(3) |
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 |
class GUIProgressTracker(progress.ProgressTracker): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
100 |
""" 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
|
101 |
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
|
102 |
in the GUI context. """ |
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 |
def __init__(self, parent): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
105 |
progress.ProgressTracker.__init__(self) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
106 |
self.parent = parent |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
107 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
108 |
self.act_started = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
109 |
self.ind_started = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
110 |
self.last_print_time = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
111 |
self.dl_started = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
112 |
self.dl_cur_pkg = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
113 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
114 |
def reset(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
115 |
progress.ProgressTracker.reset(self) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
116 |
self.act_started = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
117 |
self.ind_started = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
118 |
self.last_print_time = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
119 |
self.dl_started = False |
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_start(self): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
122 |
catstr = _("Fetching catalog: '%s' ..." % (self.cat_cur_catalog)) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
123 |
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
|
124 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
125 |
def cat_output_done(self): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
126 |
gobject.idle_add(self.parent.output_done, _("Fetching catalog")) |
578
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_start(self): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
129 |
s = _("Creating Plan ... ") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
130 |
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
|
131 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
132 |
def eval_output_progress(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
133 |
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
|
134 |
self.last_print_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
135 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
136 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
137 |
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
|
138 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
139 |
def eval_output_done(self): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
140 |
gobject.idle_add(self.parent.output_done, _("Creating Plan")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
141 |
self.last_print_time = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
142 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
143 |
def ver_output(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
144 |
if self.ver_cur_fmri != None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
145 |
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
|
146 |
self.last_print_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
147 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
148 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
149 |
gobject.idle_add(self.parent.progress_pulse) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
150 |
gobject.idle_add(self.parent.output, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
151 |
_("Verifying: %s ...") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
152 |
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
|
153 |
else: |
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, "") |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
155 |
self.last_print_time = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
156 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
157 |
def ver_output_error(self, actname, errors): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
158 |
gobject.idle_add(self.parent.output_done, _("Verifying")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
159 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
160 |
def dl_output(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
161 |
gobject.idle_add(self.parent.dl_progress, |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
162 |
self.dl_started, self.dl_cur_pkg, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
163 |
self.dl_cur_npkgs, self.dl_goal_npkgs, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
164 |
self.dl_cur_nfiles, self.dl_goal_nfiles, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
165 |
self.dl_cur_nbytes / 1024.0 / 1024.0, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
166 |
self.dl_goal_nbytes / 1024.0 / 1024.0) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
167 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
168 |
if not self.dl_started: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
169 |
self.dl_started = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
170 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
171 |
def dl_output_done(self): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
172 |
self.dl_cur_pkg = _("Completed") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
173 |
self.dl_output() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
174 |
gobject.idle_add(self.parent.output_done, _("Download")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
175 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
176 |
def act_output(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
177 |
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
|
178 |
self.last_print_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
179 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
180 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
181 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
182 |
gobject.idle_add(self.parent.act_progress, self.act_started, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
183 |
self.act_phase, self.act_cur_nactions, self.act_goal_nactions) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
184 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
185 |
if not self.act_started: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
186 |
self.act_started = True |
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 act_output_done(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
189 |
self.act_output() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
190 |
gobject.idle_add(self.parent.output_done, _("Install")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
191 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
192 |
def ind_output(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
193 |
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
|
194 |
self.last_print_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
195 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
196 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
197 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
198 |
gobject.idle_add(self.parent.ind_progress, self.ind_started, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
199 |
self.ind_phase, self.ind_cur_nitems, self.ind_goal_nitems) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
200 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
201 |
if not self.ind_started: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
202 |
self.ind_started = True |
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 |
def ind_output_done(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
205 |
self.act_output() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
206 |
gobject.idle_add(self.parent.output_done, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
207 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
208 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
209 |
class Updatemanager: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
210 |
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
|
211 |
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
|
212 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
213 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
214 |
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
|
215 |
except KeyError: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
216 |
self.application_dir = "/" |
791
123e9401e939
5778 Inability to set locale leads to stack trace
Danek Duvall <danek.duvall@sun.com>
parents:
771
diff
changeset
|
217 |
misc.setlocale(locale.LC_ALL, "") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
218 |
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
|
219 |
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
|
220 |
"/usr/share/locale") |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
221 |
module.textdomain("pkg") |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
222 |
# 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
|
223 |
# 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
|
224 |
self.um_list = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
225 |
gtk.ListStore( |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
226 |
gobject.TYPE_INT, # UM_ID |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
227 |
gobject.TYPE_BOOLEAN, # UM_INSTALL_MARK |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
228 |
gtk.gdk.Pixbuf, # UM_STATUS |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
229 |
gobject.TYPE_STRING, # UM_NAME |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
230 |
gtk.gdk.Pixbuf, # UM_REBOOT |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
231 |
gobject.TYPE_STRING, # UM_LATEST_VER |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
232 |
gobject.TYPE_STRING, # UM_SIZE |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
233 |
gobject.TYPE_STRING, # UM_FMRI |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
234 |
) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
235 |
self.progress_stop_thread = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
236 |
self.initial_active = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
237 |
self.initial_default = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
238 |
self.last_select_time = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
239 |
self.size_thread_running = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
240 |
self.cancelled = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
241 |
self.fmri_description = None |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
242 |
self.image_dir_arg = None |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
243 |
self.install = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
244 |
self.install_error = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
245 |
self.done_icon = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
246 |
self.blank_icon = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
247 |
self.update_stage = UPDATE_EVAL |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
248 |
self.toggle_counter = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
249 |
self.selection_timer = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
250 |
self.package_selection = None |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
251 |
self.update_all_proceed = False |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
252 |
self.ua_be_name = None |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
253 |
self.application_path = None |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
254 |
self.cur_pkg = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
255 |
self.show_all_opts = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
256 |
self.show_install_updates_only = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
257 |
self.do_refresh = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
258 |
self.ua_start = 0 |
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 |
# Progress Dialog |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
261 |
self.gladefile = self.application_dir + \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
262 |
"/usr/share/update-manager/updatemanager.glade" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
266 |
self.w_progressinfo_label = w_xmltree_progress.get_widget("progressinfo") |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
267 |
self.w_progressinfo_separator = w_xmltree_progress.get_widget( |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
268 |
"progressinfo_separator") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
269 |
self.w_progressinfo_expander = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
270 |
w_xmltree_progress.get_widget("progressinfo_expander") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
271 |
self.w_progressinfo_textview = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
272 |
w_xmltree_progress.get_widget("progressinfo_textview") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
273 |
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
|
274 |
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
|
275 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
276 |
self.w_progressinfo_expander_label = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
277 |
w_xmltree_progress.get_widget("progressinfo_expander_label") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
278 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
279 |
self.w_progress_install_vbox = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
280 |
w_xmltree_progress.get_widget("progress_install_vbox") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
281 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
282 |
self.w_progress_eval_img = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
283 |
w_xmltree_progress.get_widget("progress_eval_img") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
284 |
self.w_progress_eval_label = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
285 |
w_xmltree_progress.get_widget("progress_eval_label") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
286 |
self.w_progress_download_img = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
287 |
w_xmltree_progress.get_widget("progress_download_img") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
288 |
self.w_progress_download_label = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
289 |
w_xmltree_progress.get_widget("progress_download_label") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
290 |
self.w_progress_install_img = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
291 |
w_xmltree_progress.get_widget("progress_install_img") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
292 |
self.w_progress_install_label = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
293 |
w_xmltree_progress.get_widget("progress_install_label") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
294 |
self.w_progress_index_img = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
295 |
w_xmltree_progress.get_widget("progress_index_img") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
296 |
self.w_progress_index_label = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
297 |
w_xmltree_progress.get_widget("progress_index_label") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
298 |
self.w_progress_closeon_finish_chk = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
299 |
w_xmltree_progress.get_widget("closeon_finish_checkbutton") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
300 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
305 |
# UM Dialog |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
306 |
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
|
307 |
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
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
self.w_um_updateall_button = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
312 |
w_xmltree_um.get_widget("um_updateall_button") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
313 |
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
|
314 |
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
|
315 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
316 |
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
|
317 |
|
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
self.w_select_checkbox = w_xmltree_um.get_widget("selectall_checkbutton") |
985
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
324 |
self.w_um_cancel_button = w_xmltree_um.get_widget("cancel_button") |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
325 |
self.w_um_close_button = w_xmltree_um.get_widget("close_button") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
326 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
327 |
self.details_cache = {} |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
328 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
329 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
330 |
dic = \ |
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 |
"on_um_dialog_close": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
333 |
self.__on_um_dialog_close, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
334 |
"on_cancel_button_clicked": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
335 |
self.__on_cancel_button_clicked, |
985
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
336 |
"on_close_button_clicked": \ |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
337 |
self.__on_cancel_button_clicked, |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
338 |
"on_help_button_clicked": \ |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
339 |
self.__on_help_button_clicked, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
340 |
"on_install_button_clicked": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
341 |
self.__on_install_button_clicked, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
342 |
"on_um_updateall_button_clicked": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
343 |
self.__on_updateall_button_clicked, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
344 |
"on_um_expander_activate": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
345 |
self.__on_um_expander_activate, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
346 |
"on_selectall_checkbutton_toggled": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
347 |
self.__on_selectall_checkbutton_toggled, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
348 |
} |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
349 |
w_xmltree_um.signal_autoconnect(dic) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
350 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
351 |
dic_progress = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
352 |
{ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
353 |
"on_progresscancel_clicked": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
354 |
self.__on_progresscancel_clicked, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
355 |
"on_progressok_clicked": \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
356 |
self.__on_progressok_clicked, |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
357 |
} |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
358 |
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
|
359 |
|
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 |
except AttributeError, error: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
362 |
print _("GUI will not respond to any event! %s. " |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
363 |
"Check updatemanager.py signals") % error |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
364 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
365 |
self.pr = GUIProgressTracker(self) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
366 |
self.api_obj = None |
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 |
self.w_um_dialog.show_all() |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
369 |
self.w_um_dialog.resize(620,500) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
370 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
371 |
def __set_cancel_state(self, status): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
372 |
if self.install_error: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
373 |
return |
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 |
if status: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
376 |
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
|
377 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
378 |
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
|
379 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
380 |
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
|
381 |
if type_step == UPDATE_ACTIVE: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
382 |
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
|
383 |
elif type_step == UPDATE_DONE: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
384 |
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
|
385 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
386 |
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
|
387 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
388 |
def __progress_steps(self, eval_type, evaluate, dl_type, download, install_type, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
389 |
install, index_type, index): |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
390 |
self.__progress_step(eval_type, self.w_progress_eval_img, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
391 |
self.w_progress_eval_label, evaluate) |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
392 |
self.__progress_step(dl_type, self.w_progress_download_img, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
393 |
self.w_progress_download_label,download) |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
394 |
self.__progress_step(install_type, self.w_progress_install_img, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
395 |
self.w_progress_install_label, install) |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
396 |
self.__progress_step(index_type, self.w_progress_index_img, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
397 |
self.w_progress_index_label, index) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
398 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
399 |
def __progress_steps_start(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
400 |
self.__progress_steps( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
401 |
UPDATE_ACTIVE, _("Evaluate"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
402 |
UPDATE_INACTIVE, _("Download"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
403 |
UPDATE_INACTIVE, _("Install"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
404 |
UPDATE_INACTIVE, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
405 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
406 |
def __progress_steps_download(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
407 |
self.__progress_steps( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
408 |
UPDATE_DONE, _("Evaluate"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
409 |
UPDATE_ACTIVE, _("Download"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
410 |
UPDATE_INACTIVE, _("Install"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
411 |
UPDATE_INACTIVE, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
412 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
413 |
def __progress_steps_install(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
414 |
self.__progress_steps( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
415 |
UPDATE_DONE, _("Evaluate"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
416 |
UPDATE_DONE, _("Download"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
417 |
UPDATE_ACTIVE, _("Install"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
418 |
UPDATE_INACTIVE, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
419 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
420 |
def __progress_steps_index(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
421 |
self.__progress_steps( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
422 |
UPDATE_DONE, _("Evaluate"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
423 |
UPDATE_DONE, _("Download"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
424 |
UPDATE_DONE, _("Install"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
425 |
UPDATE_ACTIVE, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
426 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
427 |
def __progress_steps_done(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
428 |
self.__progress_steps( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
429 |
UPDATE_DONE, _("Evaluate"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
430 |
UPDATE_DONE, _("Download"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
431 |
UPDATE_DONE, _("Install"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
432 |
UPDATE_DONE, _("Index")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
433 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
434 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
435 |
def __progress_cancel_eval(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
436 |
self.__progress_cancel_step(self.w_progress_eval_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
437 |
self.w_progress_eval_label, _("Evaluate - canceling...")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
438 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
439 |
def __progress_cancel_download(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
440 |
self.__progress_cancel_step(self.w_progress_download_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
441 |
self.w_progress_download_label, _("Download - canceling...")) |
578
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_error_eval(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
445 |
self.__progress_error_step(self.w_progress_eval_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
446 |
self.w_progress_eval_label, _("Evaluate - failed")) |
578
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_error_download(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
449 |
self.__progress_error_step(self.w_progress_download_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
450 |
self.w_progress_download_label, _("Download - failed")) |
578
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 |
def __progress_error_install(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
453 |
self.__progress_error_step(self.w_progress_install_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
454 |
self.w_progress_install_label, _("Install - failed")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
455 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
456 |
def __progress_error_index(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
457 |
self.__progress_error_step(self.w_progress_index_img, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
458 |
self.w_progress_index_label, _("Index - failed")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
459 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
460 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
465 |
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
|
466 |
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
|
467 |
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
|
468 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
473 |
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
|
474 |
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
|
475 |
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
|
476 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
477 |
# 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
|
478 |
# 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
|
479 |
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
|
480 |
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
|
481 |
self.w_um_dialog.present() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
482 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
483 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
484 |
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
|
485 |
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
|
486 |
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
|
487 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
488 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
489 |
def __set_initial_selection(self): |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
490 |
self.__selectall_toggle(True) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
491 |
if len(self.um_list) == 0: |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
492 |
self.__display_noupdates() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
493 |
else: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
494 |
self.w_um_treeview.set_cursor(0, None) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
495 |
if self.update_all_proceed: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
496 |
self.__on_updateall_button_clicked(None) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
497 |
self.update_all_proceed = False |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
498 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
499 |
def __remove_installed(self, installed_fmris): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
500 |
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
|
501 |
iter_next = model.get_iter_first() |
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 |
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
|
504 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
505 |
while iter_next != None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
506 |
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
|
507 |
self.um_list.remove(iter_next) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
508 |
self.toggle_counter -= 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
509 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
510 |
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
|
511 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
512 |
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
|
513 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
514 |
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
|
515 |
self.__set_renderer_active(renderer, False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
516 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
517 |
self.__set_renderer_active(renderer, True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
518 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
519 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
520 |
def __set_renderer_active(renderer, active): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
521 |
if active: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
522 |
renderer.set_property("sensitive", True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
523 |
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
|
524 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
525 |
renderer.set_property("sensitive", False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
526 |
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
|
527 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
528 |
def __get_icon_pixbuf(self, icon_name): |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
529 |
return gui_misc.get_pixbuf_from_path(self.application_dir + |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
530 |
"/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
|
531 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
532 |
def __get_app_pixbuf(self, icon_name): |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
533 |
return gui_misc.get_pixbuf_from_path(self.application_dir + |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
534 |
"/usr/share/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 |
def __get_selected_fmris(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
537 |
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
|
538 |
iter_next = model.get_iter_first() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
539 |
list_of_selected_fmris = [] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
540 |
while iter_next != None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
541 |
if model.get_value(iter_next, UM_INSTALL_MARK): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
542 |
list_of_selected_fmris.append(model.get_value(iter_next, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
543 |
UM_NAME)) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
544 |
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
|
545 |
return list_of_selected_fmris |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
546 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
547 |
def init_tree_views(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
548 |
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
|
549 |
toggle_renderer = gtk.CellRendererToggle() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
550 |
toggle_renderer.connect('toggled', self.__active_pane_toggle, model) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
551 |
column = gtk.TreeViewColumn("", toggle_renderer, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
552 |
active = UM_INSTALL_MARK) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
553 |
column.set_cell_data_func(toggle_renderer, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
554 |
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
|
555 |
toggle_renderer.set_property("activatable", True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
556 |
column.set_expand(False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
557 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
558 |
# 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
|
559 |
if self.show_install_updates_only: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
560 |
self.w_um_updateall_button.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
561 |
self.show_all_opts = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
562 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
563 |
# 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
|
564 |
if self.show_all_opts: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
565 |
self.w_select_checkbox.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
566 |
self.w_um_install_button.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
567 |
self.w_um_treeview.append_column(column) |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
568 |
self.w_um_intro_label.set_text(_( |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
569 |
"Updates are available for the following packages.\n" |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
570 |
"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
|
571 |
# Show Cancel, Update All only |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
572 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
573 |
self.w_select_checkbox.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
574 |
self.w_um_install_button.hide() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
575 |
self.w_um_intro_label.set_text(_( |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
576 |
"Updates are available for the following packages.\n" |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
577 |
"Click Update All to create a new boot environment and " |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
578 |
"install all packages into it.")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
579 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
580 |
render_pixbuf = gtk.CellRendererPixbuf() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
581 |
column = gtk.TreeViewColumn() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
582 |
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
|
583 |
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
|
584 |
column.set_title(" ") |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
585 |
# Hiding Status column for now |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
586 |
#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
|
587 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
588 |
name_renderer = gtk.CellRendererText() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
589 |
column = gtk.TreeViewColumn(_("Name"), name_renderer, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
590 |
text = UM_NAME) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
591 |
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
|
592 |
column.set_expand(True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
593 |
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
|
594 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
595 |
column = gtk.TreeViewColumn() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
596 |
render_pixbuf = gtk.CellRendererPixbuf() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
597 |
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
|
598 |
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
|
599 |
# Hiding Reboot required column for now |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
600 |
# 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
|
601 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
602 |
version_renderer = gtk.CellRendererText() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
603 |
version_renderer.set_property('xalign', 0.0) |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
604 |
column = gtk.TreeViewColumn(_("Latest Version"), version_renderer, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
605 |
text = UM_LATEST_VER) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
606 |
column.set_cell_data_func(version_renderer, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
607 |
self.__cell_data_function, None) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
608 |
column.set_expand(True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
609 |
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
|
610 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
611 |
size_renderer = gtk.CellRendererText() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
612 |
size_renderer.set_property('xalign', 0.0) |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
613 |
column = gtk.TreeViewColumn(_("Size (Meg)"), size_renderer, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
614 |
text = UM_SIZE) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
615 |
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
|
616 |
column.set_expand(True) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
617 |
# 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
|
618 |
#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
|
619 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
620 |
#Added selection listener |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
621 |
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
|
622 |
self.package_selection.set_mode(gtk.SELECTION_SINGLE) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
623 |
self.package_selection.connect("changed", |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
624 |
self.__on_package_selection_changed, None) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
625 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
626 |
# Setup Icons |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
627 |
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
|
628 |
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
|
629 |
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
|
630 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
631 |
def __get_image_path(self): |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
632 |
'''This function gets the image path or the default''' |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
633 |
if self.image_dir_arg != None: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
634 |
return self.image_dir_arg |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
635 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
636 |
if local_image_dir != None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
637 |
return local_image_dir |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
638 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
639 |
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
|
640 |
if len(image_directory) == 0: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
641 |
image_directory = IMAGE_DIRECTORY_DEFAULT |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
642 |
return image_directory |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
643 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
644 |
def get_updates_to_list(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
645 |
'''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
|
646 |
that are available to list''' |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
647 |
# 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
|
648 |
um_list = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
649 |
gtk.ListStore( |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
650 |
gobject.TYPE_INT, # UM_ID |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
651 |
gobject.TYPE_BOOLEAN, # UM_INSTALL_MARK |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
652 |
gtk.gdk.Pixbuf, # UM_STATUS |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
653 |
gobject.TYPE_STRING, # UM_NAME |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
654 |
gtk.gdk.Pixbuf, # UM_REBOOT |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
655 |
gobject.TYPE_STRING, # UM_LATEST_VER |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
656 |
gobject.TYPE_STRING, # UM_SIZE |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
657 |
gobject.TYPE_STRING, # UM_FMRI |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
658 |
) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
659 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
660 |
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
|
661 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
662 |
count = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
663 |
pkg_upgradeable = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
664 |
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
|
665 |
while gtk.events_pending(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
666 |
gtk.main_iteration(False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
667 |
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
|
668 |
pkg_upgradeable = pkg |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
669 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
670 |
# 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
|
671 |
add_package = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
672 |
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
|
673 |
if list_uninstalled: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
674 |
add_package = not \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
675 |
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
|
676 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
677 |
add_package = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
678 |
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
|
679 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
680 |
if add_package: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
681 |
count += 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
682 |
# 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
|
683 |
# 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
|
684 |
# 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
|
685 |
#if state["incorporated"]: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
686 |
# incState = _("Inc") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
687 |
#else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
688 |
# incState = "--" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
689 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
690 |
um_list.insert(count, [count, False, None, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
691 |
pkg.get_name(), None, pkg.get_version(), None, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
692 |
pkg.get_fmri()]) |
578
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 |
if debug: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
695 |
print _("count: %d") % count |
578
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 |
self.progress_stop_thread = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
698 |
gobject.idle_add(self.w_um_treeview.set_model, um_list) |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
699 |
self.um_list = um_list |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
700 |
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
|
701 |
|
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
702 |
# 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
|
703 |
# 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
|
704 |
# the size column |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
705 |
# 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
|
706 |
|
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
707 |
def __get_api_obj(self): |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
708 |
if self.api_obj != None: |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
709 |
return self.api_obj |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
710 |
try: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
711 |
self.api_obj = api.ImageInterface(self.__get_image_path(), |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
712 |
CLIENT_API_VERSION, self.pr, self.__set_cancel_state, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
713 |
PKG_CLIENT_NAME) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
714 |
return self.api_obj |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
715 |
except api_errors.ImageNotFoundException, ine: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
infobuffer.set_text("") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
719 |
textiter = infobuffer.get_end_iter() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
720 |
infobuffer.insert_with_tags_by_name(textiter, _("Error\n"), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
721 |
"bold") |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
722 |
infobuffer.insert(textiter, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
723 |
_("'%s' is not an install image\n") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
724 |
ine.user_specified) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
725 |
except api_errors.VersionException, ve: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
726 |
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
|
727 |
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
|
728 |
infobuffer.set_text("") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
729 |
textiter = infobuffer.get_end_iter() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
730 |
infobuffer.insert_with_tags_by_name(textiter, _("Error\n"), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
731 |
"bold") |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
732 |
infobuffer.insert(textiter, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
733 |
_("Version mismatch: expected %s received %s\n") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
734 |
(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
|
735 |
return None |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
736 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
737 |
def __display_noupdates(self): |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
738 |
self.w_um_intro_label.set_markup(_("<b>No Updates available.</b>")) |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
739 |
self.w_um_treeview.hide() |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
740 |
self.w_um_expander.hide() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
741 |
self.w_um_install_button.set_sensitive(False) |
985
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
742 |
self.w_um_updateall_button.hide() |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
743 |
self.w_um_cancel_button.hide() |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
744 |
self.w_um_close_button.show() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
745 |
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
|
746 |
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
|
747 |
self.w_um_dialog.present() |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
748 |
self.w_um_dialog.resize(420,100) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
749 |
|
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
750 |
def __get_info_from_name(self, name, local): |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
751 |
if self.fmri_description != name: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
752 |
return None |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
753 |
if self.__get_api_obj() == None: |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
754 |
return None |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
755 |
|
917
eed22f430a9f
6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents:
869
diff
changeset
|
756 |
ret = self.__get_api_obj().info([name], local, |
eed22f430a9f
6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents:
869
diff
changeset
|
757 |
(api.PackageInfo.ALL_OPTIONS - |
eed22f430a9f
6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents:
869
diff
changeset
|
758 |
frozenset([api.PackageInfo.LICENSES])) - |
eed22f430a9f
6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents:
869
diff
changeset
|
759 |
api.PackageInfo.ACTION_OPTIONS) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
760 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
761 |
pis = ret[api.ImageInterface.INFO_FOUND] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
762 |
if len(pis) == 1: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
763 |
return pis[0] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
764 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
765 |
return None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
766 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
767 |
def __get_details_from_name(self, name): |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
768 |
info = self.__get_info_from_name(name, False) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
769 |
if info is not None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
770 |
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
|
771 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
772 |
return None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
773 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
774 |
def __update_details_from_info(self, name, info): |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
775 |
local_info = self.__get_info_from_name(name, True) |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
776 |
categories = _("None") |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
777 |
if info.category_info_list: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
778 |
verbose = len(info.category_info_list) > 1 |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
779 |
categories = "" |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
780 |
categories += info.category_info_list[0].__str__(verbose) |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
781 |
if len(info.category_info_list) > 1: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
782 |
for ci in info.category_info_list[1:]: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
783 |
categories += ", " + ci.__str__(verbose) |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
784 |
try: |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
785 |
installed_ver = "%s-%s" % (local_info.version, local_info.branch) |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
786 |
except AttributeError: |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
787 |
installed_ver = "" |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
788 |
pass # Ignore if we can't get the installed version info |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
789 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
790 |
ver = "%s-%s" % (info.version, info.branch) |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
791 |
summary = _("None") |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
792 |
if info.summary: |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
793 |
summary = info.summary |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
794 |
|
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
795 |
str_details = _( |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
796 |
'\nSummary:\t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
797 |
'\nSize: \t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
798 |
'\nCategory:\t\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
799 |
'\nLatest Version:\t\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
800 |
'\nInstalled Version:\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
801 |
'\nPackaging Date:\t%s' |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
802 |
'\nFMRI: \t\t\t%s' |
962
d7897f87708d
7488 Information about publisher needed in GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents:
942
diff
changeset
|
803 |
'\nRepository: \t\t%s' |
860
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
804 |
'\n') \ |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
805 |
% (summary, misc.bytes_to_str(info.size), |
5c86e593ed4d
5168 UM listing details incorrect
Padraig O'Briain <padraig.obriain@sun.com>
parents:
809
diff
changeset
|
806 |
categories, ver, installed_ver, |
962
d7897f87708d
7488 Information about publisher needed in GUI
Padraig O'Briain <padraig.obriain@sun.com>
parents:
942
diff
changeset
|
807 |
info.packaging_date, info.fmri, info.publisher) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
808 |
self.details_cache[name] = str_details |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
809 |
return str_details |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
810 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
811 |
# 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
|
812 |
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
|
813 |
image_obj = image.Image() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
814 |
dr = "/" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
815 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
816 |
image_obj.find_root(image_directory) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
817 |
while gtk.events_pending(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
818 |
gtk.main_iteration(False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
819 |
image_obj.load_config() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
820 |
while gtk.events_pending(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
821 |
gtk.main_iteration(False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
822 |
image_obj.load_catalogs(self.pr) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
823 |
while gtk.events_pending(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
824 |
gtk.main_iteration(False) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
825 |
except ValueError: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
826 |
print _('%s is not valid image, trying root image') \ |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
827 |
% image_directory |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
828 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
829 |
dr = os.environ["PKG_IMAGE"] |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
830 |
except KeyError: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
831 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
832 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
833 |
image_obj.find_root(dr) |
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 |
except ValueError: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
836 |
print _('%s is not valid root image, return None') \ |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
837 |
% dr |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
838 |
image_obj = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
839 |
return image_obj |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
840 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
841 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
842 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
843 |
def __removed_filter(model, itr): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
844 |
'''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
|
845 |
return True |
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 |
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
|
848 |
'''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
|
849 |
model, itr = selection.get_selected() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
850 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
851 |
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
|
852 |
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
|
853 |
if delta < SELECTION_CHANGE_LIMIT: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
854 |
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
|
855 |
self.selection_timer.cancel() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
856 |
self.selection_timer = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
857 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
858 |
self.fmri_description = fmri |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
859 |
self.last_select_time = time.time() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
860 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
861 |
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
|
862 |
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
|
863 |
self.selection_timer.cancel() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
864 |
self.selection_timer = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
865 |
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
|
866 |
infobuffer.set_text("") |
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
867 |
textiter = infobuffer.get_end_iter() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
868 |
infobuffer.insert_with_tags_by_name(textiter, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
869 |
"\n%s\n" % fmri, "bold") |
660
ea2809ad4582
4126 I10n update for IPS CLI PM and UM
John Rice <john.rice@sun.com>
parents:
653
diff
changeset
|
870 |
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
|
871 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
872 |
infobuffer = self.w_um_textview.get_buffer() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
873 |
infobuffer.set_text( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
874 |
_("\nFetching details for %s ...") % fmri) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
875 |
self.selection_timer = Timer(SELECTION_CHANGE_LIMIT, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
876 |
self.__show_package_info_thread, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
877 |
args=(fmri, )).start() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
878 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
879 |
def __show_package_info_thread(self, fmri): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
880 |
Thread(target = self.__show_package_info, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
881 |
args = (fmri, )).start() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
882 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
883 |
def __show_package_info(self, fmri): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
884 |
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
|
885 |
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
|
886 |
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
|
887 |
infobuffer.set_text("") |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
888 |
textiter = infobuffer.get_end_iter() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
889 |
infobuffer.insert_with_tags_by_name(textiter, |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
890 |
"\n%s" % fmri, "bold") |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
891 |
infobuffer.insert(textiter, details) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
892 |
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
|
893 |
infobuffer = self.w_um_textview.get_buffer() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
894 |
infobuffer.set_text("") |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
895 |
textiter = infobuffer.get_end_iter() |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
896 |
if textiter != None: #Gtk race condition seems to cause this |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
897 |
infobuffer.insert_with_tags_by_name(textiter, |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
898 |
_("\nNo details available"), "bold") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
899 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
900 |
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
|
901 |
self.__exit_app() |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
902 |
|
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
903 |
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
|
904 |
self.__exit_app() |
985
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
905 |
|
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
906 |
def __on_help_button_clicked(self, widget): |
bcc30bb98888
5432 Package Manager does not keep window settings
John Rice <john.rice@sun.com>
parents:
962
diff
changeset
|
907 |
gui_misc.display_help(self.application_dir, "um_info") |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
908 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
909 |
def __exit_app(self, be_name = None): |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
910 |
self.cancelled = True |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
911 |
if be_name: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
912 |
if self.image_dir_arg: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
913 |
gobject.spawn_async([self.application_path, "-R", |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
914 |
self.image_dir_arg, "-U", be_name]) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
915 |
else: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
916 |
gobject.spawn_async([self.application_path, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
917 |
"-U", be_name]) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
918 |
|
796
bcd90655ad83
4019 Package Manager close bug
Padraig O'Briain <padraig.obriain@sun.com>
parents:
791
diff
changeset
|
919 |
self.w_um_dialog.hide() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
920 |
gtk.main_quit() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
921 |
sys.exit(0) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
922 |
return True |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
923 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
924 |
def restart_after_ips_update(self, be_name): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
925 |
self.__exit_app(be_name) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
926 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
927 |
def __on_progressok_clicked(self, widget): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
928 |
self.w_progress_dialog.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
929 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
930 |
def __on_progresscancel_clicked(self, widget): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
931 |
if self.install_error: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
932 |
self.w_progress_dialog.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
933 |
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
|
934 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
935 |
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
|
936 |
if self.update_stage == UPDATE_EVAL: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
937 |
self.__progress_cancel_eval() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
938 |
elif self.update_stage == UPDATE_DOWNLOAD: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
939 |
self.__progress_cancel_download() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
940 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
941 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
942 |
_("\nCanceling update, please wait ...")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
943 |
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
|
944 |
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
|
945 |
else: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
946 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
947 |
_("\nUnable to cancel at this time.")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
948 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
949 |
def __on_install_button_clicked(self, widget): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
950 |
self.setup_progressdialog_show(_("Installing Updates"), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
951 |
showCancel = True, showOK = True, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
952 |
isInstall = True, showCloseOnFinish = debug) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
953 |
Thread(target = self.__install).start() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
954 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
955 |
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
|
956 |
self.__selectall_toggle(True) |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
957 |
self.__get_api_obj().reset() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
958 |
self.ua_start = time.time() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
959 |
installupdate.InstallUpdate([], self, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
960 |
self.api_obj, ips_update = False, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
961 |
action = enumerations.IMAGE_UPDATE, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
962 |
be_name = self.ua_be_name, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
963 |
parent_name = _("Update Manager"), |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
964 |
pkg_list = ["SUNWipkg", "SUNWipkg-um"], |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
965 |
main_window = self.w_um_dialog, |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
966 |
icon_confirm_dialog = self.__get_app_pixbuf("PM_package_36x")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
967 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
968 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
969 |
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
|
970 |
self.__selectall_toggle(widget.get_active()) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
971 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
972 |
def __handle_incorporated_error(self, list_incorp): |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
973 |
self.__update_progress_info(_("ERROR"), True) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
974 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
975 |
_("Following Incorporated package(s) cannot be updated:")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
976 |
for i in list_incorp: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
977 |
self.__update_progress_info("\t%s" % i) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
978 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
979 |
_("Update using: Update All\n"), True) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
980 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
981 |
def __handle_update_progress_error(self, str_error, ex = None, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
982 |
stage = UPDATE_EVAL): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
983 |
self.install_error = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
984 |
if stage == UPDATE_EVAL: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
985 |
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
|
986 |
elif stage == UPDATE_DOWNLOAD: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
987 |
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
|
988 |
elif stage == UPDATE_INSTALL: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
989 |
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
|
990 |
elif stage == UPDATE_INDEX: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
991 |
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
|
992 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
993 |
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
|
994 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
995 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
996 |
_("\nERROR"), True) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
997 |
if ex != None: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
998 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
999 |
_("%s\n%s" % (str_error, ex))) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1000 |
else: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1001 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1002 |
_("%s\n" % str_error)) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1003 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1004 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1005 |
def __display_update_image_success(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1006 |
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
|
1007 |
info_str = "" |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1008 |
if elapsed >= 1.0: |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1009 |
info_str = \ |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1010 |
_( |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1011 |
"\nUpdate All finished successfully in %1.f mins\n\n" % |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1012 |
elapsed) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1013 |
else: |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1014 |
info_str = \ |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1015 |
_( |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1016 |
"\nUpdate All finished successfully in < 1 min\n\n") |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1017 |
|
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1018 |
info_str += _( |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
1019 |
"Review the posted release notes before rebooting your system:\n\n" |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1020 |
"http://opensolaris.org/os/project/indiana/resources/" |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1021 |
"relnotes/200811/x86/") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1022 |
|
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1023 |
self.w_um_dialog.hide() |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1024 |
msgbox = gtk.MessageDialog(parent = self.w_um_dialog, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1025 |
buttons = gtk.BUTTONS_CLOSE, flags = gtk.DIALOG_MODAL, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1026 |
type = gtk.MESSAGE_INFO, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1027 |
message_format = info_str) |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1028 |
msgbox.set_title(_("Update All Completed")) |
603
4000e193b337
4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents:
601
diff
changeset
|
1029 |
msgbox.run() |
600
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1030 |
msgbox.destroy() |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1031 |
self.__exit_app() |
dc1db5978b68
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
597
diff
changeset
|
1032 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1033 |
def __handle_cancel_exception(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1034 |
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
|
1035 |
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
|
1036 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1037 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1038 |
def __install(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1039 |
self.install = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1040 |
self.install_error = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1041 |
self.update_stage = UPDATE_EVAL |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1042 |
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
|
1043 |
if len(list_fmris_to_install) == 0: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1044 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1045 |
_("Nothing selected to update.")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1046 |
return |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1047 |
|
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1048 |
if self.__get_api_obj() == None: |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1049 |
return |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1050 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1051 |
if debug: |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1052 |
print _("Updating ...") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1053 |
print list_fmris_to_install |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1054 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1055 |
# Evaluate |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1056 |
try: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1057 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1058 |
_("\nEvaluate\n"), True) |
603
4000e193b337
4101 Pylint cleanup updatemanager and updatemanagernotifier
John Rice <john.rice@sun.com>
parents:
601
diff
changeset
|
1059 |
ret, exception_caught = \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1060 |
self.__get_api_obj().plan_install(list_fmris_to_install, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1061 |
[], refresh_catalogs = self.do_refresh) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1062 |
if exception_caught != None: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1063 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1064 |
_("Update error in plan install:"), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1065 |
exception_caught, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1066 |
stage = self.update_stage) |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1067 |
return |
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1068 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1069 |
except (api_errors.CanceledException): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1070 |
self.__handle_cancel_exception() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1071 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1072 |
except (api_errors.ApiException), aex: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1073 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1074 |
_("Update unexpected API error:"), aex, |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1075 |
stage = self.update_stage) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1076 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1077 |
except (Exception), uex: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1078 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1079 |
_("Update unexpected error:"), uex, |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1080 |
stage = self.update_stage) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1081 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1082 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1083 |
if not ret: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1084 |
#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
|
1085 |
# 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
|
1086 |
self.install_error = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1087 |
gobject.idle_add(self.__progress_error_eval) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1088 |
gobject.idle_add(self.__handle_incorporated_error, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1089 |
list_fmris_to_install) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1090 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1091 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1092 |
|
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1093 |
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
|
1094 |
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
|
1095 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1096 |
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
|
1097 |
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
|
1098 |
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
|
1099 |
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
|
1100 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1101 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1102 |
_("Packages to be installed:")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1103 |
for i in list_planned: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1104 |
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
|
1105 |
|
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1106 |
if self.__shared_update_steps(_("Update"), |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1107 |
_("Update finished successfully.")) != 0: |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1108 |
return |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1109 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1110 |
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
|
1111 |
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
|
1112 |
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
|
1113 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1114 |
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
|
1115 |
# Download |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1116 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1117 |
self.update_stage = UPDATE_DOWNLOAD |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1118 |
self.__get_api_obj().prepare() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1119 |
except (api_errors.CanceledException): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1120 |
self.__handle_cancel_exception() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1121 |
return 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1122 |
except (api_errors.ApiException), aex: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1123 |
self.install_error = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1124 |
gobject.idle_add(self.__progress_error_download) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1125 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1126 |
_("\nERROR"), True) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1127 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1128 |
_("%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
|
1129 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1130 |
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
|
1131 |
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
|
1132 |
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
|
1133 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1134 |
_( |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1135 |
"%s exceded available disc space" % (what_msg)), |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1136 |
stage = self.update_stage) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1137 |
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
|
1138 |
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
|
1139 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1140 |
_("%s unexpected error:" % (what_msg)), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1141 |
uex, stage = self.update_stage) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1142 |
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
|
1143 |
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
|
1144 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1145 |
_("%s unexpected error:" % (what_msg)), |
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
|
1146 |
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
|
1147 |
return 1 |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1148 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1149 |
# Install |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1150 |
try: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1151 |
self.update_stage = UPDATE_INSTALL |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1152 |
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
|
1153 |
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
|
1154 |
except (api_errors.CanceledException): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1155 |
self.__handle_cancel_exception() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1156 |
return 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1157 |
except (api_errors.ApiException), aex: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1158 |
self.install_error = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1159 |
gobject.idle_add(self.__progress_error_install) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1160 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1161 |
_("\nERROR"), True) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1162 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1163 |
_("%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
|
1164 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1165 |
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
|
1166 |
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
|
1167 |
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
|
1168 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1169 |
_( |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1170 |
"%s exceded available disc space" % what_msg), |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1171 |
stage = self.update_stage) |
647
be0aec1c0910
4018 Package Manager - Window width bug
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
641
diff
changeset
|
1172 |
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
|
1173 |
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
|
1174 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1175 |
_("%s unexpected error:" % (what_msg)), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1176 |
uex, stage = self.update_stage) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1177 |
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
|
1178 |
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
|
1179 |
self.__handle_update_progress_error( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1180 |
_("%s unexpected error:" % (what_msg)), |
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
|
1181 |
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
|
1182 |
return 1 |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1183 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1184 |
self.__cleanup() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1185 |
gobject.idle_add(self.__progress_steps_done) |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1186 |
gobject.idle_add(self.__update_progress_info, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1187 |
_(success_msg), True) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1188 |
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
|
1189 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1190 |
return 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1191 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1192 |
def __prompt_to_load_beadm(self): |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1193 |
msgbox = gtk.MessageDialog(parent = self.w_progress_dialog, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1194 |
buttons = gtk.BUTTONS_OK_CANCEL, flags = gtk.DIALOG_MODAL, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1195 |
type = gtk.MESSAGE_ERROR, |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1196 |
message_format = _( |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
1197 |
"Not enough disc space, the Update All action cannot " |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1198 |
"be performed.\n\n" |
942
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
1199 |
"Click OK to manage your existing BEs and free up disk space or " |
cb2774668721
6707 Text change for Update Manager dialog
John Rice <john.rice@sun.com>
parents:
941
diff
changeset
|
1200 |
"Cancel to cancel Update All.")) |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1201 |
msgbox.set_title(_("Not Enough Disc Space")) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1202 |
result = msgbox.run() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1203 |
msgbox.destroy() |
597
7c6e4f5a442a
3981 UpdateManager UI Spec review and adjustments
John Rice <john.rice@sun.com>
parents:
578
diff
changeset
|
1204 |
if result == gtk.RESPONSE_OK: |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1205 |
gobject.idle_add(self.__create_beadm) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1206 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1207 |
def __create_beadm(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1208 |
self.gladefile = \ |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1209 |
"/usr/share/package-manager/packagemanager.glade" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1210 |
beadm.Beadmin(self) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1211 |
return False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1212 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1213 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1214 |
def __unique(list1, list2): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1215 |
"""Return a list containing all items |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1216 |
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
|
1217 |
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
|
1218 |
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
|
1219 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1220 |
def __cleanup(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1221 |
self.install = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1222 |
self.api_obj.reset() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1223 |
self.pr.reset() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1224 |
self.progress_stop_thread = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1225 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1226 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1227 |
def __on_um_expander_activate(widget): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1228 |
return |
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 |
def __selectall_toggle(self, select): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1231 |
for row in self.um_list: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1232 |
row[UM_INSTALL_MARK] = select |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1233 |
if select: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1234 |
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
|
1235 |
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
|
1236 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1237 |
self.toggle_counter = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1238 |
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
|
1239 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1240 |
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
|
1241 |
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
|
1242 |
itr = model.get_iter(filtered_path) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1243 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1244 |
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
|
1245 |
if installed is None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1246 |
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
|
1247 |
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
|
1248 |
if not modified: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1249 |
self.toggle_counter += 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1250 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1251 |
self.toggle_counter -= 1 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1252 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1253 |
if self.toggle_counter > 0: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1254 |
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
|
1255 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1256 |
self.toggle_counter = 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1257 |
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
|
1258 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1259 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1260 |
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
|
1261 |
'''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
|
1262 |
selected''' |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1263 |
if itr: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1264 |
if model.get_value(itr, 1): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1265 |
#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
|
1266 |
# 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
|
1267 |
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
|
1268 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1269 |
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
|
1270 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1271 |
def __on_progressdialog_progress(self, isInstall): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1272 |
if not self.progress_stop_thread: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1273 |
self.w_progressbar.pulse() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1274 |
return True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1275 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1276 |
if isInstall: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1277 |
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
|
1278 |
if not self.install_error and \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1279 |
self.w_progress_closeon_finish_chk.get_active(): |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1280 |
self.w_progress_dialog.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1281 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1282 |
self.w_progress_dialog.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1283 |
return False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1284 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1285 |
def setup_progressdialog_show(self, title, info = None, showDetails = True, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1286 |
showCancel = False, showOK = False, isInstall = False, |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1287 |
showCloseOnFinish = False): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1288 |
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
|
1289 |
infobuffer.set_text("") |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1290 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1291 |
if info != None: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1292 |
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
|
1293 |
self.w_progressinfo_label.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1294 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1295 |
self.w_progressinfo_label.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1296 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1297 |
if showDetails: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1298 |
self.w_progressinfo_expander.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1299 |
self.w_progressinfo_separator.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1300 |
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
|
1301 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1302 |
self.w_progressinfo_expander.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1303 |
self.w_progressinfo_separator.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1304 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1305 |
if showCancel: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1306 |
self.w_progress_cancel.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1307 |
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
|
1308 |
self.w_progress_cancel.grab_focus() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1309 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1310 |
self.w_progress_cancel.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1311 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1312 |
if showOK: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1313 |
self.w_progress_ok.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1314 |
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
|
1315 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1316 |
self.w_progress_ok.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1317 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1318 |
if isInstall: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1319 |
self.__progress_steps_start() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1320 |
self.w_progress_install_vbox.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1321 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1322 |
self.w_progress_install_vbox.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1323 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1324 |
if showCloseOnFinish: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1325 |
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
|
1326 |
self.w_progress_ok.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1327 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1328 |
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
|
1329 |
self.w_progress_ok.hide() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1330 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1331 |
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
|
1332 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1333 |
self.w_progress_dialog.show() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1334 |
self.progress_stop_thread = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1335 |
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
|
1336 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1337 |
def setup_updates(self): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1338 |
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
|
1339 |
return False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1340 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1341 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1342 |
def __update_size(size, pkg): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1343 |
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
|
1344 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1345 |
# Handle GUI Progress Output |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1346 |
def output(self, str_out): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1347 |
self.__update_progress_info(str_out) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1348 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1349 |
print str_out |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1350 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1351 |
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
|
1352 |
self.__update_progress_info(" ") |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1353 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1354 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1355 |
print "%s: finished" % what |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1356 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1357 |
@staticmethod |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1358 |
def progress_pulse(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1359 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1360 |
print "pulse: \n" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1361 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1362 |
def dl_progress(self, dl_started, dl_cur_pkg, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1363 |
dl_cur_npkgs, dl_goal_npkgs, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1364 |
dl_cur_nfiles, dl_goal_nfiles, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1365 |
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
|
1366 |
if not dl_started: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1367 |
self.cur_pkg = "" |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1368 |
self.__progress_steps_download() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1369 |
self.__update_progress_info(_("\nDownload\n"), True) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1370 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1371 |
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
|
1372 |
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
|
1373 |
self.cur_pkg = dl_cur_pkg |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1374 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1375 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1376 |
_("\tpkg %d/%d: \tfiles %d/%d \txfer %.2f/%.2f(meg)") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1377 |
(dl_cur_npkgs, dl_goal_npkgs, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1378 |
dl_cur_nfiles, dl_goal_nfiles, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1379 |
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
|
1380 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1381 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1382 |
print "DL: %s - %s\npkg %d/%d: files %d/%d: megs %.2f/%.2f\n" % \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1383 |
(dl_started, dl_cur_pkg, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1384 |
dl_cur_npkgs, dl_goal_npkgs, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1385 |
dl_cur_nfiles, dl_goal_nfiles, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1386 |
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
|
1387 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1388 |
def act_progress(self, act_started, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1389 |
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
|
1390 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1391 |
if not act_started: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1392 |
self.__progress_steps_install() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1393 |
self.__update_progress_info(_("\nInstall\n"), True) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1394 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1395 |
_("\t%s\t%d/%d actions") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1396 |
(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
|
1397 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1398 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1399 |
_("\t%s\t%d/%d actions") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1400 |
(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
|
1401 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1402 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1403 |
print "Install: %s - %s\nact %d/%d\n" % \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1404 |
(act_started, act_phase, act_cur_nactions, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1405 |
act_goal_nactions) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1406 |
|
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1407 |
def ind_progress(self, ind_started, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1408 |
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
|
1409 |
if not self.install: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1410 |
return |
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 |
if not ind_started: |
601
bed1b73cabbd
4094 UpdateManager displaying index stage twice
John Rice <john.rice@sun.com>
parents:
600
diff
changeset
|
1413 |
if self.update_stage != UPDATE_INSTALL: |
bed1b73cabbd
4094 UpdateManager displaying index stage twice
John Rice <john.rice@sun.com>
parents:
600
diff
changeset
|
1414 |
return |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1415 |
self.update_stage = UPDATE_INDEX |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1416 |
self.__progress_steps_index() |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1417 |
self.__update_progress_info(_("Index\n"), True) |
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1418 |
self.__update_progress_info(_("\t%-25s\t%d/%d actions" % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1419 |
(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
|
1420 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1421 |
self.__update_progress_info( |
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1422 |
_("\t%-25s\t%d/%d actions") % |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1423 |
(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
|
1424 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1425 |
if debug: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1426 |
print "Index: %s - %s\nact %d/%d\n" % \ |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1427 |
(ind_started, 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
|
1428 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1429 |
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
|
1430 |
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
|
1431 |
textiter = infobuffer.get_end_iter() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1432 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1433 |
# 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
|
1434 |
# 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
|
1435 |
if bold: |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1436 |
infobuffer.insert_with_tags_by_name(textiter, |
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1437 |
"%s\n" % str_out, "bold") |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1438 |
else: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1439 |
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
|
1440 |
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
|
1441 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1442 |
def shutdown_after_image_update(self): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1443 |
self.__display_update_image_success() |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1444 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1445 |
#-------------------- remove those |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1446 |
def main(): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1447 |
gtk.main() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1448 |
return 0 |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1449 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1450 |
if __name__ == "__main__": |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1451 |
um = Updatemanager() |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1452 |
list_uninstalled = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1453 |
debug = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1454 |
show_all_opts = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1455 |
show_install_updates_only = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1456 |
local_image_dir = None |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1457 |
do_refresh = False |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1458 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1459 |
try: |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1460 |
opts, args = getopt.getopt(sys.argv[1:], "hdualirR:U:", |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1461 |
["help", "debug","uninstalled"]) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1462 |
except getopt.error, msg: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1463 |
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
|
1464 |
sys.exit(2) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1465 |
|
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1466 |
if os.path.isabs(sys.argv[0]): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1467 |
um.application_path = sys.argv[0] |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1468 |
else: |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1469 |
cmd = os.path.join(os.getcwd(), sys.argv[0]) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1470 |
um.application_path = os.path.realpath(cmd) |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1471 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1472 |
for option, argument in opts: |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1473 |
if option in ("-h", "--help"): |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1474 |
print """\ |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1475 |
Use -d (--debug) to run in debug mode. |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1476 |
Use -R (--image-dir) to specify image directory. |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1477 |
Use -U (--update-all) to proceed with Update All""" |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1478 |
sys.exit(0) |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1479 |
if option in ("-d", "--debug"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1480 |
debug = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1481 |
if option in ("-u", "--uninstalled"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1482 |
list_uninstalled = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1483 |
if option in ("-a", "--all"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1484 |
show_all_opts = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1485 |
if option in ("-i", "--install_updates"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1486 |
show_install_updates_only = True |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1487 |
if option in ("-l", "--local_image"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1488 |
local_image_dir = os.getcwd() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1489 |
# 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
|
1490 |
if option in ("-r", "--refresh"): |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1491 |
do_refresh = True |
869
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1492 |
if option in ("-R", "--image-dir"): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1493 |
um.image_dir_arg = argument |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1494 |
if option in ("-U", "--update-all"): |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1495 |
um.update_all_proceed = True |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1496 |
um.ua_be_name = argument |
0197953cd88a
5398 UM not following steps consistently
Padraig O'Briain <padraig.obriain@sun.com>
parents:
860
diff
changeset
|
1497 |
|
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1498 |
|
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1499 |
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
|
1500 |
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
|
1501 |
um.do_refresh = do_refresh |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1502 |
um.init_tree_views() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1503 |
|
808
6c89385ac9ff
4463 Change PM and UM to use _() as opposed to self._()
Padraig O'Briain <padraig.obriain@sun.com>
parents:
796
diff
changeset
|
1504 |
um.setup_progressdialog_show(_("Checking for new software"), |
771
24696e0e0a92
5175 Wrong spacing in the updatemanager.py
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
731
diff
changeset
|
1505 |
showDetails = False) |
578
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1506 |
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
|
1507 |
main() |
da257532b3f2
3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents:
diff
changeset
|
1508 |