本文整理汇总了Python中PyQt5.Qt.QSpinBox.setMaximum方法的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox.setMaximum方法的具体用法?Python QSpinBox.setMaximum怎么用?Python QSpinBox.setMaximum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QSpinBox
的用法示例。
在下文中一共展示了QSpinBox.setMaximum方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createEditor
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [as 别名]
def createEditor(self, parent, option, index):
sb = QSpinBox(parent)
sb.setMinimum(0)
sb.setMaximum(5)
sb.setSuffix(' ' + _('stars'))
sb.setSpecialValueText(_('Not rated'))
return sb
示例2: BulkSeries
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [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(_('Remove series'))
layout.addWidget(self.remove_series)
self.idx_widget = QCheckBox(parent)
self.idx_widget.setText(_('Automatically number books'))
layout.addWidget(self.idx_widget)
self.force_number = QCheckBox(parent)
self.force_number.setText(_('Force numbers to start with '))
layout.addWidget(self.force_number)
self.series_start_number = QSpinBox(parent)
self.series_start_number.setMinimum(1)
self.series_start_number.setMaximum(9999999)
self.series_start_number.setProperty("value", 1)
layout.addWidget(self.series_start_number)
layout.addItem(QSpacerItem(20, 10, QSizePolicy.Expanding, QSizePolicy.Minimum))
self.widgets.append(w)
self.idx_widget.stateChanged.connect(self.check_changed_checkbox)
self.force_number.stateChanged.connect(self.check_changed_checkbox)
self.series_start_number.valueChanged.connect(self.check_changed_checkbox)
self.remove_series.stateChanged.connect(self.check_changed_checkbox)
self.ignore_change_signals = False
def check_changed_checkbox(self):
self.a_c_checkbox.setChecked(True)
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('')
self.a_c_checkbox.setChecked(False)
def getter(self):
n = unicode(self.main_widget.currentText()).strip()
i = self.idx_widget.checkState()
f = self.force_number.checkState()
s = self.series_start_number.value()
r = self.remove_series.checkState()
return n, i, f, s, r
def commit(self, book_ids, notify=False):
if not self.a_c_checkbox.isChecked():
return
val, update_indices, force_start, at_value, clear = self.gui_val
val = None if clear else self.normalize_ui_val(val)
if clear or val != '':
extras = []
for book_id in book_ids:
if clear:
extras.append(None)
continue
if update_indices:
if force_start:
s_index = at_value
at_value += 1
elif tweaks['series_index_auto_increment'] != 'const':
s_index = self.db.get_next_cc_series_num_for(val, num=self.col_id)
else:
s_index = 1.0
else:
s_index = self.db.get_custom_extra(book_id, num=self.col_id,
index_is_id=True)
extras.append(s_index)
self.db.set_custom_bulk(book_ids, val, extras=extras,
num=self.col_id, notify=notify)
示例3: createEditor
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [as 别名]
def createEditor(self, parent, option, index):
sb = QSpinBox(parent)
sb.setMinimum(0)
sb.setMaximum(5)
sb.setSuffix(' ' + _('stars'))
return sb
示例4: create_sz
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [as 别名]
def create_sz(label):
ans = QSpinBox(self)
ans.setSuffix(' px'), ans.setMinimum(100), ans.setMaximum(10000)
l.addRow(label, ans)
ans.valueChanged.connect(self.changed_timer.start)
return ans
示例5: __init__
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [as 别名]
#.........这里部分代码省略.........
sp.la = la = QLabel('<p>' + msg)
la.setWordWrap(True)
l.addWidget(la)
self.styles_list = sl = QListWidget(sp)
l.addWidget(sl)
self.style_map = OrderedDict()
self.font_page = fp = QWidget(st)
st.addTab(fp, _('&Fonts and Sizes'))
fp.l = l = QFormLayout()
fp.setLayout(l)
fp.f = []
def add_hline():
f = QFrame()
fp.f.append(f)
f.setFrameShape(f.HLine)
l.addRow(f)
for x, label, size_label in (
('title', _('&Title font family:'), _('&Title font size:')),
('subtitle', _('&Subtitle font family'),
_('&Subtitle font size:')),
('footer', _('&Footer font family'), _('&Footer font size')),
):
attr = '%s_font_family' % x
ff = FontFamilyChooser(fp)
setattr(self, attr, ff)
l.addRow(label, ff)
ff.family_changed.connect(self.emit_changed)
attr = '%s_font_size' % x
fs = QSpinBox(fp)
setattr(self, attr, fs)
fs.setMinimum(8), fs.setMaximum(200), fs.setSuffix(' px')
fs.setValue(prefs[attr])
fs.valueChanged.connect(self.emit_changed)
l.addRow(size_label, fs)
add_hline()
self.changed_timer = t = QTimer(self)
t.setSingleShot(True), t.setInterval(500), t.timeout.connect(
self.emit_changed)
def create_sz(label):
ans = QSpinBox(self)
ans.setSuffix(' px'), ans.setMinimum(100), ans.setMaximum(10000)
l.addRow(label, ans)
ans.valueChanged.connect(self.changed_timer.start)
return ans
self.cover_width = create_sz(_('Cover &width:'))
self.cover_height = create_sz(_('Cover &height:'))
fp.cla = la = QLabel(
_('Note that the preview to the side is of fixed aspect ratio, so changing the cover'
' width above will not have any effect. If you change the height, you should also change the width nevertheless'
' as it will be used in actual cover generation.'))
la.setWordWrap(True)
l.addRow(la)
self.templates_page = tp = QWidget(st)
st.addTab(tp, _('&Text'))
tp.l = l = QVBoxLayout()
tp.setLayout(l)
tp.la = la = QLabel(
_('The text on the generated cover is taken from the metadata of the book.'
' This is controlled via templates. You can use the <b>, <i> and <br> tags'
' in the templates for bold, italic and line breaks, respectively. The'
示例6: ConfigWidget
# 需要导入模块: from PyQt5.Qt import QSpinBox [as 别名]
# 或者: from PyQt5.Qt.QSpinBox import setMaximum [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()