aboutsummaryrefslogtreecommitdiff
path: root/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'core.py')
-rw-r--r--core.py10
1 files changed, 8 insertions, 2 deletions
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()