Permalink
Browse files

auto-copy hash to clipboard

  • Loading branch information...
1 parent eb7d279 commit ef9983629d218c930388f76279108c3ac1406b0b @gavinhungry committed Mar 11, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 hashbrowns.py
View
11 hashbrowns.py
@@ -2,7 +2,7 @@
#
# Name: hashbrowns
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
-# Date: 31 Jul 2011
+# Date: 31 Jul 2011 (last updated 11 Mar 2012)
# Desc: Provides a few hashes for a file, intended for use in a context menu
#
@@ -74,12 +74,19 @@ def checksum(button, file, hash, hashBox):
for data in iter(lambda: fd.read(128 * m.block_size), ''):
m.update(data)
- hashBox.set_text(m.hexdigest())
+ hash = m.hexdigest()
+
+ hashBox.set_text(hash)
+ clipboard.set_text(hash)
+ clipboard.store()
+
fd.close()
if __name__ == '__main__':
+ clipboard = gtk.clipboard_get()
+
if len(sys.argv) != 2:
sys.exit('usage: ' + sys.argv[0] + ' FILE')

0 comments on commit ef99836

Please sign in to comment.