diff src/plugins/plugin_misc_file.py @ 1575:833bdb227b16

plugins XEP-0234, file: moved human file size conversion to file plugi
author Goffi <goffi@goffi.org>
date Wed, 11 Nov 2015 18:19:49 +0100
parents babd97d80049
children 846a39900fa6
line wrap: on
line diff
--- a/src/plugins/plugin_misc_file.py	Wed Nov 11 18:19:47 2015 +0100
+++ b/src/plugins/plugin_misc_file.py	Wed Nov 11 18:19:49 2015 +0100
@@ -170,11 +170,14 @@
             It may content the key used in CONFIRM constant
             It *MUST NOT* contain the "peer" key
             "file_path" will be added to this dict once destination selected
+            "size_human" will also be added with human readable file size
         @param profile: %(doc_profile)s
         return (defer.Deferred): True if transfer is accepted
         """
         filename = file_data['name']
         assert filename and not '/' in filename
+        # human readable size
+        file_data['size_human'] = u'{:.6n} Mio'.format(float(file_data['size'])/(1024**2))
         d = xml_tools.deferDialog(self.host,
             _(CONFIRM).format(peer=peer_jid.full(), **file_data),
             _(CONFIRM_TITLE),