author | Padraig O'Briain <padraig.obriain@oracle.com> |
Fri, 01 Jul 2011 09:37:09 +0100 | |
changeset 2438 | b7334c565596 |
parent 2115 | c6a812ab117a |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1395
diff
changeset
|
1 |
#!/usr/bin/python |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
2 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
4 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
8 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
13 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
19 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
21 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
22 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
23 |
# |
1901
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
24 |
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
25 |
# |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
26 |
|
2438
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
27 |
MIN_ELEMENTS_BOUNCE = 5 # During indexing the progress will be progressive if |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
28 |
# the number of indexing elements is greater then this, |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
29 |
# otherwise it will bounce |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
30 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
31 |
from pkg.client.progress import NullProgressTracker |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
32 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
33 |
class GuiProgressTracker(NullProgressTracker): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
34 |
|
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
35 |
def __init__(self, indent = False): |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
36 |
NullProgressTracker.__init__(self) |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
37 |
self.prev_pkg = None |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
38 |
self.act_phase_last = None |
2438
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
39 |
self.ind_started = False |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
40 |
self.item_started = False |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
41 |
self.indent = indent |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
42 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
43 |
def cat_output_start(self): |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
44 |
if self.indent: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
45 |
self.update_details_text(_("Retrieving catalog '%s'...\n") % \ |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
46 |
self.cat_cur_catalog, "level1") |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
47 |
else: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
48 |
self.update_details_text(_("Retrieving catalog '%s'...\n") % \ |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
49 |
self.cat_cur_catalog) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
50 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
51 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
52 |
def cat_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
53 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
54 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
55 |
def cache_cats_output_start(self): |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
56 |
if self.indent: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
57 |
self.update_details_text(_("Caching catalogs ...\n"), "level1") |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
58 |
else: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
59 |
self.update_details_text(_("Caching catalogs ...\n")) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
60 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
61 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
62 |
def cache_cats_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
63 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
64 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
65 |
def load_cat_cache_output_start(self): |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
66 |
if self.indent: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
67 |
self.update_details_text(_("Loading catalog cache ...\n"), |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
68 |
"level1") |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
69 |
else: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
70 |
self.update_details_text(_("Loading catalog cache ...\n")) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
71 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
72 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
73 |
def load_cat_cache_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
74 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
75 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
76 |
def refresh_output_start(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
77 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
78 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
79 |
def refresh_output_progress(self): |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
80 |
if self.indent: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
81 |
self.update_details_text( |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
82 |
_("Refreshing catalog %s\n") % self.refresh_cur_pub, "level1") |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
83 |
else: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
84 |
self.update_details_text( |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
85 |
_("Refreshing catalog %s\n") % self.refresh_cur_pub) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
86 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
87 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
88 |
def refresh_output_done(self): |
2041
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
89 |
if self.indent: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
90 |
self.update_details_text( |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
91 |
_("Finished refreshing catalog %s\n") % self.refresh_cur_pub, |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
92 |
"level1") |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
93 |
else: |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
94 |
self.update_details_text( |
ee746d3c19be
6084 Simplify Update Manager use same code as PM
John Rice <john.rice@oracle.com>
parents:
1994
diff
changeset
|
95 |
_("Finished refreshing catalog %s\n") % self.refresh_cur_pub) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
96 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
97 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
98 |
def eval_output_start(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
99 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
100 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
101 |
def eval_output_progress(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
102 |
'''Called by progress tracker each time some package was evaluated. The |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
103 |
call is being done by calling progress tracker evaluate_progress() |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
104 |
function''' |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
105 |
if self.prev_pkg != self.eval_cur_fmri: |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
106 |
self.prev_pkg = self.eval_cur_fmri |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
107 |
text = _("Evaluating: %s") % self.eval_cur_fmri.get_name() |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
108 |
self.update_label_text(text) |
1901
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
109 |
self.reset_label_text_after_delay() |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
110 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
111 |
def eval_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
112 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
113 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
114 |
def ver_output(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
115 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
116 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
117 |
def ver_output_error(self, actname, errors): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
118 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
119 |
|
1311
9dcfd33a0efe
10695 download progress tracker can spam slow terminals
Dan Price <dp@eng.sun.com>
parents:
1217
diff
changeset
|
120 |
def ver_output_done(self): |
9dcfd33a0efe
10695 download progress tracker can spam slow terminals
Dan Price <dp@eng.sun.com>
parents:
1217
diff
changeset
|
121 |
return |
9dcfd33a0efe
10695 download progress tracker can spam slow terminals
Dan Price <dp@eng.sun.com>
parents:
1217
diff
changeset
|
122 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
123 |
def dl_output(self): |
1994
19b8be5531e7
16511 pm-updatemanager has performance problem
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1901
diff
changeset
|
124 |
self.display_download_info() |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2041
diff
changeset
|
125 |
if self.prev_pkg != self.cur_pkg: |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2041
diff
changeset
|
126 |
self.prev_pkg = self.cur_pkg |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
127 |
self.update_details_text( |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
128 |
_("Package %d of %d: %s\n") % (self.dl_cur_npkgs+1, |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2041
diff
changeset
|
129 |
self.dl_goal_npkgs, self.cur_pkg), "level1") |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
130 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
131 |
def dl_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
132 |
self.update_details_text("\n") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
133 |
|
1217
1e2405e83d3a
9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1209
diff
changeset
|
134 |
def act_output(self, force=False): |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
135 |
if self.act_phase != self.act_phase_last: |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
136 |
self.act_phase_last = self.act_phase |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
137 |
self.update_label_text(self.act_phase) |
1901
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
138 |
self.update_details_text("%s\n" % self.act_phase, "level1") |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
139 |
self.display_phase_info(self.act_phase, self.act_cur_nactions, |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
140 |
self.act_goal_nactions) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
141 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
142 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
143 |
def act_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
144 |
return |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
145 |
|
1217
1e2405e83d3a
9788 pylint errors in Package Manager and Update Manager should be fixed
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1209
diff
changeset
|
146 |
def ind_output(self, force=False): |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
147 |
if self.ind_started != self.ind_phase: |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
148 |
self.ind_started = self.ind_phase |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
149 |
self.update_label_text(self.ind_phase) |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
150 |
self.update_details_text( |
1901
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
151 |
"%s\n" % (self.ind_phase), "level1") |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
152 |
self.__indexing_progress() |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
153 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
154 |
def ind_output_done(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
155 |
self.update_progress(self.ind_cur_nitems, self.ind_goal_nitems) |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
156 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
157 |
def __indexing_progress(self): |
2438
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
158 |
self.__generic_progress(self.ind_phase, self.ind_goal_nitems, |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
159 |
self.ind_cur_nitems) |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
160 |
|
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
161 |
def __generic_progress(self, phase, goal_nitems, cur_nitems): |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
162 |
#It doesn't look nice if the progressive is just for few elements |
2438
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
163 |
if goal_nitems > MIN_ELEMENTS_BOUNCE: |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
164 |
self.display_phase_info(phase, cur_nitems-1, goal_nitems) |
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
165 |
else: |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
166 |
if not self.is_progress_bouncing(): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
167 |
self.start_bouncing_progress() |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
168 |
|
2438
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
169 |
def item_output(self, force=False): |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
170 |
if self.item_started != self.item_phase: |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
171 |
self.item_started = self.item_phase |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
172 |
self.update_label_text(self.item_phase) |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
173 |
self.update_details_text( |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
174 |
"%s\n" % (self.item_phase), "level1") |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
175 |
self.__item_progress() |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
176 |
|
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
177 |
def __item_progress(self): |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
178 |
self.__generic_progress(self.item_phase, self.item_goal_nitems, |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
179 |
self.item_cur_nitems) |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
180 |
|
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
181 |
|
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
182 |
def item_output_done(self): |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
183 |
self.update_progress(self.item_cur_nitems, self.item_goal_nitems) |
b7334c565596
18608 On remove progress bar stuck over on left hand side
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
2115
diff
changeset
|
184 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
185 |
def update_progress(self, current_progress, total_progress): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
186 |
raise NotImplementedError("abstract method update_progress() not " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
187 |
"implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
188 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
189 |
def start_bouncing_progress(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
190 |
raise NotImplementedError("abstract method start_bouncing_progress() " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
191 |
"not implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
192 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
193 |
def is_progress_bouncing(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
194 |
raise NotImplementedError("abstract method is_progress_bouncing() " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
195 |
"not implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
196 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
197 |
def stop_bouncing_progress(self): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
198 |
raise NotImplementedError("abstract method stop_bouncing_progress() " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
199 |
"not implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
200 |
|
1994
19b8be5531e7
16511 pm-updatemanager has performance problem
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1901
diff
changeset
|
201 |
def display_download_info(self): |
1901
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
202 |
raise NotImplementedError("abstract method display_download_info() " |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
203 |
"not implemented in superclass") |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
204 |
|
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
205 |
def display_phase_info(self, phase_name, cur_n, goal_n): |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
206 |
raise NotImplementedError("abstract method display_phase_info() " |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
207 |
"not implemented in superclass") |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
208 |
|
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
209 |
def reset_label_text_after_delay(self): |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
210 |
raise NotImplementedError( |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
211 |
"abstract method reset_label_text_after_delay() " |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
212 |
"not implemented in superclass") |
fb369f67a414
7934 Show progress percentage in system taskbar for UM & PM
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1529
diff
changeset
|
213 |
|
1209
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
214 |
def update_label_text(self, text): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
215 |
raise NotImplementedError("abstract method update_label_text() " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
216 |
"not implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
217 |
|
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
218 |
def update_details_text(self, text, *tags): |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
219 |
raise NotImplementedError("abstract method update_details_text() " |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
220 |
"not implemented in superclass") |
640c256cb2a3
9596 PM / UM and webinstall should use common progress class
Michal Pryc <Michal.Pryc@Sun.Com>
parents:
diff
changeset
|
221 |