i want information in QPlainTextEdit() field. IN THIS CODE IF I RUN ITS ALWAYS STOP AND THEN HANG THE APPLICATION IF I REMOVE STDOUT=PIPE THEN IT WILL RUN PERFECT IN TERMINAL BUT I WANT THAT INFORMATION ON BUTTON CLICK EVENT.
import subprocess
class demo(QWidget)
def __init__(self):
QWidget.__init__(self)
self.program_output = QPlainTextEdit()
self.program_output.setReadOnly(True)
self.program_output.setCenterOnScroll(True)
self.decode_btn = ToggleButton('Decode')
self.decode_btn.clicked.connect(self.decode_scan)
@pyqtSlot(bool)
def decode_scan(self, checked):
print('Decoder Click')
self.decode_btn.setChecked(checked)
if checked:
self.process_timer.stop()
#self.pre_process()
print('About to run decoder:')
output = subprocess.Popen('./decoder', cwd='/mnt/encrypted_fs/scripts/decode', stdout=PIPE)
response = output.communicate()
print (response)
sleep(1)
self.process_timer.start()
else:
print('Decoder button not clicked')
if output:
subprocess.Popen(f'sudo kill -9 {self.info.pid+1}', shell=True).wait()
output = None