Module Theme
[frames | no frames]

Module Theme

The Blender.Window.Theme submodule.

Theme

This module provides access to Theme objects in Blender.

Example:
 # this is a simplified version of the save_theme.py script
 # shipped with Blender:
 import Blender
 from Blender.Window import Theme, FileSelector

 theme = Theme.Get()[0] # get current theme

 def write_theme(filename):
   "Write the current theme as a BPython script"

   f = file(filename, "w")

   f.write("import Blender")
   f.write("from Blender.Window import Theme")
   f.write("theme = Theme.New('%s')" % theme.name)

   for tsp in theme.get(): # write each theme space
     command = "\n%s = theme.get('%s')" % (tsp, tsp)
     f.write(command + "\n")
     exec(command)
     exec("vars = dir(%s)" % tsp)
     vars.remove('theme')

     for var in vars: # write each variable from each theme space
       v = "%s.%s" % (tsp, var)
       exec("value = %s" % v)
       f.write("%s = %s\n" % (v, value))

   f.write('\nBlender.Redraw(-1)') # redraw to update the screen
   f.close()

 FileSelector(write_theme, "Save Current Theme", default_fname)

Classes
Theme This object gives access to Themes in Blender.
ThemeSpace There is a sub-theme for each space in Blender (except for the Scripts window, but it will be added soon).
ThemeUI This can be accessed with theme.get(t), where t can be 'ui' or -1.

Function Summary
Blender Theme or a list of Blender Themes Get(name)
Get the Theme object(s) from Blender.
Blender Theme New(name, theme)
Create a new Theme object.

Function Details

Get(name=None)

Get the Theme object(s) from Blender.
Parameters:
name - The name of the Theme object.
           (type=string)
Returns:
It depends on the name parameter:
  • (name): The Theme object called name, None if not found;
  • (): A list with all Theme objects currently in Blender.

           (type=Blender Theme or a list of Blender Themes)

New(name='New Theme', theme='<default>')

Create a new Theme object.
Parameters:
name - The name of the new theme.
           (type=string)
theme - a base theme to copy all data from. It defaults to the current one.
           (type=Blender Theme)
Returns:
A new Blender Theme object.
           (type=Blender Theme)

Generated by Epydoc 2.1 on Thu May 10 20:32:00 2007 http://epydoc.sf.net