Cleaner handle of html_comments ie make the option appears only if it is needed

This commit is contained in:
Sengian 2010-11-21 20:16:55 +01:00
parent 9f34a0c270
commit ded56f11dd

View File

@ -145,18 +145,21 @@ class MetadataSource(Plugin): # {{{
setattr(w, '_'+x, cb) setattr(w, '_'+x, cb)
cb.setChecked(c.get(x, True)) cb.setChecked(c.get(x, True))
w._layout.addWidget(cb) w._layout.addWidget(cb)
cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name)) if self.has_html_comments:
setattr(w, '_textcomments', cb) cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name))
cb.setChecked(c.get('textcomments', False)) setattr(w, '_textcomments', cb)
w._layout.addWidget(cb) cb.setChecked(c.get('textcomments', False))
w._layout.addWidget(cb)
return w return w
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'):