accept a string and parse it using gimpcolor.rgb_parse_css().

2007-12-07  Sven Neumann  <sven@gimp.org>

	* plug-ins/pygimp/gimpui.py (ColorSelector.__init__): accept a
	string and parse it using gimpcolor.rgb_parse_css().

	* plug-ins/pygimp/plug-ins/sphere.py: show off the new feature.

svn path=/trunk/; revision=24285
This commit is contained in:
Sven Neumann 2007-12-07 16:53:06 +00:00 committed by Sven Neumann
parent 8b15c5e2f3
commit 021abe4a74
3 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2007-12-07 Sven Neumann <sven@gimp.org>
* plug-ins/pygimp/gimpui.py (ColorSelector.__init__): accept a
string and parse it using gimpcolor.rgb_parse_css().
* plug-ins/pygimp/plug-ins/sphere.py: show off the new feature.
2007-12-07 Sven Neumann <sven@gimp.org>
* plug-ins/pygimp/plug-ins/foggify.py: push/pop a context instead

View File

@ -172,6 +172,8 @@ class ColorSelector(ColorButton):
color = default
elif isinstance(default, tuple):
color = apply(gimpcolor.RGB, default)
elif isinstance(default, str):
color = gimpcolor.rgb_parse_css(default)
ColorButton.__init__(self, _("Python-Fu Color Selection"), 100, 20,
color, COLOR_AREA_FLAT)
def get_value(self):

View File

@ -94,18 +94,19 @@ register(
"Simple sphere with drop shadow",
"James Henstridge",
"James Henstridge",
"1997-1999",
"<Toolbox>/Xtns/Languages/Python-Fu/Test/_Sphere",
"1997-1999, 2007",
"_Sphere",
"",
[
(PF_INT, "radius", "Radius for sphere", 100),
(PF_SLIDER, "light", "Light angle", 45, (0,360,1)),
(PF_TOGGLE, "shadow", "Shadow?", 1),
(PF_RADIO, "foo", "Test", "foo", (("Foo", "foo"), ("Bar", "bar"))),
(PF_COLOR, "bg-color", "Background", (255,255,255)),
(PF_COLOR, "sphere-color", "Sphere", (255,0,0))
(PF_COLOR, "bg-color", "Background", (1.0, 1.0, 1.0)),
(PF_COLOR, "sphere-color", "Sphere", "orange")
],
[],
sphere)
sphere,
menu="<Toolbox>/Xtns/Languages/Python-Fu/Test")
main()