def __init__(self, parent=None): QComboBox.__init__(self, parent) self.normal_background = 'rgb(255, 255, 255, 0%)' self.line_edit = SearchLineEdit(self) self.setLineEdit(self.line_edit) c = self.line_edit.completer() c.setCompletionMode(c.PopupCompletion) c.highlighted[QString].connect(self.completer_used) c.activated[QString].connect(self.history_selected) self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection) self.activated.connect(self.history_selected) self.setEditable(True) self.as_you_type = True self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.timer_event, type=Qt.QueuedConnection) self.setInsertPolicy(self.NoInsert) self.setMaxCount(self.MAX_COUNT) self.setSizeAdjustPolicy(self.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'), _('All style files'), _('Selected files'), _('Marked text') ]) 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>All style files</b></dt> <dd>Search in all style (CSS) files</dd> <dt><b>Selected files</b></dt> <dd>Search in the files currently selected in the Files Browser</dd> <dt><b>Marked text</b></dt> <dd>Search only within the marked text in the currently opened file. You can mark text using the Search menu.</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, parent=None): QComboBox.__init__(self, parent) self.setEditable(True) self.setLineEdit(EnLineEdit(self)) for item in self.ENCODINGS: self.addItem(item)
def __init__(self, parent, custom_columns={}, selected_column='', initial_items=['']): QComboBox.__init__(self, parent) self.populate_combo(custom_columns, selected_column, initial_items)
def __init__(self, parent): QComboBox.__init__(self, parent) items = [ _('All'), _('Installed'), _('Update available'), _('Not installed') ] self.addItems(items)
def __init__(self, win): """ Constructs a combobox with all the display styles. @param win: The NE1 mainwindow. @type win: L{Ui_MainWindow} """ QComboBox.__init__(self, win) self.win = win self._setup(disconnect=False)
def __init__(self, win): """ Constructs a combobox with all the display styles. @param win: The NE1 mainwindow. @type win: L{Ui_MainWindow} """ QComboBox.__init__(self, win) self.win = win self._setup(disconnect = False)
def __init__(self, parent): QComboBox.__init__(self, parent) self.addItems([_('Down'), _('Up')]) self.setToolTip('<style>dd {margin-bottom: 1.5ex}</style>' + _(''' Direction to search: <dl> <dt><b>Down</b></dt> <dd>Search for the next match from your current position</dd> <dt><b>Up</b></dt> <dd>Search for the previous match from your current position</dd> </dl>'''))
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): 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): QComboBox.__init__(self, parent) self.addItems([_('Down'), _('Up')]) self.setToolTip('<style>dd {margin-bottom: 1.5ex}</style>' + _( ''' Direction to search: <dl> <dt><b>Down</b></dt> <dd>Search for the next match from your current position</dd> <dt><b>Up</b></dt> <dd>Search for the previous match from your current position</dd> </dl>'''))
def __init__(self, parent): QComboBox.__init__(self) self.addItems([_('Current file'), _('All text files'), _('All style files'), _('Selected files'), _('Marked text')]) 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>All style files</b></dt> <dd>Search in all style (CSS) files</dd> <dt><b>Selected files</b></dt> <dd>Search in the files currently selected in the Files Browser</dd> <dt><b>Marked text</b></dt> <dd>Search only within the marked text in the currently opened file. You can mark text using the Search menu.</dd> </dl>'''))
def __init__(self, parent=None): QComboBox.__init__(self, parent) self.normal_background = 'rgb(255, 255, 255, 0%)' self.line_edit = SearchLineEdit(self) self.setLineEdit(self.line_edit) self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection) self.activated[str].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.setInsertPolicy(self.NoInsert) self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon) self.setMinimumContentsLength(10) self.tool_tip_text = self.toolTip()
def __init__(self, parent=None): QComboBox.__init__(self, parent) from calibre.utils.fonts import fontconfig try: self.families = fontconfig.find_font_families() except: self.families = [] print("WARNING: Could not load fonts") import traceback traceback.print_exc() # Restrict to Qt families as we need the font to be available in # QFontDatabase qt_families = set([unicode(x) for x in QFontDatabase().families()]) self.families = list(qt_families.intersection(set(self.families))) self.families.sort(key=sort_key) self.families.insert(0, _("None")) self.m = QStringListModel(self.families) self.setModel(self.m) self.d = FontFamilyDelegate(self) self.setItemDelegate(self.d) self.setCurrentIndex(0)
def __init__(self, parent, emphasize=False): QComboBox.__init__(self) self.addItems([_('Current file'), _('All text files'), _('All style files'), _('Selected files'), _('Marked text')]) 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>All style files</b></dt> <dd>Search in all style (CSS) files</dd> <dt><b>Selected files</b></dt> <dd>Search in the files currently selected in the Files Browser</dd> <dt><b>Marked text</b></dt> <dd>Search only within the marked text in the currently opened file. You can mark text using the Search menu.</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, parent=None): QComboBox.__init__(self, parent) self.setEditable(True)
def __init__(self, parentWidget, label='', labelColumn=0, choices=[], index=0, setAsDefault=True, spanWidth=False): """ Appends a QComboBox widget (with a QLabel widget) to <parentWidget>, a property manager group box. Arguments: @param parentWidget: the group box containing this PM widget. @type parentWidget: PM_GroupBox @param label: label that appears to the left of (or above) this PM widget. @type label: str @param labelColumn: The column number of the label in the group box grid layout. The only valid values are 0 (left column) and 1 (right column). The default is 0 (left column). @type labelColumn: int @param choices: list of combo box choices (strings). @type choices: list @param index: initial index (choice) of combobox. (0=first item) @type index: int (default 0) @param setAsDefault: if True, will restore <index> as the current index when the "Restore Defaults" button is clicked. @type setAsDefault: bool (default True) @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) @see: U{B{QComboBox}<http://doc.trolltech.com/4/qcombobox.html>} """ if 0: # Debugging code print "PM_ComboBox.__init__():" print " label =", label print " choices =", choices print " index =", index print " setAsDefault =", setAsDefault print " spanWidth =", spanWidth QComboBox.__init__(self) self.parentWidget = parentWidget self.label = label self.labelColumn = labelColumn self.setAsDefault = setAsDefault self.spanWidth = spanWidth if label: # Create this widget's QLabel. self.labelWidget = QLabel() self.labelWidget.setText(label) # Load QComboBox widget choices and set initial choice (index). for choice in choices: self.addItem(choice) self.setCurrentIndex(index) # Set default index self.defaultIndex = index self.defaultChoices = choices self.setAsDefault = setAsDefault parentWidget.addPmWidget(self)
def __init__(self, parent): QComboBox.__init__(self, parent) items = [_("All"), _("Installed"), _("Update available"), _("Not installed")] self.addItems(items)
def __init__(self, parent, custom_columns, selected_column): QComboBox.__init__(self, parent) self.populate_combo(custom_columns, selected_column)
def __init__(self, parent): QComboBox.__init__(self, parent)
def __init__(self, parent, values, selected_key): QComboBox.__init__(self, parent) self.values = values self.populate_combo(selected_key)
def __init__(self, parent): QComboBox.__init__(self, parent) items = [_('All'), _('Installed'), _('Update available'), _('Not installed')] self.addItems(items)
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.setEditable(True) self.setInsertPolicy(self.NoInsert) self.setMaxCount(10)
def __init__(self, *args): QComboBox.__init__(self, *args) self.setLineEdit(EnLineEdit(self)) self.setAutoCompletionCaseSensitivity(Qt.CaseInsensitive) self.setMinimumContentsLength(20)
def __init__(self, parent, values, selected_value=None): QComboBox.__init__(self, parent) self.values = values if selected_value is not None: self.populate_combo(selected_value)
def __init__(self, parent, algorithms, selected_algorithm): QComboBox.__init__(self, parent) self.populate_combo(algorithms, selected_algorithm)
def __init__(self, parentWidget, label = '', labelColumn = 0, choices = [], index = 0, setAsDefault = True, spanWidth = False ): """ Appends a QComboBox widget (with a QLabel widget) to <parentWidget>, a property manager group box. Arguments: @param parentWidget: the group box containing this PM widget. @type parentWidget: PM_GroupBox @param label: label that appears to the left of (or above) this PM widget. @type label: str @param labelColumn: The column number of the label in the group box grid layout. The only valid values are 0 (left column) and 1 (right column). The default is 0 (left column). @type labelColumn: int @param choices: list of combo box choices (strings). @type choices: list @param index: initial index (choice) of combobox. (0=first item) @type index: int (default 0) @param setAsDefault: if True, will restore <index> as the current index when the "Restore Defaults" button is clicked. @type setAsDefault: bool (default True) @param spanWidth: If True, the widget and its label will span the width of the group box. Its label will appear directly above the widget (unless the label is empty) and is left justified. @type spanWidth: bool (default False) @see: U{B{QComboBox}<http://doc.trolltech.com/4/qcombobox.html>} """ if 0: # Debugging code print "PM_ComboBox.__init__():" print " label =", label print " choices =", choices print " index =", index print " setAsDefault =", setAsDefault print " spanWidth =", spanWidth QComboBox.__init__(self) self.parentWidget = parentWidget self.label = label self.labelColumn = labelColumn self.setAsDefault = setAsDefault self.spanWidth = spanWidth if label: # Create this widget's QLabel. self.labelWidget = QLabel() self.labelWidget.setText(label) # Load QComboBox widget choices and set initial choice (index). for choice in choices: self.addItem(choice) self.setCurrentIndex(index) # Set default index self.defaultIndex = index self.defaultChoices = choices self.setAsDefault = setAsDefault parentWidget.addPmWidget(self)