本文整理汇总了Python中PyQt5.Qt.QDoubleSpinBox.setSuffix方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.setSuffix方法的具体用法?Python QDoubleSpinBox.setSuffix怎么用?Python QDoubleSpinBox.setSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.setSuffix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_ui
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import setSuffix [as 别名]
def setup_ui(self):
self.l = l = QFormLayout(self)
l.addRow(QLabel(_('Print %s to a PDF file') % elided_text(self.book_title)))
self.h = h = QHBoxLayout()
self.file_name = f = QLineEdit(self)
val = dynamic.get(self.OUTPUT_NAME, None)
if not val:
val = expanduser('~')
else:
val = os.path.dirname(val)
f.setText(os.path.abspath(os.path.join(val, self.default_file_name)))
self.browse_button = b = QToolButton(self)
b.setIcon(QIcon(I('document_open.png'))), b.setToolTip(_('Choose location for PDF file'))
b.clicked.connect(self.choose_file)
h.addWidget(f), h.addWidget(b)
f.setMinimumWidth(350)
w = QLabel(_('&File:'))
l.addRow(w, h), w.setBuddy(f)
self.paper_size = ps = QComboBox(self)
ps.addItems([a.upper() for a in sorted(self.paper_size_map, key=numeric_sort_key)])
previous_size = vprefs.get('print-to-pdf-page-size', None)
if previous_size not in self.paper_size_map:
previous_size = (QPrinter().pageLayout().pageSize().name() or '').lower()
if previous_size not in self.paper_size_map:
previous_size = 'a4'
ps.setCurrentIndex(ps.findText(previous_size.upper()))
l.addRow(_('Paper &size:'), ps)
tmap = {
'left':_('&Left margin:'),
'top':_('&Top margin:'),
'right':_('&Right margin:'),
'bottom':_('&Bottom margin:'),
}
for edge in 'left top right bottom'.split():
m = QDoubleSpinBox(self)
m.setSuffix(' ' + _('inches'))
m.setMinimum(0), m.setMaximum(3), m.setSingleStep(0.1)
val = vprefs.get('print-to-pdf-%s-margin' % edge, 1)
m.setValue(val)
setattr(self, '%s_margin' % edge, m)
l.addRow(tmap[edge], m)
self.pnum = pnum = QCheckBox(_('Add page &number to printed pages'), self)
pnum.setChecked(vprefs.get('print-to-pdf-page-numbers', True))
l.addRow(pnum)
self.show_file = sf = QCheckBox(_('Open PDF file after printing'), self)
sf.setChecked(vprefs.get('print-to-pdf-show-file', True))
l.addRow(sf)
l.addRow(self.bb)
示例2: EveryXDays
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import setSuffix [as 别名]
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
示例3: setupUi
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import setSuffix [as 别名]
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.Fixed, QSizePolicy.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)
示例4: margin
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import setSuffix [as 别名]
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
示例5: SliderWidget
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import setSuffix [as 别名]
class SliderWidget(QDialog):
'''
class SliderWidget
'''
valueChanged = QtCore.pyqtSignal(float)
def __init__(self, title, parent = None):
super(SliderWidget, self).__init__(parent, Qt.FramelessWindowHint)
self._mousePressed = False
self._orgPos = QPoint(0, 0)
self.setObjectName('SliderWidget')
self.resize(500, 150)
#
self.stylize()
# main layout
labelTitle = QLabel(title, self)
buttonClose = JCloseButton(self)
buttonClose.setObjectName('buttonClose')
buttonClose.setToolTip('关闭')
horiLayoutTitle = QHBoxLayout()
horiLayoutTitle.setContentsMargins(6, 0, 6, 6)
horiLayoutTitle.addWidget(labelTitle, 0, Qt.AlignTop)
horiLayoutTitle.addStretch()
horiLayoutTitle.addWidget(buttonClose, 0, Qt.AlignTop)
self.doubleSpinBox = QDoubleSpinBox(self)
self.doubleSpinBox.setObjectName('doubleSpinBox')
self.doubleSpinBox.setMinimumWidth(200)
self.doubleSpinBox.setRange(0, 6000)
self.doubleSpinBox.setDecimals(2)
self.doubleSpinBox.setSingleStep(0.01)
self.slider = QSlider(Qt.Horizontal, self)
self.slider.setObjectName('slider')
self.slider.setRange(self.doubleSpinBox.minimum(),
self.doubleSpinBox.maximum())
vertLayoutMain = QVBoxLayout(self)
vertLayoutMain.addLayout(horiLayoutTitle)
vertLayoutMain.addWidget(self.doubleSpinBox, 0, Qt.AlignHCenter)
vertLayoutMain.addSpacing(5)
vertLayoutMain.addWidget(self.slider)
self.slider.rangeChanged.connect(self.doubleSpinBox.setRange)
self.doubleSpinBox.valueChanged.connect(self.doubleSpinBoxValueChanged)
self.slider.valueChanged.connect(self.setValue)
buttonClose.clicked.connect(self.close)
def setRange(self, minValue, maxValue):
self.slider.setRange(minValue, maxValue)
def setDecimals(self, prec):
self.doubleSpinBox.setDecimals(prec)
def setSingleStep(self, value):
self.doubleSpinBox.setSingleStep(value)
def setPrefix(self, prefix):
self.doubleSpinBox.setPrefix(prefix)
def setSuffix(self, suffix):
self.doubleSpinBox.setSuffix(suffix)
def doubleSpinBoxValueChanged(self, value):
self.slider.setValue(value)
self.valueChanged.emit(value)
@QtCore.pyqtSlot(float)
def setValue(self, value):
self.doubleSpinBox.setValue(value)
@QtCore.pyqtSlot()
def stylize(self):
styles.stylize(self)
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
self._mousePressed = True
self._orgPos = event.pos()
self.setCursor(Qt.ClosedHandCursor)
def mouseMoveEvent(self, event):
if self._mousePressed:
curPos = event.pos()
curGeom = self.geometry()
self.move(curGeom.topLeft() + curPos - self._orgPos)
def mouseReleaseEvent(self, event):
self._mousePressed = False
self.setCursor(Qt.ArrowCursor)