diff options
| author | tassaron | 2017-05-30 22:05:56 -0400 |
|---|---|---|
| committer | tassaron | 2017-05-30 22:05:56 -0400 |
| commit | 5295a6d9ae3d73c7dceb286f13c6a1429e55393c (patch) | |
| tree | da62d3717a40689269f19375274d28d87619137e /components/text.py | |
| parent | ca7e8bdb0dc998088aeb45a77987a78cc4656b34 (diff) | |
presets are working
except for font because it can't be represented as a string
Diffstat (limited to 'components/text.py')
| -rw-r--r-- | components/text.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/components/text.py b/components/text.py index c9359f2..23e65eb 100644 --- a/components/text.py +++ b/components/text.py @@ -53,9 +53,6 @@ class Component(__base__.Component): self.page = page return page - def version(self): - return 1 - def update(self): self.title = self.page.lineEdit_title.text() self.alignment = self.page.comboBox_textAlign.currentIndex() @@ -71,11 +68,27 @@ class Component(__base__.Component): self.xPosition = self.xPosition - fm.width(self.title)/2 if self.alignment == 2: #Right self.xPosition = self.xPosition - fm.width(self.title) - self.parent.drawPreview() + + def loadPreset(self, pr): + self.page.lineEdit_title.setText(pr['title']) + self.page.spinBox_fontSize.setValue(pr['fontSize']) + self.page.spinBox_xTextAlign.setValue(pr['xPosition']) + self.page.spinBox_yTextAlign.setValue(pr['yPosition']) + self.page.comboBox_textAlign.setCurrentIndex(pr['alignment']) + 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): - return {} + return { + 'title' : self.title, + 'alignment' : self.alignment, + 'fontSize' : self.fontSize, + 'xPosition' : self.xPosition, + 'yPosition' : self.yPosition, + 'textColor' : self.textColor + } def previewRender(self, previewWorker): width = int(previewWorker.core.settings.value('outputWidth')) @@ -117,5 +130,7 @@ class Component(__base__.Component): def pickColor(self): RGBstring, btnStyle = super().pickColor() + if not RGBstring: + return self.page.lineEdit_textColor.setText(RGBstring) self.page.pushButton_textColor.setStyleSheet(btnStyle) |
