mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 21:56:05 +01:00
Book details panel: Dont show sizes less than 0.01MB as zero. Fixes #1882469 [Rounding on file sizes below 5.12 kilobytes](https://bugs.launchpad.net/calibre/+bug/1882469)
This commit is contained in:
parent
feabfbf294
commit
8258b394fb
1 changed files with 4 additions and 1 deletions
|
|
@ -25,7 +25,10 @@
|
|||
|
||||
def human_readable(size, precision=2):
|
||||
""" Convert a size in bytes into megabytes """
|
||||
return ('%.'+unicode_type(precision)+'f'+ 'MB') % (size/(1024*1024),)
|
||||
ans = size/(1024*1024)
|
||||
if ans < 0.1:
|
||||
return '<0.1MB'
|
||||
return ('%.'+unicode_type(precision)+'f'+ 'MB') % ans
|
||||
|
||||
|
||||
NULL_VALUES = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue