Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
1574:babd97d80049 | 1575:833bdb227b16 |
---|---|
168 the name must not be empty or contain a "/" character | 168 the name must not be empty or contain a "/" character |
169 - size (int): size of the file | 169 - size (int): size of the file |
170 It may content the key used in CONFIRM constant | 170 It may content the key used in CONFIRM constant |
171 It *MUST NOT* contain the "peer" key | 171 It *MUST NOT* contain the "peer" key |
172 "file_path" will be added to this dict once destination selected | 172 "file_path" will be added to this dict once destination selected |
173 "size_human" will also be added with human readable file size | |
173 @param profile: %(doc_profile)s | 174 @param profile: %(doc_profile)s |
174 return (defer.Deferred): True if transfer is accepted | 175 return (defer.Deferred): True if transfer is accepted |
175 """ | 176 """ |
176 filename = file_data['name'] | 177 filename = file_data['name'] |
177 assert filename and not '/' in filename | 178 assert filename and not '/' in filename |
179 # human readable size | |
180 file_data['size_human'] = u'{:.6n} Mio'.format(float(file_data['size'])/(1024**2)) | |
178 d = xml_tools.deferDialog(self.host, | 181 d = xml_tools.deferDialog(self.host, |
179 _(CONFIRM).format(peer=peer_jid.full(), **file_data), | 182 _(CONFIRM).format(peer=peer_jid.full(), **file_data), |
180 _(CONFIRM_TITLE), | 183 _(CONFIRM_TITLE), |
181 type_=C.XMLUI_DIALOG_FILE, | 184 type_=C.XMLUI_DIALOG_FILE, |
182 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR}, | 185 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR}, |