diff --git a/efl/elementary/actionslider.pyx b/efl/elementary/actionslider.pyx index 56cba56..bbc60a4 100644 --- a/efl/elementary/actionslider.pyx +++ b/efl/elementary/actionslider.pyx @@ -44,7 +44,7 @@ """ include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" from layout_class cimport LayoutClass diff --git a/efl/elementary/callback_conversions.pxi b/efl/elementary/callback_conversions.pxi new file mode 100644 index 0000000..8dd2611 --- /dev/null +++ b/efl/elementary/callback_conversions.pxi @@ -0,0 +1,11 @@ +from libc.string cimport const_char +from object_item cimport Elm_Object_Item +from object_item cimport _object_item_to_python + +def _cb_string_conv(long addr): + cdef const_char *s = addr + return _ctouni(s) if s is not NULL else None + +def _cb_object_item_conv(long addr): + cdef Elm_Object_Item *it = addr + return _object_item_to_python(it) diff --git a/efl/elementary/callbacks.pxi b/efl/elementary/callbacks.pxi deleted file mode 100644 index 3a96a39..0000000 --- a/efl/elementary/callbacks.pxi +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2012 Kai Huuhko -# -# This file is part of python-elementary. -# -# python-elementary is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# python-elementary is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with python-elementary. If not, see . -# - -from efl.eo cimport const_char_ptr - -def _cb_string_conv(long addr): - cdef const_char_ptr s = addr - if s == NULL: - return None - else: - return s diff --git a/efl/elementary/colorselector.pyx b/efl/elementary/colorselector.pyx index f5c3533..33a9730 100644 --- a/efl/elementary/colorselector.pyx +++ b/efl/elementary/colorselector.pyx @@ -35,8 +35,9 @@ """ include "widget_header.pxi" +include "callback_conversions.pxi" + from object_item cimport ObjectItem -from object_item import _cb_object_item_conv from layout_class cimport LayoutClass cimport enums diff --git a/efl/elementary/diskselector.pyx b/efl/elementary/diskselector.pyx index 616fc5e..15cee80 100644 --- a/efl/elementary/diskselector.pyx +++ b/efl/elementary/diskselector.pyx @@ -16,9 +16,10 @@ # along with this Python-EFL. If not, see . include "widget_header.pxi" +include "callback_conversions.pxi" + from object cimport Object from object_item cimport ObjectItem, _object_item_callback, _object_item_to_python -from object_item import _cb_object_item_conv from scroller cimport * cdef class DiskselectorItem(ObjectItem): diff --git a/efl/elementary/fileselector.pyx b/efl/elementary/fileselector.pyx index 6f777e7..a2888d3 100644 --- a/efl/elementary/fileselector.pyx +++ b/efl/elementary/fileselector.pyx @@ -31,7 +31,7 @@ """ include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" from layout_class cimport LayoutClass diff --git a/efl/elementary/fileselector_button.pyx b/efl/elementary/fileselector_button.pyx index 3d22507..52bbc9e 100644 --- a/efl/elementary/fileselector_button.pyx +++ b/efl/elementary/fileselector_button.pyx @@ -31,7 +31,7 @@ """ include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" cimport enums diff --git a/efl/elementary/fileselector_entry.pyx b/efl/elementary/fileselector_entry.pyx index 5acdc6f..6e2c4a4 100644 --- a/efl/elementary/fileselector_entry.pyx +++ b/efl/elementary/fileselector_entry.pyx @@ -31,7 +31,7 @@ """ include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" from object cimport Object diff --git a/efl/elementary/flipselector.pyx b/efl/elementary/flipselector.pyx index 7c4ef4a..d296eb9 100644 --- a/efl/elementary/flipselector.pyx +++ b/efl/elementary/flipselector.pyx @@ -17,7 +17,7 @@ # include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" from object cimport Object from object_item cimport _object_item_to_python, _object_item_callback, _object_item_list_to_python diff --git a/efl/elementary/gengrid.pyx b/efl/elementary/gengrid.pyx index 7bd9b4e..6576137 100644 --- a/efl/elementary/gengrid.pyx +++ b/efl/elementary/gengrid.pyx @@ -39,6 +39,7 @@ """ include "widget_header.pxi" +include "callback_conversions.pxi" include "tooltips.pxi" from object cimport Object @@ -47,7 +48,6 @@ from object_item cimport ObjectItem, \ elm_object_item_widget_get, \ _object_item_from_python, \ _object_item_list_to_python -from object_item import _cb_object_item_conv from general cimport strdup from scroller cimport * cimport enums diff --git a/efl/elementary/genlist.pyx b/efl/elementary/genlist.pyx index e330ca7..5b1ed47 100644 --- a/efl/elementary/genlist.pyx +++ b/efl/elementary/genlist.pyx @@ -146,6 +146,7 @@ """ include "widget_header.pxi" +include "callback_conversions.pxi" include "tooltips.pxi" from object_item cimport ObjectItem, \ _object_item_to_python, \ @@ -153,7 +154,6 @@ from object_item cimport ObjectItem, \ _object_item_from_python, \ _object_item_list_to_python, \ elm_object_item_data_get -from object_item import _cb_object_item_conv from general cimport strdup from efl.evas cimport eina_list_remove_list from scroller cimport * diff --git a/efl/elementary/hoversel.pyx b/efl/elementary/hoversel.pyx index e3418f4..814b9a6 100644 --- a/efl/elementary/hoversel.pyx +++ b/efl/elementary/hoversel.pyx @@ -32,8 +32,9 @@ """ include "widget_header.pxi" +include "callback_conversions.pxi" + from object_item cimport _object_item_callback, _object_item_list_to_python -from object_item import _cb_object_item_conv cimport enums diff --git a/efl/elementary/image.pyx b/efl/elementary/image.pyx index d09ff74..8e2bcfa 100644 --- a/efl/elementary/image.pyx +++ b/efl/elementary/image.pyx @@ -55,7 +55,7 @@ """ include "widget_header.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" cimport enums diff --git a/efl/elementary/index.pyx b/efl/elementary/index.pyx index 57384ce..880d921 100644 --- a/efl/elementary/index.pyx +++ b/efl/elementary/index.pyx @@ -16,11 +16,11 @@ # along with this Python-EFL. If not, see . include "widget_header.pxi" +include "callback_conversions.pxi" from layout_class cimport LayoutClass from object_item cimport _object_item_callback, _object_item_to_python -from object_item import _cb_object_item_conv cdef enum Elm_Index_Item_Insert_Kind: ELM_INDEX_ITEM_INSERT_APPEND diff --git a/efl/elementary/list.pyx b/efl/elementary/list.pyx index 82a50a2..9835eea 100644 --- a/efl/elementary/list.pyx +++ b/efl/elementary/list.pyx @@ -93,12 +93,12 @@ """ include "widget_header.pxi" +include "callback_conversions.pxi" from object cimport Object from object_item cimport _object_item_callback, \ _object_item_to_python, \ _object_item_list_to_python -from object_item import _cb_object_item_conv from scroller cimport * cimport enums diff --git a/efl/elementary/object.pyx b/efl/elementary/object.pyx index d35b74a..212053c 100644 --- a/efl/elementary/object.pyx +++ b/efl/elementary/object.pyx @@ -92,7 +92,6 @@ cdef Eina_Bool _event_dispatcher(o, src, Evas_Callback_Type t, event_info): return True return False -#TODO: More event types cdef Eina_Bool _event_callback(void *data, Evas_Object *o, Evas_Object *src, Evas_Callback_Type t, void *event_info) with gil: cdef Object obj = object_from_instance(o) cdef Object src_obj = object_from_instance(src) @@ -123,10 +122,6 @@ cdef void _event_data_del_cb(void *data, Evas_Object *o, void *event_info) with # Py_DECREF(data) -def _cb_string_conv(long addr): - cdef const_char_ptr s = addr - return s if s is not NULL else None - cdef _object_list_to_python(const_Eina_List *lst): cdef Evas_Object *o ret = [] diff --git a/efl/elementary/object_item.pyx b/efl/elementary/object_item.pyx index c6790b3..f14c5bc 100644 --- a/efl/elementary/object_item.pyx +++ b/efl/elementary/object_item.pyx @@ -27,10 +27,6 @@ import traceback cdef class ObjectItem -def _cb_object_item_conv(long addr): - cdef Elm_Object_Item *it = addr - return _object_item_to_python(it) - cdef Elm_Object_Item * _object_item_from_python(ObjectItem item) except NULL: if item is None or item.item is NULL: raise TypeError("Invalid item!") diff --git a/efl/elementary/segment_control.pyx b/efl/elementary/segment_control.pyx index 9de93ec..ae08176 100644 --- a/efl/elementary/segment_control.pyx +++ b/efl/elementary/segment_control.pyx @@ -16,11 +16,11 @@ # along with this Python-EFL. If not, see . include "widget_header.pxi" +include "callback_conversions.pxi" from layout_class cimport LayoutClass from object_item cimport _object_item_to_python -from object_item import _cb_object_item_conv cdef class SegmentControlItem(ObjectItem): diff --git a/efl/elementary/slideshow.pyx b/efl/elementary/slideshow.pyx index 96b89e5..a75ee89 100644 --- a/efl/elementary/slideshow.pyx +++ b/efl/elementary/slideshow.pyx @@ -17,6 +17,7 @@ # include "widget_header.pxi" +include "callback_conversions.pxi" include "conversions.pxi" from layout_class cimport LayoutClass @@ -24,7 +25,6 @@ from layout_class cimport LayoutClass import traceback from object_item cimport _object_item_to_python, \ _object_item_list_to_python -from object_item import _cb_object_item_conv cdef _py_elm_slideshow_item_call(func, Evas_Object *obj, data) with gil: try: diff --git a/efl/elementary/web.pyx b/efl/elementary/web.pyx index 1a3a405..c53ce88 100644 --- a/efl/elementary/web.pyx +++ b/efl/elementary/web.pyx @@ -66,7 +66,7 @@ include "widget_header.pxi" from object cimport Object include "conversions.pxi" -include "callbacks.pxi" +include "callback_conversions.pxi" import traceback cimport enums