From 98a47a21d986ccede574baececd179be7550c9d6 Mon Sep 17 00:00:00 2001
From: tassaron
Date: Thu, 3 Aug 2017 20:43:23 -0400
Subject: save presets as floats so project resolution is not relevant
unfortunately this breaks old projects and presets
---
src/components/text.py | 18 ++++----
src/components/text.ui | 114 ++++++++++++++++++++++++++++++-------------------
2 files changed, 79 insertions(+), 53 deletions(-)
(limited to 'src/components')
diff --git a/src/components/text.py b/src/components/text.py
index b7c244e..c3f3bdc 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -9,7 +9,7 @@ from toolkit.frame import FramePainter
class Component(Component):
name = 'Title Text'
- version = '1.0.0'
+ version = '1.0.1'
def __init__(self, *args):
super().__init__(*args)
@@ -25,20 +25,17 @@ class Component(Component):
self.page.comboBox_textAlign.addItem("Left")
self.page.comboBox_textAlign.addItem("Middle")
self.page.comboBox_textAlign.addItem("Right")
+ self.page.comboBox_textAlign.setCurrentIndex(int(self.alignment))
self.page.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
- 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.lineEdit_title.setText(self.title)
- 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.pushButton_center.clicked.connect(self.centerXY)
self.page.fontComboBox_titleFont.currentFontChanged.connect(
self.update
)
+
self.trackWidgets({
'textColor': self.page.lineEdit_textColor,
'title': self.page.lineEdit_title,
@@ -51,11 +48,16 @@ class Component(Component):
}, relativeWidgets=[
'xPosition', 'yPosition', 'fontSize',
])
+ self.centerXY()
def update(self):
self.titleFont = self.page.fontComboBox_titleFont.currentFont()
super().update()
+ def centerXY(self):
+ self.setRelativeWidget('xPosition', 0.5)
+ self.setRelativeWidget('yPosition', 0.5)
+
def getXY(self):
'''Returns true x, y after considering alignment settings'''
fm = QtGui.QFontMetrics(self.titleFont)
diff --git a/src/components/text.ui b/src/components/text.ui
index bb5e5af..f76979c 100644
--- a/src/components/text.ui
+++ b/src/components/text.ui
@@ -19,6 +19,36 @@
4
+ -
+
+
-
+
+
+ Title
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Testing New GUI
+
+
+
+
+
-
-
@@ -93,38 +123,6 @@
-
-
-
-
-
-
- 0
- 0
-
-
-
- Text Layout
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 5
- 20
-
-
-
-
-
@@ -132,6 +130,9 @@
+ -
+
+
-
@@ -152,7 +153,17 @@
-
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
@@ -162,28 +173,41 @@
0
-
-
+
+
+
+ 0
+ 0
+
+
- Title
+ Text Layout
-
-
-
-
- 0
- 0
-
+
+
+ -
+
+
+ Qt::Horizontal
-
+
+ QSizePolicy::Fixed
+
+
- 0
- 0
+ 5
+ 20
+
+
+ -
+
- Testing New GUI
+ Center
--
cgit v1.2.3