Exemplo n.º 1
0
	def start(self):
		self.evaluate()
		if not self.evaluated:
			return

		self.bStart.setEnabled(False)
		command = str(self.teCmd.toPlainText())

		if len(command) == 0:
			return

		self.teCmd.clear()
		time.sleep(.1)
		self.process = QtCore.QProcess(self)
		self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
		QtCore.QObject.connect(
			self.process,
			QtCore.SIGNAL('finished( int)'),
			self.processfinished
		)
		QtCore.QObject.connect(
			self.process,
			QtCore.SIGNAL('readyRead()'),
			self.processoutput
		)
		self.output = ''
		self.process.start(command)
Exemplo n.º 2
0
 def execute(self):
     if not self.evaluated:
         return
     self.evaluate()
     self.command = str(self.cmdField.toPlainText())
     if len(self.command) == 0:
         return
     self.btnStart.setEnabled(False)
     self.btnStop.setEnabled(True)
     self.btnTest.setEnabled(False)
     self.cmdField.clear()
     self.process = QtCore.QProcess(self)
     self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
     QtCore.QObject.connect(self.process, QtCore.SIGNAL('finished( int)'),
                            self.processfinished)
     QtCore.QObject.connect(self.process, QtCore.SIGNAL('readyRead()'),
                            self.processoutput)
     self.process.start(self.command)
Exemplo n.º 3
0
	def __init__(self):
		QtGui.QWidget.__init__(self)

		self.setWindowTitle(sys.argv[0])

		layout = QtGui.QVBoxLayout(self)
		self.cmdField = QtGui.QTextEdit(self)
		self.cmdField.setReadOnly(True)
		layout.addWidget(self.cmdField)
		self.outputField = QtGui.QTextEdit(self)
		self.outputField.setReadOnly(True)
		layout.addWidget(self.outputField)

		command = ''
		for arg in sys.argv[1:]:
			if command != '':
				command += ' '
			command += '"%s"' % arg
		if sys.version_info[0] < 3:
			command = command.decode('utf-8')
		else:
			command = str(command, 'utf-8')
		self.cmdField.setText(command)

		arguments = []
		if sys.platform.find('win') == 0:
			shell = 'cmd.exe'
			arguments.append('/c')
		else:
			shell = '/bin/bash'
			arguments.append('-c')
		arguments.append(command)

		self.process = QtCore.QProcess(self)
		self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
		QtCore.QObject.connect(self.process,
							   QtCore.SIGNAL('finished( int)'),
							   self.processfinished)
		QtCore.QObject.connect(self.process,
							   QtCore.SIGNAL('readyRead()'),
							   self.processoutput)
		self.process.start(shell, arguments)