26
def _message_dialog(type, primary, secondary, parent=None, buttons=gtk.BUTTONS_OK):
28
""" Display the AboutDialog. """
31
# Load AboutDialog description
32
dglade = gtk.glade.XML(olive.gladefile, 'aboutdialog')
33
dialog = dglade.get_widget('aboutdialog')
36
dialog.set_version(olive.__version__)
39
if dialog.run() == gtk.RESPONSE_CANCEL:
42
def _message_dialog(type, primary, secondary):
27
43
""" Display a given type of MessageDialog with the given message.
29
:param type: message dialog type
45
:param type: error | warning | info
31
47
:param message: the message you want to display.
33
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL, type=type, parent=parent,
35
dialog.set_markup('<big><b>' + primary + '</b></big>')
50
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
51
type=gtk.MESSAGE_ERROR,
52
buttons=gtk.BUTTONS_OK)
53
dialog.set_markup('<big><b>' + primary + '</b></big>')
54
elif type == 'warning':
55
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
56
type=gtk.MESSAGE_WARNING,
57
buttons=gtk.BUTTONS_OK)
58
dialog.set_markup('<big><b>' + primary + '</b></big>')
60
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
61
type=gtk.MESSAGE_INFO,
62
buttons=gtk.BUTTONS_OK)
63
dialog.set_markup('<big><b>' + primary + '</b></big>')
36
67
dialog.format_secondary_markup(secondary)
37
response = dialog.run()
69
if dialog.run() == gtk.RESPONSE_OK:
41
def error_dialog(primary, secondary, parent=None):
72
def error_dialog(primary, secondary):
42
73
""" Display an error dialog with the given message. """
43
return _message_dialog(gtk.MESSAGE_ERROR, primary, secondary, parent)
74
_message_dialog('error', primary, secondary)
45
def info_dialog(primary, secondary, parent=None):
76
def info_dialog(primary, secondary):
46
77
""" Display an info dialog with the given message. """
47
return _message_dialog(gtk.MESSAGE_INFO, primary, secondary, parent)
78
_message_dialog('info', primary, secondary)
49
def warning_dialog(primary, secondary, parent=None):
80
def warning_dialog(primary, secondary):
50
81
""" Display a warning dialog with the given message. """
51
return _message_dialog(gtk.MESSAGE_WARNING, primary, secondary, parent)
53
def question_dialog(primary, secondary, parent=None):
54
""" Display a dialog with the given question. """
55
return _message_dialog(gtk.MESSAGE_QUESTION, primary, secondary, parent, gtk.BUTTONS_YES_NO)
82
_message_dialog('warning', primary, secondary)