diff options
| author | tassaron | 2017-08-01 21:57:36 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-01 21:57:36 -0400 |
| commit | 5784cdbcf87556b61519782cd1fc27065ffbc631 (patch) | |
| tree | 74a7c2c473139b5cd8c1a644a53d260a9829a441 /src/components/text.py | |
| parent | 3c1b52205f183e9a2c943c5f666ed2c01db3aaf5 (diff) | |
x/y pixel values update to match output resolution
Diffstat (limited to 'src/components/text.py')
| -rw-r--r-- | src/components/text.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/components/text.py b/src/components/text.py index 1fe3467..0f87038 100644 --- a/src/components/text.py +++ b/src/components/text.py @@ -17,15 +17,12 @@ class Component(Component): def widget(self, *args): super().widget(*args) - height = int(self.settings.value('outputHeight')) - width = int(self.settings.value('outputWidth')) + # height = int(self.settings.value('outputHeight')) + # width = int(self.settings.value('outputWidth')) self.textColor = (255, 255, 255) self.title = 'Text' self.alignment = 1 - self.fontSize = height / 13.5 - fm = QtGui.QFontMetrics(self.titleFont) - self.xPosition = width / 2 - fm.width(self.title)/2 - self.yPosition = height / 2 * 1.036 + self.fontSize = self.height / 13.5 self.page.comboBox_textAlign.addItem("Left") self.page.comboBox_textAlign.addItem("Middle") @@ -35,8 +32,11 @@ class Component(Component): self.page.lineEdit_title.setText(self.title) self.page.comboBox_textAlign.setCurrentIndex(int(self.alignment)) self.page.spinBox_fontSize.setValue(int(self.fontSize)) - self.page.spinBox_xTextAlign.setValue(int(self.xPosition)) - self.page.spinBox_yTextAlign.setValue(int(self.yPosition)) + + fm = QtGui.QFontMetrics(self.titleFont) + self.page.spinBox_xTextAlign.setValue( + self.width / 2 - fm.width(self.title)/2) + self.page.spinBox_yTextAlign.setValue(self.height / 2 * 1.036) self.page.fontComboBox_titleFont.currentFontChanged.connect( self.update @@ -50,6 +50,9 @@ class Component(Component): 'yPosition': self.page.spinBox_yTextAlign, }, colorWidgets={ 'textColor': self.page.pushButton_textColor, + }, relativeWidgets={ + 'xPosition': 'x', + 'yPosition': 'y', }) def update(self): |
