nautilus.PropertyPageProvider — nautilus.PropertyPageProvider Reference
If subclassed, Nautilus will request a list of custom property pages that should appear when a user opens the Properties dialog for a file or folder.
Example 6. nautilus.PropertyPageProvider Example
import hashlib
import urllib
import gtk
import nautilus
class MD5SumPropertyPage(nautilus.PropertyPageProvider):
def __init__(self):
pass
def get_property_pages(self, files):
if len(files) != 1:
return
file = files[0]
if file.get_uri_scheme() != 'file':
return
if file.is_directory():
return
filename = urllib.unquote(file.get_uri()[7:])
self.property_label = gtk.Label('MD5Sum')
self.property_label.show()
self.hbox = gtk.HBox(0, False)
self.hbox.show()
label = gtk.Label('MD5Sum:')
label.show()
self.hbox.pack_start(label)
self.value_label = gtk.Label()
self.hbox.pack_start(self.value_label)
md5sum = hashlib.md5(filename).hexdigest()
self.value_label.set_text(md5sum)
self.value_label.show()
return nautilus.PropertyPage("NautilusPython::md5_sum",
self.property_label, self.hbox),
def get_pages()
| a list of nautilus.FileInfo objects. |
Returns : | a list of nautilus.PropertyPage objects |
This function is called by Nautilus when it wants property page items from the extension. It is called in the main thread before a property page is shown, so it should return quickly.