From e0eed5bff4316910a93937d904f1a913f365a252 Mon Sep 17 00:00:00 2001 From: tassaron Date: Sun, 28 May 2017 14:19:28 -0400 Subject: title text is now a component plus numerous bugs removed and added --- components/original.py | 46 +++- components/text.py | 160 +++++++++---- core.py | 20 +- main.py | 115 +++------- main.ui | 602 +++++++++++++++++++++++++++++++++++++++++++++++++ preview_thread.py | 6 +- video_thread.py | 11 +- 7 files changed, 798 insertions(+), 162 deletions(-) create mode 100644 main.ui diff --git a/components/original.py b/components/original.py index d1caa7b..e901c21 100644 --- a/components/original.py +++ b/components/original.py @@ -1,13 +1,18 @@ ''' Original Audio Visualization ''' import numpy from PIL import Image, ImageDraw -from PyQt4 import uic +from PyQt4 import uic, QtGui +from PyQt4.QtGui import QColor import os, random class Component: - def widget(self,parent): + def __str__(self): + return __doc__ + + def widget(self, parent): self.parent = parent + self.visColor = (255,255,255) page = uic.loadUi(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'original.ui')) page.comboBox_visLayout.addItem("Classic") @@ -16,18 +21,24 @@ class Component: #visLayoutValue = int(self.settings.value('visLayout')) page.comboBox_visLayout.setCurrentIndex(0) page.comboBox_visLayout.currentIndexChanged.connect(self.update) - + page.lineEdit_visColor.setText('%s,%s,%s' % self.visColor) + page.pushButton_visColor.clicked.connect(lambda: self.pickColor()) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.visColor).name() + page.pushButton_visColor.setStyleSheet(btnStyle) + page.lineEdit_visColor.textChanged.connect(self.update) + self.page = page return page + def update(self): self.layout = self.page.comboBox_visLayout.currentIndex() - print(self.layout) + self.visColor = RGBFromString(self.page.lineEdit_visColor.text()) self.parent.drawPreview() - def previewRender(self, previewWorker, widget): + def previewRender(self, previewWorker): spectrum = numpy.fromfunction(lambda x: 0.008*(x-128)**2, (255,), dtype="int16") width = int(previewWorker.core.settings.value('outputWidth')) height = int(previewWorker.core.settings.value('outputHeight')) - return drawBars(width, height, spectrum, (255, 255, 255), self.layout) + return drawBars(width, height, spectrum, self.visColor, self.layout) def preFrameRender(self, **kwargs): for kwarg, value in kwargs.items(): @@ -41,7 +52,15 @@ class Component: self.smoothConstantDown, self.smoothConstantUp, self.lastSpectrum) width = int(self.worker.core.settings.value('outputWidth')) height = int(self.worker.core.settings.value('outputHeight')) - return drawBars(width, height, self.lastSpectrum, (255,255,255), self.layout) + return drawBars(width, height, self.lastSpectrum, self.visColor, self.layout) + + def pickColor(self): + color = QtGui.QColorDialog.getColor() + if color.isValid(): + RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue())) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name() + self.page.lineEdit_visColor.setText(RGBstring) + self.page.pushButton_visColor.setStyleSheet(btnStyle) def transformData(i, completeAudioArray, sampleSize, smoothConstantDown, smoothConstantUp, lastSpectrum): if len(completeAudioArray) < (i + sampleSize): @@ -111,3 +130,16 @@ def drawBars(width, height, spectrum, color, layout): im.paste(imTop, (0, y), mask=imTop) return im + +def RGBFromString(string): + ''' turns an RGB string like "255, 255, 255" into a tuple ''' + try: + tup = tuple([int(i) for i in string.split(',')]) + if len(tup) != 3: + raise ValueError + for i in tup: + if i > 255 or i < 0: + raise ValueError + return tup + except: + return (255, 255, 255) diff --git a/components/text.py b/components/text.py index 68b02fe..814e13f 100644 --- a/components/text.py +++ b/components/text.py @@ -1,59 +1,131 @@ ''' Title Text ''' -import numpy from PIL import Image, ImageDraw -from PyQt4 import uic -import os +from PyQt4.QtGui import QPainter, QColor, QFont +from PyQt4 import uic, QtGui, QtCore +from PIL.ImageQt import ImageQt +import os, io class Component: - def widget(self,parent): + def __str__(self): + return __doc__ + + def widget(self, parent): + height = int(parent.settings.value('outputHeight')) + width = int(parent.settings.value('outputWidth')) + self.parent = parent + self.textColor = (255,255,255) + self.title = 'Text' + self.titleFont = None + self.alignment = 1 + self.fontSize = height / 16 + self.xPosition = width / 2 + self.yPosition = height / 2 + page = uic.loadUi(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'text.ui')) + page.comboBox_textAlign.addItem("Left") + page.comboBox_textAlign.addItem("Middle") + page.comboBox_textAlign.addItem("Right") + page.comboBox_textAlign.setCurrentIndex(1) + + page.spinBox_fontSize.setValue(int(int(parent.settings.value("outputHeight")) / 14 )) + page.spinBox_xTextAlign.setValue(int(int(parent.settings.value('outputWidth'))/2)) + page.spinBox_yTextAlign.setValue(int(int(parent.settings.value('outputHeight'))/2)) + + page.lineEdit_textColor.setText('%s,%s,%s' % self.textColor) + page.pushButton_textColor.clicked.connect(lambda: self.pickColor()) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.textColor).name() + page.pushButton_textColor.setStyleSheet(btnStyle) + + page.lineEdit_title.setText(self.title) + if not self.titleFont == None: + page.fontComboBox_titleFont.setCurrentFont(QFont(self.titleFont)) + page.comboBox_textAlign.setCurrentIndex(int(self.alignment)) + page.spinBox_fontSize.setValue(int(self.fontSize)) + page.spinBox_xTextAlign.setValue(int(self.xPosition)) + page.spinBox_yTextAlign.setValue(int(self.yPosition)) + + page.fontComboBox_titleFont.currentFontChanged.connect(self.update) + page.lineEdit_title.textChanged.connect(self.update) + page.comboBox_textAlign.currentIndexChanged.connect(self.update) + page.spinBox_xTextAlign.valueChanged.connect(self.update) + page.spinBox_yTextAlign.valueChanged.connect(self.update) + page.spinBox_fontSize.valueChanged.connect(self.update) + page.lineEdit_textColor.textChanged.connect(self.update) + self.page = page return page - def previewRender(self, previewWorker, widget): + + def update(self): + self.title = self.page.lineEdit_title.text() + self.alignment = self.page.comboBox_textAlign.currentIndex() + self.titleFont = self.page.fontComboBox_titleFont.currentFont() + self.fontSize = self.page.spinBox_fontSize.value() + self.xPosition = self.page.spinBox_xTextAlign.value() + self.yPosition = self.page.spinBox_yTextAlign.value() + self.textColor = RGBFromString(self.page.lineEdit_textColor.text()) + self.parent.drawPreview() + + def previewRender(self, previewWorker): width = int(previewWorker.core.settings.value('outputWidth')) height = int(previewWorker.core.settings.value('outputHeight')) - im = Image.new("RGBA", (width, height),(0,0,0,0)) - - return im + return self.addText(width, height) def preFrameRender(self, **kwargs): - pass + for kwarg, value in kwargs.items(): + exec('self.%s = value' % kwarg) + def frameRender(self, moduleNo, frameNo): - width = int(previewWorker.core.settings.value('outputWidth')) - height = int(previewWorker.core.settings.value('outputHeight')) + width = int(self.worker.core.settings.value('outputWidth')) + height = int(self.worker.core.settings.value('outputHeight')) + return self.addText(width, height) + + def addText(self, width, height): im = Image.new("RGBA", (width, height),(0,0,0,0)) + image = ImageQt(im) + + image1 = QtGui.QImage(image) + painter = QPainter(image1) + self.titleFont.setPixelSize(self.fontSize) + painter.setFont(self.titleFont) + painter.setPen(QColor(*self.textColor)) - return im + fm = QtGui.QFontMetrics(self.titleFont) + if self.alignment == 0: #Left + self.xPosition = self.xPosition + if self.alignment == 1: #Middle + self.xPosition = self.xPosition - fm.width(self.title)/2 + if self.alignment == 2: #Right + self.xPosition = self.xPosition - fm.width(self.title) + painter.drawText(self.xPosition, self.yPosition, self.title) + painter.end() - ''' - self._image = ImageQt(im) - - self._image1 = QtGui.QImage(self._image) - painter = QPainter(self._image1) - font = titleFont - font.setPixelSize(fontSize) - painter.setFont(font) - painter.setPen(QColor(*textColor)) - - yPosition = yOffset - - fm = QtGui.QFontMetrics(font) - if alignment == 0: #Left - xPosition = xOffset - if alignment == 1: #Middle - xPosition = xOffset - fm.width(titleText)/2 - if alignment == 2: #Right - xPosition = xOffset - fm.width(titleText) - painter.drawText(xPosition, yPosition, titleText) - painter.end() - - buffer = QtCore.QBuffer() - buffer.open(QtCore.QIODevice.ReadWrite) - self._image1.save(buffer, "PNG") - - strio = io.BytesIO() - strio.write(buffer.data()) - buffer.close() - strio.seek(0) - return Image.open(strio) - ''' + buffer = QtCore.QBuffer() + buffer.open(QtCore.QIODevice.ReadWrite) + image1.save(buffer, "PNG") + + strio = io.BytesIO() + strio.write(buffer.data()) + buffer.close() + strio.seek(0) + return Image.open(strio) + + def pickColor(self): + color = QtGui.QColorDialog.getColor() + if color.isValid(): + RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue())) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name() + self.page.lineEdit_textColor.setText(RGBstring) + self.page.pushButton_textColor.setStyleSheet(btnStyle) + +def RGBFromString(string): + ''' turns an RGB string like "255, 255, 255" into a tuple ''' + try: + tup = tuple([int(i) for i in string.split(',')]) + if len(tup) != 3: + raise ValueError + for i in tup: + if i > 255 or i < 0: + raise ValueError + return tup + except: + return (255, 255, 255) diff --git a/core.py b/core.py index c8bfbca..5478f93 100644 --- a/core.py +++ b/core.py @@ -1,11 +1,9 @@ import sys, io, os from PyQt4 import QtCore, QtGui, uic -from PyQt4.QtGui import QPainter, QColor from os.path import expanduser import subprocess as sp import numpy -from PIL import Image, ImageDraw, ImageFont -from PIL.ImageQt import ImageQt +from PIL import Image import tempfile from shutil import rmtree import atexit @@ -34,7 +32,7 @@ class Core(): def parseBaseImage(self, backgroundImage, preview=False): ''' determines if the base image is a single frame or list of frames ''' if backgroundImage == "": - return [] + return [''] else: _, bgExt = os.path.splitext(backgroundImage) if not bgExt == '.mp4': @@ -112,17 +110,3 @@ class Core(): shell=True ) return sorted([os.path.join(self.tempDir, f) for f in os.listdir(self.tempDir)]) - - @staticmethod - def RGBFromString(string): - ''' turns an RGB string like "255, 255, 255" into a tuple ''' - try: - tup = tuple([int(i) for i in string.split(',')]) - if len(tup) != 3: - raise ValueError - for i in tup: - if i > 255 or i < 0: - raise ValueError - return tup - except: - return (255, 255, 255) diff --git a/main.py b/main.py index 77fc9cc..09d8e46 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,6 @@ import sys, io, os from PyQt4 import QtCore, QtGui, uic -from PyQt4.QtGui import QPainter, QColor, QFont from os.path import expanduser -import subprocess as sp -import numpy -from PIL import Image, ImageDraw, ImageFont -from PIL.ImageQt import ImageQt import atexit from queue import Queue from PyQt4.QtCore import QSettings @@ -14,9 +9,11 @@ from importlib import import_module import preview_thread, core, video_thread +# FIXME: commandline functionality broken until we decide how to implement it +''' class Command(QtCore.QObject): - videoTask = QtCore.pyqtSignal(str, str, QFont, int, int, int, int, tuple, tuple, str, str, list) + videoTask = QtCore.pyqtSignal(str, str, str, list) def __init__(self): QtCore.QObject.__init__(self) @@ -110,7 +107,7 @@ class Command(QtCore.QObject): self.settings.setValue("visColor", '%s,%s,%s' % self.visColor) self.settings.setValue("textColor", '%s,%s,%s' % self.textColor) sys.exit(0) - +''' class Main(QtCore.QObject): newTask = QtCore.pyqtSignal(str, list) @@ -127,10 +124,6 @@ class Main(QtCore.QObject): LoadDefaultSettings(self) self.pages = [] - - # load colors as tuples from a comma-separated string - self.textColor = core.Core.RGBFromString(self.settings.value("textColor", '255, 255, 255')) - self.visColor = core.Core.RGBFromString(self.settings.value("visColor", '255, 255, 255')) self.previewQueue = Queue() @@ -174,49 +167,10 @@ class Main(QtCore.QObject): window.comboBox_resolution.currentIndexChanged.connect(self.updateResolution) ''' - window.comboBox_textAlign.addItem("Left") - window.comboBox_textAlign.addItem("Middle") - window.comboBox_textAlign.addItem("Right") - window.comboBox_textAlign.setCurrentIndex(1) - - window.spinBox_fontSize.setValue(int(int(self.settings.value("outputHeight")) / 14 )) - window.spinBox_xTextAlign.setValue(int(int(self.settings.value('outputWidth'))/2)) - window.spinBox_yTextAlign.setValue(int(int(self.settings.value('outputHeight'))/2)) - - window.lineEdit_textColor.setText('%s,%s,%s' % self.textColor) window.lineEdit_visColor.setText('%s,%s,%s' % self.visColor) - window.pushButton_textColor.clicked.connect(lambda: self.pickColor('text')) window.pushButton_visColor.clicked.connect(lambda: self.pickColor('vis')) - btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.textColor).name() - window.pushButton_textColor.setStyleSheet(btnStyle) btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.visColor).name() window.pushButton_visColor.setStyleSheet(btnStyle) - - titleFont = self.settings.value("titleFont") - if not titleFont == None: - window.fontComboBox_titleFont.setCurrentFont(QFont(titleFont)) - - alignment = self.settings.value("alignment") - if not alignment == None: - window.comboBox_textAlign.setCurrentIndex(int(alignment)) - fontSize = self.settings.value("fontSize") - if not fontSize == None: - window.spinBox_fontSize.setValue(int(fontSize)) - xPosition = self.settings.value("xPosition") - if not xPosition == None: - window.spinBox_xTextAlign.setValue(int(xPosition)) - yPosition = self.settings.value("yPosition") - if not yPosition == None: - window.spinBox_yTextAlign.setValue(int(yPosition)) - - window.fontComboBox_titleFont.currentFontChanged.connect(self.drawPreview) - window.lineEdit_title.textChanged.connect(self.drawPreview) - window.comboBox_textAlign.currentIndexChanged.connect(self.drawPreview) - window.comboBox_visLayout.currentIndexChanged.connect(self.drawPreview) - window.spinBox_xTextAlign.valueChanged.connect(self.drawPreview) - window.spinBox_yTextAlign.valueChanged.connect(self.drawPreview) - window.spinBox_fontSize.valueChanged.connect(self.drawPreview) - window.lineEdit_textColor.textChanged.connect(self.drawPreview) window.lineEdit_visColor.textChanged.connect(self.drawPreview) ''' self.drawPreview() @@ -227,7 +181,8 @@ class Main(QtCore.QObject): self.timer.stop() self.previewThread.quit() self.previewThread.wait() - + # TODO: replace remembered settings with presets/projects + ''' self.settings.setValue("titleFont", self.window.fontComboBox_titleFont.currentFont().toString()) self.settings.setValue("alignment", str(self.window.comboBox_textAlign.currentIndex())) self.settings.setValue("fontSize", str(self.window.spinBox_fontSize.value())) @@ -235,6 +190,7 @@ class Main(QtCore.QObject): self.settings.setValue("yPosition", str(self.window.spinBox_yTextAlign.value())) self.settings.setValue("visColor", self.window.lineEdit_visColor.text()) self.settings.setValue("textColor", self.window.lineEdit_textColor.text()) + ''' def openInputFileDialog(self): inputDir = self.settings.value("inputDir", expanduser("~")) @@ -268,21 +224,26 @@ class Main(QtCore.QObject): self.drawPreview() def createAudioVisualisation(self): - ffmpeg_cmd = self.settings.value("ffmpeg_cmd", expanduser("~")) - - self.videoThread = QtCore.QThread(self) - self.videoWorker = video_thread.Worker(self) - - self.videoWorker.moveToThread(self.videoThread) - self.videoWorker.videoCreated.connect(self.videoCreated) - self.videoWorker.progressBarUpdate.connect(self.progressBarUpdated) - self.videoWorker.progressBarSetText.connect(self.progressBarSetText) - - self.videoThread.start() - self.videoTask.emit(self.window.lineEdit_background.text(), - self.window.lineEdit_audioFile.text(), - self.window.lineEdit_outputFile.text(), - self.selectedComponents) + # create output video if mandatory settings are filled in + if self.window.lineEdit_audioFile.text() and self.window.lineEdit_outputFile.text(): + ffmpeg_cmd = self.settings.value("ffmpeg_cmd", expanduser("~")) + + self.videoThread = QtCore.QThread(self) + self.videoWorker = video_thread.Worker(self) + + self.videoWorker.moveToThread(self.videoThread) + self.videoWorker.videoCreated.connect(self.videoCreated) + self.videoWorker.progressBarUpdate.connect(self.progressBarUpdated) + self.videoWorker.progressBarSetText.connect(self.progressBarSetText) + + self.videoThread.start() + self.videoTask.emit(self.window.lineEdit_background.text(), + self.window.lineEdit_audioFile.text(), + self.window.lineEdit_outputFile.text(), + self.selectedComponents) + else: + # TODO: use QMessageBox or similar to alert user that fields are empty + pass def progressBarUpdated(self, value): self.window.progressBar_createVideo.setValue(value) @@ -312,18 +273,6 @@ class Main(QtCore.QObject): self.window.label_previewContainer.setPixmap(self._previewPixmap) - def pickColor(self, colorTarget): - color = QtGui.QColorDialog.getColor() - if color.isValid(): - RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue())) - btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name() - if colorTarget == 'text': - self.window.lineEdit_textColor.setText(RGBstring) - window.pushButton_textColor.setStyleSheet(btnStyle) - elif colorTarget == 'vis': - self.window.lineEdit_visColor.setText(RGBstring) - window.pushButton_visColor.setStyleSheet(btnStyle) - def findComponents(self): def findComponents(): srcPath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'components') @@ -339,8 +288,7 @@ class Main(QtCore.QObject): def addComponent(self, moduleIndex): self.window.listWidget_componentList.addItem(self.modules[moduleIndex].__doc__) self.selectedComponents.append(self.modules[moduleIndex].Component()) - self.selectedComponents[-1].page = self.selectedComponents[-1].widget(self) - self.pages.append(self.selectedComponents[-1].page) + self.pages.append(self.selectedComponents[-1].widget(self)) self.window.stackedWidget.addWidget(self.pages[-1]) self.selectedComponents[-1].update() @@ -381,6 +329,8 @@ def LoadDefaultSettings(self): if self.settings.value(parm) == None: self.settings.setValue(parm,value) + +''' ####### commandline functionality broken until we decide how to implement it if len(sys.argv) > 1: # command line mode app = QtGui.QApplication(sys.argv, False) @@ -388,8 +338,9 @@ if len(sys.argv) > 1: signal.signal(signal.SIGINT, command.cleanUp) sys.exit(app.exec_()) else: - # gui mode - if __name__ == "__main__": +''' +# gui mode +if __name__ == "__main__": app = QtGui.QApplication(sys.argv) window = uic.loadUi("mainwindow.ui") # window.adjustSize() diff --git a/main.ui b/main.ui new file mode 100644 index 0000000..c2892c5 --- /dev/null +++ b/main.ui @@ -0,0 +1,602 @@ + + + MainWindow + + + + 0 + 0 + 635 + 600 + + + + + 0 + 0 + + + + + 635 + 600 + + + + MainWindow + + + + + 0 + 0 + + + + + + + + + + 0 + 0 + + + + + 0 + 200 + + + + + 16777215 + 16777215 + + + + GroupBox + + + + + + + + + + + 1 + 0 + + + + + 200 + 0 + + + + + 16777215 + 16777215 + + + + PushButton + + + + + + + + 2 + 0 + + + + QFrame::Box + + + + + + + + + + + + + + + 1 + 0 + + + + + 200 + 0 + + + + + 16777215 + 16777215 + + + + PushButton + + + + + + + + 2 + 0 + + + + QFrame::Box + + + + + + + + + + + + + + + 1 + 0 + + + + + 200 + 0 + + + + + 16777215 + 16777215 + + + + PushButton + + + + + + + + 2 + 0 + + + + QFrame::Box + + + + + + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 200 + 0 + + + + QFrame::NoFrame + + + + + + + + + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 200 + 0 + + + + QFrame::NoFrame + + + + + + + + + + + + + + + + + + + + + + 999 + + + + + + + Qt::LeftToRight + + + X + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + -99999 + + + 99999 + + + + + + + Y + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + -99999 + + + 99999 + + + + + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 200 + 0 + + + + QFrame::NoFrame + + + + + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 32 + 32 + + + + + + + + 32 + 32 + + + + + + + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 32 + 32 + + + + + + + + 32 + 32 + + + + + + + + + + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + 200 + 0 + + + + QFrame::NoFrame + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 220 + + + + + 16777215 + 220 + + + + GroupBox + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + 320 + 180 + + + + + 320 + 180 + + + + QFrame::Box + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + GroupBox + + + + + + + + 24 + + + Qt::AlignCenter + + + true + + + + + + + + 0 + 0 + + + + PushButton + + + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + + diff --git a/preview_thread.py b/preview_thread.py index 7a7e619..b20e9a1 100644 --- a/preview_thread.py +++ b/preview_thread.py @@ -55,11 +55,9 @@ class Worker(QtCore.QObject): frame = Image.new("RGBA", (width, height),(0,0,0,255)) frame.paste(im) - - componentWidgets = [self.stackedWidget.widget(i) for i in range(self.stackedWidget.count())] components = nextPreviewInformation["components"] - for component, componentWidget in zip(components, componentWidgets): - newFrame = Image.alpha_composite(frame,component.previewRender(self, componentWidget)) + for component in components: + newFrame = Image.alpha_composite(frame,component.previewRender(self)) frame = Image.alpha_composite(frame,newFrame) self._image = ImageQt(frame) diff --git a/video_thread.py b/video_thread.py index ccb2730..8bef6ef 100644 --- a/video_thread.py +++ b/video_thread.py @@ -76,19 +76,16 @@ class Worker(QtCore.QObject): stdin=sp.PIPE,stdout=sys.stdout, stderr=sys.stdout) # initialize components - componentWidgets = [self.stackedWidget.widget(i) for i in range(self.stackedWidget.count())] - print('######################## Data') - print(components) - print(componentWidgets) + print('loaded components: ', [str(component) for component in components]) sampleSize = 1470 - for component, widget in zip(components, componentWidgets): - component.preFrameRender(worker=self, widget=widget, completeAudioArray=completeAudioArray, sampleSize=sampleSize) + for component in components: + component.preFrameRender(worker=self, completeAudioArray=completeAudioArray, sampleSize=sampleSize) + # create video for output numpy.seterr(divide='ignore') frame = getBackgroundAtIndex(0) bgI = 0 - # create video for output for i in range(0, len(completeAudioArray), sampleSize): newFrame = Image.new("RGBA", (int(self.core.settings.value('outputWidth')), int(self.core.settings.value('outputHeight'))),(0,0,0,255)) -- cgit v1.2.3