mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
6bc8bf81e4
@ -532,7 +532,7 @@ OptionRecommendation(name='format_scene_breaks',
|
||||
'horizontal rules.')),
|
||||
|
||||
OptionRecommendation(name='replace_scene_breaks',
|
||||
recommended_value=None, level=OptionRecommendation.LOW,
|
||||
recommended_value='', level=OptionRecommendation.LOW,
|
||||
help=_('Replace scene breaks with the specified text. By default, the '
|
||||
'text from the input document is used.')),
|
||||
|
||||
|
@ -218,7 +218,7 @@ class TXTMLizer(object):
|
||||
|
||||
if tag in SPACE_TAGS:
|
||||
text.append(u' ')
|
||||
|
||||
|
||||
# Scene breaks.
|
||||
if tag == 'hr':
|
||||
text.append('\n\n* * *\n\n')
|
||||
|
@ -27,7 +27,8 @@ class HeuristicsWidget(Widget, Ui_Form):
|
||||
'dehyphenate', 'renumber_headings']
|
||||
)
|
||||
self.db, self.book_id = db, book_id
|
||||
self.rssb_defaults = ['', '<hr />', '* * *']
|
||||
self.rssb_defaults = [u'', u'<hr />', u'* * *', u'• • •', u'✦ ✦ ✦',
|
||||
u'✮ ✮ ✮', u'☆ ☆ ☆', u'❂ ❂ ❂', u'✣ ✣ ✣', u'❖ ❖ ❖', u'☼ ☼ ☼', u'✠ ✠ ✠']
|
||||
self.initialize_options(get_option, get_help, db, book_id)
|
||||
|
||||
self.load_histories()
|
||||
@ -39,16 +40,18 @@ class HeuristicsWidget(Widget, Ui_Form):
|
||||
|
||||
def restore_defaults(self, get_option):
|
||||
Widget.restore_defaults(self, get_option)
|
||||
|
||||
|
||||
self.save_histories()
|
||||
rssb_hist = gprefs['replace_scene_breaks_history']
|
||||
for x in self.rssb_defaults:
|
||||
if x in rssb_hist:
|
||||
del rssb_hist[rssb_hist.index(x)]
|
||||
gprefs['replace_scene_breaks_history'] = self.rssb_defaults + gprefs['replace_scene_breaks_history']
|
||||
self.load_histories()
|
||||
|
||||
def commit_options(self, save_defaults=False):
|
||||
self.save_histories()
|
||||
|
||||
|
||||
return Widget.commit_options(self, save_defaults)
|
||||
|
||||
def break_cycles(self):
|
||||
@ -69,6 +72,9 @@ class HeuristicsWidget(Widget, Ui_Form):
|
||||
return True
|
||||
|
||||
def load_histories(self):
|
||||
self.opt_replace_scene_breaks.clear()
|
||||
self.opt_replace_scene_breaks.lineEdit().setText('')
|
||||
|
||||
val = unicode(self.opt_replace_scene_breaks.currentText())
|
||||
rssb_hist = gprefs.get('replace_scene_breaks_history', self.rssb_defaults)
|
||||
if val in rssb_hist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user