~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/pygimp/gimpshelf.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
import gimp
42
42
 
43
43
import copy_reg
 
44
 
44
45
def _image_id(obj):
45
46
    return gimp._id2image, (obj.ID,)
 
47
 
46
48
def _drawable_id(obj):
47
49
    return gimp._id2drawable, (obj.ID,)
 
50
 
48
51
def _display_id(obj):
49
52
    return gimp._id2display, int(obj)
50
 
copy_reg.pickle(gimp.Image, _image_id, gimp._id2image)
51
 
copy_reg.pickle(gimp.Layer, _drawable_id, gimp._id2drawable)
 
53
 
 
54
def _vectors_id(obj):
 
55
    return gimp._id2vectors, int(obj.ID)
 
56
 
 
57
copy_reg.pickle(gimp.Image,   _image_id,    gimp._id2image)
 
58
copy_reg.pickle(gimp.Layer,   _drawable_id, gimp._id2drawable)
52
59
copy_reg.pickle(gimp.Channel, _drawable_id, gimp._id2drawable)
53
 
copy_reg.pickle(gimp.Display, _display_id, gimp._id2display)
54
 
del copy_reg, _image_id, _drawable_id, _display_id
 
60
copy_reg.pickle(gimp.Display, _display_id,  gimp._id2display)
 
61
copy_reg.pickle(gimp.Vectors, _vectors_id,  gimp._id2vectors)
 
62
 
 
63
del copy_reg, _image_id, _drawable_id, _display_id, _vectors_id
55
64
 
56
65
class Gimpshelf:
57
66
    def has_key(self, key):
66
75
            s = gimp.get_data(key)
67
76
        except gimp.error:
68
77
            raise KeyError, key
 
78
 
69
79
        f = StringIO.StringIO(s)
70
80
        return pickle.Unpickler(f).load()
 
81
 
71
82
    def __setitem__(self, key, value):
72
83
        f = StringIO.StringIO()
73
84
        p = pickle.Pickler(f)
74
85
        p.dump(value)
75
86
        gimp.set_data(key, f.getvalue())
 
87
 
76
88
    def __delitem__(self, key):
77
89
        gimp.set_data(key, '')
78
90