From cfb8e17b6362719ca736997a23a939bec4975e70 Mon Sep 17 00:00:00 2001 From: tassaron Date: Sat, 3 Jun 2017 22:58:40 -0400 Subject: basic image component --- components/color.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'components/color.py') diff --git a/components/color.py b/components/color.py index d86470c..ae818e2 100644 --- a/components/color.py +++ b/components/color.py @@ -57,12 +57,19 @@ class Component(__base__.Component): r,g,b = self.color1 return Image.new("RGBA", (width, height), (r, g, b, 255)) - def loadPreset(self, presetDict): - # update widgets using a preset dict - pass + def loadPreset(self, pr): + self.page.lineEdit_color1.setText('%s,%s,%s' % pr['color1']) + self.page.lineEdit_color2.setText('%s,%s,%s' % pr['color2']) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*pr['color1']).name() + self.page.pushButton_color1.setStyleSheet(btnStyle) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*pr['color2']).name() + self.page.pushButton_color2.setStyleSheet(btnStyle) def savePreset(self): - return {} + return { + 'color1' : self.color1, + 'color2' : self.color2, + } def pickColor(self, num): RGBstring, btnStyle = super().pickColor() -- cgit v1.2.3