本文整理汇总了Python中PyQt5.Qt.QSpinBox.setSingleStep方法的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox.setSingleStep方法的具体用法?Python QSpinBox.setSingleStep怎么用?Python QSpinBox.setSingleStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QSpinBox
的用法示例。
在下文中一共展示了QSpinBox.setSingleStep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigWidget
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setSingleStep [as 别名]
class ConfigWidget(QWidget):
"""Configuration widget for managing calibre-comicvine config."""
def __init__(self):
QWidget.__init__(self)
self.layout = QGridLayout()
self.layout.setSpacing(10)
self.setLayout(self.layout)
self.index = 0
self.api_key = QLineEdit(self)
self.api_key.setText(PREFS['api_key'])
self.add_labeled_widget('&API key:', self.api_key)
# Worker threads is the maximum number of worker threads to spawn.
# Restricted to 1+
self.worker_threads = QSpinBox(self)
self.worker_threads.setMinimum(1)
self.worker_threads.setValue(PREFS['worker_threads'])
self.add_labeled_widget('&Worker threads:', self.worker_threads)
# Request interval represents wait time between batches of requests.
self.request_interval = QSpinBox(self)
self.request_interval.setMinimum(0)
self.request_interval.setValue(PREFS['request_interval'])
self.add_labeled_widget('&Request interval (seconds):',
self.request_interval)
# Request batch is the maximum number of requests to run at a time.
# Restricted to 1+
self.request_batch_size = QSpinBox(self)
self.request_batch_size.setMinimum(1)
self.request_batch_size.setValue(PREFS['request_batch_size'])
self.add_labeled_widget('&Request batch size:', self.request_batch_size)
# Retries is the number of times to retry if we get any error
# from comicvine besides a rate limit error.
self.retries = QSpinBox(self)
self.retries.setMinimum(0)
self.retries.setValue(PREFS['retries'])
self.add_labeled_widget('&Retries:', self.retries)
# Search volume limit is the max number of volumes to return from
# a volume search.
self.search_volume_limit = QSpinBox(self)
self.search_volume_limit.setMinimum(10)
self.search_volume_limit.setMaximum(10000)
self.search_volume_limit.setSingleStep(10)
self.search_volume_limit.setValue(PREFS['search_volume_limit'])
self.add_labeled_widget('&search_volume_limit:',
self.search_volume_limit)
def add_labeled_widget(self, label_text, widget):
"""
Add a configuration widget, incrementing the index for the next widget.
"""
self.index += 1
label = QLabel(label_text)
label.setBuddy(widget)
self.layout.addWidget(label, self.index, 0)
self.layout.addWidget(widget, self.index, 1)
def save_settings(self):
"""Apply new settings value."""
PREFS['api_key'] = unicode(self.api_key.text())
PREFS['worker_threads'] = self.worker_threads.value()
PREFS['request_interval'] = self.request_interval.value()
PREFS['request_batch_size'] = self.request_batch_size.value()
PREFS['retries'] = self.retries.value()
PREFS['search_volume_limit'] = self.search_volume_limit.value()