From b91f16d0c4c1d4b40d825e4dbeb40ec7b62b9308 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 May 2010 09:35:59 -0600 Subject: [PATCH] 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 '#') --- src/calibre/customize/profiles.py | 9 ++++++--- src/calibre/ebooks/oeb/transforms/jacket.py | 2 +- src/calibre/gui2/ui.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 7141fe05b2..f253b17c6e 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -4,6 +4,7 @@ __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' from itertools import izip +from xml.sax.saxutils import escape from calibre.customize import Plugin as _Plugin @@ -238,7 +239,7 @@ class OutputProfile(Plugin): @classmethod def tags_to_string(cls, tags): - return ', '.join(tags) + return escape(', '.join(tags)) class iPadOutput(OutputProfile): @@ -383,7 +384,8 @@ class KindleOutput(OutputProfile): @classmethod def tags_to_string(cls, tags): - return 'ttt '.join(tags)+'ttt ' + return u'%s
%s' % (', '.join(tags), + 'ttt '.join(tags)+'ttt ') class KindleDXOutput(OutputProfile): @@ -399,7 +401,8 @@ class KindleDXOutput(OutputProfile): @classmethod def tags_to_string(cls, tags): - return 'ttt '.join(tags)+'ttt ' + return u'%s
%s' % (', '.join(tags), + 'ttt '.join(tags)+'ttt ') class IlliadOutput(OutputProfile): diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index 2991e28d02..fec4d230c3 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -99,7 +99,7 @@ class Jacket(object): except: tags = [] if tags: - tags = 'Tags: ' + escape(self.opts.dest.tags_to_string(tags)) + tags = 'Tags: ' + self.opts.dest.tags_to_string(tags) else: tags = '' try: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 64004c70f8..392e6428eb 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -2096,7 +2096,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): return for row in rows: path = self.library_view.model().db.abspath(row.row()) - QDesktopServices.openUrl(QUrl('file:'+path)) + QDesktopServices.openUrl(QUrl.fromLocalFile(path)) def view_book(self, triggered):