aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core.py12
-rw-r--r--main.py6
-rw-r--r--preview_thread.py6
3 files changed, 15 insertions, 9 deletions
diff --git a/core.py b/core.py
index 9ee4b71..1dd6438 100644
--- a/core.py
+++ b/core.py
@@ -26,7 +26,7 @@ class Core():
except:
return "avconv"
- def drawBaseImage(self, backgroundImage, titleText, titleFont, alignment, xOffset, yOffset):
+ def drawBaseImage(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset):
if self._image == None or not self.lastBackgroundImage == backgroundImage:
self.lastBackgroundImage = backgroundImage
@@ -45,19 +45,19 @@ class Core():
self._image1 = QtGui.QImage(self._image)
painter = QPainter(self._image1)
font = titleFont
- font.setPointSizeF(35)
+ font.setPointSizeF(fontSize)
painter.setFont(font)
painter.setPen(QColor(255, 255, 255))
- yPosition = 375 + yOffset
+ yPosition = yOffset
fm = QtGui.QFontMetrics(font)
if alignment == "Left":
- xPosition = 70 + xOffset
+ xPosition = xOffset
if alignment == "Middle":
- xPosition = xOffset + (1280/2 - fm.width(titleText)/2)
+ xPosition = xOffset - fm.width(titleText)/2
if alignment == "Right":
- xPosition = xOffset + (1210 - fm.width(titleText))
+ xPosition = xOffset - fm.width(titleText)
painter.drawText(xPosition, yPosition, titleText)
painter.end()
diff --git a/main.py b/main.py
index 64c17e2..bc0a015 100644
--- a/main.py
+++ b/main.py
@@ -14,7 +14,7 @@ import preview_thread, core, video_thread
class Main(QtCore.QObject):
- newTask = QtCore.pyqtSignal(str, str, QFont, str, int, int)
+ newTask = QtCore.pyqtSignal(str, str, QFont, int, str, int, int)
processTask = QtCore.pyqtSignal()
videoTask = QtCore.pyqtSignal(str, str, QFont, str, str, str)
@@ -52,6 +52,7 @@ class Main(QtCore.QObject):
window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
window.textXSpinBox.valueChanged.connect(self.drawPreview)
window.textYSpinBox.valueChanged.connect(self.drawPreview)
+ window.fontsizeSpinBox.valueChanged.connect(self.drawPreview)
window.progressBar_create.setValue(0)
window.setWindowTitle("Audio Visualizer")
@@ -70,6 +71,8 @@ class Main(QtCore.QObject):
window.alignmentComboBox.addItem("Left");
window.alignmentComboBox.addItem("Middle");
window.alignmentComboBox.addItem("Right");
+ window.textXSpinBox.setValue(70);
+ window.textYSpinBox.setValue(375);
titleFont = self.settings.value("titleFont")
if not titleFont == None:
@@ -147,6 +150,7 @@ class Main(QtCore.QObject):
self.newTask.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())
diff --git a/preview_thread.py b/preview_thread.py
index ddb5407..8f759be 100644
--- a/preview_thread.py
+++ b/preview_thread.py
@@ -19,13 +19,14 @@ class Worker(QtCore.QObject):
self.queue = queue
- @pyqtSlot(str, str, QtGui.QFont, str, int, int)
- def createPreviewImage(self, backgroundImage, titleText, titleFont, alignment, xOffset, yOffset):
+ @pyqtSlot(str, str, QtGui.QFont, int, str, int, int)
+ def createPreviewImage(self, backgroundImage, titleText, titleFont, fontSize, alignment, xOffset, yOffset):
# print('worker thread id: {}'.format(QtCore.QThread.currentThreadId()))
dic = {
"backgroundImage": backgroundImage,
"titleText": titleText,
"titleFont": titleFont,
+ "fontSize": fontSize,
"alignment": alignment,
"xoffset": xOffset,
"yoffset": yOffset
@@ -46,6 +47,7 @@ class Worker(QtCore.QObject):
nextPreviewInformation["backgroundImage"],
nextPreviewInformation["titleText"],
nextPreviewInformation["titleFont"],
+ nextPreviewInformation["fontSize"],
nextPreviewInformation["alignment"],
nextPreviewInformation["xoffset"],
nextPreviewInformation["yoffset"])