/usr/share/rhn/up2date_client/progress.py is in rhn-client-tools 1.8.26-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #
# Progress bar for Update Agent
# Copyright (c) 1999-2010 Red Hat, Inc.
#
# Author: Preston Brown <pbrown@redhat.com>
import gtk
class Progress:
def __init__(self):
glade_prefix = "/usr/share/rhn/up2date_client/"
self.xml = gtk.glade.XML(glade_prefix + "progress.glade", "progressWindow")
self.progressWindow = self.xml.get_widget("progressWindow")
self.progressWindow.connect("delete-event", self.progressWindow.hide)
#self.progressWindow.connect("hide", self.progressWindow.hide)
cursor = gtk.gdk.Cursor(gtk.gdk.WATCH)
self.progressWindow.window.set_cursor(cursor)
while gtk.events_pending():
gtk.main_iteration(False)
self.lastProgress = 0.0
def hide(self):
self.progressWindow.hide()
while gtk.events_pending():
gtk.main_iteration(False)
del self
def setLabel(self, text):
label = self.xml.get_widget("progressLabel")
label.set_text(text)
while gtk.events_pending():
gtk.main_iteration(False)
# the xmlrpc callbacks only use the first three
# the GET style use all 4, so pass em but dont use them
def setProgress(self, amount, total, speed = 0, secs = 0):
if total:
i = float(amount) / total
else:
i = 1
if i > 1:
i = 1
if i > self.lastProgress + .01 or i == 1:
self.xml.get_widget("progressBar").set_fraction(i)
if i == 1:
# reset
i = 0
# gtk.gdk_flush()
while gtk.events_pending():
gtk.main_iteration(False)
self.lastProgress = i
def setStatusLabel(self, text):
self.xml.get_widget("statusLabel").set_text(text)
while gtk.events_pending():
gtk.main_iteration(False)
def destroy(self):
while gtk.events_pending():
gtk.main_iteration(False)
self.progressWindow.destroy()
def noop(self, win, event):
return True
|