From 5295a6d9ae3d73c7dceb286f13c6a1429e55393c Mon Sep 17 00:00:00 2001 From: tassaron Date: Tue, 30 May 2017 22:05:56 -0400 Subject: presets are working except for font because it can't be represented as a string --- components/__base__.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'components/__base__.py') diff --git a/components/__base__.py b/components/__base__.py index 252ad03..05d5cb6 100644 --- a/components/__base__.py +++ b/components/__base__.py @@ -5,18 +5,21 @@ class Component: return self.__doc__ def version(self): + # change this number to identify new versions of a component return 1 def preFrameRender(self, **kwargs): - for kwarg, value in kwargs.items(): - exec('self.%s = value' % kwarg) + for item in kwargs.items(): + exec('self.%s = %s' % item) def pickColor(self): color = QtGui.QColorDialog.getColor() if color.isValid(): - RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue())) - btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name() - return RGBstring, btnStyle + RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue())) + btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name() + return RGBstring, btnStyle + else: + return None, None def RGBFromString(self, string): ''' turns an RGB string like "255, 255, 255" into a tuple ''' @@ -58,7 +61,9 @@ class Component: image = Image.new("RGBA", (width, height), (0,0,0,0)) return image - def version(self): - # change this number to identify new versions of your component - return 1 + def loadPreset(self, presetDict): + # update widgets using a preset dict + + def savePreset(self): + return {} ''' -- cgit v1.2.3