I tried following the solution laid out in this question, but nothing seems to happen once the signal is supposed to be emitted.
This isn't all of the code, but it should be enough to demonstrate what I'm trying to do:
class StartQT5(QMainWindow):
def __init__(self):
super().__init__()
[...]
self.getFileProperties(path, batch)
def getFileProperties(self, path, batch):
self.thread = QThread()
self.w = probeThread(self)
self.w.moveToThread(self.thread)
self.w.finished[dict].connect(self.setProbeOutput)
self.thread.started.connect(self.w.run)
self.thread.start()
@pyqtSlot(dict)
def setProbeOutput(self, data):
print("gotOutput")
self.probeOutput = data
print(data)
class probeThread(QObject):
finished = pyqtSignal(dict)
def __init__(self, parent):
super().__init__()
self.parent = parent
self.output = {}
def run(self):
self.output = json.loads(subprocess.check_output('%s -v 0 -print_format json -show_format -show_streams -count_frames "%s"' % (self.parent.ffprobePath, self.parent.file)).decode("utf-8"))
print("finished")
self.finished.emit(self.output)
The thread runs fine, but setProbeOutput
never gets called. Sorry if this is something trivial, but I just can't seem to get it to work, thanks! :)