From 8052d91e337345d9b0f59fa917ce2915c0bf931c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 15 Sep 2010 10:01:49 -0600 Subject: [PATCH] Use asterisk for ratings on most output profiles --- src/calibre/customize/profiles.py | 5 ++++ src/calibre/ebooks/oeb/transforms/jacket.py | 6 ++-- .../gui2/convert/structure_detection.ui | 28 +++++++++---------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 1563f764ca..a8d7eb2e0d 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -248,6 +248,9 @@ class OutputProfile(Plugin): #: If True, the date is appended to the title of downloaded news periodical_date_in_title = True + #: The character used to represent a star in ratings + ratings_char = u'*' + @classmethod def tags_to_string(cls, tags): return escape(', '.join(tags)) @@ -273,6 +276,7 @@ class iPadOutput(OutputProfile): 'macros': {'border-width': '{length}|medium|thick|thin'} } ] + ratings_char = u'\u2605' touchscreen = True # touchscreen_news_css {{{ touchscreen_news_css = u''' @@ -553,6 +557,7 @@ class KindleOutput(OutputProfile): fsizes = [12, 12, 14, 16, 18, 20, 22, 24] supports_mobi_indexing = True periodical_date_in_title = False + ratings_char = u'\u2605' @classmethod def tags_to_string(cls, tags): diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index a44a18db95..88c7a4ff0e 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -93,7 +93,7 @@ class Jacket(object): # Render Jacket {{{ -def get_rating(rating): +def get_rating(rating, rchar): ans = '' try: num = float(rating)/2 @@ -104,7 +104,7 @@ def get_rating(rating): if num < 1: return ans - ans = u'\u2605' * int(num) + ans = rchar * int(num) return ans @@ -129,7 +129,7 @@ def render_jacket(mi, output_profile, except: pubdate = '' - rating = get_rating(mi.rating) + rating = get_rating(mi.rating, output_profile.ratings_char) tags = mi.tags if mi.tags else alt_tags if tags: diff --git a/src/calibre/gui2/convert/structure_detection.ui b/src/calibre/gui2/convert/structure_detection.ui index eb2892a07a..c0b3de3bd9 100644 --- a/src/calibre/gui2/convert/structure_detection.ui +++ b/src/calibre/gui2/convert/structure_detection.ui @@ -41,24 +41,17 @@ - + Insert &metadata as page at start of book - - - - &Preprocess input file to possibly improve structure detection - - - - + - + Qt::Vertical @@ -71,26 +64,33 @@ - + Remove F&ooter - + Remove H&eader - + - + + + + + &Preprocess input file to possibly improve structure detection + + +