Updated preferences box to support Python 3, PyGObject and GTK 3
[zeroinstall.git] / zeroinstall / 0launch-gui / dialog.py
blob57f1067fb26216921cfd2b5c5b31c69706ecf261
1 # Copyright (C) 2009, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
4 import os
5 from zeroinstall.gtkui import gtkutils, gtk
7 last_error = None
9 builderfile = os.path.join(os.path.dirname(__file__), 'zero-install.ui')
11 class Template(gtkutils.Template):
12 def __init__(self, root):
13 gtkutils.Template.__init__(self, builderfile, root)
15 class Dialog(gtk.Dialog):
16 def __init__(self):
17 gtk.Dialog.__init__(self)
18 self.set_has_separator(False)
19 self.set_position(gtk.WIN_POS_CENTER)
21 def add_mixed_button(self, message, stock, response):
22 button = MixedButton(message, stock)
23 button.set_flags(gtk.CAN_DEFAULT)
25 self.add_action_widget(button, response)
26 button.show_all()
27 return button
29 def alert(parent, message, type = gtk.MESSAGE_ERROR):
30 if type == gtk.MESSAGE_ERROR:
31 global last_error
32 last_error = message
34 gtkutils.show_message_box(parent, message, type)
36 DialogResponse = gtkutils.DialogResponse
37 ButtonClickedBlocker = gtkutils.ButtonClickedBlocker
38 MixedButton = gtkutils.MixedButton