1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#
# progress_gui.py: install/upgrade progress window setup.
#
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import glob
import gtk
import pango
import gui
from flags import flags
from iw_gui import *
from constants import *
import language
import logging
log = logging.getLogger("anaconda")
class InstallProgressWindow (InstallWindow):
windowTitle = N_("Installing Packages")
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
ics.setPrevEnabled (False)
ics.setNextEnabled (False)
self._updateChange = 0.01
self._showPercentage = False
def processEvents(self):
gui.processEvents()
def get_fraction(self):
return self.progress.get_fraction()
def set_fraction(self, pct):
cur = self.get_fraction()
if pct - cur > self._updateChange:
self.progress.set_fraction(pct)
if self._showPercentage:
self.progress.set_text("%d %%" %(pct * 100,))
self.processEvents()
def set_label(self, txt):
# handle txt strings that contain '&' and '&'
# we convert everything to '&' first, then take them all to '&'
# so we avoid things like &&
# we have to use '&' for the set_markup() method
txt = txt.replace('&', '&')
txt = txt.replace('&', '&')
self.infolabel.set_markup(txt)
self.infolabel.set_ellipsize(pango.ELLIPSIZE_END)
self.processEvents()
def set_text(self, txt):
if self._showPercentage:
log.debug("Setting progress text with showPercentage set")
return
self.progress.set_text(txt)
self.processEvents()
def renderCallback(self):
self.intf.icw.nextClicked()
def setShowPercentage(self, val):
if val not in (True, False):
raise ValueError, "Invalid value passed to setShowPercentage"
self._showPercentage = val
def _getRnotes(self):
langs = []
pixmaps = []
if (os.environ.has_key('LANG')):
langs = language.expandLangs(os.environ['LANG'])
langs.append('')
pixmaps = []
paths = ("/tmp/product/pixmaps/rnotes/%s/*.png",
"/usr/share/anaconda/pixmaps/rnotes/%s/*.png")
for p in paths:
for lang in langs:
path = p % lang
pixmaps = glob.glob(path)
if len(pixmaps) > 0:
break
if len(pixmaps) > 0:
files = pixmaps
else:
files = ["progress_first.png"]
return files
def getScreen (self, anaconda):
self.intf = anaconda.intf
if anaconda.dir == DISPATCH_BACK:
self.intf.icw.prevClicked()
return
self.pixmaps = self._getRnotes()
# Create vbox to contain components of UI
vbox = gtk.VBox (False, 12)
# Create rnote area
self.adpix = None
self.adbox = None
pix = gui.readImageFromFile ("progress_first.png")
if pix:
frame = gtk.Frame()
frame.set_shadow_type(gtk.SHADOW_NONE)
box = gtk.EventBox()
self.adpix = pix
box.add(self.adpix)
self.adbox = box
frame.add(box)
vbox.pack_start(frame, False)
self.progress = gtk.ProgressBar()
vbox.pack_start(self.progress, False)
self.infolabel = gui.WrappingLabel("")
self.infolabel.set_alignment(0,0)
vbox.pack_start(self.infolabel)
# All done with creating components of UI
self.intf.setPackageProgressWindow(self)
anaconda.id.setInstallProgressClass(self)
vbox.set_border_width(6)
return vbox
|