diff options
author | James Henstridge <james@daa.com.au> | 1999-02-23 11:24:18 +0000 |
---|---|---|
committer | James Henstridge <jamesh@src.gnome.org> | 1999-02-23 11:24:18 +0000 |
commit | 4331a74c8ff40502c213eed791ed775b4ab619f9 (patch) | |
tree | 3960bf14a75b7d1123969853bce3d54d4bbad5f8 /gtkmodule.c | |
parent | 8f264bd573916d92862a9dfbc7215e5c0ef769a1 (diff) | |
download | pygtk-4331a74c8ff40502c213eed791ed775b4ab619f9.tar.gz |
added references to the MAPPING file.
1999-02-23 James Henstridge <james@daa.com.au>
* README, Makefile.am, pygtk.spec: added references to the MAPPING
file.
* MAPPING: new file describing the mapping of GTK+ onto python as
pygtk does it.
1999-02-22 James Henstridge <james@daa.com.au>
* description.py (GdkCursor): added information about this type.
* gtk.py: commented out the __getattr__, __setattr__ and __delattr__
methods of GtkObject. There were too many things that broke because
of these changes. If I can get these to work correctly in the
future, I will consider re-enabling it, but not till then.
* examples/testgtk/testgtk.py (create_cursor_test): added a cursor
test to the python testgtk. It is adapted from the translation sent
in by Osamu Tanimoto.
* gtkmodule.c: fixed a bit of bad copy'n'paste in the GC part of the
style wrapper code. Thanks go to Osamu Tanimoto <tanimoto@rios.co.jp>.
(PyGdkCursor_GetAttr): now GdkCursor objects have a type attribute
that returns the type number for the object, and a name attribute
that gives a string representation of that type number.
Diffstat (limited to 'gtkmodule.c')
-rw-r--r-- | gtkmodule.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/gtkmodule.c b/gtkmodule.c index 181ef747..bab922eb 100644 --- a/gtkmodule.c +++ b/gtkmodule.c @@ -651,17 +651,17 @@ static PyObject *PyGtkStyle_GetAttr(PyGtkStyle_Object *self, char *attr) { if (!strcmp(attr, "fg_gc")) return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); if (!strcmp(attr, "bg_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->bg_gc); if (!strcmp(attr, "light_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->light_gc); if (!strcmp(attr, "dark_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->dark_gc); if (!strcmp(attr, "mid_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->mid_gc); if (!strcmp(attr, "text_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->text_gc); if (!strcmp(attr, "base_gc")) - return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->fg_gc); + return PyGtkStyleHelper_New(style, STYLE_GC_ARRAY, style->base_gc); if (!strcmp(attr, "black_gc")) return PyGdkGC_New(style->black_gc); if (!strcmp(attr, "white_gc")) @@ -2013,13 +2013,28 @@ PyGdkCursor_Repr(PyGdkCursor_Object *self) { while (vals->value_name != NULL && vals->value != self->obj->type) vals++; if (vals->value_nick) cname = vals->value_nick; - else cname = "*unknown"; + else cname = "*unknown*"; } g_snprintf(buf, 256, "<GdkCursor '%s'>", cname); return PyString_FromString(buf); } +static PyObject *PyGdkCursor_GetAttr(PyGdkCursor_Object *self, char *attr) { + if (!strcmp(attr, "type")) + return PyInt_FromLong(self->obj->type); + else if (!strcmp(attr, "name")) { + GtkEnumValue *vals = gtk_type_enum_get_values(GTK_TYPE_GDK_CURSOR_TYPE); + + while (vals->value_name != NULL && vals->value != self->obj->type) + vals++; + if (vals->value_nick) return PyString_FromString(vals->value_nick); + return PyString_FromString("*unknown*"); + } + PyErr_SetString(PyExc_AttributeError, attr); + return NULL; +} + static PyTypeObject PyGdkCursor_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, @@ -2028,7 +2043,7 @@ static PyTypeObject PyGdkCursor_Type = { 0, (destructor)PyGdkCursor_Dealloc, (printfunc)0, - (getattrfunc)0, + (getattrfunc)PyGdkCursor_GetAttr, (setattrfunc)0, (cmpfunc)PyGdkCursor_Compare, (reprfunc)PyGdkCursor_Repr, |