From e9fc4d4caacb5c9a88be5d6831840694dc2298b5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Apr 2011 08:41:55 -0600 Subject: [PATCH] When the size of a book is less that 0.1MB display the size as <0.1 instead of 0.0. Fixes #755768 (RFE: change units in size column) --- src/calibre/gui2/library/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 653a8ea2f6..35fdbe5bdf 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -604,7 +604,10 @@ class BooksModel(QAbstractTableModel): # {{{ def size(r, idx=-1): size = self.db.data[r][idx] if size: - return QVariant('%.1f'%(float(size)/(1024*1024))) + ans = '%.1f'%(float(size)/(1024*1024)) + if ans == '0.0': + ans = '<0.1' + return QVariant(ans) return None def rating_type(r, idx=-1):