def __init__(self, parent): QWidget.__init__(self, parent) self.default_template = default_custom_list_template() self.l = l = QFormLayout(self) l.setFieldGrowthPolicy(l.AllNonFixedFieldsGrow) self.la = la = QLabel('<p>' + _( 'Here you can create a template to control what data is shown when' ' using the <i>Custom list</i> mode for the book list')) la.setWordWrap(True) l.addRow(la) self.thumbnail = t = QCheckBox(_('Show a cover &thumbnail')) self.thumbnail_height = th = QSpinBox(self) th.setSuffix(' px'), th.setRange(60, 600) self.entry_height = eh = QLineEdit(self) l.addRow(t), l.addRow(_('Thumbnail &height:'), th) l.addRow(_('Entry &height:'), eh) t.stateChanged.connect(self.changed_signal) th.valueChanged.connect(self.changed_signal) eh.textChanged.connect(self.changed_signal) eh.setToolTip( textwrap.fill( _('The height for each entry. The special value "auto" causes a height to be calculated' ' based on the number of lines in the template. Otherwise, use a CSS length, such as' ' 100px or 15ex'))) t.stateChanged.connect(self.thumbnail_state_changed) th.setVisible(False) self.comments_fields = cf = QLineEdit(self) l.addRow(_('&Long text fields:'), cf) cf.setToolTip( textwrap.fill( _('A comma separated list of fields that will be added at the bottom of every entry.' ' These fields are interpreted as containing HTML, not plain text.' ))) cf.textChanged.connect(self.changed_signal) self.la1 = la = QLabel('<p>' + _( 'The template below will be interpreted as HTML and all {{fields}} will be replaced' ' by the actual metadata, if available. For custom columns use the column lookup' ' name, for example: #mytags. You can use {0} as a separator' ' to split a line into multiple columns.').format('|||')) la.setWordWrap(True) l.addRow(la) self.template = t = QPlainTextEdit(self) l.addRow(t) t.textChanged.connect(self.changed_signal) self.imex = bb = QDialogButtonBox(self) b = bb.addButton(_('&Import template'), bb.ActionRole) b.clicked.connect(self.import_template) b = bb.addButton(_('E&xport template'), bb.ActionRole) b.clicked.connect(self.export_template) l.addRow(bb)
def __init__(self, parent): QWidget.__init__(self, parent) self.default_template = default_custom_list_template() self.l = l = QFormLayout(self) l.setFieldGrowthPolicy(l.AllNonFixedFieldsGrow) self.la = la = QLabel('<p>' + _( 'Here you can create a template to control what data is shown when' ' using the <i>Custom list</i> mode for the book list')) la.setWordWrap(True) l.addRow(la) self.thumbnail = t = QCheckBox(_('Show a cover &thumbnail')) self.thumbnail_height = th = QSpinBox(self) th.setSuffix(' px'), th.setRange(60, 600) self.entry_height = eh = QLineEdit(self) l.addRow(t), l.addRow(_('Thumbnail &height:'), th) l.addRow(_('Entry &height:'), eh) t.stateChanged.connect(self.changed_signal) th.valueChanged.connect(self.changed_signal) eh.textChanged.connect(self.changed_signal) eh.setToolTip(textwrap.fill(_( 'The height for each entry. The special value "auto" causes a height to be calculated' ' based on the number of lines in the template. Otherwise, use a CSS length, such as' ' 100px or 15ex'))) t.stateChanged.connect(self.thumbnail_state_changed) th.setVisible(False) self.comments_fields = cf = QLineEdit(self) l.addRow(_('&Long text fields:'), cf) cf.setToolTip(textwrap.fill(_( 'A comma separated list of fields that will be added at the bottom of every entry.' ' These fields are interpreted as containing HTML, not plain text.'))) cf.textChanged.connect(self.changed_signal) self.la1 = la = QLabel('<p>' + _( 'The template below will be interpreted as HTML and all {{fields}} will be replaced' ' by the actual metadata, if available. For custom columns use the column lookup' ' name, for example: #mytags. You can use {0} as a separator' ' to split a line into multiple columns.').format('|||')) la.setWordWrap(True) l.addRow(la) self.template = t = QPlainTextEdit(self) l.addRow(t) t.textChanged.connect(self.changed_signal) self.imex = bb = QDialogButtonBox(self) b = bb.addButton(_('&Import template'), bb.ActionRole) b.clicked.connect(self.import_template) b = bb.addButton(_('E&xport template'), bb.ActionRole) b.clicked.connect(self.export_template) l.addRow(bb)