本文整理汇总了Python中calibre.gui2.widgets.HistoryLineEdit.setMinimumContentsLength方法的典型用法代码示例。如果您正苦于以下问题:Python HistoryLineEdit.setMinimumContentsLength方法的具体用法?Python HistoryLineEdit.setMinimumContentsLength怎么用?Python HistoryLineEdit.setMinimumContentsLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.widgets.HistoryLineEdit
的用法示例。
在下文中一共展示了HistoryLineEdit.setMinimumContentsLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_Form
# 需要导入模块: from calibre.gui2.widgets import HistoryLineEdit [as 别名]
# 或者: from calibre.gui2.widgets.HistoryLineEdit import setMinimumContentsLength [as 别名]
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(430, 74)
Form.setWindowTitle(_("Form"))
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.msg = QtGui.QLabel(Form)
self.msg.setText(_("TextLabel"))
self.msg.setWordWrap(True)
self.msg.setObjectName(_fromUtf8("msg"))
self.verticalLayout.addWidget(self.msg)
self.edit = HistoryLineEdit(Form)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(100)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.edit.sizePolicy().hasHeightForWidth())
self.edit.setSizePolicy(sizePolicy)
self.edit.setMinimumSize(QtCore.QSize(350, 0))
self.edit.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLengthWithIcon)
self.edit.setMinimumContentsLength(30)
self.edit.setObjectName(_fromUtf8("edit"))
self.verticalLayout.addWidget(self.edit)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.button = QtGui.QToolButton(Form)
self.button.setToolTip(_("Use a wizard to help construct the Regular expression"))
self.button.setText(_("..."))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(I("wizard.png"))), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.button.setIcon(icon)
self.button.setIconSize(QtCore.QSize(40, 40))
self.button.setObjectName(_fromUtf8("button"))
self.gridLayout.addWidget(self.button, 0, 1, 1, 1)
self.msg.setBuddy(self.edit)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
pass
示例2: TagBrowserWidget
# 需要导入模块: from calibre.gui2.widgets import HistoryLineEdit [as 别名]
# 或者: from calibre.gui2.widgets.HistoryLineEdit import setMinimumContentsLength [as 别名]
class TagBrowserWidget(QWidget): # {{{
def __init__(self, parent):
QWidget.__init__(self, parent)
self.parent = parent
self._layout = QVBoxLayout()
self.setLayout(self._layout)
self._layout.setContentsMargins(0,0,0,0)
# Set up the find box & button
search_layout = QHBoxLayout()
self._layout.addLayout(search_layout)
self.item_search = HistoryLineEdit(parent)
self.item_search.setMinimumContentsLength(5)
self.item_search.setSizeAdjustPolicy(self.item_search.AdjustToMinimumContentsLengthWithIcon)
try:
self.item_search.lineEdit().setPlaceholderText(
_('Find item in tag browser'))
except:
pass # Using Qt < 4.7
self.item_search.setToolTip(_(
'Search for items. This is a "contains" search; items containing the\n'
'text anywhere in the name will be found. You can limit the search\n'
'to particular categories using syntax similar to search. For example,\n'
'tags:foo will find foo in any tag, but not in authors etc. Entering\n'
'*foo will filter all categories at once, showing only those items\n'
'containing the text "foo"'))
search_layout.addWidget(self.item_search)
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser find box',
_('Find item'), default_keys=(),
action=ac, group=_('Tag Browser'))
ac.triggered.connect(self.set_focus_to_find_box)
self.search_button = QToolButton()
self.search_button.setText(_('Find'))
self.search_button.setToolTip(_('Find the first/next matching item'))
search_layout.addWidget(self.search_button)
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser find button',
_('Find button'), default_keys=(),
action=ac, group=_('Tag Browser'))
ac.triggered.connect(self.search_button.click)
self.expand_button = QToolButton()
self.expand_button.setText('-')
self.expand_button.setToolTip(_('Collapse all categories'))
search_layout.addWidget(self.expand_button)
search_layout.setStretch(0, 10)
search_layout.setStretch(1, 1)
search_layout.setStretch(2, 1)
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser collapse all',
_('Collapse all'), default_keys=(),
action=ac, group=_('Tag Browser'))
ac.triggered.connect(self.expand_button.clicked)
self.current_find_position = None
self.search_button.clicked.connect(self.find)
self.item_search.initialize('tag_browser_search')
self.item_search.lineEdit().returnPressed.connect(self.do_find)
self.item_search.lineEdit().textEdited.connect(self.find_text_changed)
self.item_search.activated[str].connect(self.do_find)
self.item_search.completer().setCaseSensitivity(Qt.CaseSensitive)
parent.tags_view = TagsView(parent)
self.tags_view = parent.tags_view
self.expand_button.clicked.connect(self.tags_view.collapseAll)
self._layout.addWidget(parent.tags_view)
# Now the floating 'not found' box
l = QLabel(self.tags_view)
self.not_found_label = l
l.setFrameStyle(QFrame.StyledPanel)
l.setAutoFillBackground(True)
l.setText('<p><b>'+_('No More Matches.</b><p> Click Find again to go to first match'))
l.setAlignment(Qt.AlignVCenter)
l.setWordWrap(True)
l.resize(l.sizeHint())
l.move(10,20)
l.setVisible(False)
self.not_found_label_timer = QTimer()
self.not_found_label_timer.setSingleShot(True)
self.not_found_label_timer.timeout.connect(self.not_found_label_timer_event,
type=Qt.QueuedConnection)
parent.alter_tb = l = QPushButton(parent)
l.setText(_('Alter Tag Browser'))
l.setIcon(QIcon(I('tags.png')))
l.m = QMenu()
l.setMenu(l.m)
self._layout.addWidget(l)
ac = QAction(parent)
parent.addAction(ac)
parent.keyboard.register_shortcut('tag browser alter',
_('Alter tag browser'), default_keys=(),
action=ac, group=_('Tag Browser'))
#.........这里部分代码省略.........