This commit is contained in:
Kovid Goyal 2016-09-05 00:15:39 +05:30
parent 0dafccf479
commit 7fe6a03db3
3 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ from PyQt5.Qt import (
from PyQt5.QtWebKitWidgets import QWebView from PyQt5.QtWebKitWidgets import QWebView
from calibre.customize.ui import metadata_plugins from calibre.customize.ui import metadata_plugins
from calibre.ebooks.metadata import authors_to_string from calibre.ebooks.metadata import authors_to_string, rating_to_stars
from calibre.utils.logging import GUILog as Log from calibre.utils.logging import GUILog as Log
from calibre.ebooks.metadata.sources.identify import urls_from_identifiers from calibre.ebooks.metadata.sources.identify import urls_from_identifiers
from calibre.ebooks.metadata.book.base import Metadata from calibre.ebooks.metadata.book.base import Metadata
@ -269,7 +269,7 @@ class ResultsView(QTableView): # {{{
parts.append('<div>%s: %s</div>'%series) parts.append('<div>%s: %s</div>'%series)
if not book.is_null('rating'): if not book.is_null('rating'):
style = 'style=\'font-family:"%s"\''%f style = 'style=\'font-family:"%s"\''%f
parts.append('<div %s>%s</div>'%(style, '\u2605'*int(book.rating))) parts.append('<div %s>%s</div>'%(style, rating_to_stars(int(book.rating))))
parts.append('</center>') parts.append('</center>')
if book.identifiers: if book.identifiers:
urls = urls_from_identifiers(book.identifiers) urls = urls_from_identifiers(book.identifiers)

View File

@ -1351,7 +1351,7 @@ class TagsModel(QAbstractItemModel): # {{{
if self.db.field_metadata[tag.category]['is_csp']: if self.db.field_metadata[tag.category]['is_csp']:
add_colon = True add_colon = True
if tag.name and tag.name[0] == u'\u2605': # char is a star. Assume rating if tag.name and tag.name[0] in u'★½': # char is a star or a half. Assume rating
ans.append('%s%s:%s'%(prefix, category, len(tag.name))) ans.append('%s%s:%s'%(prefix, category, len(tag.name)))
else: else:
name = tag.original_name name = tag.original_name

View File

@ -256,7 +256,7 @@ class SearchPanel:
return expr return expr
category = 'tags' if item.category is 'news' else item.category category = 'tags' if item.category is 'news' else item.category
if item.name and item.name[0] is '★': if item.name and item.name[0] in '★½':
# Assume ratings # Assume ratings
expr = '{}:{}'.format(category, item.name.length) expr = '{}:{}'.format(category, item.name.length)
else: else: