diff options
| author | tassaron | 2017-08-26 21:23:44 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-26 21:23:44 -0400 |
| commit | 85d3b779d07ad92b0f540ea52185777c3c3f5e48 (patch) | |
| tree | dd193fb213412cf022a718848e90bbff671892e4 /src/components/text.py | |
| parent | 62e2ef18a3a31c15f88a96f07b2bc587808f5ad5 (diff) | |
fixed too-large Color sizes, fixed a redoing bug, rm pointless things
and now Ctrl+Alt+Shift+A gives a bunch of debug info
Diffstat (limited to 'src/components/text.py')
| -rw-r--r-- | src/components/text.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/components/text.py b/src/components/text.py index 92f0599..32a108e 100644 --- a/src/components/text.py +++ b/src/components/text.py @@ -2,10 +2,13 @@ from PIL import ImageEnhance, ImageFilter, ImageChops from PyQt5.QtGui import QColor, QFont from PyQt5 import QtGui, QtCore, QtWidgets import os +import logging from component import Component from toolkit.frame import FramePainter, PaintColor +log = logging.getLogger('AVP.Components.Text') + class Component(Component): name = 'Title Text' @@ -76,16 +79,15 @@ class Component(Component): def getXY(self): '''Returns true x, y after considering alignment settings''' fm = QtGui.QFontMetrics(self.titleFont) - if self.alignment == 0: # Left - x = int(self.xPosition) + x = self.pixelValForAttr('xPosition') if self.alignment == 1: # Middle offset = int(fm.width(self.title)/2) - x = self.xPosition - offset - + x -= offset if self.alignment == 2: # Right offset = fm.width(self.title) - x = self.xPosition - offset + x -= offset + return x, self.yPosition def loadPreset(self, pr, *args): @@ -137,6 +139,7 @@ class Component(Component): image = FramePainter(width, height) x, y = self.getXY() + log.debug('Text position translates to %s, %s', x, y) if self.stroke > 0: outliner = QtGui.QPainterPathStroker() outliner.setWidth(self.stroke) |
