28
28
""" Display the AboutDialog. """
30
from guifiles import GLADEFILENAME
31
32
# Load AboutDialog description
32
dglade = gtk.glade.XML(olive.gladefile, 'aboutdialog')
33
dglade = gtk.glade.XML(GLADEFILENAME, 'aboutdialog')
33
34
dialog = dglade.get_widget('aboutdialog')
36
37
dialog.set_version(olive.__version__)
38
40
# Destroy the dialog
39
if dialog.run() == gtk.RESPONSE_CANCEL:
42
43
def _message_dialog(type, primary, secondary):
43
44
""" Display a given type of MessageDialog with the given message.
61
62
type=gtk.MESSAGE_INFO,
62
63
buttons=gtk.BUTTONS_OK)
63
64
dialog.set_markup('<big><b>' + primary + '</b></big>')
65
elif type == 'question':
66
dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
67
type=gtk.MESSAGE_QUESTION,
68
buttons=gtk.BUTTONS_YES_NO)
69
dialog.set_markup('<big><b>' + primary + '</b></big>')
67
73
dialog.format_secondary_markup(secondary)
69
if dialog.run() == gtk.RESPONSE_OK:
75
response = dialog.run()
72
80
def error_dialog(primary, secondary):
73
81
""" Display an error dialog with the given message. """
74
_message_dialog('error', primary, secondary)
82
return _message_dialog('error', primary, secondary)
76
84
def info_dialog(primary, secondary):
77
85
""" Display an info dialog with the given message. """
78
_message_dialog('info', primary, secondary)
86
return _message_dialog('info', primary, secondary)
80
88
def warning_dialog(primary, secondary):
81
89
""" Display a warning dialog with the given message. """
82
_message_dialog('warning', primary, secondary)
90
return _message_dialog('warning', primary, secondary)
92
def question_dialog(primary, secondary):
93
""" Display a dialog with the given question. """
94
return _message_dialog('question', primary, secondary)