Moved progress bar to bottom.
[zeroinstall.git] / dialog.py
blob96c85134a110300c20f4a6cc085d1cdc4fb98f35
1 import gtk
3 n_windows = 0
5 class Dialog(gtk.Dialog):
6 def __init__(self):
7 global n_windows
8 gtk.Dialog.__init__(self)
9 self.set_has_separator(False)
10 self.set_position(gtk.WIN_POS_CENTER)
12 def destroyed(widget):
13 global n_windows
14 n_windows -= 1
15 if n_windows == 0:
16 gtk.main_quit()
17 self.connect('destroy', destroyed)
19 n_windows += 1
21 def alert(parent, message):
22 box = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT,
23 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
24 message)
25 box.set_position(gtk.WIN_POS_CENTER)
26 box.connect('response', lambda b, r: box.destroy())
27 box.show()