diff options
| author | Maximilian Siess | 2017-04-18 13:35:29 +0200 |
|---|---|---|
| committer | Maximilian Siess | 2017-04-18 13:35:29 +0200 |
| commit | c772bf5583dec23513371392ca6d2018518483cb (patch) | |
| tree | 1de8e0323662a494679d52212107840d861c9045 /core.py | |
| parent | 7d2ecb0d1511f9918a951c995988e797d2971fd7 (diff) | |
Added text alignment option
Diffstat (limited to 'core.py')
| -rw-r--r-- | core.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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() |
