I have a program I am making for my dept at work that will make all of our lives easier. I would like to print to a TextEdit Field in real time (similar to console) but have had no luck. I think QThread is my solution but after watching many videos and attempting for a week I have made no progress.

Below is my abridged code (because it is long). I know the issue is that all the processes are being run in the GUI class, but I can not figure out how to split it up. Any guidance on the issue would be much appreciated.

Everywhere the is a print statement, I would like to replace with a self.textEdit.append

here is my abridged code:

Code:
from PyQt4 import QtCore, QtGui
import socket
from binascii import hexlify
import os
import sys, string, telnetlib, time
import csv, datetime, io
import urllib.request

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(595, 252)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.tabWidget = QtGui.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(0, 0, 591, 121))
        self.tabWidget.setTabPosition(QtGui.QTabWidget.North)
        self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
        self.tabWidget.setElideMode(QtCore.Qt.ElideNone)
        self.tabWidget.setUsesScrollButtons(True)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
.
.
.*Stuff in the tabs..
.
.
.

Code:
self.pushButtonRUN = QtGui.QPushButton(self.centralwidget)
        self.pushButtonRUN.setGeometry(QtCore.QRect(490, 130, 91, 21))
        self.pushButtonRUN.setObjectName(_fromUtf8("pushButtonRUN"))
        self.pushButtonRUN.clicked.connect(self.Run)#
        
        self.labelPATH = QtGui.QLabel(self.centralwidget)
        self.labelPATH.setGeometry(QtCore.QRect(10, 130, 91, 21))
        self.labelPATH.setObjectName(_fromUtf8("labelPATH"))
        
        self.linePATH = QtGui.QLineEdit(self.centralwidget)
        self.linePATH.setGeometry(QtCore.QRect(100, 130, 291, 21))
        self.linePATH.setObjectName(_fromUtf8("linePATH"))
        
        self.pushButtonPATH = QtGui.QPushButton(self.centralwidget)
        self.pushButtonPATH.setGeometry(QtCore.QRect(400, 130, 75, 21))
        self.pushButtonPATH.setObjectName(_fromUtf8("pushButtonPATH"))
        self.pushButtonPATH.clicked.connect(self.selectPath)#
        
        self.textEdit = QtGui.QTextEdit(self.centralwidget)
        self.textEdit.setGeometry(QtCore.QRect(20, 160, 551, 71))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
     
        MainWindow.setCentralWidget(self.centralwidget)
        
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        
        MainWindow.setStatusBar(self.statusbar)
        
        self.actionExit = QtGui.QAction(MainWindow)
        self.actionExit.setObjectName(_fromUtf8("actionExit"))

        self.retranslateUi(MainWindow)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
.
.
.*set labels and such*
.
Code:
def selectPath(self):
        self.filedialog = QtGui.QFileDialog()
        filepath = str(self.filedialog.getExistingDirectory())
        self.linePATH.setText(filepath)

def Run(self):
.
.
.*big if/elif statement for each tab performance... example of one below:*

Code:
        elif self.tabWidget.currentIndex() == 1 :
            print("Fetching AAA Data...")
            AAAIP = self.lineAAAIP.text()
            AAAport = self.lineAAAport.text()
            AAACMD = self.lineAAACMD.text()
            addressAAA = 'http://' + AAAIP + ':' + AAAport +'/' + AAACMD + '.csv'
            htmlMRC = urllib.request.urlopen(addressAAA).read()
            f = open(self.linePATH.text() + '/' + AAAIP + '-' + AAAport + '.csv', 'wb')
            f.write(htmlAAA)
            f.close()
            print('File saved to ' + self.linePATH.text() + ' as ' + AAAIP + '-' + AAAport + '.csv')
            self.textEdit.append(_translate("MainWindow", ">>> Download complete and Files saved to " + self.linePATH.text(), None))###
            print("Done.")
.
.

Code:
if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    MainWindow = QtGui.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    
    sys.exit(app.exec_())