Skip to content

Notifications and Prompts

emzed_gui provides three lightweight message-box helpers. Like the file dialogs, they create a QApplication automatically if none is running.

show_warning

emzed_gui.show_warning(message, title="Warning")

Shows a modal warning dialog with an OK button.

import emzed_gui

emzed_gui.show_warning("No peaks found in the selected range.")
emzed_gui.show_warning("Retention-time tolerance is very wide.", title="Check settings")

Warning dialog

show_information

emzed_gui.show_information(message, title="Information")

Shows a modal information dialog with an OK button.

emzed_gui.show_information("Exported 42 rows to result.csv.")

Information dialog

ask_yes_no

emzed_gui.ask_yes_no(
    message, allow_cancel=False, title="Question"
) -> bool | None

Shows a question dialog and returns:

User action Return value
Yes True
No False
Cancel (only when allow_cancel=True) None
if emzed_gui.ask_yes_no("Overwrite existing results?"):
    table.store(path)

With a cancel option:

answer = emzed_gui.ask_yes_no(
    "Save changes before closing?",
    allow_cancel=True,
)
if answer is True:
    table.store(path)
elif answer is None:
    return  # user cancelled — abort the close action

Yes/No/Cancel dialog