Release 1.6
[zeroinstall.git] / zeroinstall / 0launch-gui / dialog.py
blob862b1e6e50df9a3f482f2c62f76bec5a06f6e6c7
1 # Copyright (C) 2009, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
4 import gtk
5 import os
6 from zeroinstall.gtkui import gtkutils
8 last_error = None
10 builderfile = os.path.join(os.path.dirname(__file__), 'zero-install.ui')
12 class Template(gtkutils.Template):
13 def __init__(self, root):
14 gtkutils.Template.__init__(self, builderfile, root)
16 class Dialog(gtk.Dialog):
17 def __init__(self):
18 gtk.Dialog.__init__(self)
19 self.set_has_separator(False)
20 self.set_position(gtk.WIN_POS_CENTER)
22 def add_mixed_button(self, message, stock, response):
23 button = MixedButton(message, stock)
24 button.set_flags(gtk.CAN_DEFAULT)
26 self.add_action_widget(button, response)
27 button.show_all()
28 return button
30 def alert(parent, message, type = gtk.MESSAGE_ERROR):
31 if type == gtk.MESSAGE_ERROR:
32 global last_error
33 last_error = message
35 gtkutils.show_message_box(parent, message, type)
37 DialogResponse = gtkutils.DialogResponse
38 ButtonClickedBlocker = gtkutils.ButtonClickedBlocker
39 MixedButton = gtkutils.MixedButton