]>
Commit | Line | Data |
---|---|---|
2009933e | 1 | diff --git plugins/python/python-window.c plugins/python/python-window.c |
2 | index e0ac50f..3fee09a 100644 | |
3 | --- plugins/python/python-window.c | |
4 | +++ plugins/python/python-window.c | |
5 | @@ -52,6 +52,48 @@ | |
6 | // * | |
7 | // * *************************************************************************** | |
8 | ||
9 | +PyTypeObject ekg_window_type = { | |
10 | + PyObject_HEAD_INIT(NULL) | |
11 | + 0, | |
12 | + "window", | |
13 | + sizeof(ekg_windowObj), | |
14 | + 0, | |
15 | + (destructor)ekg_window_dealloc, | |
16 | + 0, | |
17 | + (getattrfunc)ekg_window_get_attr, | |
18 | + 0, | |
19 | + 0, | |
20 | + (reprfunc)ekg_window_repr, | |
21 | + 0, | |
22 | + 0, | |
23 | + 0, | |
24 | + 0, /*tp_hash */ | |
25 | + 0, /*tp_call*/ | |
26 | + (reprfunc)ekg_window_str, /*tp_str*/ | |
27 | + 0, /*tp_getattro*/ | |
28 | + 0, /*tp_setattro*/ | |
29 | + 0, /*tp_as_buffer*/ | |
30 | + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ | |
31 | + "Window object", /* tp_doc */ | |
32 | + 0, /* tp_traverse */ | |
33 | + 0, /* tp_clear */ | |
34 | + 0, /* tp_richcompare */ | |
35 | + 0, /* tp_weaklistoffset */ | |
36 | + 0, /* tp_iter */ | |
37 | + 0, /* tp_iternext */ | |
38 | + ekg_window_methods, /* tp_methods */ | |
39 | + 0, /* tp_members */ | |
40 | + 0, /* tp_getset */ | |
41 | + 0, /* tp_base */ | |
42 | + 0, /* tp_dict */ | |
43 | + 0, /* tp_descr_get */ | |
44 | + 0, /* tp_descr_set */ | |
45 | + 0, /* tp_dictoffset */ | |
46 | + (initproc)ekg_window_init, /* tp_init */ | |
47 | + 0, /* tp_alloc */ | |
48 | + 0, /* tp_new */ | |
49 | +}; | |
50 | + | |
51 | /** | |
52 | * ekg_window_init() | |
53 | * | |
54 | diff --git plugins/python/python-window.h plugins/python/python-window.h | |
55 | index 8361164..dce92ff 100644 | |
56 | --- plugins/python/python-window.h | |
57 | +++ plugins/python/python-window.h | |
58 | @@ -52,48 +52,7 @@ staticforward PyMethodDef ekg_window_methods[] = { | |
59 | {NULL, NULL, 0, NULL} | |
60 | }; | |
61 | ||
62 | -static PyTypeObject ekg_window_type = { | |
63 | - PyObject_HEAD_INIT(NULL) | |
64 | - 0, | |
65 | - "window", | |
66 | - sizeof(ekg_windowObj), | |
67 | - 0, | |
68 | - (destructor)ekg_window_dealloc, | |
69 | - 0, | |
70 | - (getattrfunc)ekg_window_get_attr, | |
71 | - 0, | |
72 | - 0, | |
73 | - (reprfunc)ekg_window_repr, | |
74 | - 0, | |
75 | - 0, | |
76 | - 0, | |
77 | - 0, /*tp_hash */ | |
78 | - 0, /*tp_call*/ | |
79 | - (reprfunc)ekg_window_str, /*tp_str*/ | |
80 | - 0, /*tp_getattro*/ | |
81 | - 0, /*tp_setattro*/ | |
82 | - 0, /*tp_as_buffer*/ | |
83 | - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ | |
84 | - "Window object", /* tp_doc */ | |
85 | - 0, /* tp_traverse */ | |
86 | - 0, /* tp_clear */ | |
87 | - 0, /* tp_richcompare */ | |
88 | - 0, /* tp_weaklistoffset */ | |
89 | - 0, /* tp_iter */ | |
90 | - 0, /* tp_iternext */ | |
91 | - ekg_window_methods, /* tp_methods */ | |
92 | - 0, /* tp_members */ | |
93 | - 0, /* tp_getset */ | |
94 | - 0, /* tp_base */ | |
95 | - 0, /* tp_dict */ | |
96 | - 0, /* tp_descr_get */ | |
97 | - 0, /* tp_descr_set */ | |
98 | - 0, /* tp_dictoffset */ | |
99 | - (initproc)ekg_window_init, /* tp_init */ | |
100 | - 0, /* tp_alloc */ | |
101 | - 0, /* tp_new */ | |
102 | -}; | |
103 | - | |
104 | +extern PyTypeObject ekg_window_type; | |
105 | ||
106 | #endif | |
107 | ||
108 | diff --git plugins/python/python.c plugins/python/python.c | |
109 | index 272ad4f..207a8d3 100644 | |
110 | --- plugins/python/python.c | |
111 | +++ plugins/python/python.c | |
112 | @@ -23,6 +23,7 @@ | |
113 | #include "python.h" | |
114 | #include "python-ekg.h" | |
115 | #include "python-config.h" | |
116 | +#include "python-window.h" | |
117 | ||
118 | #include <sys/types.h> | |
119 | ||
120 | @@ -531,6 +532,22 @@ without that works ? wtf ?! | |
121 | // * | |
122 | // ******************************************************************************** | |
123 | ||
124 | + | |
125 | +/* XXX check http://docs.python.org/extending/newtypes.html */ | |
126 | +static void python_init_type(PyTypeObject *type) | |
127 | +{ | |
128 | + type->tp_new = PyType_GenericNew; | |
129 | + if (PyType_Ready(type) < 0) | |
130 | + return; | |
131 | +/* | |
132 | + PyObject* m = Py_InitModule3("noddy", noddy_methods, | |
133 | + "Example module that creates an extension type."); | |
134 | + | |
135 | + Py_INCREF(&noddy_NoddyType); | |
136 | + PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); | |
137 | +*/ | |
138 | +} | |
139 | + | |
140 | /** | |
141 | * python_initialize() | |
142 | * | |
143 | @@ -550,6 +567,8 @@ int python_initialize() | |
144 | ekg_config = PyObject_NEW(PyObject, &ekg_config_type); | |
145 | PyModule_AddObject(ekg, "config", ekg_config); | |
146 | ||
147 | + python_init_type(&ekg_window_type); | |
148 | + | |
149 | // Const - general | |
150 | PyModule_AddStringConstant(ekg, "VERSION", VERSION); | |
151 |