diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-12-30 10:32:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-12-30 10:32:58 +0300 |
commit | 5af67129f8d3c2245772a55e5fa5ea4cd0653477 (patch) | |
tree | 35db18fe4fe34aeacaf7b3370ca35d9a936e5bf9 /source/blender/python/api2_2x/windowTheme.c | |
parent | 26719af48a9e6b28dbfdba608cbb2fe780f629c7 (diff) |
* theme save script now saves iconThemes and supports string types.
* added .iconTheme variable
* bugfix. drawType was not being saved because Py_BuildValue and __members__ was missing an "s"
* added Blender.Get('icondir')
Diffstat (limited to 'source/blender/python/api2_2x/windowTheme.c')
-rw-r--r-- | source/blender/python/api2_2x/windowTheme.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/windowTheme.c b/source/blender/python/api2_2x/windowTheme.c index eac9a18d9f4..985af8b3c11 100644 --- a/source/blender/python/api2_2x/windowTheme.c +++ b/source/blender/python/api2_2x/windowTheme.c @@ -33,10 +33,13 @@ #include "windowTheme.h" /*This must come first*/ #include "BLI_blenlib.h" +#include "BIF_interface_icons.h" +#include "BIF_resources.h" #include "MEM_guardedalloc.h" #include "charRGBA.h" #include "gen_utils.h" + #define EXPP_THEME_VTX_SIZE_MIN 1 #define EXPP_THEME_VTX_SIZE_MAX 10 #define EXPP_THEME_FDOT_SIZE_MIN 1 @@ -398,14 +401,16 @@ static PyObject *ThemeUI_getAttr( BPy_ThemeUI * self, char *name ) ELSEIF_TUI_RGBA( menu_text_hi ) else if( !strcmp( name, "drawType" ) ) attrib = PyInt_FromLong( ( char ) tui->but_drawtype ); + else if( !strcmp( name, "iconTheme" ) ) + attrib = PyString_FromString( tui->iconfile ); else if( !strcmp( name, "__members__" ) ) - attrib = Py_BuildValue( "[ssssssssssssssssss]", "theme", + attrib = Py_BuildValue( "[ssssssssssssssssssss]", "theme", "outline", "neutral", "action", "setting", "setting1", "setting2", "num", "textfield", "textfield_hi", "popup", "text", "text_hi", "menu_back", "menu_item", "menu_hilite", "menu_text", - "menu_text_hi", "drawType" ); + "menu_text_hi", "drawType", "iconTheme" ); if( attrib != Py_None ) return attrib; @@ -449,6 +454,16 @@ static int ThemeUI_setAttr( BPy_ThemeUI * self, char *name, PyObject * value ) EXPP_THEME_DRAWTYPE_MIN, EXPP_THEME_DRAWTYPE_MAX ); ret = 0; + } else if ( !strcmp( name, "iconTheme" ) ) { + if ( !PyString_Check(value) ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected string value" ); + BLI_strncpy(tui->iconfile, PyString_AsString(value), 80); + + BIF_icons_free(); + BIF_icons_init(BIFICONID_LAST+1); + + ret = 0; } else return EXPP_ReturnIntError( PyExc_AttributeError, "attribute not found" ); |