From 8060eb115bc7c0d4cc02a15913a710819ee4b3e0 Mon Sep 17 00:00:00 2001 From: Maniu Date: Tue, 3 Jun 2025 13:17:01 +0200 Subject: [PATCH] Update python-fu-removebg.py add show_alert --- python-fu-removebg/python-fu-removebg.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/python-fu-removebg/python-fu-removebg.py b/python-fu-removebg/python-fu-removebg.py index 44b37f0..9e1bfb0 100644 --- a/python-fu-removebg/python-fu-removebg.py +++ b/python-fu-removebg/python-fu-removebg.py @@ -54,6 +54,23 @@ def find_rembg_install() -> Optional[Path]: return None +def show_alert(text: str, message: str, parent=None) -> None: + """Popup a message dialog with the given text and message""" + + dialog = Gtk.MessageDialog( + transient_for=parent, + flags=0, + message_type=Gtk.MessageType.ERROR, + buttons=Gtk.ButtonsType.CLOSE, + text=text, + ) + dialog.format_secondary_text(message) + dialog.set_title(f"{PROC_NAME} v{VERSION}") + dialog.run() + dialog.destroy() + + + class PythonRemoveBG(Gimp.PlugIn): ## GimpPlugIn virtual methods ## def do_set_i18n(self, procname):