本文整理汇总了Python中spyderlib.widgets.comboboxes.PythonModulesComboBox.findText方法的典型用法代码示例。如果您正苦于以下问题:Python PythonModulesComboBox.findText方法的具体用法?Python PythonModulesComboBox.findText怎么用?Python PythonModulesComboBox.findText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.widgets.comboboxes.PythonModulesComboBox
的用法示例。
在下文中一共展示了PythonModulesComboBox.findText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProfilerWidget
# 需要导入模块: from spyderlib.widgets.comboboxes import PythonModulesComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PythonModulesComboBox import findText [as 别名]
#.........这里部分代码省略.........
def save_data(self):
"""Save data"""
title = _( "Save profiler result")
filename, _selfilter = getsavefilename(self, title,
getcwd(),
_("Profiler result")+" (*.Result)")
if filename:
self.datatree.save_data(filename)
def compare(self):
filename, _selfilter = getopenfilename(self, _("Select script to compare"),
getcwd(), _("Profiler result")+" (*.Result)")
if filename:
self.datatree.compare(filename)
self.show_data()
self.clear_button.setEnabled(True)
def clear(self):
self.datatree.compare(None)
self.datatree.hide_diff_cols(True)
self.show_data()
self.clear_button.setEnabled(False)
def analyze(self, filename, wdir=None, args=None, pythonpath=None):
if not is_profiler_installed():
return
self.kill_if_running()
#index, _data = self.get_data(filename)
index = None # FIXME: storing data is not implemented yet
if index is None:
self.filecombo.addItem(filename)
self.filecombo.setCurrentIndex(self.filecombo.count()-1)
else:
self.filecombo.setCurrentIndex(self.filecombo.findText(filename))
self.filecombo.selected()
if self.filecombo.is_valid():
if wdir is None:
wdir = osp.dirname(filename)
self.start(wdir, args, pythonpath)
def select_file(self):
self.redirect_stdio.emit(False)
filename, _selfilter = getopenfilename(self, _("Select Python script"),
getcwd(), _("Python scripts")+" (*.py ; *.pyw)")
self.redirect_stdio.emit(True)
if filename:
self.analyze(filename)
def show_log(self):
if self.output:
TextEditor(self.output, title=_("Profiler output"),
readonly=True, size=(700, 500)).exec_()
def show_errorlog(self):
if self.error_output:
TextEditor(self.error_output, title=_("Profiler output"),
readonly=True, size=(700, 500)).exec_()
def start(self, wdir=None, args=None, pythonpath=None):
filename = to_text_string(self.filecombo.currentText())
if wdir is None:
wdir = self._last_wdir
if wdir is None:
wdir = osp.basename(filename)
if args is None:
args = self._last_args
示例2: MemoryProfilerWidget
# 需要导入模块: from spyderlib.widgets.comboboxes import PythonModulesComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PythonModulesComboBox import findText [as 别名]
#.........这里部分代码省略.........
layout.addLayout(hlayout2)
layout.addWidget(self.datatree)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
self.start_button.setEnabled(False)
if not is_memoryprofiler_installed():
for widget in (self.datatree, self.filecombo, self.log_button,
self.start_button, self.stop_button, browse_button,
self.collapse_button, self.expand_button):
widget.setDisabled(True)
text = _(
'<b>Please install the <a href="%s">memory_profiler module</a></b>'
) % WEBSITE_URL
self.datelabel.setText(text)
self.datelabel.setOpenExternalLinks(True)
else:
pass # self.show_data()
def analyze(self, filename, wdir=None, args=None, pythonpath=None,
use_colors=True):
self.use_colors = use_colors
if not is_memoryprofiler_installed():
return
self.kill_if_running()
#index, _data = self.get_data(filename)
index = None # FIXME: storing data is not implemented yet
if index is None:
self.filecombo.addItem(filename)
self.filecombo.setCurrentIndex(self.filecombo.count()-1)
else:
self.filecombo.setCurrentIndex(self.filecombo.findText(filename))
self.filecombo.selected()
if self.filecombo.is_valid():
if wdir is None:
wdir = osp.dirname(filename)
self.start(wdir, args, pythonpath)
def select_file(self):
self.emit(SIGNAL('redirect_stdio(bool)'), False)
filename, _selfilter = getopenfilename(
self, _("Select Python script"), getcwd(),
_("Python scripts")+" (*.py ; *.pyw)")
self.emit(SIGNAL('redirect_stdio(bool)'), False)
if filename:
self.analyze(filename)
def show_log(self):
if self.output:
TextEditor(self.output, title=_("Memory profiler output"),
readonly=True, size=(700, 500)).exec_()
def show_errorlog(self):
if self.error_output:
TextEditor(self.error_output, title=_("Memory profiler output"),
readonly=True, size=(700, 500)).exec_()
def start(self, wdir=None, args=None, pythonpath=None):
filename = to_text_string(self.filecombo.currentText())
if wdir is None:
wdir = self._last_wdir
if wdir is None:
wdir = osp.basename(filename)
if args is None:
示例3: PylintWidget
# 需要导入模块: from spyderlib.widgets.comboboxes import PythonModulesComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PythonModulesComboBox import findText [as 别名]
#.........这里部分代码省略.........
self.setLayout(layout)
self.process = None
self.set_running_state(False)
if PYLINT_PATH is None:
for widget in (self.treewidget, self.filecombo,
self.start_button, self.stop_button):
widget.setDisabled(True)
if os.name == 'nt' \
and programs.is_module_installed("pylint"):
# Pylint is installed but pylint script is not in PATH
# (AFAIK, could happen only on Windows)
text = _('Pylint script was not found. Please add "%s" to PATH.')
text = to_text_string(text) % osp.join(sys.prefix, "Scripts")
else:
text = _('Please install <b>pylint</b>:')
url = 'http://www.logilab.fr'
text += ' <a href=%s>%s</a>' % (url, url)
self.ratelabel.setText(text)
else:
self.show_data()
def analyze(self, filename):
if PYLINT_PATH is None:
return
filename = to_text_string(filename) # filename is a QString instance
self.kill_if_running()
index, _data = self.get_data(filename)
if index is None:
self.filecombo.addItem(filename)
self.filecombo.setCurrentIndex(self.filecombo.count()-1)
else:
self.filecombo.setCurrentIndex(self.filecombo.findText(filename))
self.filecombo.selected()
if self.filecombo.is_valid():
self.start()
def select_file(self):
self.redirect_stdio.emit(False)
filename, _selfilter = getopenfilename(self, _("Select Python file"),
getcwd(), _("Python files")+" (*.py ; *.pyw)")
self.redirect_stdio.emit(True)
if filename:
self.analyze(filename)
def remove_obsolete_items(self):
"""Removing obsolete items"""
self.rdata = [(filename, data) for filename, data in self.rdata
if is_module_or_package(filename)]
def get_filenames(self):
return [filename for filename, _data in self.rdata]
def get_data(self, filename):
filename = osp.abspath(filename)
for index, (fname, data) in enumerate(self.rdata):
if fname == filename:
return index, data
else:
return None, None
def set_data(self, filename, data):
filename = osp.abspath(filename)
index, _data = self.get_data(filename)
if index is not None:
示例4: ProfilerWidget
# 需要导入模块: from spyderlib.widgets.comboboxes import PythonModulesComboBox [as 别名]
# 或者: from spyderlib.widgets.comboboxes.PythonModulesComboBox import findText [as 别名]
#.........这里部分代码省略.........
for widget in (self.datatree, self.filecombo,
self.start_button, self.stop_button):
widget.setDisabled(True)
if os.name == 'nt' \
and programs.is_module_installed("profile"):
# The following is a comment from the pylint plugin:
# Module is installed but script is not in PATH
# (AFAIK, could happen only on Windows)
text = translate('Profiler',
'Profiler script was not found. Please add "%s" to PATH.')
text = unicode(text) % os.path.join(sys.prefix, "Scripts")
else:
text = translate('Profiler',
('Please install the modules '+
'<b>profile</b> and <b>pstats</b>:'))
# FIXME: need the actual website
url = 'http://www.python.org'
text += ' <a href=%s>%s</a>' % (url, url)
self.datelabel.setText(text)
else:
pass # self.show_data()
def analyze(self, filename):
if not is_profiler_installed():
return
filename = unicode(filename) # filename is a QString instance
self.kill_if_running()
#index, _data = self.get_data(filename)
index=None # FIXME: storing data is not implemented yet
if index is None:
self.filecombo.addItem(filename)
self.filecombo.setCurrentIndex(self.filecombo.count()-1)
else:
self.filecombo.setCurrentIndex(self.filecombo.findText(filename))
self.filecombo.selected()
if self.filecombo.is_valid():
self.start()
def select_file(self):
self.emit(SIGNAL('redirect_stdio(bool)'), False)
filename = QFileDialog.getOpenFileName(self,
translate('Profiler', "Select Python script"), os.getcwdu(),
translate('Profiler', "Python scripts")+" (*.py ; *.pyw)")
self.emit(SIGNAL('redirect_stdio(bool)'), False)
if filename:
self.analyze(filename)
def show_log(self):
if self.output:
TextEditor(self.output, title=translate('Profiler', "Profiler output"),
readonly=True, size=(700, 500)).exec_()
def show_errorlog(self):
if self.error_output:
TextEditor(self.error_output, title=translate('Profiler', "Profiler output"),
readonly=True, size=(700, 500)).exec_()
def start(self):
self.datelabel.setText('Profiling, please wait...')
filename = unicode(self.filecombo.currentText())
self.process = QProcess(self)
self.process.setProcessChannelMode(QProcess.SeparateChannels)
self.process.setWorkingDirectory(os.path.dirname(filename))
self.connect(self.process, SIGNAL("readyReadStandardOutput()"),
self.read_output)