From 8e984e62fbb48b2eb310040b9ff8044aeebe2718 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 18 Jul 2013 11:00:10 -0500 Subject: [PATCH] Only do Smarten Punctuation on calibre 0.9.39+. --- calibre-plugin/config.py | 10 ++++++---- calibre-plugin/jobs.py | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index f034bee4..2753000f 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -17,6 +17,7 @@ from PyQt4.Qt import (QDialog, QWidget, QVBoxLayout, QHBoxLayout, QLabel, from calibre.gui2.ui import get_gui from calibre.gui2 import dynamic, info_dialog +from calibre.constants import numeric_version as calibre_version from calibre_plugins.fanfictiondownloader_plugin.prefs import prefs, PREFS_NAMESPACE from calibre_plugins.fanfictiondownloader_plugin.dialogs \ @@ -321,10 +322,11 @@ class BasicTab(QWidget): self.updateepubcover.setChecked(prefs['updateepubcover']) self.l.addWidget(self.updateepubcover) - self.smarten_punctuation = QCheckBox('Smarten Punctuation (EPUB only)',self) - self.smarten_punctuation.setToolTip("Run Smarten Punctuation from Calibre's Polish Book feature on each EPUB download and update.") - self.smarten_punctuation.setChecked(prefs['smarten_punctuation']) - self.l.addWidget(self.smarten_punctuation) + if calibre_version >= (0, 9, 39): + self.smarten_punctuation = QCheckBox('Smarten Punctuation (EPUB only)',self) + self.smarten_punctuation.setToolTip("Run Smarten Punctuation from Calibre's Polish Book feature on each EPUB download and update.") + self.smarten_punctuation.setChecked(prefs['smarten_punctuation']) + self.l.addWidget(self.smarten_punctuation) cali_gb = groupbox = QGroupBox("Updating Calibre Options") self.l = QVBoxLayout() diff --git a/calibre-plugin/jobs.py b/calibre-plugin/jobs.py index 0b4899f6..7959f6d7 100644 --- a/calibre-plugin/jobs.py +++ b/calibre-plugin/jobs.py @@ -14,6 +14,7 @@ from StringIO import StringIO from calibre.utils.ipc.server import Server from calibre.utils.ipc.job import ParallelJob +from calibre.constants import numeric_version as calibre_version from calibre_plugins.fanfictiondownloader_plugin.dialogs import (NotGoingToDownload, OVERWRITE, OVERWRITEALWAYS, UPDATE, UPDATEALWAYS, ADDNEW, SKIP, CALIBREONLY) @@ -206,7 +207,8 @@ def do_download_for_worker(book,options,notification=lambda x,y:x): book['comment'] = 'Update %s completed, added %s chapters for %s total.'%\ (options['fileform'],(urlchaptercount-chaptercount),urlchaptercount) - if options['smarten_punctuation'] and options['fileform'] == "epub": + if options['smarten_punctuation'] and options['fileform'] == "epub" \ + and calibre_version >= (0, 9, 39): # do smarten_punctuation from calibre's polish feature from calibre.ebooks.oeb.polish.main import polish, ALL_OPTS from calibre.utils.logging import Log