(self)
| 64 | super(Window, self).closeEvent(event) |
| 65 | |
| 66 | def _init(self): |
| 67 | if self._cmdProcess: |
| 68 | return |
| 69 | # 打开终端shell |
| 70 | self._cmdProcess = QProcess(self) |
| 71 | self._cmdProcess.setProgram( |
| 72 | 'cmd' if sys.platform.startswith('win') else 'bash') |
| 73 | # 合并输出流和错误流,只从标准输出流读取数据 |
| 74 | self._cmdProcess.setProcessChannelMode(QProcess.MergedChannels) |
| 75 | self._cmdProcess.started.connect(self.on_started) |
| 76 | self._cmdProcess.finished.connect(self.on_finished) |
| 77 | self._cmdProcess.errorOccurred.connect(self.on_error) |
| 78 | self._cmdProcess.readyReadStandardOutput.connect( |
| 79 | self.on_readyReadStandardOutput) |
| 80 | self._cmdProcess.start() |
| 81 | |
| 82 | def run_command(self): |
| 83 | self._init() |
no test coverage detected