本文整理汇总了Python中qtpy.QtCore.QProcess.state方法的典型用法代码示例。如果您正苦于以下问题:Python QProcess.state方法的具体用法?Python QProcess.state怎么用?Python QProcess.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtCore.QProcess
的用法示例。
在下文中一共展示了QProcess.state方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LineProfilerWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class LineProfilerWidget(QWidget):
"""
Line profiler widget.
"""
DATAPATH = get_conf_path('lineprofiler.results')
VERSION = '0.0.1'
redirect_stdio = Signal(bool)
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setWindowTitle("Line 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 by line"),
tip=_("Run line 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.filecombo.valid.connect(self.start_button.setEnabled)
#self.filecombo.valid.connect(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 = LineProfilerDataTree(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_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)
#.........这里部分代码省略.........
示例2: PylintWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [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: CondaProcess
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class CondaProcess(QObject):
"""Conda API modified to work with QProcess instead of popen."""
# Signals
sig_finished = Signal(str, object, str)
sig_partial = Signal(str, object, str)
sig_started = Signal()
ENCODING = "ascii"
ROOT_PREFIX = None
def __init__(self, parent):
QObject.__init__(self, parent)
self._parent = parent
self._output = None
self._partial = None
self._stdout = None
self._error = None
self._parse = False
self._function_called = ""
self._name = None
self._process = QProcess()
self.set_root_prefix()
# Signals
self._process.finished.connect(self._call_conda_ready)
self._process.readyReadStandardOutput.connect(self._call_conda_partial)
# --- Helpers
# -------------------------------------------------------------------------
def _is_running(self):
return self._process.state() != QProcess.NotRunning
def _is_not_running(self):
return self._process.state() == QProcess.NotRunning
def _call_conda_partial(self):
""" """
stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(stdout, CondaProcess.ENCODING)
stderr = self._process.readAllStandardError()
stderr = handle_qbytearray(stderr, CondaProcess.ENCODING)
if self._parse:
try:
self._output = json.loads(stdout)
except Exception:
# Result is a partial json. Can only be parsed when finished
self._output = stdout
else:
self._output = stdout
self._partial = self._output
self._stdout = self._output
self._error = stderr
self.sig_partial.emit(self._function_called, self._partial, self._error)
def _call_conda_ready(self):
"""Function called when QProcess in _call_conda finishes task."""
function = self._function_called
if self._stdout is None:
stdout = to_text_string(self._process.readAllStandardOutput(), encoding=CondaProcess.ENCODING)
else:
stdout = self._stdout
if self._error is None:
stderr = to_text_string(self._process.readAllStandardError(), encoding=CondaProcess.ENCODING)
else:
stderr = self._error
if function == "get_conda_version":
pat = re.compile(r"conda:?\s+(\d+\.\d\S+|unknown)")
m = pat.match(stderr.strip())
if m is None:
m = pat.match(stdout.strip())
if m is None:
raise Exception("output did not match: {0}".format(stderr))
self._output = m.group(1)
elif function == "config_path":
result = self._output
self._output = result["rc_path"]
elif function == "config_get":
result = self._output
self._output = result["get"]
elif (
function == "config_delete"
or function == "config_add"
or function == "config_set"
or function == "config_remove"
):
result = self._output
self._output = result.get("warnings", [])
elif function == "pip":
result = []
lines = self._output.split("\n")
for line in lines:
if "<pip>" in line:
#.........这里部分代码省略.........
示例4: ProfilerWidget
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
#.........这里部分代码省略.........
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
# profilers are included in the Python standard library
for widget in (self.datatree, self.filecombo,
self.start_button, self.stop_button):
widget.setDisabled(True)
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()
示例5: CondaProcess
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class CondaProcess(QObject):
"""Conda API modified to work with QProcess instead of popen."""
# Signals
sig_finished = Signal(str, object, str)
sig_partial = Signal(str, object, str)
sig_started = Signal()
ENCODING = 'ascii'
ROOT_PREFIX = None
def __init__(self, parent):
QObject.__init__(self, parent)
self._parent = parent
self._output = None
self._partial = None
self._stdout = None
self._error = None
self._parse = False
self._function_called = ''
self._name = None
self._process = QProcess()
self.set_root_prefix()
# Signals
self._process.finished.connect(self._call_conda_ready)
self._process.readyReadStandardOutput.connect(self._call_conda_partial)
# --- Helpers
# -------------------------------------------------------------------------
def _is_running(self):
return self._process.state() != QProcess.NotRunning
def _is_not_running(self):
return self._process.state() == QProcess.NotRunning
def _call_conda_partial(self):
""" """
stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(stdout, CondaProcess.ENCODING)
stderr = self._process.readAllStandardError()
stderr = handle_qbytearray(stderr, CondaProcess.ENCODING)
if self._parse:
try:
self._output = json.loads(stdout)
except Exception:
# Result is a partial json. Can only be parsed when finished
self._output = stdout
else:
self._output = stdout
self._partial = self._output
self._stdout = self._output
self._error = stderr
self.sig_partial.emit(self._function_called, self._partial,
self._error)
def _call_conda_ready(self):
"""Function called when QProcess in _call_conda finishes task."""
function = self._function_called
if self._stdout is None:
stdout = to_text_string(self._process.readAllStandardOutput(),
encoding=CondaProcess.ENCODING)
else:
stdout = self._stdout
if self._error is None:
stderr = to_text_string(self._process.readAllStandardError(),
encoding=CondaProcess.ENCODING)
else:
stderr = self._error
if function == 'get_conda_version':
pat = re.compile(r'conda:?\s+(\d+\.\d\S+|unknown)')
m = pat.match(stderr.strip())
if m is None:
m = pat.match(stdout.strip())
if m is None:
raise Exception('output did not match: {0}'.format(stderr))
self._output = m.group(1)
elif function == 'config_path':
result = self._output
self._output = result['rc_path']
elif function == 'config_get':
result = self._output
self._output = result['get']
elif (function == 'config_delete' or function == 'config_add' or
function == 'config_set' or function == 'config_remove'):
result = self._output
self._output = result.get('warnings', [])
elif function == 'pip':
result = []
lines = self._output.split('\n')
for line in lines:
if '<pip>' in line:
temp = line.split()[:-1] + ['pip']
#.........这里部分代码省略.........
示例6: ProcessWorker
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class ProcessWorker(QObject):
"""
"""
sig_finished = Signal(object, object, object)
sig_partial = Signal(object, object, object)
def __init__(self, cmd_list, parse=False, pip=False, callback=None,
extra_kwargs={}):
super(ProcessWorker, self).__init__()
self._result = None
self._cmd_list = cmd_list
self._parse = parse
self._pip = pip
self._conda = not pip
self._callback = callback
self._fired = False
self._communicate_first = False
self._partial_stdout = None
self._extra_kwargs = extra_kwargs
self._timer = QTimer()
self._process = QProcess()
self._timer.setInterval(50)
self._timer.timeout.connect(self._communicate)
self._process.finished.connect(self._communicate)
self._process.readyReadStandardOutput.connect(self._partial)
def _partial(self):
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, _CondaAPI.UTF8)
json_stdout = stdout.replace('\n\x00', '')
try:
json_stdout = json.loads(json_stdout)
except Exception:
json_stdout = stdout
if self._partial_stdout is None:
self._partial_stdout = stdout
else:
self._partial_stdout += stdout
self.sig_partial.emit(self, json_stdout, None)
def _communicate(self):
"""
"""
if not self._communicate_first:
if self._process.state() == QProcess.NotRunning:
self.communicate()
elif self._fired:
self._timer.stop()
def communicate(self):
"""
"""
self._communicate_first = True
self._process.waitForFinished()
if self._partial_stdout is None:
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, _CondaAPI.UTF8)
else:
stdout = self._partial_stdout
raw_stderr = self._process.readAllStandardError()
stderr = handle_qbytearray(raw_stderr, _CondaAPI.UTF8)
result = [stdout.encode(_CondaAPI.UTF8), stderr.encode(_CondaAPI.UTF8)]
# FIXME: Why does anaconda client print to stderr???
if PY2:
stderr = stderr.decode()
if 'using anaconda cloud api site' not in stderr.lower():
if stderr.strip() and self._conda:
raise Exception('{0}:\n'
'STDERR:\n{1}\nEND'
''.format(' '.join(self._cmd_list),
stderr))
# elif stderr.strip() and self._pip:
# raise PipError(self._cmd_list)
else:
result[-1] = ''
if self._parse and stdout:
try:
result = json.loads(stdout), result[-1]
except ValueError as error:
result = stdout, error
if 'error' in result[0]:
error = '{0}: {1}'.format(" ".join(self._cmd_list),
result[0]['error'])
result = result[0], error
if self._callback:
result = self._callback(result[0], result[-1],
**self._extra_kwargs), result[-1]
#.........这里部分代码省略.........
示例7: ProcessWorker
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class ProcessWorker(QObject):
"""Conda worker based on a QProcess for non blocking UI."""
sig_finished = Signal(object, object, object)
sig_partial = Signal(object, object, object)
def __init__(self, cmd_list, parse=False, pip=False, callback=None,
extra_kwargs=None):
"""Conda worker based on a QProcess for non blocking UI.
Parameters
----------
cmd_list : list of str
Command line arguments to execute.
parse : bool (optional)
Parse json from output.
pip : bool (optional)
Define as a pip command.
callback : func (optional)
If the process has a callback to process output from comd_list.
extra_kwargs : dict
Arguments for the callback.
"""
super(ProcessWorker, self).__init__()
self._result = None
self._cmd_list = cmd_list
self._parse = parse
self._pip = pip
self._conda = not pip
self._callback = callback
self._fired = False
self._communicate_first = False
self._partial_stdout = None
self._extra_kwargs = extra_kwargs if extra_kwargs else {}
self._timer = QTimer()
self._process = QProcess()
self._timer.setInterval(150)
self._timer.timeout.connect(self._communicate)
# self._process.finished.connect(self._communicate)
self._process.readyReadStandardOutput.connect(self._partial)
def _partial(self):
"""Callback for partial output."""
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, _CondaAPI.UTF8)
json_stdout = stdout.replace('\n\x00', '')
try:
json_stdout = json.loads(json_stdout)
except Exception:
json_stdout = stdout
if self._partial_stdout is None:
self._partial_stdout = stdout
else:
self._partial_stdout += stdout
self.sig_partial.emit(self, json_stdout, None)
def _communicate(self):
"""Callback for communicate."""
if (not self._communicate_first and
self._process.state() == QProcess.NotRunning):
self.communicate()
elif self._fired:
self._timer.stop()
def communicate(self):
"""Retrieve information."""
self._communicate_first = True
self._process.waitForFinished()
if self._partial_stdout is None:
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, _CondaAPI.UTF8)
else:
stdout = self._partial_stdout
raw_stderr = self._process.readAllStandardError()
stderr = handle_qbytearray(raw_stderr, _CondaAPI.UTF8)
result = [stdout.encode(_CondaAPI.UTF8), stderr.encode(_CondaAPI.UTF8)]
# FIXME: Why does anaconda client print to stderr???
if PY2:
stderr = stderr.decode()
if 'using anaconda' not in stderr.lower():
if stderr.strip() and self._conda:
logger.error('{0}:\nSTDERR:\n{1}\nEND'.format(
' '.join(self._cmd_list), stderr))
elif stderr.strip() and self._pip:
logger.error("pip error: {}".format(self._cmd_list))
result[-1] = ''
if self._parse and stdout:
try:
result = json.loads(stdout), result[-1]
except Exception as error:
#.........这里部分代码省略.........
示例8: CondaProcess
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
#.........这里部分代码省略.........
if ROOT_PREFIX is None:
# qprocess = QProcess()
# cmd_list = ['conda', 'info', '--json']
# qprocess.start(cmd_list[0], cmd_list[1:])
# qprocess.waitForFinished()
# output = qprocess.readAllStandardOutput()
# output = handle_qbytearray(output, CondaProcess.ENCODING)
# info = json.loads(output)
# ROOT_PREFIX = info['root_prefix']
info = self.info(abspath=False)
ROOT_PREFIX = info['root_prefix']
def get_conda_version(self):
"""
return the version of conda being used (invoked) as a string
"""
# pat = re.compile(r'conda:?\s+(\d+\.\d\S+|unknown)')
# stdout, stderr = self._call_conda(['--version'])
# # argparse outputs version to stderr in Python < 3.4.
# # http://bugs.python.org/issue18920
# m = pat.match(stderr.decode().strip())
# if m is None:
# m = pat.match(stdout.decode().strip())
#
# if m is None:
# raise Exception('output did not match: %r' % stderr)
# return m.group(1)
# adapted code
# ------------
if self._process.state() == QProcess.NotRunning:
self._function_called = 'get_conda_version'
self._call_conda(['--version'])
def get_envs(self):
"""
Return all of the (named) environment (this does not include the root
environment), as a list of absolute path to their prefixes.
"""
# info = self._call_and_parse(['info', '--json'])
# return info['envs']
info = self.info()
return info['envs']
# adapted code
# ------------
# if self._process.state() == QProcess.NotRunning:
# self._function_called = 'get_envs'
# self._call_and_parse(['info', '--json'])
def get_prefix_envname(self, name):
"""
Given the name of an environment return its full prefix path, or None
if it cannot be found.
"""
if name == 'root':
return ROOT_PREFIX
for prefix in self.get_envs():
if basename(prefix) == name:
return prefix
return None
示例9: ProcessWorker
# 需要导入模块: from qtpy.QtCore import QProcess [as 别名]
# 或者: from qtpy.QtCore.QProcess import state [as 别名]
class ProcessWorker(QObject):
"""Process worker based on a QProcess for non blocking UI."""
sig_started = Signal(object)
sig_finished = Signal(object, object, object)
sig_partial = Signal(object, object, object)
def __init__(self, cmd_list, environ=None):
"""
Process worker based on a QProcess for non blocking UI.
Parameters
----------
cmd_list : list of str
Command line arguments to execute.
environ : dict
Process environment,
"""
super(ProcessWorker, self).__init__()
self._result = None
self._cmd_list = cmd_list
self._fired = False
self._communicate_first = False
self._partial_stdout = None
self._started = False
self._timer = QTimer()
self._process = QProcess()
self._set_environment(environ)
self._timer.setInterval(150)
self._timer.timeout.connect(self._communicate)
self._process.readyReadStandardOutput.connect(self._partial)
def _get_encoding(self):
"""Return the encoding/codepage to use."""
enco = 'utf-8'
# Currently only cp1252 is allowed?
if WIN:
import ctypes
codepage = to_text_string(ctypes.cdll.kernel32.GetACP())
# import locale
# locale.getpreferredencoding() # Differences?
enco = 'cp' + codepage
return enco
def _set_environment(self, environ):
"""Set the environment on the QProcess."""
if environ:
q_environ = self._process.processEnvironment()
for k, v in environ.items():
q_environ.insert(k, v)
self._process.setProcessEnvironment(q_environ)
def _partial(self):
"""Callback for partial output."""
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, self._get_encoding())
if self._partial_stdout is None:
self._partial_stdout = stdout
else:
self._partial_stdout += stdout
self.sig_partial.emit(self, stdout, None)
def _communicate(self):
"""Callback for communicate."""
if (not self._communicate_first and
self._process.state() == QProcess.NotRunning):
self.communicate()
elif self._fired:
self._timer.stop()
def communicate(self):
"""Retrieve information."""
self._communicate_first = True
self._process.waitForFinished()
enco = self._get_encoding()
if self._partial_stdout is None:
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, enco)
else:
stdout = self._partial_stdout
raw_stderr = self._process.readAllStandardError()
stderr = handle_qbytearray(raw_stderr, enco)
result = [stdout.encode(enco), stderr.encode(enco)]
if PY2:
stderr = stderr.decode()
result[-1] = ''
self._result = result
if not self._fired:
self.sig_finished.emit(self, result[0], result[-1])
#.........这里部分代码省略.........