MCPcopy Index your code
hub / github.com/PyQt5/PyQt / __init__

Method __init__

QProcess/InteractiveRun.py:32–56  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

30class Window(QWidget):
31
32 def __init__(self, *args, **kwargs):
33 super(Window, self).__init__(*args, **kwargs)
34 layout = QVBoxLayout(self)
35
36 command = 'ping www.baidu.com'
37 if sys.platform.startswith('win'):
38 command = 'ping -n 5 www.baidu.com'
39 elif sys.platform.startswith('darwin') or sys.platform.startswith(
40 'linux'):
41 command = 'ping -c 5 www.baidu.com'
42 else:
43 raise RuntimeError('Unsupported platform: %s' % sys.platform)
44
45 self.cmdEdit = QLineEdit(command, self)
46 layout.addWidget(self.cmdEdit)
47
48 self.buttonRun = QPushButton('执行命令', self)
49 layout.addWidget(self.buttonRun)
50 self.buttonRun.clicked.connect(self.run_command)
51
52 self.resultView = QTextBrowser(self)
53 layout.addWidget(self.resultView)
54
55 self._cmdProcess = None
56 self._init()
57
58 def closeEvent(self, event):
59 if self._cmdProcess:

Callers

nothing calls this directly

Calls 2

_initMethod · 0.95
addWidgetMethod · 0.80

Tested by

no test coverage detected