From c772bf5583dec23513371392ca6d2018518483cb Mon Sep 17 00:00:00 2001
From: Maximilian SiessÂ
Date: Tue, 18 Apr 2017 13:35:29 +0200
Subject: Added text alignment option
---
.core.py.swp | Bin 0 -> 20480 bytes
.main.py.swp | Bin 0 -> 20480 bytes
.main.ui.swp | Bin 0 -> 24576 bytes
.preview_thread.py.swp | Bin 0 -> 12288 bytes
core.py | 10 ++++++++--
main.py | 11 +++++++++--
main.ui | 35 +++++++++++++++++++++++++++++++++++
preview_thread.py | 10 ++++++----
8 files changed, 58 insertions(+), 8 deletions(-)
create mode 100644 .core.py.swp
create mode 100644 .main.py.swp
create mode 100644 .main.ui.swp
create mode 100644 .preview_thread.py.swp
diff --git a/.core.py.swp b/.core.py.swp
new file mode 100644
index 0000000..76e8645
Binary files /dev/null and b/.core.py.swp differ
diff --git a/.main.py.swp b/.main.py.swp
new file mode 100644
index 0000000..4705a19
Binary files /dev/null and b/.main.py.swp differ
diff --git a/.main.ui.swp b/.main.ui.swp
new file mode 100644
index 0000000..bd61a94
Binary files /dev/null and b/.main.ui.swp differ
diff --git a/.preview_thread.py.swp b/.preview_thread.py.swp
new file mode 100644
index 0000000..5d323a4
Binary files /dev/null and b/.preview_thread.py.swp differ
diff --git a/core.py b/core.py
index 895d1a9..6bd533d 100644
--- a/core.py
+++ b/core.py
@@ -26,7 +26,7 @@ class Core():
except:
return "avconv"
- def drawBaseImage(self, backgroundImage, titleText, titleFont):
+ def drawBaseImage(self, backgroundImage, titleText, titleFont, alignment):
if self._image == None or not self.lastBackgroundImage == backgroundImage:
self.lastBackgroundImage = backgroundImage
@@ -49,7 +49,13 @@ class Core():
painter.setFont(font)
painter.setPen(QColor(255, 255, 255))
- painter.drawText(70, 375, titleText)
+ fm = QtGui.QFontMetrics(font)
+ if alignment == "Left":
+ painter.drawText(70, 375, titleText)
+ if alignment == "Middle":
+ painter.drawText(1280/2 - fm.width(titleText)/2, 375, titleText)
+ if alignment == "Right":
+ painter.drawText(1210 - fm.width(titleText), 375, titleText)
painter.end()
buffer = QtCore.QBuffer()
diff --git a/main.py b/main.py
index 03e0f02..f71bbf2 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)
+ newTask = QtCore.pyqtSignal(str, str, QFont, str)
processTask = QtCore.pyqtSignal()
videoTask = QtCore.pyqtSignal(str, str, QFont, str, str)
@@ -49,6 +49,7 @@ class Main(QtCore.QObject):
window.fontComboBox.currentFontChanged.connect(self.drawPreview)
window.lineEdit_title.textChanged.connect(self.drawPreview)
+ window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
window.progressBar_create.setValue(0)
window.setWindowTitle("Audio Visualizer")
@@ -56,12 +57,17 @@ class Main(QtCore.QObject):
window.pushButton_selectOutput.setText("Select Output Video File")
window.pushButton_selectBackground.setText("Select Background Image")
window.label_font.setText("Title Font")
+ window.label_alignment.setText("Alignment")
window.label_title.setText("Title Text")
window.pushButton_createVideo.setText("Create Video")
window.groupBox_create.setTitle("Create")
window.groupBox_settings.setTitle("Settings")
window.groupBox_preview.setTitle("Preview")
+ window.alignmentComboBox.addItem("Left");
+ window.alignmentComboBox.addItem("Middle");
+ window.alignmentComboBox.addItem("Right");
+
titleFont = self.settings.value("titleFont")
if not titleFont == None:
window.fontComboBox.setCurrentFont(QFont(titleFont))
@@ -136,7 +142,8 @@ class Main(QtCore.QObject):
def drawPreview(self):
self.newTask.emit(self.window.label_background.text(),
self.window.lineEdit_title.text(),
- self.window.fontComboBox.currentFont())
+ self.window.fontComboBox.currentFont(),
+ self.window.alignmentComboBox.currentText())
# self.processTask.emit()
def showPreviewImage(self, image):
diff --git a/main.ui b/main.ui
index f9e79c3..ad0f280 100644
--- a/main.ui
+++ b/main.ui
@@ -171,6 +171,41 @@
+ -
+
+
-
+
+
+
+ 200
+ 0
+
+
+
+
+ 200
+ 16777215
+
+
+
+
+ 200
+ 0
+
+
+
+ QFrame::NoFrame
+
+
+
+
+
+
+ -
+
+
+
+
-
-
diff --git a/preview_thread.py b/preview_thread.py
index 740f6c6..53bb608 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)
- def createPreviewImage(self, backgroundImage, titleText, titleFont):
+ @pyqtSlot(str, str, QtGui.QFont, str)
+ def createPreviewImage(self, backgroundImage, titleText, titleFont, alignment):
# print('worker thread id: {}'.format(QtCore.QThread.currentThreadId()))
dic = {
"backgroundImage": backgroundImage,
"titleText": titleText,
- "titleFont": titleFont
+ "titleFont": titleFont,
+ "alignment": alignment
}
self.queue.put(dic)
@@ -42,7 +43,8 @@ class Worker(QtCore.QObject):
im = self.core.drawBaseImage(
nextPreviewInformation["backgroundImage"],
nextPreviewInformation["titleText"],
- nextPreviewInformation["titleFont"])
+ nextPreviewInformation["titleFont"],
+ nextPreviewInformation["alignment"])
spectrum = numpy.fromfunction(lambda x: 0.008*(x-128)**2, (255,), dtype="int16")
--
cgit v1.2.3
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
---
.main.py.swp | Bin 20480 -> 20480 bytes
.main.ui.swp | Bin 24576 -> 0 bytes
.video_thread.py.swp | Bin 0 -> 12288 bytes
main.py | 3 ++-
video_thread.py | 7 ++++---
5 files changed, 6 insertions(+), 4 deletions(-)
delete mode 100644 .main.ui.swp
create mode 100644 .video_thread.py.swp
diff --git a/.main.py.swp b/.main.py.swp
index 4705a19..e57f30f 100644
Binary files a/.main.py.swp and b/.main.py.swp differ
diff --git a/.main.ui.swp b/.main.ui.swp
deleted file mode 100644
index bd61a94..0000000
Binary files a/.main.ui.swp and /dev/null differ
diff --git a/.video_thread.py.swp b/.video_thread.py.swp
new file mode 100644
index 0000000..12dd93f
Binary files /dev/null and b/.video_thread.py.swp differ
diff --git a/main.py b/main.py
index f71bbf2..40c1650 100644
--- a/main.py
+++ b/main.py
@@ -16,7 +16,7 @@ class Main(QtCore.QObject):
newTask = QtCore.pyqtSignal(str, str, QFont, str)
processTask = QtCore.pyqtSignal()
- videoTask = QtCore.pyqtSignal(str, str, QFont, str, str)
+ videoTask = QtCore.pyqtSignal(str, str, QFont, str, str, str)
def __init__(self, window):
@@ -128,6 +128,7 @@ class Main(QtCore.QObject):
self.videoTask.emit(self.window.label_background.text(),
self.window.lineEdit_title.text(),
self.window.fontComboBox.currentFont(),
+ self.window.alignmentComboBox.currentText(),
self.window.label_input.text(),
self.window.label_output.text())
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 ec502ce7e5fe126b0174968394bebd79142f517d Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Tue, 18 Apr 2017 13:56:31 +0200
Subject: Matched the label to the naming scheme
---
main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.py b/main.py
index 40c1650..a7952a4 100644
--- a/main.py
+++ b/main.py
@@ -57,7 +57,7 @@ class Main(QtCore.QObject):
window.pushButton_selectOutput.setText("Select Output Video File")
window.pushButton_selectBackground.setText("Select Background Image")
window.label_font.setText("Title Font")
- window.label_alignment.setText("Alignment")
+ window.label_alignment.setText("Title Alignment")
window.label_title.setText("Title Text")
window.pushButton_createVideo.setText("Create Video")
window.groupBox_create.setTitle("Create")
--
cgit v1.2.3
From 153ba9123196c0457d8773d4b2a1a5f86ea4c2ab Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 18:26:54 +0200
Subject: added fontsize and position option to UI
---
.main.py.swo | Bin 0 -> 16384 bytes
main.py | 3 ++-
main.ui | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 70 insertions(+), 4 deletions(-)
create mode 100644 .main.py.swo
diff --git a/.main.py.swo b/.main.py.swo
new file mode 100644
index 0000000..6971350
Binary files /dev/null and b/.main.py.swo differ
diff --git a/main.py b/main.py
index a7952a4..6e9358b 100644
--- a/main.py
+++ b/main.py
@@ -57,7 +57,8 @@ class Main(QtCore.QObject):
window.pushButton_selectOutput.setText("Select Output Video File")
window.pushButton_selectBackground.setText("Select Background Image")
window.label_font.setText("Title Font")
- window.label_alignment.setText("Title Alignment")
+ window.label_alignment.setText("Title Options")
+ window.label_fontsize.setText("Fontsize")
window.label_title.setText("Title Text")
window.pushButton_createVideo.setText("Create Video")
window.groupBox_create.setTitle("Create")
diff --git a/main.ui b/main.ui
index ad0f280..5b71d1c 100644
--- a/main.ui
+++ b/main.ui
@@ -202,7 +202,74 @@
-
-
+
+
-
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ 999
+
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ X
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ -99999
+
+
+ 99999
+
+
+
+ -
+
+
+ Y
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ -99999
+
+
+ 99999
+
+
+
+
@@ -244,8 +311,6 @@
- verticalLayoutWidget_2
- layoutWidget_2
-
--
cgit v1.2.3
From f639760ffc8f3152b46c32a881303a7522b8daca Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 18:47:14 +0200
Subject: added x/y offset of text in preview
---
core.py | 11 +++++++----
main.py | 8 ++++++--
preview_thread.py | 12 ++++++++----
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/core.py b/core.py
index 6bd533d..9ee4b71 100644
--- a/core.py
+++ b/core.py
@@ -26,7 +26,7 @@ class Core():
except:
return "avconv"
- def drawBaseImage(self, backgroundImage, titleText, titleFont, alignment):
+ def drawBaseImage(self, backgroundImage, titleText, titleFont, alignment, xOffset, yOffset):
if self._image == None or not self.lastBackgroundImage == backgroundImage:
self.lastBackgroundImage = backgroundImage
@@ -49,13 +49,16 @@ class Core():
painter.setFont(font)
painter.setPen(QColor(255, 255, 255))
+ yPosition = 375 + yOffset
+
fm = QtGui.QFontMetrics(font)
if alignment == "Left":
- painter.drawText(70, 375, titleText)
+ xPosition = 70 + xOffset
if alignment == "Middle":
- painter.drawText(1280/2 - fm.width(titleText)/2, 375, titleText)
+ xPosition = xOffset + (1280/2 - fm.width(titleText)/2)
if alignment == "Right":
- painter.drawText(1210 - fm.width(titleText), 375, titleText)
+ xPosition = xOffset + (1210 - fm.width(titleText))
+ painter.drawText(xPosition, yPosition, titleText)
painter.end()
buffer = QtCore.QBuffer()
diff --git a/main.py b/main.py
index 6e9358b..64c17e2 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)
+ newTask = QtCore.pyqtSignal(str, str, QFont, str, int, int)
processTask = QtCore.pyqtSignal()
videoTask = QtCore.pyqtSignal(str, str, QFont, str, str, str)
@@ -50,6 +50,8 @@ class Main(QtCore.QObject):
window.fontComboBox.currentFontChanged.connect(self.drawPreview)
window.lineEdit_title.textChanged.connect(self.drawPreview)
window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
+ window.textXSpinBox.valueChanged.connect(self.drawPreview)
+ window.textYSpinBox.valueChanged.connect(self.drawPreview)
window.progressBar_create.setValue(0)
window.setWindowTitle("Audio Visualizer")
@@ -145,7 +147,9 @@ class Main(QtCore.QObject):
self.newTask.emit(self.window.label_background.text(),
self.window.lineEdit_title.text(),
self.window.fontComboBox.currentFont(),
- self.window.alignmentComboBox.currentText())
+ self.window.alignmentComboBox.currentText(),
+ self.window.textXSpinBox.value(),
+ self.window.textYSpinBox.value())
# self.processTask.emit()
def showPreviewImage(self, image):
diff --git a/preview_thread.py b/preview_thread.py
index 53bb608..ddb5407 100644
--- a/preview_thread.py
+++ b/preview_thread.py
@@ -19,14 +19,16 @@ class Worker(QtCore.QObject):
self.queue = queue
- @pyqtSlot(str, str, QtGui.QFont, str)
- def createPreviewImage(self, backgroundImage, titleText, titleFont, alignment):
+ @pyqtSlot(str, str, QtGui.QFont, str, int, int)
+ def createPreviewImage(self, backgroundImage, titleText, titleFont, alignment, xOffset, yOffset):
# print('worker thread id: {}'.format(QtCore.QThread.currentThreadId()))
dic = {
"backgroundImage": backgroundImage,
"titleText": titleText,
"titleFont": titleFont,
- "alignment": alignment
+ "alignment": alignment,
+ "xoffset": xOffset,
+ "yoffset": yOffset
}
self.queue.put(dic)
@@ -44,7 +46,9 @@ class Worker(QtCore.QObject):
nextPreviewInformation["backgroundImage"],
nextPreviewInformation["titleText"],
nextPreviewInformation["titleFont"],
- nextPreviewInformation["alignment"])
+ nextPreviewInformation["alignment"],
+ nextPreviewInformation["xoffset"],
+ nextPreviewInformation["yoffset"])
spectrum = numpy.fromfunction(lambda x: 0.008*(x-128)**2, (255,), dtype="int16")
--
cgit v1.2.3
From 8423d958201f0230f4c4887a4b75f14f54a2161a Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 19:01:19 +0200
Subject: added font size of text in preview
---
core.py | 12 ++++++------
main.py | 6 +++++-
preview_thread.py | 6 ++++--
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"])
--
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(-)
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 ca789ce766aca702cfe5a49d2e14ef6ef15535d5 Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 19:48:51 +0200
Subject: all options are saved to and loaded from settings.ini
---
main.py | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/main.py b/main.py
index 5808baa..f485601 100644
--- a/main.py
+++ b/main.py
@@ -68,16 +68,30 @@ class Main(QtCore.QObject):
window.groupBox_settings.setTitle("Settings")
window.groupBox_preview.setTitle("Preview")
- window.alignmentComboBox.addItem("Left");
- window.alignmentComboBox.addItem("Middle");
- window.alignmentComboBox.addItem("Right");
- window.textXSpinBox.setValue(70);
- window.textYSpinBox.setValue(375);
+ window.alignmentComboBox.addItem("Left")
+ window.alignmentComboBox.addItem("Middle"
+ window.alignmentComboBox.addItem("Right")
+ window.fontsizeSpinBox.setValue(35)
+ window.textXSpinBox.setValue(70)
+ window.textYSpinBox.setValue(375)
titleFont = self.settings.value("titleFont")
if not titleFont == None:
window.fontComboBox.setCurrentFont(QFont(titleFont))
+ alignment = self.settings.value("alignment")
+ if not alignment == None:
+ window.alignmentComboBox.setCurrentIndex(int(alignment))
+ fontSize = self.settings.value("fontSize")
+ if not fontSize == None:
+ window.fontsizeSpinBox.setValue(int(fontSize))
+ xPosition = self.settings.value("xPosition")
+ if not xPosition == None:
+ window.textXSpinBox.setValue(int(xPosition))
+ yPosition = self.settings.value("yPosition")
+ if not yPosition == None:
+ window.textYSpinBox.setValue(int(yPosition))
+
self.drawPreview()
window.show()
@@ -88,6 +102,10 @@ class Main(QtCore.QObject):
self.previewThread.wait()
self.settings.setValue("titleFont", self.window.fontComboBox.currentFont().toString())
+ self.settings.setValue("alignment", str(self.window.alignmentComboBox.currentIndex()))
+ self.settings.setValue("fontSize", str(self.window.fontsizeSpinBox.value()))
+ self.settings.setValue("xPosition", str(self.window.textXSpinBox.value()))
+ self.settings.setValue("yPosition", str(self.window.textYSpinBox.value()))
def openInputFileDialog(self):
inputDir = self.settings.value("inputDir", expanduser("~"))
--
cgit v1.2.3
From 81a20cd2e3a43eba302d486ec3793541ba1e3ad7 Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 20:21:11 +0200
Subject: clean up
---
main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.py b/main.py
index f485601..ae85f50 100644
--- a/main.py
+++ b/main.py
@@ -69,7 +69,7 @@ class Main(QtCore.QObject):
window.groupBox_preview.setTitle("Preview")
window.alignmentComboBox.addItem("Left")
- window.alignmentComboBox.addItem("Middle"
+ window.alignmentComboBox.addItem("Middle")
window.alignmentComboBox.addItem("Right")
window.fontsizeSpinBox.setValue(35)
window.textXSpinBox.setValue(70)
--
cgit v1.2.3
From 018f5900f0703ad8a2a962d076ac291b0805657d Mon Sep 17 00:00:00 2001
From: Maximilian Siess
Date: Thu, 20 Apr 2017 20:22:28 +0200
Subject: cleanup
---
.core.py.swp | Bin 20480 -> 0 bytes
.main.py.swo | Bin 16384 -> 0 bytes
.main.py.swp | Bin 20480 -> 0 bytes
.preview_thread.py.swp | Bin 12288 -> 0 bytes
.video_thread.py.swp | Bin 12288 -> 0 bytes
5 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 .core.py.swp
delete mode 100644 .main.py.swo
delete mode 100644 .main.py.swp
delete mode 100644 .preview_thread.py.swp
delete mode 100644 .video_thread.py.swp
diff --git a/.core.py.swp b/.core.py.swp
deleted file mode 100644
index 76e8645..0000000
Binary files a/.core.py.swp and /dev/null differ
diff --git a/.main.py.swo b/.main.py.swo
deleted file mode 100644
index 6971350..0000000
Binary files a/.main.py.swo and /dev/null differ
diff --git a/.main.py.swp b/.main.py.swp
deleted file mode 100644
index e57f30f..0000000
Binary files a/.main.py.swp and /dev/null differ
diff --git a/.preview_thread.py.swp b/.preview_thread.py.swp
deleted file mode 100644
index 5d323a4..0000000
Binary files a/.preview_thread.py.swp and /dev/null differ
diff --git a/.video_thread.py.swp b/.video_thread.py.swp
deleted file mode 100644
index 12dd93f..0000000
Binary files a/.video_thread.py.swp and /dev/null differ
--
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(-)
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
From 23ba08397fba9641d239b70ff397f9e3e10f53c0 Mon Sep 17 00:00:00 2001
From: Martin Kaistra
Date: Sat, 22 Apr 2017 11:04:34 +0200
Subject: Connect drawPreview events after input elements have values
---
main.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/main.py b/main.py
index 8c1d48d..121efa0 100644
--- a/main.py
+++ b/main.py
@@ -47,13 +47,6 @@ class Main(QtCore.QObject):
window.pushButton_createVideo.clicked.connect(self.createAudioVisualisation)
window.pushButton_selectBackground.clicked.connect(self.openBackgroundFileDialog)
- window.fontComboBox.currentFontChanged.connect(self.drawPreview)
- window.lineEdit_title.textChanged.connect(self.drawPreview)
- 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")
window.pushButton_selectInput.setText("Select Input Music File")
@@ -92,6 +85,13 @@ class Main(QtCore.QObject):
if not yPosition == None:
window.textYSpinBox.setValue(int(yPosition))
+ window.fontComboBox.currentFontChanged.connect(self.drawPreview)
+ window.lineEdit_title.textChanged.connect(self.drawPreview)
+ window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
+ window.textXSpinBox.valueChanged.connect(self.drawPreview)
+ window.textYSpinBox.valueChanged.connect(self.drawPreview)
+ window.fontsizeSpinBox.valueChanged.connect(self.drawPreview)
+
self.drawPreview()
window.show()
--
cgit v1.2.3