def setupUi(self, *a): self.l = l = QFormLayout(self) self.opt_docx_page_size = QComboBox(self) l.addRow(_('Paper si&ze:'), self.opt_docx_page_size) self.opt_docx_custom_page_size = w = QLineEdit(self) w.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) l.addRow(_('&Custom size:'), w) for i, text in enumerate( (_('Page &left margin'), _('Page &top margin'), _('Page &right margin'), _('Page &bottom margin'))): m = 'left top right bottom'.split()[i] w = QDoubleSpinBox(self) w.setRange(-100, 500), w.setSuffix(' pt'), w.setDecimals(1) setattr(self, 'opt_docx_page_margin_' + m, w) l.addRow(text + ':', w) self.opt_docx_no_toc = QCheckBox( _('Do not insert the &Table of Contents as a page at the start of the document' )) l.addRow(self.opt_docx_no_toc) self.opt_docx_no_cover = QCheckBox( _('Do not insert &cover as image at start of document')) l.addRow(self.opt_docx_no_cover) self.opt_preserve_cover_aspect_ratio = QCheckBox( _('Preserve the aspect ratio of the image inserted as cover')) l.addRow(self.opt_preserve_cover_aspect_ratio)
class EveryXDays(Base): HELP = _('''\ Download this periodical every x days. For example, if you choose 30 days, the periodical will be downloaded every 30 days. Note that you can set periods of less than a day, like 0.1 days to download a periodical more than once a day. ''') def __init__(self, parent=None): Base.__init__(self, parent) self.l1 = QLabel(_('&Download every:')) self.interval = QDoubleSpinBox(self) self.interval.setMinimum(0.04) self.interval.setSpecialValueText(_('every hour')) self.interval.setMaximum(1000.0) self.interval.setValue(31.0) self.interval.setSuffix(' ' + _('days')) self.interval.setSingleStep(1.0) self.interval.setDecimals(2) self.l1.setBuddy(self.interval) self.l2 = QLabel( _('Note: You can set intervals of less than a day,' ' by typing the value manually.')) self.l2.setWordWrap(True) self.l.addWidget(self.l1, 0, 0, 1, 1) self.l.addWidget(self.interval, 0, 1, 1, 1) self.l.addWidget(self.l2, 1, 0, 1, -1) def initialize(self, typ=None, val=None): if val is None: val = 31.0 self.interval.setValue(val) @property def schedule(self): schedule = self.interval.value() return 'interval', schedule
def margin(which): w = QDoubleSpinBox(self) w.setRange(-100, 500), w.setSuffix(' pt'), w.setDecimals(1) setattr(self, 'opt_pdf_page_margin_' + which, w) return w