MOBI Output: When inserting metadata, hide the searchable version of the tags (append with ttt). They are still searchable, but not visible. Also Fix #5424 (Keyboard Shortcut 'o' doesnt work if the path name contains '#')

This commit is contained in:
Kovid Goyal 2010-05-01 09:35:59 -06:00
parent 73ba818428
commit b91f16d0c4
3 changed files with 8 additions and 5 deletions

View File

@ -4,6 +4,7 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
from itertools import izip from itertools import izip
from xml.sax.saxutils import escape
from calibre.customize import Plugin as _Plugin from calibre.customize import Plugin as _Plugin
@ -238,7 +239,7 @@ class OutputProfile(Plugin):
@classmethod @classmethod
def tags_to_string(cls, tags): def tags_to_string(cls, tags):
return ', '.join(tags) return escape(', '.join(tags))
class iPadOutput(OutputProfile): class iPadOutput(OutputProfile):
@ -383,7 +384,8 @@ class KindleOutput(OutputProfile):
@classmethod @classmethod
def tags_to_string(cls, tags): def tags_to_string(cls, tags):
return 'ttt '.join(tags)+'ttt ' return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags),
'ttt '.join(tags)+'ttt ')
class KindleDXOutput(OutputProfile): class KindleDXOutput(OutputProfile):
@ -399,7 +401,8 @@ class KindleDXOutput(OutputProfile):
@classmethod @classmethod
def tags_to_string(cls, tags): def tags_to_string(cls, tags):
return 'ttt '.join(tags)+'ttt ' return u'%s <br/><span style="color: white">%s</span>' % (', '.join(tags),
'ttt '.join(tags)+'ttt ')
class IlliadOutput(OutputProfile): class IlliadOutput(OutputProfile):

View File

@ -99,7 +99,7 @@ class Jacket(object):
except: except:
tags = [] tags = []
if tags: if tags:
tags = '<b>Tags: </b>' + escape(self.opts.dest.tags_to_string(tags)) tags = '<b>Tags: </b>' + self.opts.dest.tags_to_string(tags)
else: else:
tags = '' tags = ''
try: try:

View File

@ -2096,7 +2096,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
return return
for row in rows: for row in rows:
path = self.library_view.model().db.abspath(row.row()) path = self.library_view.model().db.abspath(row.row())
QDesktopServices.openUrl(QUrl('file:'+path)) QDesktopServices.openUrl(QUrl.fromLocalFile(path))
def view_book(self, triggered): def view_book(self, triggered):