Surface NMR processing and inversion GUI
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

callScript.py 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from PyQt5 import uic
  2. from PyQt5 import QtGui, QtCore
  3. from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication, QTextEdit, QApplication, QDialog
  4. def p(x):
  5. print (x)
  6. class callScript(QDialog):
  7. #def __init__(self):
  8. # super().__init__()
  9. def setupCB(self, akvoData, TxCoil, SaveStr):
  10. #QtGui.QWidget.__init__(self)
  11. #uic.loadUi('redirect.ui', self)
  12. print ('Connecting process')
  13. self.process = QtCore.QProcess(self)
  14. self.process.readyReadStandardOutput.connect(self.stdoutReady)
  15. self.process.readyReadStandardError.connect(self.stderrReady)
  16. self.process.started.connect(lambda: p('Started!'))
  17. self.process.finished.connect(lambda: p('Finished!'))
  18. print ('Starting process')
  19. self.process.start('python', ['calcAkvoKernel.py', akvoData, TxCoil, SaveStr])
  20. def append(self, text):
  21. cursor = self.ui.textEdit.textCursor()
  22. cursor.movePosition(cursor.End)
  23. cursor.insertText(text)
  24. self.ui.textEdit.ensureCursorVisible()
  25. #MyTextEdit.verticalScrollBar()->setValue(MyTextEdit.verticalScrollBar()->maximum());
  26. def stdoutReady(self):
  27. text = str(self.process.readAllStandardOutput(), encoding='utf-8')
  28. #print (text)
  29. self.append(text)
  30. def stderrReady(self):
  31. text = str(self.process.readAllStandardError())
  32. #print (text) #.strip())
  33. self.append(text)
  34. #def main():
  35. # import sys
  36. # app = QApplication(sys.argv)
  37. # win = MainWindow()
  38. # win.show()
  39. # sys.exit(app.exec_())
  40. #if __name__ == '__main__':
  41. # main()