Skip to content

Commit

Permalink
If this works windows is the worst os ever
Browse files Browse the repository at this point in the history
  • Loading branch information
natis1 committed Aug 1, 2020
1 parent 68e0d52 commit b756e37
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions qencoder/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from time import sleep
import psutil
from multiprocessing import Process, Queue
import threading

import pickle

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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))])
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b756e37

Please sign in to comment.