本文整理汇总了Python中PyQt5.Qt.QDoubleSpinBox.value方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.value方法的具体用法?Python QDoubleSpinBox.value怎么用?Python QDoubleSpinBox.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EveryXDays
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import value [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
示例2: BulkSeries
# 需要导入模块: from PyQt5.Qt import QDoubleSpinBox [as 别名]
# 或者: from PyQt5.Qt.QDoubleSpinBox import value [as 别名]
class BulkSeries(BulkBase):
def setup_ui(self, parent):
self.make_widgets(parent, EditWithComplete)
values = self.all_values = list(self.db.all_custom(num=self.col_id))
values.sort(key=sort_key)
self.main_widget.setSizeAdjustPolicy(self.main_widget.AdjustToMinimumContentsLengthWithIcon)
self.main_widget.setMinimumContentsLength(25)
self.widgets.append(QLabel('', parent))
w = QWidget(parent)
layout = QHBoxLayout(w)
layout.setContentsMargins(0, 0, 0, 0)
self.remove_series = QCheckBox(parent)
self.remove_series.setText(_('Clear series'))
layout.addWidget(self.remove_series)
self.idx_widget = QCheckBox(parent)
self.idx_widget.setText(_('Automatically number books'))
self.idx_widget.setToolTip('<p>' + _(
'If not checked, the series number for the books will be set to 1. '
'If checked, selected books will be automatically numbered, '
'in the order you selected them. So if you selected '
'Book A and then Book B, Book A will have series number 1 '
'and Book B series number 2.') + '</p>')
layout.addWidget(self.idx_widget)
self.force_number = QCheckBox(parent)
self.force_number.setText(_('Force numbers to start with '))
self.force_number.setToolTip('<p>' + _(
'Series will normally be renumbered from the highest '
'number in the database for that series. Checking this '
'box will tell calibre to start numbering from the value '
'in the box') + '</p>')
layout.addWidget(self.force_number)
self.series_start_number = QDoubleSpinBox(parent)
self.series_start_number.setMinimum(0.0)
self.series_start_number.setMaximum(9999999.0)
self.series_start_number.setProperty("value", 1.0)
layout.addWidget(self.series_start_number)
self.series_increment = QDoubleSpinBox(parent)
self.series_increment.setMinimum(0.00)
self.series_increment.setMaximum(99999.0)
self.series_increment.setProperty("value", 1.0)
self.series_increment.setToolTip('<p>' + _(
'The amount by which to increment the series number '
'for successive books. Only applicable when using '
'force series numbers.') + '</p>')
self.series_increment.setPrefix('+')
layout.addWidget(self.series_increment)
layout.addItem(QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
self.widgets.append(w)
self.idx_widget.stateChanged.connect(self.a_c_checkbox_changed)
self.force_number.stateChanged.connect(self.a_c_checkbox_changed)
self.series_start_number.valueChanged.connect(self.a_c_checkbox_changed)
self.series_increment.valueChanged.connect(self.a_c_checkbox_changed)
self.remove_series.stateChanged.connect(self.a_c_checkbox_changed)
self.main_widget
self.ignore_change_signals = False
def a_c_checkbox_changed(self):
def disable_numbering_checkboxes(idx_widget_enable):
if idx_widget_enable:
self.idx_widget.setEnabled(True)
else:
self.idx_widget.setChecked(False)
self.idx_widget.setEnabled(False)
self.force_number.setChecked(False)
self.force_number.setEnabled(False)
self.series_start_number.setEnabled(False)
self.series_increment.setEnabled(False)
if self.ignore_change_signals:
return
self.ignore_change_signals = True
apply_changes = False
if self.remove_series.isChecked():
self.main_widget.setText('')
self.main_widget.setEnabled(False)
disable_numbering_checkboxes(idx_widget_enable=False)
apply_changes = True
elif self.main_widget.text():
self.remove_series.setEnabled(False)
self.idx_widget.setEnabled(True)
apply_changes = True
else: # no text, no clear. Basically reinitialize
self.main_widget.setEnabled(True)
self.remove_series.setEnabled(True)
disable_numbering_checkboxes(idx_widget_enable=False)
apply_changes = False
self.force_number.setEnabled(self.idx_widget.isChecked())
self.series_start_number.setEnabled(self.force_number.isChecked())
self.series_increment.setEnabled(self.force_number.isChecked())
self.ignore_change_signals = False
self.a_c_checkbox.setChecked(apply_changes)
def initialize(self, book_id):
self.idx_widget.setChecked(False)
self.main_widget.set_separator(None)
self.main_widget.update_items_cache(self.all_values)
self.main_widget.setEditText('')
#.........这里部分代码省略.........