bitbake/progress: make progress dialog modal for parent window
[bitbake.git] / lib / bb / ui / crumbs / progress.py
1 import gtk
2
3 class ProgressBar(gtk.Dialog):
4     def __init__(self, parent):
5
6         gtk.Dialog.__init__(self, flags=(gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT))
7         self.set_title("Parsing metadata, please wait...")
8         self.set_default_size(500, 0)
9         self.set_transient_for(parent)
10         self.progress = gtk.ProgressBar()
11         self.vbox.pack_start(self.progress)
12         self.show_all()
13
14     def update(self, x, y):
15         self.progress.set_fraction(float(x)/float(y))
16         self.progress.set_text("%2d %%" % (x*100/y))
17
18     def pulse(self):
19         self.progress.set_text("Loading...")
20         self.progress.pulse()