From 9e4383c776b1174477b0fc62724d4b0a10cbd61b Mon Sep 17 00:00:00 2001 From: John Schember Date: Thu, 19 May 2011 06:39:08 -0400 Subject: [PATCH 1/2] ... --- src/calibre/gui2/shortcuts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/shortcuts.py b/src/calibre/gui2/shortcuts.py index 55ff625fdc..5cdaf2da8a 100644 --- a/src/calibre/gui2/shortcuts.py +++ b/src/calibre/gui2/shortcuts.py @@ -44,9 +44,9 @@ class Customize(QFrame, Ui_Frame): clear.clicked.connect(partial(self.clear_clicked, which=x)) def clear_clicked(self, which=0): - button = getattr(self, 'button%d'%which) - button.setText(_('None')) - setattr(self, 'shortcut%d'%which, None) + button = getattr(self, 'button%d'%which) + button.setText(_('None')) + setattr(self, 'shortcut%d'%which, None) def custom_toggled(self, checked): for w in ('1', '2'): From ae96797d333feaca4d8f76cb509ac3e3effb32b4 Mon Sep 17 00:00:00 2001 From: John Schember Date: Thu, 2 Jun 2011 20:31:27 -0400 Subject: [PATCH 2/2] Fix bug #791805: RTF output does not handle { and } properly. --- src/calibre/ebooks/rtf/rtfml.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/ebooks/rtf/rtfml.py b/src/calibre/ebooks/rtf/rtfml.py index f3febb1743..60f69e2e17 100644 --- a/src/calibre/ebooks/rtf/rtfml.py +++ b/src/calibre/ebooks/rtf/rtfml.py @@ -68,8 +68,13 @@ TODO: ''' def txt2rtf(text): + # Escape { and } in the text. + text = text.replace('{', r'\'7b') + text = text.replace('}', r'\'7d') + if not isinstance(text, unicode): return text + buf = cStringIO.StringIO() for x in text: val = ord(x)