summaryrefslogtreecommitdiff
path: root/examples/md5sum-property-page.py
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-01-13 23:18:04 +0100
committerStefano Karapetsas <[email protected]>2012-01-13 23:18:04 +0100
commitca0a8f4d6cc24707bc07c3013bff321e2f0c24fd (patch)
tree4c4d47f249603be3cb816b1456a9dc71c0b48999 /examples/md5sum-property-page.py
downloadpython-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.bz2
python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.xz
initial import from Mate-Extra repo
Diffstat (limited to 'examples/md5sum-property-page.py')
-rw-r--r--examples/md5sum-property-page.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/md5sum-property-page.py b/examples/md5sum-property-page.py
new file mode 100644
index 0000000..13c59e7
--- /dev/null
+++ b/examples/md5sum-property-page.py
@@ -0,0 +1,42 @@
+import hashlib
+import urllib
+
+import gtk
+import caja
+
+class MD5SumPropertyPage(caja.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 caja.PropertyPage("CajaPython::md5_sum",
+ self.property_label, self.hbox),