minor corrections linked to bug 7345

This commit is contained in:
Sengian 2010-11-02 00:05:20 +01:00
parent 6259647329
commit a8578eee2d

View File

@ -17,8 +17,6 @@ from calibre.utils.html2text import html2text
metadata_config = None
html_check = re.compile("([\<])([^\>]{1,})*([\>])", re.I)
class MetadataSource(Plugin): # {{{
'''
Represents a source to query for metadata. Subclasses must implement
@ -86,9 +84,6 @@ class MetadataSource(Plugin): # {{{
mi.rating = None
if not c.get('comments', True):
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):
mi.tags = []
if self.has_html_comments and mi.comments and \
@ -151,18 +146,21 @@ class MetadataSource(Plugin): # {{{
setattr(w, '_'+x, cb)
cb.setChecked(c.get(x, True))
w._layout.addWidget(cb)
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
setattr(w, '_textcomments', cb)
cb.setChecked(c.get('textcomments', False))
w._layout.addWidget(cb)
if self.has_html_comments:
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
setattr(w, '_textcomments', cb)
cb.setChecked(c.get('textcomments', False))
w._layout.addWidget(cb)
return w
def save_settings(self, w):
dl_settings = {}
for x in ('rating', 'tags', 'comments', 'textcomments'):
for x in ('rating', 'tags', 'comments'):
dl_settings[x] = getattr(w, '_'+x).isChecked()
if self.has_html_comments:
dl_settings['textcomments'] = getattr(w, '_textcomments').isChecked()
c = self.config_store()
c.set(self.name, dl_settings)
if hasattr(w, '_sc'):