Changeset 2805
- Timestamp:
- 09/25/07 20:20:00
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/bindings/python/Makefile.am (modified) (5 diffs)
- trunk/bindings/python/README (modified) (3 diffs)
- trunk/bindings/python/tinymail-platform-base.defs (deleted)
- trunk/bindings/python/tinymail-platform.override (deleted)
- trunk/bindings/python/tinymail.override (modified) (2 diffs)
- trunk/bindings/python/tinymailui-gtk.override (modified) (1 diff)
- trunk/tests/python-demo (modified) (1 prop)
- trunk/tests/python-demo/.svnignore (modified) (1 diff)
- trunk/tests/python-demo/nmdevice.py (added)
- trunk/tests/python-demo/pyplatformfactory.py (added)
- trunk/tests/python-demo/pytnylist.py (added)
- trunk/tests/python-demo/tinymail-python-test.glade (modified) (1 diff)
- trunk/tests/python-demo/tinymail-python-test.py (modified) (2 diffs)
- trunk/tests/python-demo/xmlaccountstore.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2804 r2805 1 2007-09-25 Mark Doffman <mark.doffman@codethink.co.uk> 2 3 * /bindings/python/*: Remove the platform generation 4 from the automatically generated bindings. 5 6 * /bindings/python/README: Update for changes to the way 7 the python bindings are generated. 8 9 * /tests/python-demo/*: Add implementations of a tny-list 10 iterator, platform factory, and account store. Update the 11 svn ignore to ignore the compiled python files. 12 13 * /tests/python-demo/tinymail-python-test.py: Modify to use 14 the python implementation of the platform factory. 15 1 16 2007-09-24 Philip Van Hoof <pvanhoof@gnome.org> 2 17 trunk/bindings/python/Makefile.am
r2795 r2805 17 17 tinymail_LTLIBRARIES += uigtk.la 18 18 endif 19 tinymail_LTLIBRARIES += platform.la20 19 21 20 ptinymail_PYTHON = __init__.py … … 44 43 nodist_uigtk_la_SOURCES = tinymailui-gtk-glue.c 45 44 46 platform_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initplatform47 platform_la_LIBADD = $(LIBTINYMAILUI_LIBS) $(LIBTINYMAIL_LIBS) \48 $(TINYMAIL_PYTHON_LIBS) \49 $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \50 $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la \51 $(top_builddir)/libtinymail-camel/libtinymail-camel-$(API_VERSION).la52 platform_la_SOURCES = tinymail-platformmodule.c53 nodist_platform_la_SOURCES = tinymail-platform-glue.c54 55 45 camel_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initcamel 56 46 camel_la_LIBADD = $(LIBTINYMAILUI_LIBS) $(LIBTINYMAIL_LIBS) \ … … 65 55 66 56 CLEANFILES = tinymail-glue.c tinymailui-glue.c tinymailui-gtk-glue.c \ 67 tinymail -platform.defs tinymail-platform-glue.c platform_include.h tinymail.defs \57 tinymail.defs \ 68 58 tinymailui.defs tinymailui-gtk.defs \ 69 59 tinymail-camel.defs tinymail-camel-glue.c … … 102 92 tinymailui-gtk.defs > $@ 103 93 104 TINYMAIL_PLATFORM_DEFS = $(top_srcdir)/bindings/python/tinymail-platform-base.defs105 106 tinymail-platform.defs: $(TINYMAIL_PLATFORM_DEFS)107 $(CREATEDEFS) $@ $(TINYMAIL_PLATFORM_DEFS)108 109 platform_include.h:110 ls $(top_srcdir)/libtinymail-gnome-desktop/*h | grep -v \\-priv | sed 's/^/\#include\ \"/g' | sed 's/\.h/\.h\"/g' > $@111 112 tinymail-platform-glue.c: tinymail-platform.defs tinymail-platform.override platform_include.h113 $(PYGTK_CODEGEN) --prefix pyplatform \114 --register tinymailui.defs \115 --register tinymail.defs \116 --register tinymail-camel.defs \117 --override $(top_srcdir)/bindings/python/tinymail-platform.override \118 tinymail-platform.defs > $@119 120 94 TINYMAIL_CAMEL_DEFS = $(top_srcdir)/bindings/python/tinymail-camel-base.defs \ 121 95 $(top_srcdir)/bindings/python/tinymail-camel-extra.defs … … 132 106 EXTRA_DIST = filter.py tinymail.override \ 133 107 tinymailui.override tinymailui-gtk.override \ 134 tinymail- platform.override tinymail-camel.override \108 tinymail-camel.override \ 135 109 tinymail-camel-base.defs tinymail-camel-extra.defs \ 136 110 tinymail-base.defs tinymail-extra.defs \ 137 tinymailui-gtk-base.defs tinymail-platform-base.defs\111 tinymailui-gtk-base.defs \ 138 112 tinymailui-base.defs createdefs.py pytny-status.h \ 139 p latform_include.h pytny-session-camel.h113 pytny-session-camel.h 140 114 141 115 # 142 116 # pytny-status.c pytny-session-camel.c tinymailmodule.c \ 143 # tinymail-camelmodule.c tinymail-platformmodule.c\117 # tinymail-camelmodule.c \ 144 118 # tinymailui-gtkmodule.c tinymailuimodule.c 145 119 # trunk/bindings/python/README
r1533 r2805 2 2 ---------------- 3 3 4 The generator will generate a binding for libtinymail, libtinymailui , the5 selected platform library $(PLATFORMDIR)and libtinymail-camel.4 The generator will generate a binding for libtinymail, libtinymailui 5 and libtinymail-camel. 6 6 7 o. It will first use h2def.py to generate out of the .h files of each target8 a list of defines to the standard output 7 o. The .defs files are checked in as tinymail-base.defs. These can be generated 8 using the Makefile in /gendefs, but this is not done during the normal course of a build. 9 9 10 o. The filter.py(.in) script will read that as standard input. This script will 11 also read a .defs.extra file. It will avoid duplicate defines where it will 12 prefer the define in the .defs.extra file. It will also append all the other 13 defines of the .defs.extra file to the standard output 14 15 o. The standard output is set to $@ in the Makefile.am. It generates tinymail.defs, 16 tinymailui.defs, tinymailui-gtk.defs and tinymail-platform.defs 17 18 o. Using those .defs files and the non-generated .override files, pygtk-codegen 10 o. Using those .defs files and the .override files, pygtk-codegen 19 11 generates -glue.c files. Those are compiled to the .so file that gets installed 20 12 in the site-packages directory. … … 33 25 Special defines 34 26 --------------- 35 You can override and define extra defines in tinymail .defs.extra,36 tinymailui .defs.extra, tinymailui-gtk.defs.extraand37 tinymail- platform.defs.extra27 You can override and define extra defines in tinymail-extra.defs, 28 tinymailui-extra.defs, tinymailui-gtk-extra.defs and 29 tinymail-camel-extra.defs 38 30 39 31 Overrides … … 41 33 42 34 Overrides go in the .override files 43 trunk/bindings/python/tinymail.override
r2772 r2805 172 172 %% 173 173 override tny_folder_change_get_rename noargs 174 static PyObject* 174 175 _wrap_tny_folder_change_get_rename (PyGObject *self) 175 176 { … … 180 181 return Py_BuildValue("ss", rename, oldname); 181 182 } 182 183 184 185 186 187 183 %% 184 override tny_list_foreach args 185 186 typedef struct { 187 PyObject* func; 188 PyObject* data; 189 } PyTnyListForeachCaller; 190 191 static void 192 pytny_list_foreach_marshal(GObject* obj, gpointer data) 193 { 194 PyGILState_STATE state; 195 PyTnyListForeachCaller *call = (PyTnyListForeachCaller*) data; 196 PyObject *pyobj, *retobj; 197 198 g_assert(call->func); 199 200 state = pyg_gil_state_ensure(); 201 202 pyobj = pygobject_new(obj); 203 if (call->data) 204 retobj = PyEval_CallFunction(call->func, "(NO)", 205 pyobj, call->data); 206 else 207 retobj = PyEval_CallFunction(call->func, "(N)", 208 pyobj); 209 210 if (retobj == NULL) { 211 PyErr_Print(); 212 } 213 214 Py_XDECREF(retobj); 215 216 pyg_gil_state_release(state); 217 } 218 219 220 static PyObject * 221 _wrap_tny_list_foreach(PyGObject* self, PyObject* args) 222 { 223 PyTnyListForeachCaller call; 224 call.data = NULL; 225 226 if (!PyArg_ParseTuple(args, "O|O", 227 &call.func, &call.data)) 228 return NULL; 229 230 tny_list_foreach(TNY_LIST(self->obj), (GFunc) pytny_list_foreach_marshal, &call); 231 Py_RETURN_NONE; 232 } 233 234 %% 235 override TnyList__do_foreach_func args 236 237 static PyObject * 238 _wrap_TnyList__do_foreach_func(PyGObject *self, PyObject *args) 239 { 240 TnyListIface *iface; 241 PyTnyListForeachCaller call; 242 243 if (!PyArg_ParseTuple(args, "O|O", 244 &call.func, &call.data)) 245 return NULL; 246 247 iface = g_type_interface_peek(g_type_class_peek(pyg_type_from_object((PyObject*)self)), TNY_TYPE_LIST); 248 if (iface->foreach_func) 249 iface->foreach_func(TNY_LIST(self->obj), (GFunc) pytny_list_foreach_marshal, (gpointer) &call); 250 else { 251 PyErr_SetString(PyExc_NotImplementedError, "interface method TnyList.foreach not implemented"); 252 return NULL; 253 } 254 Py_RETURN_NONE; 255 } 256 257 %% 258 override TnyList__proxy_do_foreach_func 259 260 typedef struct { 261 GFunc func; 262 gpointer data; 263 } PyTnyListFuncData; 264 265 static PyObject * 266 pytny_list_forall_proxy_func(PyObject *self, PyObject *args) 267 { 268 PyObject *py_obj; 269 PyObject *py_data; 270 PyTnyListFuncData *data; 271 if (!PyArg_ParseTuple(args, "O!O!", 272 &PyGObject_Type, &py_obj, 273 &PyCObject_Type, &py_data)) 274 return NULL; 275 276 data = PyCObject_AsVoidPtr(py_data); 277 data->func(G_OBJECT(pygobject_get(py_obj)), data->data); 278 279 Py_RETURN_NONE; 280 } 281 282 static void 283 _wrap_TnyList__proxy_do_foreach_func (TnyList* self, 284 GFunc func, 285 gpointer user_data) 286 { 287 PyGILState_STATE state; 288 PyObject *py_obj, *py_func, *py_data; 289 PyMethodDef py_func_def = { "TnyList.do_foreach callback", 290 (PyCFunction) pytny_list_forall_proxy_func, 291 METH_VARARGS }; 292 PyTnyListFuncData *data; 293 294 state = pyg_gil_state_ensure(); 295 py_obj = pygobject_new((GObject*) self); 296 py_func = PyCFunction_NewEx(&py_func_def, NULL, NULL); 297 298 data = g_new(PyTnyListFuncData, 1); 299 data->func = func; 300 data->data = user_data; 301 py_data = PyCObject_FromVoidPtr(data, g_free); 302 if (!PyObject_CallMethod(py_obj, "do_foreach_func", "NN", 303 py_func, 304 py_data)) 305 PyErr_Print(); 306 307 pyg_gil_state_release(state); 308 } 309 310 311 312 313 188 314 189 315 trunk/bindings/python/tinymailui-gtk.override
r2772 r2805 42 42 import gtk.TextView as PyGtkTextView_Type 43 43 44 import tinymai .Header as PyTnyHeader_Type44 import tinymail.Header as PyTnyHeader_Type 45 45 import tinymail.Folder as PyTnyFolder_Type 46 46 import tinymail.MimePart as PyTnyMimePart_Type 47 import tinymai .Msg as PyTnyMsg_Type47 import tinymail.Msg as PyTnyMsg_Type 48 48 import tinymail.List as PyTnyList_Type 49 49 import tinymail.FolderStore as PyTnyFolderStore_Type trunk/tests/python-demo
- Property svn:ignore changed from Makefile.in .svnignore Makefile to *.pyc Makefile.in Makefile
trunk/tests/python-demo/.svnignore
r727 r2805 1 *.pyc 1 2 Makefile.in 2 .svnignore3 3 Makefile trunk/tests/python-demo/tinymail-python-test.glade
r726 r2805 8 8 <property name="height_request">400</property> 9 9 <property name="visible">True</property> 10 <property name="title" translatable="yes"> window1</property>10 <property name="title" translatable="yes">Tinymail python test</property> 11 11 <property name="type">GTK_WINDOW_TOPLEVEL</property> 12 12 <property name="window_position">GTK_WIN_POS_NONE</property> trunk/tests/python-demo/tinymail-python-test.py
r2697 r2805 5 5 import tinymail.ui 6 6 import tinymail.uigtk 7 import tinymail.platform8 7 import tinymail.camel 9 8 import gc 9 10 from pyplatformfactory import PyPlatformFactory 10 11 11 12 def on_refresh_folder (folder, cancelled, headerstree): … … 70 71 column.set_sizing (gtk.TREE_VIEW_COLUMN_FIXED) 71 72 headerstree.append_column (column) 72 platfact = tinymail.platform.tny_gnome_platform_factory_get_instance()73 platfact = PyPlatformFactory() 73 74 msgview = platfact.new_msg_view () 74 75 msgview.show ()
