diff --git a/src/calibre/gui2/dialogs/comicconf.py b/src/calibre/gui2/dialogs/comicconf.py deleted file mode 100644 index 2bffd4a4c7..0000000000 --- a/src/calibre/gui2/dialogs/comicconf.py +++ /dev/null @@ -1,91 +0,0 @@ -from __future__ import with_statement -__license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net' -__docformat__ = 'restructuredtext en' - -'''''' -from PyQt5.Qt import QDialog -from calibre.gui2.dialogs.comicconf_ui import Ui_Dialog -from calibre.ebooks.lrf.comic.convert_from import config, PROFILES -from polyglot.builtins import unicode_type - - -def set_conversion_defaults(window): - d = ComicConf(window) - d.exec_() - - -def get_bulk_conversion_options(window): - d = ComicConf(window, config_defaults=config(None).as_string()) - if d.exec_() == QDialog.Accepted: - return d.config.parse() - - -def get_conversion_options(window, defaults, title, author): - if defaults is None: - defaults = config(None).as_string() - defaults += '\ntitle=%s\nauthor=%s'%(repr(title), repr(author)) - d = ComicConf(window, config_defaults=defaults, generic=False) - if d.exec_() == QDialog.Accepted: - return d.config.parse(), d.config.src - return None, None - - -class ComicConf(QDialog, Ui_Dialog): - - def __init__(self, window, config_defaults=None, generic=True, - title=_('Set defaults for conversion of comics (CBR/CBZ files)')): - QDialog.__init__(self, window) - Ui_Dialog.__init__(self) - self.setupUi(self) - self.setWindowTitle(title) - self.config = config(config_defaults) - opts = self.config.parse() - if generic: - for i in ('title', 'author'): - getattr(self, 'opt_'+i).setVisible(False) - getattr(self, i+'_label').setVisible(False) - else: - title = opts.title - if not title: - title = _('Unknown') - self.setWindowTitle(_('Set options for converting %s')%title) - author = opts.author - self.opt_title.setText(title) - self.opt_author.setText(author) - self.opt_colors.setValue(opts.colors) - self.opt_profile.addItem(opts.profile) - for x in PROFILES.keys(): - if x != opts.profile: - self.opt_profile.addItem(x) - self.opt_dont_normalize.setChecked(opts.dont_normalize) - self.opt_keep_aspect_ratio.setChecked(opts.keep_aspect_ratio) - self.opt_dont_sharpen.setChecked(opts.dont_sharpen) - self.opt_landscape.setChecked(opts.landscape) - self.opt_no_sort.setChecked(opts.no_sort) - self.opt_despeckle.setChecked(opts.despeckle) - self.opt_wide.setChecked(opts.wide) - self.opt_right2left.setChecked(opts.right2left) - - for opt in self.config.option_set.preferences: - g = getattr(self, 'opt_'+opt.name, False) - if opt.help and g: - g.setToolTip(opt.help) - - def accept(self): - for opt in self.config.option_set.preferences: - g = getattr(self, 'opt_'+opt.name, False) - if not g or not g.isVisible(): - continue - if hasattr(g, 'isChecked'): - val = bool(g.isChecked()) - elif hasattr(g, 'value'): - val = g.value() - elif hasattr(g, 'itemText'): - val = unicode_type(g.itemText(g.currentIndex())) - elif hasattr(g, 'text'): - val = unicode_type(g.text()) - else: - raise Exception('Bad coding') - self.config.set(opt.name, val) - return QDialog.accept(self) diff --git a/src/calibre/gui2/dialogs/comicconf.ui b/src/calibre/gui2/dialogs/comicconf.ui deleted file mode 100644 index 309ff84945..0000000000 --- a/src/calibre/gui2/dialogs/comicconf.ui +++ /dev/null @@ -1,202 +0,0 @@ - - - Dialog - - - - 0 - 0 - 646 - 503 - - - - Dialog - - - - :/images/convert.png:/images/convert.png - - - - - - &Title: - - - opt_title - - - - - - - - - - &Author(s): - - - opt_author - - - - - - - - - - &Number of colors: - - - opt_colors - - - - - - - 8 - - - 3200000 - - - 8 - - - - - - - &Profile: - - - opt_profile - - - - - - - - - - Disable &normalize - - - - - - - Keep &aspect ratio - - - - - - - Disable &sharpening - - - - - - - &Landscape - - - - - - - Don't so&rt - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - &Right to left - - - - - - - De&speckle - - - - - - - &Wide - - - - - - - Disable &trimming - - - - - - - - EnLineEdit - QLineEdit -
calibre/gui2/widgets.h
-
-
- - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/src/calibre/utils/config_base.py b/src/calibre/utils/config_base.py index 5ef1ef5f98..4362e741cc 100644 --- a/src/calibre/utils/config_base.py +++ b/src/calibre/utils/config_base.py @@ -288,12 +288,6 @@ class Config(ConfigInterface): traceback.print_exc() return self.option_set.parse_string(src) - def as_string(self): - if not os.path.exists(self.config_file_path): - return '' - with ExclusiveFile(self.config_file_path) as f: - return f.read().decode('utf-8') - def set(self, name, val): if not self.option_set.has_option(name): raise ValueError('The option %s is not defined.'%name)