aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.core.py.swpbin0 -> 20480 bytes
-rw-r--r--.main.py.swpbin0 -> 20480 bytes
-rw-r--r--.main.ui.swpbin0 -> 24576 bytes
-rw-r--r--.preview_thread.py.swpbin0 -> 12288 bytes
-rw-r--r--core.py10
-rw-r--r--main.py11
-rw-r--r--main.ui35
-rw-r--r--preview_thread.py10
8 files changed, 58 insertions, 8 deletions
diff --git a/.core.py.swp b/.core.py.swp
new file mode 100644
index 0000000..76e8645
--- /dev/null
+++ b/.core.py.swp
Binary files differ
diff --git a/.main.py.swp b/.main.py.swp
new file mode 100644
index 0000000..4705a19
--- /dev/null
+++ b/.main.py.swp
Binary files differ
diff --git a/.main.ui.swp b/.main.ui.swp
new file mode 100644
index 0000000..bd61a94
--- /dev/null
+++ b/.main.ui.swp
Binary files differ
diff --git a/.preview_thread.py.swp b/.preview_thread.py.swp
new file mode 100644
index 0000000..5d323a4
--- /dev/null
+++ b/.preview_thread.py.swp
Binary files 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
@@ -172,6 +172,41 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_alignment">
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="alignmentComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_title">
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")