33
33
return with_main_iteration
36
class PromptDialog(Gtk.MessageDialog):
36
class PromptDialog(Gtk.Dialog):
37
37
"""Prompt the user for a yes/no answer."""
39
def __init__(self, prompt, parent=None):
40
super(PromptDialog, self).__init__(
41
parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
42
Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, prompt)
45
class InfoDialog(Gtk.MessageDialog):
46
"""Show the user an informational message."""
48
MESSAGE_TYPE = Gtk.MessageType.INFO
50
def __init__(self, prompt, parent=None):
51
super(InfoDialog, self).__init__(
52
parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
53
self.MESSAGE_TYPE, Gtk.ButtonsType.CLOSE, prompt)
56
class WarningDialog(InfoDialog):
57
"""Show the user a warning message."""
59
MESSAGE_TYPE = Gtk.MessageType.WARNING
62
class ErrorDialog(InfoDialog):
63
"""Show the user a warning message."""
65
MESSAGE_TYPE = Gtk.MessageType.ERROR
39
def __init__(self, prompt):
40
super(PromptDialog, self).__init__()
42
label = Gtk.Label(label=prompt)
43
self.get_content_area().pack_start(label, True, True, 10)
44
self.get_content_area().show_all()
46
self.add_buttons(Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_NO,
68
50
class GtkProgressBar(Gtk.ProgressBar):
194
176
return (response == Gtk.ResponseType.YES)
196
def show_message(self, msg):
197
"""See UIFactory.show_message."""
198
dialog = InfoDialog(msg)
202
def show_warning(self, msg):
203
"""See UIFactory.show_warning."""
204
dialog = WarningDialog(msg)
208
def show_error(self, msg):
209
"""See UIFactory.show_error."""
210
dialog = ErrorDialog(msg)
214
def show_user_warning(self, warning_id, **message_args):
215
"""See UIFactory.show_user_warning."""
216
if warning_id not in self.suppressed_warnings:
217
message = self.format_user_warning(warning_id, message_args)
218
self.show_warning(message)
220
178
def get_password(self, prompt='', **kwargs):
221
179
"""Prompt the user for a password.