mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
minor corrections linked to bug 7345
This commit is contained in:
parent
6259647329
commit
a8578eee2d
@ -17,8 +17,6 @@ from calibre.utils.html2text import html2text
|
|||||||
|
|
||||||
metadata_config = None
|
metadata_config = None
|
||||||
|
|
||||||
html_check = re.compile("([\<])([^\>]{1,})*([\>])", re.I)
|
|
||||||
|
|
||||||
class MetadataSource(Plugin): # {{{
|
class MetadataSource(Plugin): # {{{
|
||||||
'''
|
'''
|
||||||
Represents a source to query for metadata. Subclasses must implement
|
Represents a source to query for metadata. Subclasses must implement
|
||||||
@ -86,9 +84,6 @@ class MetadataSource(Plugin): # {{{
|
|||||||
mi.rating = None
|
mi.rating = None
|
||||||
if not c.get('comments', True):
|
if not c.get('comments', True):
|
||||||
mi.comments = None
|
mi.comments = None
|
||||||
if c.get('textconvert', True) and mi.comments is not None \
|
|
||||||
and html_check.search(mi.comments) is not None:
|
|
||||||
mi.comments = html2text(mi.comments)
|
|
||||||
if not c.get('tags', True):
|
if not c.get('tags', True):
|
||||||
mi.tags = []
|
mi.tags = []
|
||||||
if self.has_html_comments and mi.comments and \
|
if self.has_html_comments and mi.comments and \
|
||||||
@ -152,6 +147,7 @@ class MetadataSource(Plugin): # {{{
|
|||||||
cb.setChecked(c.get(x, True))
|
cb.setChecked(c.get(x, True))
|
||||||
w._layout.addWidget(cb)
|
w._layout.addWidget(cb)
|
||||||
|
|
||||||
|
if self.has_html_comments:
|
||||||
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
|
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
|
||||||
setattr(w, '_textcomments', cb)
|
setattr(w, '_textcomments', cb)
|
||||||
cb.setChecked(c.get('textcomments', False))
|
cb.setChecked(c.get('textcomments', False))
|
||||||
@ -161,8 +157,10 @@ class MetadataSource(Plugin): # {{{
|
|||||||
|
|
||||||
def save_settings(self, w):
|
def save_settings(self, w):
|
||||||
dl_settings = {}
|
dl_settings = {}
|
||||||
for x in ('rating', 'tags', 'comments', 'textcomments'):
|
for x in ('rating', 'tags', 'comments'):
|
||||||
dl_settings[x] = getattr(w, '_'+x).isChecked()
|
dl_settings[x] = getattr(w, '_'+x).isChecked()
|
||||||
|
if self.has_html_comments:
|
||||||
|
dl_settings['textcomments'] = getattr(w, '_textcomments').isChecked()
|
||||||
c = self.config_store()
|
c = self.config_store()
|
||||||
c.set(self.name, dl_settings)
|
c.set(self.name, dl_settings)
|
||||||
if hasattr(w, '_sc'):
|
if hasattr(w, '_sc'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user