本文整理汇总了Python中spyderlib.widgets.comboboxes.PatternComboBox.add_current_text方法的典型用法代码示例。如果您正苦于以下问题:Python PatternComboBox.add_current_text方法的具体用法?Python PatternComboBox.add_current_text怎么用?Python PatternComboBox.add_current_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.widgets.comboboxes.PatternComboBox
的用法示例。
在下文中一共展示了PatternComboBox.add_current_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import add_current_text [as 别名]
#.........这里部分代码省略.........
if self.isHidden():
if self.editor is not None:
self.clear_matches()
return
state = self.editor is not None
for widget in self.widgets:
widget.setEnabled(state)
if state:
self.find()
def set_editor(self, editor, refresh=True):
"""
Set associated editor/web page:
codeeditor.base.TextEditBaseWidget
browser.WebView
"""
self.editor = editor
from spyderlib.qt.QtWebKit import QWebView
self.words_button.setVisible(not isinstance(editor, QWebView))
self.re_button.setVisible(not isinstance(editor, QWebView))
from spyderlib.widgets.sourcecode.codeeditor import CodeEditor
self.is_code_editor = isinstance(editor, CodeEditor)
self.highlight_button.setVisible(self.is_code_editor)
if refresh:
self.refresh()
if self.isHidden() and editor is not None:
self.clear_matches()
@Slot()
def find_next(self):
"""Find next occurrence"""
state = self.find(changed=False, forward=True, rehighlight=False)
self.editor.setFocus()
self.search_text.add_current_text()
return state
@Slot()
def find_previous(self):
"""Find previous occurrence"""
state = self.find(changed=False, forward=False, rehighlight=False)
self.editor.setFocus()
return state
def text_has_been_edited(self, text):
"""Find text has been edited (this slot won't be triggered when
setting the search pattern combo box text programmatically"""
self.find(changed=True, forward=True, start_highlight_timer=True)
def highlight_matches(self):
"""Highlight found results"""
if self.is_code_editor and self.highlight_button.isChecked():
text = self.search_text.currentText()
words = self.words_button.isChecked()
regexp = self.re_button.isChecked()
self.editor.highlight_found_results(text, words=words,
regexp=regexp)
def clear_matches(self):
"""Clear all highlighted matches"""
if self.is_code_editor:
self.editor.clear_found_results()
def find(self, changed=True, forward=True,
rehighlight=True, start_highlight_timer=False):
"""Call the find function"""
text = self.search_text.currentText()
示例2: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import add_current_text [as 别名]
#.........这里部分代码省略.........
if self.editor is not None:
self.clear_matches()
return
state = self.editor is not None
for widget in self.widgets:
widget.setEnabled(state)
if state:
self.find()
def set_editor(self, editor, refresh=True):
"""
Set associated editor/web page:
codeeditor.base.TextEditBaseWidget
browser.WebView
"""
self.editor = editor
from spyderlib.qt.QtWebKit import QWebView
self.words_button.setVisible(not isinstance(editor, QWebView))
self.re_button.setVisible(not isinstance(editor, QWebView))
from spyderlib.widgets.sourcecode.codeeditor import CodeEditor
self.is_code_editor = isinstance(editor, CodeEditor)
self.highlight_button.setVisible(self.is_code_editor)
if refresh:
self.refresh()
if self.isHidden() and editor is not None:
self.clear_matches()
def find_next(self):
"""Find next occurence"""
state = self.find(changed=False, forward=True, rehighlight=False)
self.editor.setFocus()
self.search_text.add_current_text()
return state
def find_previous(self):
"""Find previous occurence"""
state = self.find(changed=False, forward=False, rehighlight=False)
self.editor.setFocus()
return state
def text_has_been_edited(self, text):
"""Find text has been edited (this slot won't be triggered when
setting the search pattern combo box text programmatically"""
self.find(changed=True, forward=True, start_highlight_timer=True)
def highlight_matches(self):
"""Highlight found results"""
if self.is_code_editor and self.highlight_button.isChecked():
text = self.search_text.currentText()
words = self.words_button.isChecked()
regexp = self.re_button.isChecked()
self.editor.highlight_found_results(text, words=words, regexp=regexp)
def clear_matches(self):
"""Clear all highlighted matches"""
if self.is_code_editor:
self.editor.clear_found_results()
def find(self, changed=True, forward=True, rehighlight=True, start_highlight_timer=False):
"""Call the find function"""
text = self.search_text.currentText()
if len(text) == 0:
self.search_text.lineEdit().setStyleSheet("")
return None