本文整理汇总了Python中spyderlib.widgets.comboboxes.PatternComboBox.setEditText方法的典型用法代码示例。如果您正苦于以下问题:Python PatternComboBox.setEditText方法的具体用法?Python PatternComboBox.setEditText怎么用?Python PatternComboBox.setEditText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.widgets.comboboxes.PatternComboBox
的用法示例。
在下文中一共展示了PatternComboBox.setEditText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setEditText [as 别名]
#.........这里部分代码省略.........
if self.enable_replace:
# Toggle replace widgets
if self.replace_widgets[0].isVisible():
self.hide_replace()
self.hide()
else:
self.show_replace()
self.replace_text.setFocus()
@Slot(bool)
def toggle_highlighting(self, state):
"""Toggle the 'highlight all results' feature"""
if self.editor is not None:
if state:
self.highlight_matches()
else:
self.clear_matches()
def show(self):
"""Overrides Qt Method"""
QWidget.show(self)
self.visibility_changed.emit(True)
if self.editor is not None:
text = self.editor.get_selected_text()
# If no text is highlighted for search, use whatever word is under the cursor
if not text:
cursor = self.editor.textCursor()
cursor.select(QTextCursor.WordUnderCursor)
text = to_text_string(cursor.selectedText())
# Now that text value is sorted out, use it for the search
if text:
self.search_text.setEditText(text)
self.search_text.lineEdit().selectAll()
self.refresh()
else:
self.search_text.lineEdit().selectAll()
self.search_text.setFocus()
@Slot()
def hide(self):
"""Overrides Qt Method"""
for widget in self.replace_widgets:
widget.hide()
QWidget.hide(self)
self.visibility_changed.emit(False)
if self.editor is not None:
self.editor.setFocus()
self.clear_matches()
def show_replace(self):
"""Show replace widgets"""
self.show()
for widget in self.replace_widgets:
widget.show()
def hide_replace(self):
"""Hide replace widgets"""
for widget in self.replace_widgets:
widget.hide()
def refresh(self):
"""Refresh widget"""
if self.isHidden():
if self.editor is not None:
示例2: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setEditText [as 别名]
#.........这里部分代码省略.........
]
def update_search_combo(self):
self.search_text.lineEdit().emit(SIGNAL("returnPressed()"))
def update_replace_combo(self):
self.replace_text.lineEdit().emit(SIGNAL("returnPressed()"))
def toggle_replace_widgets(self):
if self.enable_replace:
# Toggle replace widgets
if self.replace_widgets[0].isVisible():
self.hide_replace()
self.hide()
else:
self.show_replace()
self.replace_text.setFocus()
def toggle_highlighting(self, state):
"""Toggle the 'highlight all results' feature"""
if self.editor is not None:
if state:
self.highlight_matches()
else:
self.clear_matches()
def show(self):
"""Overrides Qt Method"""
QWidget.show(self)
self.emit(SIGNAL("visibility_changed(bool)"), True)
if self.editor is not None:
text = self.editor.get_selected_text()
if len(text) > 0:
self.search_text.setEditText(text)
self.search_text.lineEdit().selectAll()
self.refresh()
else:
self.search_text.lineEdit().selectAll()
self.search_text.setFocus()
def hide(self):
"""Overrides Qt Method"""
for widget in self.replace_widgets:
widget.hide()
QWidget.hide(self)
self.emit(SIGNAL("visibility_changed(bool)"), False)
if self.editor is not None:
self.editor.setFocus()
self.clear_matches()
def show_replace(self):
"""Show replace widgets"""
self.show()
for widget in self.replace_widgets:
widget.show()
def hide_replace(self):
"""Hide replace widgets"""
for widget in self.replace_widgets:
widget.hide()
def refresh(self):
"""Refresh widget"""
if self.isHidden():
if self.editor is not None:
self.clear_matches()
示例3: FindOptions
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setEditText [as 别名]
#.........这里部分代码省略.........
self.dir_combo.setDisabled)
self.connect(self.hg_manifest, SIGNAL('toggled(bool)'),
self.dir_combo.setDisabled)
browse = create_toolbutton(self, get_std_icon('DirOpenIcon'),
tip=translate('FindInFiles',
'Browse a search directory'),
triggered=self.select_directory)
for widget in [searchin_label, self.python_path, self.hg_manifest,
self.custom_dir, self.dir_combo, browse]:
hlayout3.addWidget(widget)
vlayout = QVBoxLayout()
vlayout.addLayout(hlayout1)
vlayout.addLayout(hlayout2)
vlayout.addLayout(hlayout3)
self.setLayout(vlayout)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
def update_combos(self):
self.search_text.lineEdit().emit(SIGNAL('returnPressed()'))
self.include_pattern.lineEdit().emit(SIGNAL('returnPressed()'))
self.exclude_pattern.lineEdit().emit(SIGNAL('returnPressed()'))
def detect_hg_repository(self, path=None):
if path is None:
path = os.getcwdu()
hg_repository = is_hg_installed() and get_hg_root(path) is not None
self.hg_manifest.setEnabled(hg_repository)
if not hg_repository and self.hg_manifest.isChecked():
self.custom_dir.setChecked(True)
def set_search_text(self, text):
self.search_text.setEditText(text)
self.search_text.lineEdit().selectAll()
self.search_text.setFocus()
def get_options(self, all=False):
# Getting options
utext = unicode(self.search_text.currentText())
if not utext:
return
try:
texts = [str(utext)]
except UnicodeDecodeError:
texts = []
for encoding in self.supported_encodings:
try:
texts.append( utext.encode(encoding) )
except UnicodeDecodeError:
pass
text_re = self.edit_regexp.isChecked()
include = unicode(self.include_pattern.currentText())
include_re = self.include_regexp.isChecked()
exclude = unicode(self.exclude_pattern.currentText())
exclude_re = self.exclude_regexp.isChecked()
python_path = self.python_path.isChecked()
hg_manifest = self.hg_manifest.isChecked()
path = osp.abspath( unicode( self.dir_combo.currentText() ) )
# Finding text occurences
if not include_re:
include = fnmatch.translate(include)
if not exclude_re:
exclude = fnmatch.translate(exclude)
示例4: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setEditText [as 别名]
#.........这里部分代码省略.........
if event.key() == Qt.Key_Escape:
self.hide()
event.accept()
return
elif event.key() == Qt.Key_F3:
# Find next
self.find_next()
event.accept()
elif event.key() == Qt.Key_F and ctrl:
# Toggle find widgets
if self.isVisible():
self.hide()
else:
self.show()
event.accept()
elif event.key() == Qt.Key_H and ctrl and self.enable_replace:
# Toggle replace widgets
if self.replace_widgets[0].isVisible():
self.hide_replace()
self.hide()
else:
self.show_replace()
self.replace_text.setFocus()
event.accept()
else:
event.ignore()
def show(self):
"""Overrides Qt Method"""
QWidget.show(self)
if self.editor is not None:
text = self.editor.selectedText()
if len(text)>0:
self.search_text.setEditText(text)
self.search_text.lineEdit().selectAll()
self.refresh()
else:
self.search_text.lineEdit().selectAll()
def hide(self):
"""Overrides Qt Method"""
for widget in self.replace_widgets:
widget.hide()
QWidget.hide(self)
if self.editor is not None:
self.editor.setFocus()
def show_replace(self):
"""Show replace widgets"""
for widget in self.replace_widgets:
widget.show()
def hide_replace(self):
"""Hide replace widgets"""
for widget in self.replace_widgets:
widget.hide()
def refresh(self):
"""Refresh widget"""
if self.isHidden():
return
state = self.editor is not None
for widget in self.widgets:
widget.setEnabled(state)
if state:
self.find()