|
carol.gimp.orggimp2Python:restore tools |
| *et-tools |
|---|
|
File Edit Search Preferences |
def get_tools(): version = pdb.gimp_version() old_settings = (gimp.get_foreground(), gimp.get_background(), pdb.gimp_context_get_brush(), pdb.gimp_context_get_font(), pdb.gimp_context_get_gradient(), pdb.gimp_context_get_palette(), pdb.gimp_context_get_pattern()) return old_settings, version def reset_tools(old_settings): old_fg,old_bg,old_brush,old_font,old_gradient,old_palette,old_pattern = old_settings pdb.gimp_context_set_background(old_bg) pdb.gimp_context_set_foreground(old_fg) pdb.gimp_context_set_brush(old_brush) pdb.gimp_context_set_font(old_font) pdb.gimp_context_set_gradient(old_gradient) pdb.gimp_context_set_palette(old_palette) pdb.gimp_context_get_pattern(old_pattern) pdb.gimp_context_set_foreground(old_fg) pdb.gimp_context_set_background(old_bg) pdb.gimp_context_set_gradient(old_gradient) pdb.gimp_context_set_palette(old_palette) # at the beginning of your script old_settings, version = get_tools() # at the end of your script reset_tools(old_settings) |
|
|
|