From 2822ddfd5f748b3edc598e60ee75100c07fcc6a1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 13 Aug 2013 20:53:53 +0530 Subject: [PATCH] Handle both space and comma separated font size keys --- src/calibre/gui2/convert/font_key.py | 2 +- src/calibre/gui2/convert/look_and_feel.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/convert/font_key.py b/src/calibre/gui2/convert/font_key.py index 39eb58dd48..2d8b883abd 100644 --- a/src/calibre/gui2/convert/font_key.py +++ b/src/calibre/gui2/convert/font_key.py @@ -64,7 +64,7 @@ class FontKeyChooser(QDialog, Ui_Dialog): @property def fsizes(self): key = unicode(self.font_size_key.text()).strip() - return [float(x.strip()) for x in key.split(',') if x.strip()] + return [float(x.strip()) for x in key.split(',' if ',' in key else ' ') if x.strip()] @property def dbase(self): diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index a3e364b9ca..ba101a8c0a 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -76,6 +76,10 @@ class LookAndFeelWidget(Widget, Ui_Form): ans = ans.union(set([x.strip().lower() for x in unicode(self.filter_css_others.text()).split(',')])) return ','.join(ans) if ans else None + if g is self.opt_font_size_mapping: + val = unicode(g.text()).strip() + val = [x.strip() for x in val.split(',' if ',' in val else ' ') if x.strip()] + return ', '.join(val) or None return Widget.get_value_handler(self, g) def set_value_handler(self, g, val): @@ -87,7 +91,8 @@ class LookAndFeelWidget(Widget, Ui_Form): break return True if g is self.opt_filter_css: - if not val: val = '' + if not val: + val = '' items = frozenset([x.strip().lower() for x in val.split(',')]) for key, vals in self.FILTER_CSS.iteritems(): w = getattr(self, 'filter_css_%s'%key)