本文整理匯總了Python中spyderlib.widgets.comboboxes.PatternComboBox.setCurrentIndex方法的典型用法代碼示例。如果您正苦於以下問題:Python PatternComboBox.setCurrentIndex方法的具體用法?Python PatternComboBox.setCurrentIndex怎麽用?Python PatternComboBox.setCurrentIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類spyderlib.widgets.comboboxes.PatternComboBox
的用法示例。
在下文中一共展示了PatternComboBox.setCurrentIndex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FindOptions
# 需要導入模塊: from spyderlib.widgets.comboboxes import PatternComboBox [as 別名]
# 或者: from spyderlib.widgets.comboboxes.PatternComboBox import setCurrentIndex [as 別名]
class FindOptions(QWidget):
"""Find widget with options"""
find = Signal()
stop = Signal()
def __init__(self, parent, search_text, search_text_regexp, search_path,
include, include_idx, include_regexp,
exclude, exclude_idx, exclude_regexp,
supported_encodings, in_python_path, more_options):
QWidget.__init__(self, parent)
if search_path is None:
search_path = getcwd()
if not isinstance(search_text, (list, tuple)):
search_text = [search_text]
if not isinstance(search_path, (list, tuple)):
search_path = [search_path]
if not isinstance(include, (list, tuple)):
include = [include]
if not isinstance(exclude, (list, tuple)):
exclude = [exclude]
self.supported_encodings = supported_encodings
# Layout 1
hlayout1 = QHBoxLayout()
self.search_text = PatternComboBox(self, search_text,
_("Search pattern"))
self.edit_regexp = create_toolbutton(self,
icon=ima.icon('advanced'),
tip=_('Regular expression'))
self.edit_regexp.setCheckable(True)
self.edit_regexp.setChecked(search_text_regexp)
self.more_widgets = ()
self.more_options = create_toolbutton(self,
toggled=self.toggle_more_options)
self.more_options.setCheckable(True)
self.more_options.setChecked(more_options)
self.ok_button = create_toolbutton(self, text=_("Search"),
icon=ima.icon('DialogApplyButton'),
triggered=lambda: self.find.emit(),
tip=_("Start search"),
text_beside_icon=True)
self.ok_button.clicked.connect(self.update_combos)
self.stop_button = create_toolbutton(self, text=_("Stop"),
icon=ima.icon('stop'),
triggered=lambda: self.stop.emit(),
tip=_("Stop search"),
text_beside_icon=True)
self.stop_button.setEnabled(False)
for widget in [self.search_text, self.edit_regexp,
self.ok_button, self.stop_button, self.more_options]:
hlayout1.addWidget(widget)
# Layout 2
hlayout2 = QHBoxLayout()
self.include_pattern = PatternComboBox(self, include,
_("Included filenames pattern"))
if include_idx is not None and include_idx >= 0 \
and include_idx < self.include_pattern.count():
self.include_pattern.setCurrentIndex(include_idx)
self.include_regexp = create_toolbutton(self,
icon=ima.icon('advanced'),
tip=_('Regular expression'))
self.include_regexp.setCheckable(True)
self.include_regexp.setChecked(include_regexp)
include_label = QLabel(_("Include:"))
include_label.setBuddy(self.include_pattern)
self.exclude_pattern = PatternComboBox(self, exclude,
_("Excluded filenames pattern"))
if exclude_idx is not None and exclude_idx >= 0 \
and exclude_idx < self.exclude_pattern.count():
self.exclude_pattern.setCurrentIndex(exclude_idx)
self.exclude_regexp = create_toolbutton(self,
icon=ima.icon('advanced'),
tip=_('Regular expression'))
self.exclude_regexp.setCheckable(True)
self.exclude_regexp.setChecked(exclude_regexp)
exclude_label = QLabel(_("Exclude:"))
exclude_label.setBuddy(self.exclude_pattern)
for widget in [include_label, self.include_pattern,
self.include_regexp,
exclude_label, self.exclude_pattern,
self.exclude_regexp]:
hlayout2.addWidget(widget)
# Layout 3
hlayout3 = QHBoxLayout()
self.python_path = QRadioButton(_("PYTHONPATH"), self)
self.python_path.setChecked(in_python_path)
self.python_path.setToolTip(_(
"Search in all directories listed in sys.path which"
" are outside the Python installation directory"))
self.hg_manifest = QRadioButton(_("Hg repository"), self)
self.detect_hg_repository()
self.hg_manifest.setToolTip(
_("Search in current directory hg repository"))
self.custom_dir = QRadioButton(_("Here:"), self)
#.........這裏部分代碼省略.........