From 5d796c76b796d65d1fd08812b6d038ba01bb001e Mon Sep 17 00:00:00 2001 From: Maximilian Siess Date: Tue, 18 Apr 2017 13:46:24 +0200 Subject: Alignment options added to render task --- video_thread.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'video_thread.py') diff --git a/video_thread.py b/video_thread.py index 9f4ce7b..2bd767c 100644 --- a/video_thread.py +++ b/video_thread.py @@ -18,14 +18,15 @@ class Worker(QtCore.QObject): self.core = core.Core() - @pyqtSlot(str, str, QtGui.QFont, str, str) - def createVideo(self, backgroundImage, titleText, titleFont, inputFile, outputFile): + @pyqtSlot(str, str, QtGui.QFont, str, str, str) + def createVideo(self, backgroundImage, titleText, titleFont, alignment, inputFile, outputFile): # print('worker thread id: {}'.format(QtCore.QThread.currentThreadId())) imBackground = self.core.drawBaseImage( backgroundImage, titleText, - titleFont) + titleFont, + alignment) self.progressBarUpdate.emit(0) -- cgit v1.2.3 From a170996259d2a135a0e559e0f674cf997e58769e Mon Sep 17 00:00:00 2001 From: Maximilian Siess Date: Thu, 20 Apr 2017 19:25:34 +0200 Subject: added font size and text position to video thread --- main.py | 5 ++++- video_thread.py | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'video_thread.py') diff --git a/main.py b/main.py index bc0a015..5808baa 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ class Main(QtCore.QObject): newTask = QtCore.pyqtSignal(str, str, QFont, int, str, int, int) processTask = QtCore.pyqtSignal() - videoTask = QtCore.pyqtSignal(str, str, QFont, str, str, str) + videoTask = QtCore.pyqtSignal(str, str, QFont, int, str, int, int, str, str) def __init__(self, window): @@ -134,7 +134,10 @@ class Main(QtCore.QObject): self.videoTask.emit(self.window.label_background.text(), self.window.lineEdit_title.text(), self.window.fontComboBox.currentFont(), + self.window.fontsizeSpinBox.value(), self.window.alignmentComboBox.currentText(), + self.window.textXSpinBox.value(), + self.window.textYSpinBox.value(), self.window.label_input.text(), self.window.label_output.text()) diff --git a/video_thread.py b/video_thread.py index 2bd767c..8f7c8d8 100644 --- a/video_thread.py +++ b/video_thread.py @@ -18,15 +18,18 @@ class Worker(QtCore.QObject): self.core = core.Core() - @pyqtSlot(str, str, QtGui.QFont, str, str, str) - def createVideo(self, backgroundImage, titleText, titleFont, alignment, inputFile, outputFile): + @pyqtSlot(str, str, QtGui.QFont, int, str, int, int, str, str) + def createVideo(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset, inputFile, outputFile): # print('worker thread id: {}'.format(QtCore.QThread.currentThreadId())) imBackground = self.core.drawBaseImage( backgroundImage, titleText, titleFont, - alignment) + fontSize, + alignment, + xOffset, + yOffset) self.progressBarUpdate.emit(0) -- cgit v1.2.3 From 4aef5bfdb7f04dde13b1c6a94172824ce143be6e Mon Sep 17 00:00:00 2001 From: Maximilian Siess Date: Fri, 21 Apr 2017 01:00:17 +0200 Subject: changed differentiater of text alignment from string to int --- core.py | 6 +++--- main.py | 8 ++++---- preview_thread.py | 2 +- video_thread.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'video_thread.py') diff --git a/core.py b/core.py index 1dd6438..b362087 100644 --- a/core.py +++ b/core.py @@ -52,11 +52,11 @@ class Core(): yPosition = yOffset fm = QtGui.QFontMetrics(font) - if alignment == "Left": + if alignment == 0: #Left xPosition = xOffset - if alignment == "Middle": + if alignment == 1: #Middle xPosition = xOffset - fm.width(titleText)/2 - if alignment == "Right": + if alignment == 2: #Right xPosition = xOffset - fm.width(titleText) painter.drawText(xPosition, yPosition, titleText) painter.end() diff --git a/main.py b/main.py index ae85f50..8c1d48d 100644 --- a/main.py +++ b/main.py @@ -14,9 +14,9 @@ import preview_thread, core, video_thread class Main(QtCore.QObject): - newTask = QtCore.pyqtSignal(str, str, QFont, int, str, int, int) + newTask = QtCore.pyqtSignal(str, str, QFont, int, int, int, int) processTask = QtCore.pyqtSignal() - videoTask = QtCore.pyqtSignal(str, str, QFont, int, str, int, int, str, str) + videoTask = QtCore.pyqtSignal(str, str, QFont, int, int, int, int, str, str) def __init__(self, window): @@ -153,7 +153,7 @@ class Main(QtCore.QObject): self.window.lineEdit_title.text(), self.window.fontComboBox.currentFont(), self.window.fontsizeSpinBox.value(), - self.window.alignmentComboBox.currentText(), + self.window.alignmentComboBox.currentIndex(), self.window.textXSpinBox.value(), self.window.textYSpinBox.value(), self.window.label_input.text(), @@ -172,7 +172,7 @@ class Main(QtCore.QObject): self.window.lineEdit_title.text(), self.window.fontComboBox.currentFont(), self.window.fontsizeSpinBox.value(), - self.window.alignmentComboBox.currentText(), + self.window.alignmentComboBox.currentIndex(), self.window.textXSpinBox.value(), self.window.textYSpinBox.value()) # self.processTask.emit() diff --git a/preview_thread.py b/preview_thread.py index 8f759be..9dc7e4c 100644 --- a/preview_thread.py +++ b/preview_thread.py @@ -19,7 +19,7 @@ class Worker(QtCore.QObject): self.queue = queue - @pyqtSlot(str, str, QtGui.QFont, int, str, int, int) + @pyqtSlot(str, str, QtGui.QFont, int, int, int, int) def createPreviewImage(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset): # print('worker thread id: {}'.format(QtCore.QThread.currentThreadId())) dic = { diff --git a/video_thread.py b/video_thread.py index 8f7c8d8..1d1d44b 100644 --- a/video_thread.py +++ b/video_thread.py @@ -18,7 +18,7 @@ class Worker(QtCore.QObject): self.core = core.Core() - @pyqtSlot(str, str, QtGui.QFont, int, str, int, int, str, str) + @pyqtSlot(str, str, QtGui.QFont, int, int, int, int, str, str) def createVideo(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset, inputFile, outputFile): # print('worker thread id: {}'.format(QtCore.QThread.currentThreadId())) -- cgit v1.2.3