1
# -*- coding: utf-8 -*-
4
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
5
__docformat__ = 'restructuredtext en'
7
from calibre.gui2.convert.txt_output_ui import Ui_Form
8
from calibre.gui2.convert import Widget
9
from calibre.ebooks.txt.writer import TxtNewlines
10
from calibre.gui2.widgets import BasicComboModel
14
class PluginWidget(Widget, Ui_Form):
16
TITLE = _('TXT Output')
17
HELP = _('Options specific to')+' TXT '+_('output')
19
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
20
Widget.__init__(self, parent, 'txt_output', ['newline'])
21
self.db, self.book_id = db, book_id
22
self.initialize_options(get_option, get_help, db, book_id)
24
default = self.opt_newline.currentText()
27
if newline_model is None:
28
newline_model = BasicComboModel(TxtNewlines.NEWLINE_TYPES.keys())
29
self.newline_model = newline_model
30
self.opt_newline.setModel(self.newline_model)
32
default_index = self.opt_newline.findText(default)
33
system_index = self.opt_newline.findText('system')
34
self.opt_newline.setCurrentIndex(default_index if default_index != -1 else system_index if system_index != -1 else 0)