added info dialog

This commit is contained in:
DYefremov
2019-05-01 17:19:31 +03:00
parent edb97cbf8c
commit 55b0dccc80

View File

@@ -18,6 +18,7 @@ class DialogType(Enum):
QUESTION = "question_dialog"
ABOUT = "about_dialog"
WAIT = "wait_dialog"
INFO = "info_dialog"
class WaitDialog:
@@ -42,6 +43,9 @@ class WaitDialog:
def show_dialog(dialog_type: DialogType, transient, text=None, options=None, action_type=None, file_filter=None):
""" Shows dialogs by name """
if dialog_type is DialogType.INFO:
return get_info_dialog(transient, text)
builder, dialog = get_dialog_from_xml(dialog_type, transient)
if dialog_type is DialogType.CHOOSER and options:
@@ -104,6 +108,13 @@ def get_chooser_dialog(transient, options, pattern, name):
file_filter=file_filter)
def get_info_dialog(transient, text):
dialog = Gtk.MessageDialog(parent=transient, type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK)
dialog.set_markup(get_message(text))
dialog.run()
dialog.destroy()
def get_message(message):
""" returns translated message """
return locale.dgettext(TEXT_DOMAIN, message)