1# -*- coding: utf-8 -*- 2 3 4__license__ = 'GPL 3' 5__copyright__ = '2011, John Schember <john@nachtimwald.com>' 6__docformat__ = 'restructuredtext en' 7 8from qt.core import QWidget 9 10from calibre.gui2.store.basic_config_widget_ui import Ui_Form 11 12 13class BasicStoreConfigWidget(QWidget, Ui_Form): 14 15 def __init__(self, store): 16 QWidget.__init__(self) 17 self.setupUi(self) 18 19 self.store = store 20 21 self.load_setings() 22 23 def load_setings(self): 24 config = self.store.config 25 26 self.open_external.setChecked(config.get('open_external', False)) 27 self.tags.setText(config.get('tags', '')) 28 29 30class BasicStoreConfig: 31 32 def customization_help(self, gui=False): 33 return 'Customize the behavior of this store.' 34 35 def config_widget(self): 36 return BasicStoreConfigWidget(self) 37 38 def save_settings(self, config_widget): 39 self.config['open_external'] = config_widget.open_external.isChecked() 40 tags = str(config_widget.tags.text()) 41 self.config['tags'] = tags 42