The following code
import gtk
import nautilus
import os
def alert(message):
"""A function to debug"""
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, message)
dialog.run()
dialog.destroy()
class TestExtension(nautilus.MenuProvider):
def __init__(self):
pass
def get_file_items(self, window, files):
items = []
"""Called when the user selects a file in Nautilus."""
item = nautilus.MenuItem("NautilusPython::test_item", "Test", "Test")
item.connect("activate", self.menu_activate_cb, files)
items.append(item)
return items
def menu_activate_cb(self, menu, files):
"""Called when the user selects the menu."""
for name in files:
alert(name)
does not produce any Messages.
However
import easygui
import nautilus
import os
def alert(message):
"""A function to debug"""
easygui.msgbox(message)
class TestExtension(nautilus.MenuProvider):
def __init__(self):
pass
def get_file_items(self, window, files):
items = []
"""Called when the user selects a file in Nautilus."""
item = nautilus.MenuItem("NautilusPython::test_item", "Test", "Test")
item.connect("activate", self.menu_activate_cb, files)
items.append(item)
return items
def menu_activate_cb(self, menu, files):
"""Called when the user selects the menu."""
for name in files:
alert(name)
works nicely and produces the requested Messages.
Can someone explain this - or better - provide a workaround?
(Even better is that when moving the alert()-call into get_file_items()
the message appears correctly)