I'm building a simple Caja-Python extension and would like to show an "are you sure" messagebox before deleting files. There is no example in this repository.
Any suggestions?
I'm building a simple Caja-Python extension and would like to show an "are you sure" messagebox before deleting files. There is no example in this repository.
Any suggestions?
Welcome @Erriez to the community!
Possibly some form of this?:
I'm looking for a messagebox (GUI).
I found the answer for a Caja-Python extension script in ~/.local/share/caja-python/extensions/script.py
:
def menu_activate_cb(self, menu, files):
dialog = Gtk.MessageDialog(
parent=None,
flags=0,
message_type=Gtk.MessageType.QUESTION,
buttons=Gtk.ButtonsType.YES_NO,
text="Are you sure?",
)
dialog.format_secondary_text("WARNING: This cannot be undone!")
response = dialog.run()
dialog.destroy()
if response == Gtk.ResponseType.YES:
print("QUESTION dialog closed by clicking YES button")
elif response == Gtk.ResponseType.NO:
print("QUESTION dialog closed by clicking NO button")
...