aboutsummaryrefslogtreecommitdiff
path: root/src/components/text.py
diff options
context:
space:
mode:
authortassaron2017-08-01 17:57:39 -0400
committertassaron2017-08-01 17:57:39 -0400
commit3c1b52205f183e9a2c943c5f666ed2c01db3aaf5 (patch)
tree0b92d6d2a1a21b87bd9f2f19181da15c09a1408b /src/components/text.py
parenta472246dab69d0676c3c78ecd61659e432c960b4 (diff)
component class now tracks colorwidgets
so adding new color-selection widgets is now simple
Diffstat (limited to 'src/components/text.py')
-rw-r--r--src/components/text.py27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/components/text.py b/src/components/text.py
index 8a302ff..1fe3467 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -5,7 +5,6 @@ import os
from component import Component
from toolkit.frame import FramePainter
-from toolkit import rgbFromString, pickColor
class Component(Component):
@@ -33,11 +32,6 @@ class Component(Component):
self.page.comboBox_textAlign.addItem("Right")
self.page.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
- self.page.pushButton_textColor.clicked.connect(self.pickColor)
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*self.textColor).name()
- self.page.pushButton_textColor.setStyleSheet(btnStyle)
-
self.page.lineEdit_title.setText(self.title)
self.page.comboBox_textAlign.setCurrentIndex(int(self.alignment))
self.page.spinBox_fontSize.setValue(int(self.fontSize))
@@ -48,21 +42,18 @@ class Component(Component):
self.update
)
self.trackWidgets({
+ 'textColor': self.page.lineEdit_textColor,
'title': self.page.lineEdit_title,
'alignment': self.page.comboBox_textAlign,
'fontSize': self.page.spinBox_fontSize,
'xPosition': self.page.spinBox_xTextAlign,
'yPosition': self.page.spinBox_yTextAlign,
+ }, colorWidgets={
+ 'textColor': self.page.pushButton_textColor,
})
def update(self):
self.titleFont = self.page.fontComboBox_titleFont.currentFont()
- self.textColor = rgbFromString(
- self.page.lineEdit_textColor.text())
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*self.textColor).name()
- self.page.pushButton_textColor.setStyleSheet(btnStyle)
-
super().update()
def getXY(self):
@@ -86,15 +77,10 @@ class Component(Component):
font = QFont()
font.fromString(pr['titleFont'])
self.page.fontComboBox_titleFont.setCurrentFont(font)
- self.page.lineEdit_textColor.setText('%s,%s,%s' % pr['textColor'])
- btnStyle = "QPushButton { background-color : %s; outline: none; }" \
- % QColor(*pr['textColor']).name()
- self.page.pushButton_textColor.setStyleSheet(btnStyle)
def savePreset(self):
saveValueStore = super().savePreset()
saveValueStore['titleFont'] = self.titleFont.toString()
- saveValueStore['textColor'] = self.textColor
return saveValueStore
def previewRender(self):
@@ -122,13 +108,6 @@ class Component(Component):
return image.finalize()
- def pickColor(self):
- RGBstring, btnStyle = pickColor()
- if not RGBstring:
- return
- self.page.lineEdit_textColor.setText(RGBstring)
- self.page.pushButton_textColor.setStyleSheet(btnStyle)
-
def commandHelp(self):
print('Enter a string to use as centred white text:')
print(' "title=User Error"')