From b756e376434a4e1a0bdd740228c2db89b47932f1 Mon Sep 17 00:00:00 2001 From: Eli Stone Date: Fri, 31 Jul 2020 19:49:50 -0600 Subject: [PATCH] If this works windows is the worst os ever --- qencoder/window.py | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/qencoder/window.py b/qencoder/window.py index 5d07881..d129183 100644 --- a/qencoder/window.py +++ b/qencoder/window.py @@ -17,6 +17,7 @@ from time import sleep import psutil from multiprocessing import Process, Queue +import threading import pickle @@ -821,6 +822,7 @@ def encodeVideo1(self): self.textEdit_audiocmd.setEnabled(0) self.textEdit_ffmpegcmd.setEnabled(0) self.currentlyRunning = True + self.pushButton.setEnabled(1) self.pushButton.setText("Cancel") self.pushButton_encQueue.setEnabled(0) self.pushButton_save.setEnabled(0) @@ -1006,7 +1008,13 @@ def finalizeEncode(self): self.enableDisableGoodSplit() print("Enabled all buttons, returning program to normal") -class AwfulWindowsWorkaround(Process): + +class EncodeWorker(QtCore.QObject): + updateStatusProgress = QtCore.pyqtSignal(str, int) + updateQueuedStatus = QtCore.pyqtSignal(str) + encodeFinished = QtCore.pyqtSignal(bool) + runningPav1n = False + def __init__(self, argdata, window, shutdown): super().__init__() self.argdat = argdata @@ -1022,7 +1030,7 @@ def runProcessing(self, dictargs): av1an.main_thread(self) print("\n\nEncode completed for " + str(dictargs['input_file']) + " -> " + str(dictargs['output_file'])) - def run(self): + def runInternal(self): print("Running") if (len(self.argdat) > 1): self.q.put([1, "Encoding video 1/" + str(len(self.argdat))]) @@ -1060,23 +1068,8 @@ def run(self): os.system("shutdown now -h") - -class EncodeWorker(QtCore.QObject): - updateStatusProgress = QtCore.pyqtSignal(str, int) - updateQueuedStatus = QtCore.pyqtSignal(str) - encodeFinished = QtCore.pyqtSignal(bool) - runningPav1n = False - - def __init__(self, argdata, window, shutdown): - super().__init__() - self.argdat = argdata - self.window = window - self.shutdown = shutdown - self.q = Queue() - self.istty = sys.stdin.isatty() - def run(self): - t = AwfulWindowsWorkaround(self.argdat, self.window, self.shutdown) + t = threading.Thread(target=self.runInternal) t.start() while (t.is_alive()): sleep(0.05)