diff options
author | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-01-13 23:18:04 +0100 |
commit | ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd (patch) | |
tree | 4c4d47f249603be3cb816b1456a9dc71c0b48999 /examples/block-size-column.py | |
download | python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.bz2 python-caja-ca0a8f4d6cc24707bc07c3013bff321e2f0c24fd.tar.xz |
initial import from Mate-Extra repo
Diffstat (limited to 'examples/block-size-column.py')
-rw-r--r-- | examples/block-size-column.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/block-size-column.py b/examples/block-size-column.py new file mode 100644 index 0000000..6f94158 --- /dev/null +++ b/examples/block-size-column.py @@ -0,0 +1,22 @@ +import os +import urllib + +import caja + +class ColumnExtension(caja.ColumnProvider, caja.InfoProvider): + def __init__(self): + pass + + def get_columns(self): + return caja.Column("CajaPython::block_size_column", + "block_size", + "Block size", + "Get the block size"), + + def update_file_info(self, file): + if file.get_uri_scheme() != 'file': + return + + filename = urllib.unquote(file.get_uri()[7:]) + + file.add_string_attribute('block_size', str(os.stat(filename).st_blksize)) |