本文整理汇总了Python中qtpy.QtCore.QProcess.kill方法的典型用法代码示例。如果您正苦于以下问题:Python QProcess.kill方法的具体用法?Python QProcess.kill怎么用?Python QProcess.kill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtCore.QProcess
的用法示例。
在下文中一共展示了QProcess.kill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LineProfilerWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import kill [as 别名]
#.........这里部分代码省略.........
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_lineprofiler_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">line_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_lineprofiler_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(False)
if filename:
self.analyze(filename)
def show_log(self):
if self.output:
TextEditor(self.output, title=_("Line profiler output"),
readonly=True, size=(700, 500)).exec_()
def show_errorlog(self):
if self.error_output:
TextEditor(self.error_output, title=_("Line profiler output"),
readonly=True, size=(700, 500)).exec_()
示例2: PylintWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import kill [as 别名]
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)
self.show_data()
def analyze(self, filename):
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()
@Slot()
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)
#.........这里部分代码省略.........
示例3: ProfilerWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import kill [as 别名]
#.........这里部分代码省略.........
url = 'http://docs.python.org/library/profile.html'
text = '%s <a href=%s>%s</a>' % (_('Please install'), url,
_("the Python profiler modules"))
self.datelabel.setText(text)
else:
pass # self.show_data()
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):