本文整理汇总了Python中spyderlib.widgets.comboboxes.PatternComboBox.setTabOrder方法的典型用法代码示例。如果您正苦于以下问题:Python PatternComboBox.setTabOrder方法的具体用法?Python PatternComboBox.setTabOrder怎么用?Python PatternComboBox.setTabOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.widgets.comboboxes.PatternComboBox
的用法示例。
在下文中一共展示了PatternComboBox.setTabOrder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setTabOrder [as 别名]
class FindReplace(QWidget):
"""
Find widget
Signals:
visibility_changed(bool)
"""
STYLE = {False: "background-color:rgb(255, 175, 90);", True: ""}
def __init__(self, parent, enable_replace=False):
QWidget.__init__(self, parent)
self.enable_replace = enable_replace
self.editor = None
self.is_code_editor = None
glayout = QGridLayout()
glayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(glayout)
self.close_button = create_toolbutton(self, triggered=self.hide, icon=get_std_icon("DialogCloseButton"))
glayout.addWidget(self.close_button, 0, 0)
# Find layout
self.search_text = PatternComboBox(self, tip=_("Search string"), adjust_to_minimum=False)
self.connect(self.search_text.lineEdit(), SIGNAL("textEdited(QString)"), self.text_has_been_edited)
self.previous_button = create_toolbutton(self, triggered=self.find_previous, icon=get_std_icon("ArrowBack"))
self.next_button = create_toolbutton(self, triggered=self.find_next, icon=get_std_icon("ArrowForward"))
self.connect(self.next_button, SIGNAL("clicked()"), self.update_search_combo)
self.connect(self.previous_button, SIGNAL("clicked()"), self.update_search_combo)
self.re_button = create_toolbutton(self, icon=get_icon("advanced.png"), tip=_("Regular expression"))
self.re_button.setCheckable(True)
self.connect(self.re_button, SIGNAL("toggled(bool)"), lambda state: self.find())
self.case_button = create_toolbutton(self, icon=get_icon("upper_lower.png"), tip=_("Case Sensitive"))
self.case_button.setCheckable(True)
self.connect(self.case_button, SIGNAL("toggled(bool)"), lambda state: self.find())
self.words_button = create_toolbutton(self, icon=get_icon("whole_words.png"), tip=_("Whole words"))
self.words_button.setCheckable(True)
self.connect(self.words_button, SIGNAL("toggled(bool)"), lambda state: self.find())
self.highlight_button = create_toolbutton(self, icon=get_icon("highlight.png"), tip=_("Highlight matches"))
self.highlight_button.setCheckable(True)
self.connect(self.highlight_button, SIGNAL("toggled(bool)"), self.toggle_highlighting)
hlayout = QHBoxLayout()
self.widgets = [
self.close_button,
self.search_text,
self.previous_button,
self.next_button,
self.re_button,
self.case_button,
self.words_button,
self.highlight_button,
]
for widget in self.widgets[1:]:
hlayout.addWidget(widget)
glayout.addLayout(hlayout, 0, 1)
# Replace layout
replace_with = QLabel(_("Replace with:"))
self.replace_text = PatternComboBox(self, adjust_to_minimum=False, tip=_("Replace string"))
self.replace_button = create_toolbutton(
self,
text=_("Replace/find"),
icon=get_std_icon("DialogApplyButton"),
triggered=self.replace_find,
text_beside_icon=True,
)
self.connect(self.replace_button, SIGNAL("clicked()"), self.update_replace_combo)
self.connect(self.replace_button, SIGNAL("clicked()"), self.update_search_combo)
self.all_check = QCheckBox(_("Replace all"))
self.replace_layout = QHBoxLayout()
widgets = [replace_with, self.replace_text, self.replace_button, self.all_check]
for widget in widgets:
self.replace_layout.addWidget(widget)
glayout.addLayout(self.replace_layout, 1, 1)
self.widgets.extend(widgets)
self.replace_widgets = widgets
self.hide_replace()
self.search_text.setTabOrder(self.search_text, self.replace_text)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.findnext_sc = QShortcut(QKeySequence("F3"), parent, self.find_next)
self.findnext_sc.setContext(Qt.WidgetWithChildrenShortcut)
self.findprev_sc = QShortcut(QKeySequence("Shift+F3"), parent, self.find_previous)
self.findprev_sc.setContext(Qt.WidgetWithChildrenShortcut)
self.togglefind_sc = QShortcut(QKeySequence("Ctrl+F"), parent, self.show)
self.togglefind_sc.setContext(Qt.WidgetWithChildrenShortcut)
self.togglereplace_sc = QShortcut(QKeySequence("Ctrl+H"), parent, self.toggle_replace_widgets)
self.togglereplace_sc.setContext(Qt.WidgetWithChildrenShortcut)
#.........这里部分代码省略.........
示例2: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setTabOrder [as 别名]
class FindReplace(QWidget):
"""Find widget"""
STYLE = {False: "background-color:rgb(255, 175, 90);",
True: ""}
visibility_changed = Signal(bool)
def __init__(self, parent, enable_replace=False):
QWidget.__init__(self, parent)
self.enable_replace = enable_replace
self.editor = None
self.is_code_editor = None
glayout = QGridLayout()
glayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(glayout)
self.close_button = create_toolbutton(self, triggered=self.hide,
icon=ima.icon('DialogCloseButton'))
glayout.addWidget(self.close_button, 0, 0)
# Find layout
self.search_text = PatternComboBox(self, tip=_("Search string"),
adjust_to_minimum=False)
self.search_text.valid.connect(
lambda state:
self.find(changed=False, forward=True, rehighlight=False))
self.search_text.lineEdit().textEdited.connect(
self.text_has_been_edited)
self.previous_button = create_toolbutton(self,
triggered=self.find_previous,
icon=ima.icon('ArrowUp'))
self.next_button = create_toolbutton(self,
triggered=self.find_next,
icon=ima.icon('ArrowDown'))
self.next_button.clicked.connect(self.update_search_combo)
self.previous_button.clicked.connect(self.update_search_combo)
self.re_button = create_toolbutton(self, icon=ima.icon('advanced'),
tip=_("Regular expression"))
self.re_button.setCheckable(True)
self.re_button.toggled.connect(lambda state: self.find())
self.case_button = create_toolbutton(self,
icon=get_icon("upper_lower.png"),
tip=_("Case Sensitive"))
self.case_button.setCheckable(True)
self.case_button.toggled.connect(lambda state: self.find())
self.words_button = create_toolbutton(self,
icon=get_icon("whole_words.png"),
tip=_("Whole words"))
self.words_button.setCheckable(True)
self.words_button.toggled.connect(lambda state: self.find())
self.highlight_button = create_toolbutton(self,
icon=get_icon("highlight.png"),
tip=_("Highlight matches"))
self.highlight_button.setCheckable(True)
self.highlight_button.toggled.connect(self.toggle_highlighting)
hlayout = QHBoxLayout()
self.widgets = [self.close_button, self.search_text,
self.previous_button, self.next_button,
self.re_button, self.case_button, self.words_button,
self.highlight_button]
for widget in self.widgets[1:]:
hlayout.addWidget(widget)
glayout.addLayout(hlayout, 0, 1)
# Replace layout
replace_with = QLabel(_("Replace with:"))
self.replace_text = PatternComboBox(self, adjust_to_minimum=False,
tip=_('Replace string'))
self.replace_button = create_toolbutton(self,
text=_('Replace/find'),
icon=ima.icon('DialogApplyButton'),
triggered=self.replace_find,
text_beside_icon=True)
self.replace_button.clicked.connect(self.update_replace_combo)
self.replace_button.clicked.connect(self.update_search_combo)
self.all_check = QCheckBox(_("Replace all"))
self.replace_layout = QHBoxLayout()
widgets = [replace_with, self.replace_text, self.replace_button,
self.all_check]
for widget in widgets:
self.replace_layout.addWidget(widget)
glayout.addLayout(self.replace_layout, 1, 1)
self.widgets.extend(widgets)
self.replace_widgets = widgets
self.hide_replace()
self.search_text.setTabOrder(self.search_text, self.replace_text)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.shortcuts = self.create_shortcuts(parent)
#.........这里部分代码省略.........
示例3: FindReplace
# 需要导入模块: from spyderlib.widgets.comboboxes import PatternComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setTabOrder [as 别名]
class FindReplace(QWidget):
"""
Find widget
"""
STYLE = {False: "background-color:rgb(255, 175, 90);",
True: ""}
def __init__(self, parent, enable_replace=False):
QWidget.__init__(self, parent)
self.enable_replace = enable_replace
self.editor = None
glayout = QGridLayout()
glayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(glayout)
self.close_button = create_toolbutton(self, triggered=self.hide,
icon=get_std_icon("DialogCloseButton"))
glayout.addWidget(self.close_button, 0, 0)
# Find layout
self.search_text = PatternComboBox(self, tip=self.tr("Search string"),
adjust_to_minimum=False)
self.connect(self.search_text, SIGNAL("editTextChanged(QString)"),
self.text_has_changed)
self.previous_button = create_toolbutton(self,
text=self.tr("Previous"),
triggered=self.find_previous,
icon=get_std_icon("ArrowBack"))
self.next_button = create_toolbutton(self,
text=self.tr("Next"),
triggered=self.find_next,
icon=get_std_icon("ArrowForward"))
self.connect(self.next_button, SIGNAL('clicked()'),
self.update_search_combo)
self.connect(self.previous_button, SIGNAL('clicked()'),
self.update_search_combo)
self.case_check = QCheckBox(self.tr("Case Sensitive"))
self.connect(self.case_check, SIGNAL("stateChanged(int)"), self.find)
self.words_check = QCheckBox(self.tr("Whole words"))
self.connect(self.words_check, SIGNAL("stateChanged(int)"), self.find)
hlayout = QHBoxLayout()
self.widgets = [self.close_button, self.search_text, self.previous_button,
self.next_button, self.case_check, self.words_check]
for widget in self.widgets[1:]:
hlayout.addWidget(widget)
glayout.addLayout(hlayout, 0, 1)
# Replace layout
replace_with1 = QLabel(self.tr("Replace"))
replace_with2 = QLabel()
font = replace_with2.font()
font.setBold(True)
replace_with2.setFont(font)
replace_with3 = QLabel(self.tr("with:"))
self.replace_text = PatternComboBox(self, adjust_to_minimum=False,
tip=self.tr("Replace string"))
self.replace_button = create_toolbutton(self,
text=self.tr("Replace/find"),
triggered=self.replace_find,
icon=get_std_icon("DialogApplyButton"))
self.connect(self.replace_button, SIGNAL('clicked()'),
self.update_replace_combo)
self.connect(self.replace_button, SIGNAL('clicked()'),
self.update_search_combo)
self.all_check = QCheckBox(self.tr("Replace all"))
self.replace_layout = QHBoxLayout()
widgets = [replace_with1, replace_with2, replace_with3,
self.replace_text, self.replace_button, self.all_check]
for widget in widgets:
self.replace_layout.addWidget(widget)
self.connect(self.search_text, SIGNAL("editTextChanged(QString)"),
replace_with2, SLOT("setText(QString)"))
glayout.addLayout(self.replace_layout, 1, 1)
self.widgets.extend(widgets)
self.replace_widgets = widgets
self.hide_replace()
self.search_text.setTabOrder(self.search_text, self.replace_text)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
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 keyPressEvent(self, event):
"""Reimplemented to handle key events"""
ctrl = event.modifiers() & Qt.ControlModifier
if event.key() == Qt.Key_Escape:
self.hide()
event.accept()
return
#.........这里部分代码省略.........