本文整理汇总了Python中spyderlib.widgets.comboboxes.PythonModulesComboBox类的典型用法代码示例。如果您正苦于以下问题:Python PythonModulesComboBox类的具体用法?Python PythonModulesComboBox怎么用?Python PythonModulesComboBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PythonModulesComboBox类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Profiler")
self.output = None
self.error_output = None
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(self, icon=ima.icon('run'),
text=_("Profile"),
tip=_("Run profiler"),
triggered=lambda : self.start(),
text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=ima.icon('stop'),
text=_("Stop"),
tip=_("Stop current profiling"),
text_beside_icon=True)
self.filecombo.valid.connect(self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(self, icon=ima.icon('fileopen'),
tip=_('Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=ima.icon('log'),
text=_("Output"),
text_beside_icon=True,
tip=_("Show program's output"),
triggered=self.show_log)
self.datatree = ProfilerDataTree(self)
self.collapse_button = create_toolbutton(self,
icon=ima.icon('collapse'),
triggered=lambda dD:
self.datatree.change_view(-1),
tip=_('Collapse one level up'))
self.expand_button = create_toolbutton(self,
icon=ima.icon('expand'),
triggered=lambda dD:
self.datatree.change_view(1),
tip=_('Expand one level down'))
self.save_button = create_toolbutton(self, text_beside_icon=True,
text=_("Save data"),
icon=ima.icon('filesave'),
triggered=self.save_data,
tip=_('Save profiling data'))
self.load_button = create_toolbutton(self, text_beside_icon=True,
text=_("Load data"),
icon=ima.icon('fileimport'),
triggered=self.compare,
tip=_('Load profiling data for comparison'))
self.clear_button = create_toolbutton(self, text_beside_icon=True,
text=_("Clear comparison"),
icon=ima.icon('editdelete'),
triggered=self.clear)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
hlayout2.addWidget(self.save_button)
hlayout2.addWidget(self.load_button)
hlayout2.addWidget(self.clear_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.datatree)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
self.start_button.setEnabled(False)
self.clear_button.setEnabled(False)
if not is_profiler_installed():
# This should happen only on certain GNU/Linux distributions
# or when this a home-made Python build because the Python
#.........这里部分代码省略.........
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:101,代码来源:profilergui.py
示例2: __init__
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Pylint")
self.output = None
self.error_output = None
self.max_entries = max_entries
self.rdata = []
if osp.isfile(self.DATAPATH):
try:
data = pickle.loads(open(self.DATAPATH, 'rb').read())
if data[0] == self.VERSION:
self.rdata = data[1:]
except (EOFError, ImportError):
pass
self.filecombo = PythonModulesComboBox(self)
if self.rdata:
self.remove_obsolete_items()
self.filecombo.addItems(self.get_filenames())
self.start_button = create_toolbutton(self, icon=ima.icon('run'),
text=_("Analyze"),
tip=_("Run analysis"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=ima.icon('stop'),
text=_("Stop"),
tip=_("Stop current analysis"),
text_beside_icon=True)
self.filecombo.valid.connect(self.start_button.setEnabled)
self.filecombo.valid.connect(self.show_data)
browse_button = create_toolbutton(self, icon=ima.icon('fileopen'),
tip=_('Select Python file'),
triggered=self.select_file)
self.ratelabel = QLabel()
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=ima.icon('log'),
text=_("Output"),
text_beside_icon=True,
tip=_("Complete output"),
triggered=self.show_log)
self.treewidget = ResultsTree(self)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.ratelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.treewidget)
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()
开发者ID:gyenney,项目名称:Tools,代码行数:87,代码来源:pylintgui.py
示例3: ProfilerWidget
class ProfilerWidget(QWidget):
"""
Profiler widget
"""
DATAPATH = get_conf_path('profiler.results')
VERSION = '0.0.1'
redirect_stdio = Signal(bool)
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Profiler")
self.output = None
self.error_output = None
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(self, icon=ima.icon('run'),
text=_("Profile"),
tip=_("Run profiler"),
triggered=lambda : self.start(),
text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=ima.icon('stop'),
text=_("Stop"),
tip=_("Stop current profiling"),
text_beside_icon=True)
self.filecombo.valid.connect(self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(self, icon=ima.icon('fileopen'),
tip=_('Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=ima.icon('log'),
text=_("Output"),
text_beside_icon=True,
tip=_("Show program's output"),
triggered=self.show_log)
self.datatree = ProfilerDataTree(self)
self.collapse_button = create_toolbutton(self,
icon=ima.icon('collapse'),
triggered=lambda dD:
self.datatree.change_view(-1),
tip=_('Collapse one level up'))
self.expand_button = create_toolbutton(self,
icon=ima.icon('expand'),
triggered=lambda dD:
self.datatree.change_view(1),
tip=_('Expand one level down'))
self.save_button = create_toolbutton(self, text_beside_icon=True,
text=_("Save data"),
icon=ima.icon('filesave'),
triggered=self.save_data,
tip=_('Save profiling data'))
self.load_button = create_toolbutton(self, text_beside_icon=True,
text=_("Load data"),
icon=ima.icon('fileimport'),
triggered=self.compare,
tip=_('Load profiling data for comparison'))
self.clear_button = create_toolbutton(self, text_beside_icon=True,
text=_("Clear comparison"),
icon=ima.icon('editdelete'),
triggered=self.clear)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
hlayout2.addWidget(self.save_button)
hlayout2.addWidget(self.load_button)
hlayout2.addWidget(self.clear_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.datatree)
self.setLayout(layout)
#.........这里部分代码省略.........
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:101,代码来源:profilergui.py
示例4: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setWindowTitle("Memory profiler")
self.output = None
self.error_output = None
self.use_colors = True
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(
self, icon=get_icon('run.png'),
text=_("Profile memory usage"),
tip=_("Run memory profiler"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(
self,
icon=get_icon('terminate.png'),
text=_("Stop"),
tip=_("Stop current profiling"),
text_beside_icon=True)
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(
self, icon=get_icon('fileopen.png'),
tip=_('Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(
self, icon=get_icon('log.png'),
text=_("Output"),
text_beside_icon=True,
tip=_("Show program's output"),
triggered=self.show_log)
self.datatree = MemoryProfilerDataTree(self)
self.collapse_button = create_toolbutton(
self,
icon=get_icon('collapse.png'),
triggered=lambda dD=-1: self.datatree.collapseAll(),
tip=_('Collapse all'))
self.expand_button = create_toolbutton(
self,
icon=get_icon('expand.png'),
triggered=lambda dD=1: self.datatree.expandAll(),
tip=_('Expand all'))
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
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()
开发者ID:Nodd,项目名称:spyder_line_profiler,代码行数:96,代码来源:memoryprofilergui.py
示例5: PylintWidget
class PylintWidget(QWidget):
"""
Pylint widget
"""
DATAPATH = get_conf_path('pylint.results')
VERSION = '1.1.0'
redirect_stdio = Signal(bool)
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Pylint")
self.output = None
self.error_output = None
self.max_entries = max_entries
self.rdata = []
if osp.isfile(self.DATAPATH):
try:
data = pickle.loads(open(self.DATAPATH, 'rb').read())
if data[0] == self.VERSION:
self.rdata = data[1:]
except (EOFError, ImportError):
pass
self.filecombo = PythonModulesComboBox(self)
if self.rdata:
self.remove_obsolete_items()
self.filecombo.addItems(self.get_filenames())
self.start_button = create_toolbutton(self, icon=ima.icon('run'),
text=_("Analyze"),
tip=_("Run analysis"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=ima.icon('stop'),
text=_("Stop"),
tip=_("Stop current analysis"),
text_beside_icon=True)
self.filecombo.valid.connect(self.start_button.setEnabled)
self.filecombo.valid.connect(self.show_data)
browse_button = create_toolbutton(self, icon=ima.icon('fileopen'),
tip=_('Select Python file'),
triggered=self.select_file)
self.ratelabel = QLabel()
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=ima.icon('log'),
text=_("Output"),
text_beside_icon=True,
tip=_("Complete output"),
triggered=self.show_log)
self.treewidget = ResultsTree(self)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.ratelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.treewidget)
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
#.........这里部分代码省略.........
开发者ID:gyenney,项目名称:Tools,代码行数:101,代码来源:pylintgui.py
示例6: MemoryProfilerWidget
class MemoryProfilerWidget(QWidget):
"""
Memory profiler widget
"""
DATAPATH = get_conf_path('memoryprofiler.results')
VERSION = '0.0.1'
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setWindowTitle("Memory profiler")
self.output = None
self.error_output = None
self.use_colors = True
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(
self, icon=get_icon('run.png'),
text=_("Profile memory usage"),
tip=_("Run memory profiler"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(
self,
icon=get_icon('terminate.png'),
text=_("Stop"),
tip=_("Stop current profiling"),
text_beside_icon=True)
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(
self, icon=get_icon('fileopen.png'),
tip=_('Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(
self, icon=get_icon('log.png'),
text=_("Output"),
text_beside_icon=True,
tip=_("Show program's output"),
triggered=self.show_log)
self.datatree = MemoryProfilerDataTree(self)
self.collapse_button = create_toolbutton(
self,
icon=get_icon('collapse.png'),
triggered=lambda dD=-1: self.datatree.collapseAll(),
tip=_('Collapse all'))
self.expand_button = create_toolbutton(
self,
icon=get_icon('expand.png'),
triggered=lambda dD=1: self.datatree.expandAll(),
tip=_('Expand all'))
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
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)
#.........这里部分代码省略.........
开发者ID:Nodd,项目名称:spyder_line_profiler,代码行数:101,代码来源:memoryprofilergui.py
示例7: __init__
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.output = None
self.error_output = None
self.max_entries = max_entries
self.data = [self.VERSION]
if osp.isfile(self.DATAPATH):
try:
data = cPickle.load(file(self.DATAPATH))
if data[0] == self.VERSION:
self.data = data
except EOFError:
pass
self.filecombo = PythonModulesComboBox(self)
if self.data:
self.remove_obsolete_items()
self.filecombo.addItems(self.get_filenames())
self.start_button = create_toolbutton(self, get_icon('run.png'),
translate('Pylint', "Analyze"),
tip=translate('Pylint', "Run analysis"),
triggered=self.start)
self.stop_button = create_toolbutton(self, get_icon('terminate.png'),
translate('Pylint', "Stop"),
tip=translate('Pylint',
"Stop current analysis"))
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
browse_button = create_toolbutton(self, get_icon('fileopen.png'),
tip=translate('Pylint', 'Select Python script'),
triggered=self.select_file)
self.ratelabel = QLabel()
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, get_icon('log.png'),
translate('Pylint', "Output"),
tip=translate('Pylint',
"Complete Pylint output"),
triggered=self.show_log)
self.treewidget = ResultsTree(self)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.ratelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.treewidget)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
if not is_pylint_installed():
for widget in (self.treewidget, self.filecombo,
self.start_button, self.stop_button):
widget.setDisabled(True)
text = translate('Pylint', '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()
开发者ID:Brainsciences,项目名称:luminoso,代码行数:78,代码来源:pylintgui.py
示例8: PylintWidget
class PylintWidget(QWidget):
"""
Pylint widget
"""
DATAPATH = get_conf_path('.pylint.results')
VERSION = '1.0.2'
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.output = None
self.error_output = None
self.max_entries = max_entries
self.data = [self.VERSION]
if osp.isfile(self.DATAPATH):
try:
data = cPickle.load(file(self.DATAPATH))
if data[0] == self.VERSION:
self.data = data
except EOFError:
pass
self.filecombo = PythonModulesComboBox(self)
if self.data:
self.remove_obsolete_items()
self.filecombo.addItems(self.get_filenames())
self.start_button = create_toolbutton(self, get_icon('run.png'),
translate('Pylint', "Analyze"),
tip=translate('Pylint', "Run analysis"),
triggered=self.start)
self.stop_button = create_toolbutton(self, get_icon('terminate.png'),
translate('Pylint', "Stop"),
tip=translate('Pylint',
"Stop current analysis"))
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
browse_button = create_toolbutton(self, get_icon('fileopen.png'),
tip=translate('Pylint', 'Select Python script'),
triggered=self.select_file)
self.ratelabel = QLabel()
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, get_icon('log.png'),
translate('Pylint', "Output"),
tip=translate('Pylint',
"Complete Pylint output"),
triggered=self.show_log)
self.treewidget = ResultsTree(self)
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.ratelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.treewidget)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
if not is_pylint_installed():
for widget in (self.treewidget, self.filecombo,
self.start_button, self.stop_button):
widget.setDisabled(True)
text = translate('Pylint', '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 not is_pylint_installed():
return
filename = unicode(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(index)
self.filecombo.selected()
if self.filecombo.is_valid():
self.start()
#.........这里部分代码省略.........
开发者ID:Brainsciences,项目名称:luminoso,代码行数:101,代码来源:pylintgui.py
示例9: __init__
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Profiler")
self.output = None
self.error_output = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(self, icon=get_icon('run.png'),
text=translate('Profiler', "Profile"),
tip=translate('Profiler', "Run profiler"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=get_icon('terminate.png'),
text=translate('Profiler', "Stop"),
tip=translate('Profiler',
"Stop current profiling"),
text_beside_icon=True)
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(self, icon=get_icon('fileopen.png'),
tip=translate('Profiler', 'Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=get_icon('log.png'),
text=translate('Profiler', "Output"),
text_beside_icon=True,
tip=translate('Profiler',
"Show program's output"),
triggered=self.show_log)
self.datatree = ProfilerDataTree(self)
self.collapse_button = create_toolbutton(self, icon=get_icon('collapse.png'),
triggered=lambda dD=-1:self.datatree.change_view(dD),
tip='Collapse one level up')
self.expand_button = create_toolbutton(self, icon=get_icon('expand.png'),
triggered=lambda dD=1:self.datatree.change_view(dD),
tip='Expand one level down')
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.datatree)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
if not is_profiler_installed():
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()
开发者ID:sjara,项目名称:spyder-profiler,代码行数:94,代码来源:profilergui.py
示例10: ProfilerWidget
class ProfilerWidget(QWidget):
"""
Profiler widget
"""
DATAPATH = get_conf_path('.profiler.results')
VERSION = '0.0.1'
def __init__(self, parent, max_entries=100):
QWidget.__init__(self, parent)
self.setWindowTitle("Profiler")
self.output = None
self.error_output = None
self.filecombo = PythonModulesComboBox(self)
self.start_button = create_toolbutton(self, icon=get_icon('run.png'),
text=translate('Profiler', "Profile"),
tip=translate('Profiler', "Run profiler"),
triggered=self.start, text_beside_icon=True)
self.stop_button = create_toolbutton(self,
icon=get_icon('terminate.png'),
text=translate('Profiler', "Stop"),
tip=translate('Profiler',
"Stop current profiling"),
text_beside_icon=True)
self.connect(self.filecombo, SIGNAL('valid(bool)'),
self.start_button.setEnabled)
#self.connect(self.filecombo, SIGNAL('valid(bool)'), self.show_data)
# FIXME: The combobox emits this signal on almost any event
# triggering show_data() too early, too often.
browse_button = create_toolbutton(self, icon=get_icon('fileopen.png'),
tip=translate('Profiler', 'Select Python script'),
triggered=self.select_file)
self.datelabel = QLabel()
self.log_button = create_toolbutton(self, icon=get_icon('log.png'),
text=translate('Profiler', "Output"),
text_beside_icon=True,
tip=translate('Profiler',
"Show program's output"),
triggered=self.show_log)
self.datatree = ProfilerDataTree(self)
self.collapse_button = create_toolbutton(self, icon=get_icon('collapse.png'),
triggered=lambda dD=-1:self.datatree.change_view(dD),
tip='Collapse one level up')
self.expand_button = create_toolbutton(self, icon=get_icon('expand.png'),
triggered=lambda dD=1:self.datatree.change_view(dD),
tip='Expand one level down')
hlayout1 = QHBoxLayout()
hlayout1.addWidget(self.filecombo)
hlayout1.addWidget(browse_button)
hlayout1.addWidget(self.start_button)
hlayout1.addWidget(self.stop_button)
hlayout2 = QHBoxLayout()
hlayout2.addWidget(self.collapse_button)
hlayout2.addWidget(self.expand_button)
hlayout2.addStretch()
hlayout2.addWidget(self.datelabel)
hlayout2.addStretch()
hlayout2.addWidget(self.log_button)
layout = QVBoxLayout()
layout.addLayout(hlayout1)
layout.addLayout(hlayout2)
layout.addWidget(self.datatree)
self.setLayout(layout)
self.process = None
self.set_running_state(False)
if not is_profiler_installed():
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:
#.........这里部分代码省略.........
开发者ID:sjara,项目名称:spyder-profiler,代码行数:101,代码来源:profilergui.py
注:本文中的spyderlib.widgets.comboboxes.PythonModulesComboBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论