def __init__(self, parent=None): QComboBox.__init__(self, parent) self.setEditable(True) self.setLineEdit(EnLineEdit(self)) for item in self.ENCODINGS: self.addItem(item)
def __init__(self, *args): QComboBox.__init__(self, *args) self.setEditable(True) self.setInsertPolicy(QComboBox.InsertPolicy.NoInsert) self.setMaxCount(10) self.setClearButtonEnabled = self.lineEdit().setClearButtonEnabled self.textChanged = self.editTextChanged
def __init__(self, parent=None, add_clear_action=True, as_url=None): QComboBox.__init__(self, parent) self.line_edit = SearchLineEdit(self) self.line_edit.as_url = as_url self.setLineEdit(self.line_edit) self.line_edit.clear_history.connect(self.clear_history) if add_clear_action: self.lineEdit().setClearButtonEnabled(True) ac = self.findChild(QAction, QT_HIDDEN_CLEAR_ACTION) if ac is not None: ac.triggered.connect(self.clear_clicked) c = self.line_edit.completer() c.setCompletionMode(QCompleter.CompletionMode.PopupCompletion) c.highlighted[native_string_type].connect(self.completer_used) self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.ConnectionType.DirectConnection) # QueuedConnection as workaround for https://bugreports.qt-project.org/browse/QTBUG-40807 self.activated[native_string_type].connect(self.history_selected, type=Qt.ConnectionType.QueuedConnection) self.setEditable(True) self.as_you_type = True self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.timer_event, type=Qt.ConnectionType.QueuedConnection) self.setInsertPolicy(QComboBox.InsertPolicy.NoInsert) self.setMaxCount(self.MAX_COUNT) self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon) self.setMinimumContentsLength(25) self._in_a_search = False self.tool_tip_text = self.toolTip()
def __init__(self, parent, emphasize=False): QComboBox.__init__(self) self.addItems([ _('Current file'), _('All text files'), _('Selected files'), _('Open files') ]) self.setToolTip('<style>dd {margin-bottom: 1.5ex}</style>' + _(''' Where to search/replace: <dl> <dt><b>Current file</b></dt> <dd>Search only inside the currently opened file</dd> <dt><b>All text files</b></dt> <dd>Search in all text (HTML) files</dd> <dt><b>Selected files</b></dt> <dd>Search in the files currently selected in the File browser</dd> <dt><b>Open files</b></dt> <dd>Search in the files currently open in the editor</dd> </dl>''')) self.emphasize = emphasize self.ofont = QFont(self.font()) if emphasize: f = self.emph_font = QFont(self.ofont) f.setBold(True), f.setItalic(True) self.setFont(f)
def __init__(self, name, layout): QComboBox.__init__(self) self.setEditable(False) opt = options[name] self.choices = opt.choices tuple(map(self.addItem, opt.choices)) self.currentIndexChanged.connect(self.changed_signal.emit) init_opt(self, opt, layout)
def __init__(self, parent): QComboBox.__init__(self, parent) items = [ _('All'), _('Installed'), _('Update available'), _('Not installed') ] self.addItems(items)
def __init__(self, parent): QComboBox.__init__(self, parent) self.addItems([_('Normal'), _('Regex')]) self.setToolTip('<style>dd {margin-bottom: 1.5ex}</style>' + _('''Select how the search expression is interpreted <dl> <dt><b>Normal</b></dt> <dd>The search expression is treated as normal text, calibre will look for the exact text.</dd> <dt><b>Regex</b></dt> <dd>The search expression is interpreted as a regular expression. See the User Manual for more help on using regular expressions.</dd> </dl>'''))
def __init__(self, parent=None, is_half_star=False): QComboBox.__init__(self, parent) self.addItem(_('Not rated')) if is_half_star: [self.addItem(stars(x, True)) for x in range(1, 11)] else: [self.addItem(stars(x)) for x in (2, 4, 6, 8, 10)] self.rating_font = QFont(rating_font()) self.undo_stack = QUndoStack(self) self.undo, self.redo = self.undo_stack.undo, self.undo_stack.redo self.allow_undo = False self.is_half_star = is_half_star self.delegate = RatingItemDelegate(self) self.view().setItemDelegate(self.delegate) self.view().setStyleSheet('QListView { background: palette(window) }\nQListView::item { padding: 6px }') self.setMaxVisibleItems(self.count()) self.currentIndexChanged.connect(self.update_font)
def __init__(self, parent=None): QComboBox.__init__(self, parent) self.line_edit = SearchLineEdit(self) self.setLineEdit(self.line_edit) self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.ConnectionType.DirectConnection) self.activated[native_string_type].connect(self.saved_search_selected) # Turn off auto-completion so that it doesn't interfere with typing # names of new searches. completer = QCompleter(self) self.setCompleter(completer) self.setEditable(True) self.setMaxVisibleItems(25) self.setInsertPolicy(QComboBox.InsertPolicy.NoInsert) self.setSizeAdjustPolicy(QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon) self.setMinimumContentsLength(25) self.tool_tip_text = self.toolTip()
def __init__(self, parent=None): QComboBox.__init__(self, parent) self.setEditable(True)
def __init__(self, parent=None): QComboBox.__init__(self, parent) self.currentIndexChanged[int].connect(self.index_changed) self.help_text = '' self.state_set = False
def __init__(self, *args): QComboBox.__init__(self, *args) self.setLineEdit(EnLineEdit(self)) self.completer().setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) self.setMinimumContentsLength(20)
def __init__(self, parent): QComboBox.__init__(self, parent)