# Copyright (C) 2007-2014 various contributors (see AUTHORS)
#
# This file is part of Python-EFL.
#
# Python-EFL 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-EFL 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 this Python-EFL. If not, see .
from efl.utils.conversions cimport eina_list_objects_to_python_list
from cpython cimport PyMethod_New
import types
#cdef object _smart_classes
#_smart_classes = list()
include "smart_object_metaclass.pxi"
_install_metaclass(EvasSmartObjectMeta, SmartObject)
_install_metaclass(EvasSmartObjectMeta, ClippedSmartObject)
cdef void _smart_object_delete(Evas_Object *o) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
try:
obj._m_delete(obj)
except Exception:
traceback.print_exc()
if type(obj.delete) is types.MethodType:
try:
del obj.delete
except AttributeError:
pass
if type(obj.move) is types.MethodType:
try:
del obj.move
except AttributeError:
pass
if type(obj.resize) is types.MethodType:
try:
del obj.resize
except AttributeError:
pass
if type(obj.show) is types.MethodType:
try:
del obj.show
except AttributeError:
pass
if type(obj.hide) is types.MethodType:
try:
del obj.hide
except AttributeError:
pass
if type(obj.color_set) is types.MethodType:
try:
del obj.color_set
except AttributeError:
pass
if type(obj.clip_set) is types.MethodType:
try:
del obj.clip_set
except AttributeError:
pass
if type(obj.clip_unset) is types.MethodType:
try:
del obj.clip_unset
except AttributeError:
pass
if type(obj.calculate) is types.MethodType:
try:
del obj.calculate
except AttributeError:
pass
if type(obj.member_add) is types.MethodType:
try:
del obj.member_add
except AttributeError:
pass
if type(obj.member_del) is types.MethodType:
try:
del obj.member_del
except AttributeError:
pass
obj._smart_callbacks = None
obj._m_delete = None
obj._m_move = None
obj._m_resize = None
obj._m_show = None
obj._m_hide = None
obj._m_color_set = None
obj._m_clip_set = None
obj._m_clip_unset = None
obj._m_calculate = None
obj._m_member_add = None
obj._m_member_del = None
cdef void _smart_object_move(Evas_Object *o,
Evas_Coord x, Evas_Coord y) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_move is not None:
try:
obj._m_move(obj, x, y)
except Exception:
traceback.print_exc()
cdef void _smart_object_resize(Evas_Object *o,
Evas_Coord w, Evas_Coord h) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_resize is not None:
try:
obj._m_resize(obj, w, h)
except Exception:
traceback.print_exc()
cdef void _smart_object_show(Evas_Object *o) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_show is not None:
try:
obj._m_show(obj)
except Exception:
traceback.print_exc()
cdef void _smart_object_hide(Evas_Object *o) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_hide is not None:
try:
obj._m_hide(obj)
except Exception:
traceback.print_exc()
cdef void _smart_object_color_set(Evas_Object *o,
int r, int g, int b, int a) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_color_set is not None:
try:
obj._m_color_set(obj, r, g, b, a)
except Exception:
traceback.print_exc()
cdef void _smart_object_clip_set(Evas_Object *o, Evas_Object *clip) with gil:
cdef:
void *tmp
SmartObject obj
Object other
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
other = object_from_instance(clip)
if obj._m_clip_set is not None:
try:
obj._m_clip_set(obj, other)
except Exception:
traceback.print_exc()
cdef void _smart_object_clip_unset(Evas_Object *o) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_clip_unset is not None:
try:
obj._m_clip_unset(obj)
except Exception:
traceback.print_exc()
cdef void _smart_object_calculate(Evas_Object *o) with gil:
cdef:
void *tmp
SmartObject obj
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
if obj._m_calculate is not None:
try:
obj._m_calculate(obj)
except Exception:
traceback.print_exc()
cdef void _smart_object_member_add(Evas_Object *o, Evas_Object *clip) with gil:
cdef:
void *tmp
SmartObject obj
Object other
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
other = object_from_instance(clip)
if obj._m_member_add is not None:
try:
obj._m_member_add(obj, other)
except Exception:
traceback.print_exc()
cdef void _smart_object_member_del(Evas_Object *o, Evas_Object *clip) with gil:
cdef:
void *tmp
SmartObject obj
Object other
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
other = object_from_instance(clip)
if obj._m_member_del is not None:
try:
obj._m_member_del(obj, other)
except Exception:
traceback.print_exc()
cdef void _smart_callback(void *data,
Evas_Object *o, void *event_info) with gil:
cdef:
void *tmp
SmartObject obj
object event, ei
tmp = evas_object_data_get(o, "python-eo")
if tmp == NULL:
EINA_LOG_DOM_WARN(PY_EFL_EVAS_LOG_DOMAIN, "obj is NULL!", NULL)
return
obj = tmp
event =