mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -25,7 +25,10 @@ SIMPLE_SET = frozenset(SIMPLE_GET - {'identifiers'})
|
|||||||
|
|
||||||
def human_readable(size, precision=2):
|
def human_readable(size, precision=2):
|
||||||
""" Convert a size in bytes into megabytes """
|
""" 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 = {
|
NULL_VALUES = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user