From e9fc4d4caacb5c9a88be5d6831840694dc2298b5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Apr 2011 08:41:55 -0600 Subject: [PATCH 1/2] 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): From b87afcffc964b739c50195575bf77b272a557344 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Apr 2011 08:43:50 -0600 Subject: [PATCH 2/2] ... --- src/calibre/gui2/library/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 35fdbe5bdf..f7074a6fee 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -605,7 +605,7 @@ class BooksModel(QAbstractTableModel): # {{{ size = self.db.data[r][idx] if size: ans = '%.1f'%(float(size)/(1024*1024)) - if ans == '0.0': + if size > 0 and ans == '0.0': ans = '<0.1' return QVariant(ans) return None