Revert "Remove Python -> C string hacks"

A quote from Cython documentation:

"The other direction, i.e. automatic encoding to C strings, is only supported
for the ASCII codec (and the “default encoding”, which is runtime specific
and may or may not be ASCII). This is because CPython handles the memory
management in this case by keeping an encoded copy of the string alive
together with the original unicode string. Otherwise, there would be no way
to limit the lifetime of the encoded string in any sensible way, thus
rendering any attempt to extract a C string pointer from it a dangerous
endeavour."

Cython plays it safe and we can't live with ASCII-only; reverting to
our earlier "hacks" for string conversion.

This reverts commit b547ff2aa2.

Conflicts:
	efl/elementary/entry.pyx
	efl/elementary/object.pyx
This commit is contained in:
Kai Huuhko 2014-04-06 23:48:16 +03:00
parent 9cb0bbaf8b
commit d6dc3a2045
82 changed files with 666 additions and 53 deletions

View File

@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
cdef extern from "Python.h":
object PyUnicode_FromStringAndSize(char *s, Py_ssize_t len)
int PyObject_GetBuffer(obj, Py_buffer *view, int flags)
@ -310,6 +312,7 @@ cdef class Exe(object):
if flags is None:
flags = 0
if isinstance(exe_cmd, unicode): exe_cmd = PyUnicode_AsUTF8String(exe_cmd)
self._set_obj(exe_cmd, flags)
self.__data = data
self.__callbacks = {}
@ -396,6 +399,9 @@ cdef class Exe(object):
Py_buffer buf_view
bint ret
if isinstance(buf, unicode):
buf = PyUnicode_AsUTF8String(buf)
PyObject_GetBuffer(buf, &buf_view, 0)
if size <= 0:

View File

@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
cdef void _completion_cb(void *data, const char *file, int status) with gil:
obj = <FileDownload>data
try:
@ -87,6 +89,8 @@ cdef class FileDownload(object):
self.args = args
self.kargs = kargs
if isinstance(url, unicode): url = PyUnicode_AsUTF8String(url)
if isinstance(dst, unicode): dst = PyUnicode_AsUTF8String(dst)
if not ecore_file_download(
<const char *>url if url is not None else NULL,
<const char *>dst if dst is not None else NULL,
@ -175,5 +179,6 @@ def file_download_protocol_available(protocol):
:return: True if the protocol is supported
:rtype: bool
"""
if isinstance(protocol, unicode): protocol = PyUnicode_AsUTF8String(protocol)
return bool(ecore_file_download_protocol_available(
<const char *>protocol if protocol is not None else NULL))

View File

@ -15,6 +15,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
cdef void _file_monitor_cb(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) with gil:
obj = <FileMonitor>data
try:
@ -69,6 +72,7 @@ cdef class FileMonitor(object):
self.args = args
self.kargs = kargs
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
self.mon = ecore_file_monitor_add(
<const char *>path if path is not None else NULL,
_file_monitor_cb, <void *>self)

View File

@ -18,7 +18,7 @@
import traceback
import warnings
from cpython cimport PyMem_Malloc, PyMem_Free
from cpython cimport PyMem_Malloc, PyMem_Free, PyUnicode_AsUTF8String
cimport libc.stdlib
from libc.stdint cimport uintptr_t
@ -156,6 +156,7 @@ def thaw():
def fontset_append_set(fonts):
if isinstance(fonts, unicode): fonts = PyUnicode_AsUTF8String(fonts)
edje_fontset_append_set(<const char *>fonts if fonts is not None else NULL)
@ -165,6 +166,7 @@ def fontset_append_get():
def file_collection_list(file):
cdef Eina_List *lst
if isinstance(file, unicode): file = PyUnicode_AsUTF8String(file)
lst = edje_file_collection_list(
<const char *>file if file is not None else NULL)
ret = eina_list_strings_to_python_list(lst)
@ -173,6 +175,8 @@ def file_collection_list(file):
def file_group_exists(file, group):
if isinstance(file, unicode): file = PyUnicode_AsUTF8String(file)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
return bool(edje_file_group_exists(
<const char *>file if file is not None else NULL,
<const char *>group if group is not None else NULL))
@ -180,6 +184,8 @@ def file_group_exists(file, group):
def file_data_get(file, key):
cdef char *s
if isinstance(file, unicode): file = PyUnicode_AsUTF8String(file)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
s = edje_file_data_get(
<const char *>file if file is not None else NULL,
<const char *>key if key is not None else NULL)
@ -227,6 +233,8 @@ def color_class_set(color_class,
int r, int g, int b, int a,
int r2, int g2, int b2, int a2,
int r3, int g3, int b3, int a3):
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_color_class_set(
<const char *>color_class if color_class is not None else NULL,
r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
@ -236,6 +244,8 @@ def color_class_get(color_class):
cdef int r, g, b, a
cdef int r2, g2, b2, a2
cdef int r3, g3, b3, a3
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_color_class_get(
<const char *>color_class if color_class is not None else NULL,
&r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
@ -243,6 +253,8 @@ def color_class_get(color_class):
def color_class_del(color_class):
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_color_class_del(
<const char *>color_class if color_class is not None else NULL)
@ -263,6 +275,10 @@ def color_class_list():
def text_class_set(text_class, font, int size):
if isinstance(text_class, unicode):
text_class = PyUnicode_AsUTF8String(text_class)
if isinstance(font, unicode):
font = PyUnicode_AsUTF8String(font)
edje_text_class_set(
<const char *>text_class if text_class is not None else NULL,
<const char *>font if font is not None else NULL,
@ -270,6 +286,7 @@ def text_class_set(text_class, font, int size):
def text_class_del(text_class):
if isinstance(text_class, unicode): text_class = PyUnicode_AsUTF8String(text_class)
edje_text_class_del(
<const char *>text_class if text_class is not None else NULL)
@ -316,6 +333,7 @@ def available_modules_get():
def module_load(name):
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
return bool(edje_module_load(
<const char *>name if name is not None else NULL))

View File

@ -186,6 +186,7 @@ cdef class Edje(Object):
:type: string
"""
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
return _ctouni(edje_object_data_get(self.obj,
<const char *>key if key is not None else NULL))
@ -198,6 +199,8 @@ cdef class Edje(Object):
:raise EdjeLoadError: if error occurred during load.
"""
if isinstance(file, unicode): file = PyUnicode_AsUTF8String(file)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if edje_object_file_set(self.obj,
<const char *>file if file is not None else NULL,
<const char *>group if group is not None else NULL) == 0:
@ -307,6 +310,8 @@ cdef class Edje(Object):
:parm a3:
"""
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_object_color_class_set(self.obj,
<const char *>color_class if color_class is not None else NULL,
r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3)
@ -322,6 +327,8 @@ cdef class Edje(Object):
cdef int r, g, b, a
cdef int r2, g2, b2, a2
cdef int r3, g3, b3, a3
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_object_color_class_get(self.obj,
<const char *>color_class if color_class is not None else NULL,
&r, &g, &b, &a, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3)
@ -329,6 +336,8 @@ cdef class Edje(Object):
def color_class_del(self, color_class):
"Delete a specific color class."
if isinstance(color_class, unicode):
color_class = PyUnicode_AsUTF8String(color_class)
edje_object_color_class_del(self.obj,
<const char *>color_class if color_class is not None else NULL)
@ -339,6 +348,10 @@ cdef class Edje(Object):
:param font: the font name
:param size: the font size
"""
if isinstance(text_class, unicode):
text_class = PyUnicode_AsUTF8String(text_class)
if isinstance(font, unicode):
font = PyUnicode_AsUTF8String(font)
edje_object_text_class_set(self.obj,
<const char *>text_class if text_class is not None else NULL,
<const char *>font if font is not None else NULL,
@ -472,6 +485,7 @@ cdef class Edje(Object):
def part_exists(self, part):
":rtype: bool"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_exists(self.obj,
<const char *>part if part is not None else NULL))
@ -486,6 +500,7 @@ cdef class Edje(Object):
"""
cdef Evas_Object *obj
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
obj = <Evas_Object*>edje_object_part_object_get(self.obj,
<const char *>part if part is not None else NULL)
return object_from_instance(obj)
@ -493,6 +508,7 @@ cdef class Edje(Object):
def part_geometry_get(self, part):
":rtype: tuple of int"
cdef int x, y, w, h
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_geometry_get(self.obj,
<const char *>part if part is not None else NULL,
&x, &y, &w, &h)
@ -501,6 +517,7 @@ cdef class Edje(Object):
def part_size_get(self, part):
":rtype: tuple of int"
cdef int w, h
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_geometry_get(self.obj,
<const char *>part if part is not None else NULL,
NULL, NULL, &w, &h)
@ -509,6 +526,7 @@ cdef class Edje(Object):
def part_pos_get(self, part):
":rtype: tuple of int"
cdef int x, y
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_geometry_get(self.obj,
<const char *>part if part is not None else NULL,
&x, &y, NULL, NULL)
@ -540,6 +558,8 @@ cdef class Edje(Object):
:param text: the new text to set
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
edje_object_part_text_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>text if text is not None else NULL)
@ -552,16 +572,19 @@ cdef class Edje(Object):
"""
cdef const char *s
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(edje_object_part_text_get(self.obj,
<const char *>part if part is not None else NULL))
def part_text_select_all(self, part):
"Select all the text of the given TEXT or TEXTBLOCK part"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_text_select_all(self.obj,
<const char *>part if part is not None else NULL)
def part_text_select_none(self, part):
"Deselect all the text of the given TEXT or TEXTBLOCK part"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_text_select_none(self.obj,
<const char *>part if part is not None else NULL)
@ -575,6 +598,9 @@ cdef class Edje(Object):
:see: part_text_set()
:see: part_text_unescaped_get()
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text_to_escape, unicode):
text_to_escape = PyUnicode_AsUTF8String(text_to_escape)
edje_object_part_text_unescaped_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>text_to_escape if text_to_escape is not None else NULL)
@ -589,6 +615,7 @@ cdef class Edje(Object):
:see: part_text_unescaped_set()
"""
cdef char *s
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
s = edje_object_part_text_unescaped_get(self.obj,
<const char *>part if part is not None else NULL)
if s == NULL:
@ -614,6 +641,7 @@ cdef class Edje(Object):
:type obj: efl.evas.Object
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_swallow(self.obj,
<const char *>part if part is not None else NULL, obj.obj)
@ -623,11 +651,13 @@ cdef class Edje(Object):
def part_swallow_get(self, part):
":rtype: efl.evas.Object"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(edje_object_part_swallow_get(
self.obj, <const char *>part if part is not None else NULL))
def part_external_object_get(self, part):
":rtype: efl.evas.Object"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(edje_object_part_external_object_get(
self.obj, <const char *>part if part is not None else NULL))
@ -641,8 +671,28 @@ cdef class Edje(Object):
:rtype: bool
"""
cdef Edje_External_Param p
cdef const char *c_part
cdef const char *c_param
p.name = <const char *>param
if isinstance(part, unicode):
str1 = PyUnicode_AsUTF8String(part)
c_part = str1
elif isinstance(part, str):
c_part = part
else:
raise TypeError("part must be str or unicode, found %s" %
type(part).__name__)
if isinstance(param, unicode):
str2 = PyUnicode_AsUTF8String(param)
c_param = str2
elif isinstance(param, str):
c_param = param
else:
raise TypeError("param must be str or unicode, found %s" %
type(param).__name__)
p.name = c_param
if isinstance(value, bool): # bool is int, so keep it before!
p.type = EDJE_EXTERNAL_PARAM_TYPE_BOOL
p.i = value
@ -655,18 +705,14 @@ cdef class Edje(Object):
elif isinstance(value, (str, unicode)):
# may be STRING or CHOICE
p.type = edje_object_part_external_param_type_get(
self.obj,
<const char *>part,
<const char *>param
)
p.s = <const char *>value
self.obj, c_part, c_param)
if isinstance(value, unicode):
value = PyUnicode_AsUTF8String(value)
p.s = value
else:
raise TypeError("unsupported type %s" % type(value).__name__)
return bool(edje_object_part_external_param_set(self.obj,
<const char *>part,
&p)
)
return bool(edje_object_part_external_param_set(self.obj, c_part, &p))
def part_external_param_get(self, part, param):
"""Get a parameter of the external part.
@ -677,19 +723,33 @@ cdef class Edje(Object):
:return: *None* for errors, other values depending on the parameter type.
"""
cdef Edje_External_Param p
cdef const char *c_part
cdef const char *c_param
p.name = <const char *>param
p.type = edje_object_part_external_param_type_get(self.obj,
<const char *>part,
<const char *>param
)
if isinstance(part, unicode):
str1 = PyUnicode_AsUTF8String(part)
c_part = str1
elif isinstance(part, str):
c_part = part
else:
raise TypeError("part must be str or unicode, found %s" %
type(part).__name__)
if isinstance(param, unicode):
str2 = PyUnicode_AsUTF8String(param)
c_param = str2
elif isinstance(param, str):
c_param = param
else:
raise TypeError("param must be str or unicode, found %s" %
type(param).__name__)
p.name = c_param
p.type = edje_object_part_external_param_type_get(self.obj, c_part, c_param)
if p.type >= EDJE_EXTERNAL_PARAM_TYPE_MAX:
return None
if not edje_object_part_external_param_get(self.obj,
<const char *>part,
&p
):
if not edje_object_part_external_param_get(self.obj, c_part, &p):
return None
if p.type == EDJE_EXTERNAL_PARAM_TYPE_BOOL:
return bool(p.i)
@ -712,6 +772,7 @@ cdef class Edje(Object):
:param obj: the efl.evas.Object to append
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_box_append(self.obj,
<const char *>part if part is not None else NULL, obj.obj))
@ -726,6 +787,7 @@ cdef class Edje(Object):
:param obj: the efl.evas.Object to append
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_box_prepend(self.obj,
<const char *>part if part is not None else NULL, obj.obj))
@ -738,6 +800,7 @@ cdef class Edje(Object):
:param pos: the position to append the object
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_box_insert_at(self.obj,
<const char *>part if part is not None else NULL, obj.obj, pos))
@ -749,6 +812,7 @@ cdef class Edje(Object):
:param reference: the efl.evas.Object used as reference
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_box_insert_before(self.obj,
<const char *>part if part is not None else NULL,
obj.obj, reference.obj))
@ -765,6 +829,7 @@ cdef class Edje(Object):
:rtype: efl.evas.Object or *None*
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(edje_object_part_box_remove(self.obj,
<const char *>part if part is not None else NULL, obj.obj))
@ -779,6 +844,7 @@ cdef class Edje(Object):
:return: the removed object
:rtype: efl.evas.Object or None
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(edje_object_part_box_remove_at(self.obj,
<const char *>part if part is not None else NULL, pos))
@ -792,6 +858,7 @@ cdef class Edje(Object):
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_box_remove_all(self.obj,
<const char *>part if part is not None else NULL, clear))
@ -807,6 +874,7 @@ cdef class Edje(Object):
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_table_pack(self.obj,
<const char *>part if part is not None else NULL,
child.obj, col, row, colspan, rowspan))
@ -819,6 +887,7 @@ cdef class Edje(Object):
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_table_unpack(self.obj,
<const char *>part if part is not None else NULL,
child.obj))
@ -831,6 +900,7 @@ cdef class Edje(Object):
:rtype: tuple of int
"""
cdef int c, r
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_table_col_row_size_get(self.obj,
<const char *>part if part is not None else NULL, &c, &r)
return (c, r)
@ -845,6 +915,7 @@ cdef class Edje(Object):
:rtype: bool
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return bool(edje_object_part_table_clear(self.obj,
<const char *>part if part is not None else NULL, clear))
@ -858,6 +929,7 @@ cdef class Edje(Object):
:return: the object ath the given position
:rtype: efl.evas.Object
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(edje_object_part_table_child_get(self.obj,
<const char *>part if part is not None else NULL, row, column))
@ -865,12 +937,14 @@ cdef class Edje(Object):
":rtype: (name, value)"
cdef double sv
cdef const char *sn
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
sn = edje_object_part_state_get(self.obj,
<const char *>part if part is not None else NULL, &sv)
return (_ctouni(sn), sv)
def part_drag_dir_get(self, part):
":rtype: int"
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return edje_object_part_drag_dir_get(self.obj,
<const char *>part if part is not None else NULL)
@ -879,12 +953,14 @@ cdef class Edje(Object):
:param dx:
:param dy:
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_value_set(self.obj,
<const char *>part if part is not None else NULL, dx, dy)
def part_drag_value_get(self, part):
":rtype: tuple of float"
cdef double dx, dy
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_value_get(self.obj,
<const char *>part if part is not None else NULL, &dx, &dy)
return (dx, dy)
@ -894,12 +970,14 @@ cdef class Edje(Object):
:param dw:
:param dh:
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_size_set(self.obj,
<const char *>part if part is not None else NULL, dw, dh)
def part_drag_size_get(self, part):
":rtype: tuple of float"
cdef double dw, dh
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_size_get(self.obj,
<const char *>part if part is not None else NULL, &dw, &dh)
return (dw, dh)
@ -909,32 +987,38 @@ cdef class Edje(Object):
:param dx:
:param dy:
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_step_set(self.obj,
<const char *>part if part is not None else NULL, dx, dy)
def part_drag_step_get(self, part):
":rtype: tuple of float"
cdef double dx, dy
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_step_get(self.obj,
<const char *>part if part is not None else NULL, &dx, &dy)
return (dx, dy)
def part_drag_step(self, part, double dx, double dy):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_step(self.obj,
<const char *>part if part is not None else NULL, dx, dy)
def part_drag_page_set(self, part, double dx, double dy):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_page_set(self.obj,
<const char *>part if part is not None else NULL, dx, dy)
def part_drag_page_get(self, part):
":rtype: tuple of float"
cdef double dx, dy
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_page_get(self.obj,
<const char *>part if part is not None else NULL, &dx, &dy)
return (dx, dy)
def part_drag_page(self, part, double dx, double dy):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
edje_object_part_drag_page(self.obj,
<const char *>part if part is not None else NULL, dx, dy)
@ -950,6 +1034,7 @@ cdef class Edje(Object):
cdef void message_send_str(self, int id, data):
cdef Edje_Message_String m
if isinstance(data, unicode): data = PyUnicode_AsUTF8String(data)
m.str = <char *>data if data is not None else NULL
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING, id, <void*>&m)
@ -973,6 +1058,7 @@ cdef class Edje(Object):
cdef void message_send_str_int(self, int id, s, int i):
cdef Edje_Message_String_Int m
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
m.str = <char *>s if s is not None else NULL
m.val = i
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_INT, id,
@ -980,6 +1066,7 @@ cdef class Edje(Object):
cdef void message_send_str_float(self, int id, s, float f):
cdef Edje_Message_String_Float m
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
m.str = <char *>s if s is not None else NULL
m.val = f
edje_object_message_send(self.obj, EDJE_MESSAGE_STRING_FLOAT, id,
@ -993,6 +1080,7 @@ cdef class Edje(Object):
m = <Edje_Message_String_Int_Set*>PyMem_Malloc(
sizeof(Edje_Message_String_Int_Set) + (count - 1) * sizeof(int))
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
m.str = <char *>s if s is not None else NULL
m.count = count
i = 0
@ -1013,6 +1101,7 @@ cdef class Edje(Object):
sizeof(Edje_Message_String_Float_Set) +
(count - 1) * sizeof(double))
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
m.str = <char *>s if s is not None else NULL
m.count = count
i = 0
@ -1073,7 +1162,6 @@ cdef class Edje(Object):
elif isinstance(head, float):
self.message_send_float_set(id, data)
elif isinstance(head, str):
# FIXME: Unicode?
if issubclass(item_type, str):
self.message_send_str_set(id, data)
elif item_type == int or item_type == long:
@ -1107,7 +1195,6 @@ cdef class Edje(Object):
elif isinstance(data, float):
self.message_send_float(id, data)
elif isinstance(data, str):
# FIXME: Unicode?
self.message_send_str(id, data)
elif isinstance(data, (tuple, list)):
if len(data) < 1:
@ -1174,6 +1261,8 @@ cdef class Edje(Object):
d = self._signal_callbacks.setdefault(emission, {})
lst = d.setdefault(source, [])
if not lst:
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
edje_object_signal_callback_add(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -1205,6 +1294,8 @@ cdef class Edje(Object):
d.pop(source)
if not d:
self._signal_callbacks.pop(emission)
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
edje_object_signal_callback_del(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -1212,6 +1303,8 @@ cdef class Edje(Object):
def signal_emit(self, emission, source):
"Emit signal with ``emission`` and ``source``"
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
edje_object_signal_emit(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL)

View File

@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _touni
from efl.evas cimport Object as evasObject
@ -75,6 +77,7 @@ cdef class Accessible(Object):
:see: elm_access_info_cb_set
"""
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_access_info_set(self.obj, type,
<const char *>text if text is not None else NULL)

View File

@ -86,6 +86,7 @@ Actionslider positions
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register

View File

@ -63,6 +63,8 @@ Background display modes
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, Eo
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -127,12 +129,16 @@ cdef class Background(LayoutClass):
else:
filename = value
group = ""
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_bg_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):
raise RuntimeError("Could not set background file.")
def file_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_bg_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):

View File

@ -125,6 +125,8 @@ Box layout modes
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -89,6 +89,8 @@ Bubble arrow positions
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -167,7 +167,7 @@ Days
"""
from cpython cimport PyMem_Malloc, PyMem_Free
from cpython cimport PyUnicode_AsUTF8String, PyMem_Malloc, PyMem_Free
from efl.utils.conversions cimport _ctouni, array_of_strings_to_python_list, \
python_list_strings_to_array_of_strings
@ -261,6 +261,7 @@ cdef class CalendarMark(object):
time.tm_wday = tmtup.tm_wday
time.tm_yday = tmtup.tm_yday
time.tm_isdst = tmtup.tm_isdst
if isinstance(mark_type, unicode): mark_type = PyUnicode_AsUTF8String(mark_type)
self.obj = elm_calendar_mark_add(cal.obj,
<const char *>mark_type if mark_type is not None else NULL,
&time, repeat)

View File

@ -392,6 +392,7 @@ cdef class DragUserInfo(object):
return _ctouni(self._data)
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self._data = value
# Elm_Sel_Format format;

View File

@ -68,7 +68,7 @@ Colorselector modes
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -234,11 +234,13 @@ cdef class Colorselector(LayoutClass):
return _ctouni(elm_colorselector_palette_name_get(self.obj))
def __set__(self, palette_name):
s = palette_name
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
elm_colorselector_palette_name_set(self.obj,
<const char *>s if s is not None else NULL)
def palette_name_set(self, palette_name):
s = palette_name
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
elm_colorselector_palette_name_set(self.obj,
<const char *>s if s is not None else NULL)
def palette_name_get(self):
@ -251,7 +253,7 @@ cdef class Colorselector(LayoutClass):
:rtype: list of :py:class:`ColorselectorPaletteItem`
.. versionadded:: 1.9
"""
cdef:
list ret = list()

View File

@ -101,6 +101,8 @@ Elm_Softcursor_Mode
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.utils.conversions cimport _ctouni, eina_list_strings_to_python_list
cimport enums
@ -159,6 +161,7 @@ cdef class Configuration(object):
def __get__(self):
return _ctouni(elm_config_profile_get())
def __set__(self, profile):
if isinstance(profile, unicode): profile = PyUnicode_AsUTF8String(profile)
elm_config_profile_set(<const char *>profile if profile is not None else NULL)
def profile_dir_get(self, profile, bint is_user):
@ -175,6 +178,7 @@ cdef class Configuration(object):
:rtype: string
"""
if isinstance(profile, unicode): profile = PyUnicode_AsUTF8String(profile)
return _ctouni(elm_config_profile_dir_get(
<const char *>profile if profile is not None else NULL,
is_user))
@ -547,6 +551,7 @@ cdef class Configuration(object):
def __get__(self):
return _ctouni(elm_config_engine_get())
def __set__(self, engine):
if isinstance(engine, unicode): engine = PyUnicode_AsUTF8String(engine)
elm_config_engine_set(
<const char *>engine if engine is not None else NULL)
@ -566,6 +571,7 @@ cdef class Configuration(object):
def __get__(self):
return _ctouni(elm_config_preferred_engine_get())
def __set__(self, engine):
if isinstance(engine, unicode): engine = PyUnicode_AsUTF8String(engine)
elm_config_preferred_engine_set(
<const char *>engine if engine is not None else NULL)
@ -648,6 +654,8 @@ cdef class Configuration(object):
"""
a1 = text_class
a2 = font
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
elm_config_font_overlay_set(
<const char *>a1 if a1 is not None else NULL,
<const char *>a2 if a2 is not None else NULL,
@ -695,6 +703,7 @@ cdef class Configuration(object):
"""
a1 = text_class
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
elm_config_font_overlay_unset(
<const char *>a1 if a1 is not None else NULL)
@ -930,12 +939,14 @@ def focus_highlight_animate_set(animate):
def preferred_engine_get():
return _ctouni(elm_config_preferred_engine_get())
def preferred_engine_set(engine):
if isinstance(engine, unicode): engine = PyUnicode_AsUTF8String(engine)
elm_config_preferred_engine_set(
<const char *>engine if engine is not None else NULL)
def engine_get():
return _ctouni(elm_config_engine_get())
def engine_set(engine):
if isinstance(engine, unicode): engine = PyUnicode_AsUTF8String(engine)
elm_config_engine_set(
<const char *>engine if engine is not None else NULL)

View File

@ -89,7 +89,7 @@ Ctxpopup arrow directions
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
@ -135,6 +135,7 @@ cdef class CtxpopupItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
self.icon = icon
self.cb_func = callback
@ -241,6 +242,8 @@ cdef class Ctxpopup(LayoutClass):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_ctxpopup_item_append(self.obj,
<const char *>label if label is not None else NULL,
icon.obj if icon is not None else NULL,

View File

@ -249,6 +249,8 @@ Datetime fields
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -373,6 +375,7 @@ cdef class Datetime(Object):
def __get__(self):
return _ctouni(elm_datetime_format_get(self.obj))
def __set__(self, fmt):
if isinstance(fmt, unicode): fmt = PyUnicode_AsUTF8String(fmt)
elm_datetime_format_set(self.obj,
<const char *>fmt if fmt is not None else NULL)

View File

@ -108,6 +108,8 @@ Dayselector days
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.evas cimport Object as evasObject
from efl.utils.conversions cimport python_list_strings_to_array_of_strings, \

View File

@ -71,7 +71,7 @@ using multiple inheritance, for example::
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -143,6 +143,7 @@ cdef class DiskselectorItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
self.icon = icon
self.cb_func = callback
@ -355,6 +356,8 @@ cdef class Diskselector(Object):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_diskselector_item_append(self.obj,
<const char *>label if label is not None else NULL,
icon.obj if icon is not None else NULL,

View File

@ -472,7 +472,7 @@ Icon types
from libc.string cimport strdup
from libc.stdlib cimport free
from libc.stdint cimport uintptr_t
from cpython cimport Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _touni, _ctouni
@ -550,20 +550,24 @@ cdef void _entry_context_menu_callback(void *data, Evas_Object *obj, void *event
@DEPRECATED("1.8", "Use markup_to_utf8() instead.")
def Entry_markup_to_utf8(string):
"""Entry_markup_to_utf8(string)"""
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_markup_to_utf8(
<const char *>string if string is not None else NULL))
@DEPRECATED("1.8", "Use utf8_to_markup() instead.")
def Entry_utf8_to_markup(string):
"""Entry_utf8_to_markup(string)"""
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_utf8_to_markup(
<const char *>string if string is not None else NULL))
def markup_to_utf8(string):
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_markup_to_utf8(
<const char *>string if string is not None else NULL))
def utf8_to_markup(string):
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_utf8_to_markup(
<const char *>string if string is not None else NULL))
@ -665,6 +669,7 @@ cdef class FilterAcceptSet(object):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.fltr.accepted = value
def __get__(self):
@ -677,6 +682,7 @@ cdef class FilterAcceptSet(object):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.fltr.rejected = value
def __get__(self):
@ -812,6 +818,7 @@ cdef class Entry(LayoutClass):
.. versionadded:: 1.8
"""
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_entry_text_style_user_push(self.obj,
<const char *>style if style is not None else NULL)
@ -894,10 +901,12 @@ cdef class Entry(LayoutClass):
return _ctouni(elm_entry_entry_get(self.obj))
def __set__(self, entry):
if isinstance(entry, unicode): entry = PyUnicode_AsUTF8String(entry)
elm_entry_entry_set(self.obj,
<const char *>entry if entry is not None else NULL)
def entry_set(self, entry):
if isinstance(entry, unicode): entry = PyUnicode_AsUTF8String(entry)
elm_entry_entry_set(self.obj,
<const char *>entry if entry is not None else NULL)
def entry_get(self):
@ -916,6 +925,7 @@ cdef class Entry(LayoutClass):
:param string entry: The text to be displayed
"""
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_entry_entry_append(self.obj,
<const char *>text if text is not None else NULL)
@ -1011,6 +1021,7 @@ cdef class Entry(LayoutClass):
:type entry: string
"""
if isinstance(entry, unicode): entry = PyUnicode_AsUTF8String(entry)
elm_entry_entry_insert(self.obj,
<const char *>entry if entry is not None else NULL)
@ -1287,6 +1298,9 @@ cdef class Entry(LayoutClass):
cb = _entry_context_menu_callback
data = (func, args, kwargs)
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
if isinstance(icon_file, unicode): icon_file = PyUnicode_AsUTF8String(icon_file)
elm_entry_context_menu_item_add(self.obj,
<const char *>label if label is not None else NULL,
<const char *>icon_file if icon_file is not None else NULL,
@ -1416,11 +1430,13 @@ cdef class Entry(LayoutClass):
@DEPRECATED("1.8", "Use the module level markup_to_utf8() method instead.")
def markup_to_utf8(self, string):
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_markup_to_utf8(
<const char *>string if string is not None else NULL))
@DEPRECATED("1.8", "Use the module level utf8_to_markup() method instead.")
def utf8_to_markup(self, string):
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return _touni(elm_entry_utf8_to_markup(
<const char *>string if string is not None else NULL))
@ -1452,6 +1468,7 @@ cdef class Entry(LayoutClass):
file_name, file_format = value
a1 = file_name
a2 = file_format
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if not elm_entry_file_set(self.obj,
<const char *>a1 if a1 is not None else NULL,
a2 if a2 is not None else enums.ELM_TEXT_FORMAT_PLAIN_UTF8):
@ -1460,6 +1477,7 @@ cdef class Entry(LayoutClass):
def file_set(self, file_name, file_format):
a1 = file_name
a2 = file_format
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if not elm_entry_file_set(self.obj,
<const char *>a1 if a1 is not None else NULL,
a2 if a2 is not None else enums.ELM_TEXT_FORMAT_PLAIN_UTF8):
@ -1920,10 +1938,12 @@ cdef class Entry(LayoutClass):
return _ctouni(elm_entry_anchor_hover_style_get(self.obj))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_entry_anchor_hover_style_set(self.obj,
<const char *>style if style is not None else NULL)
def anchor_hover_style_set(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_entry_anchor_hover_style_set(self.obj,
<const char *>style if style is not None else NULL)
def anchor_hover_style_get(self):

View File

@ -138,7 +138,7 @@ Fileselector sort method
"""
from cpython cimport Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -288,10 +288,12 @@ cdef class Fileselector(LayoutClass):
return _ctouni(elm_fileselector_path_get(self.obj))
def __set__(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_path_set(self.obj,
<const char *>path if path is not None else NULL)
def path_set(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_path_set(self.obj,
<const char *>path if path is not None else NULL)
def path_get(self):
@ -381,11 +383,13 @@ cdef class Fileselector(LayoutClass):
return _ctouni(elm_fileselector_selected_get(self.obj))
def __set__(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
if not elm_fileselector_selected_set(self.obj,
<const char *>path if path is not None else NULL):
raise RuntimeError("Setting the selected path failed")
def selected_set(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
if not elm_fileselector_selected_set(self.obj,
<const char *>path if path is not None else NULL):
raise RuntimeError("Setting the selected path failed")
@ -437,6 +441,8 @@ cdef class Fileselector(LayoutClass):
"""
mime_types_s = ",".join(mime_types)
if isinstance(mime_types_s, unicode): mime_types_s = PyUnicode_AsUTF8String(mime_types_s)
if isinstance(filter_name, unicode): filter_name = PyUnicode_AsUTF8String(filter_name)
if not elm_fileselector_mime_types_filter_append(self.obj, mime_types_s,
<const char *>filter_name if filter_name is not None else NULL):
raise RuntimeWarning
@ -464,6 +470,7 @@ cdef class Fileselector(LayoutClass):
# deleted in the remove method.
Py_INCREF(cb_data)
if isinstance(filter_name, unicode): filter_name = PyUnicode_AsUTF8String(filter_name)
elm_fileselector_custom_filter_append(self.obj,
py_elm_fileselector_custom_filter_cb, <void *>cb_data,
<const char *>filter_name if filter_name is not None else NULL)

View File

@ -74,6 +74,7 @@ using multiple inheritance, for example::
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -120,10 +121,12 @@ cdef class FileselectorButton(Button):
return _ctouni(elm_fileselector_button_window_title_get(self.obj))
def __set__(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_fileselector_button_window_title_set(self.obj,
<const char *>title if title is not None else NULL)
def window_title_set(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_fileselector_button_window_title_set(self.obj,
<const char *>title if title is not None else NULL)
def window_title_get(self):
@ -198,6 +201,7 @@ cdef class FileselectorButton(Button):
@DEPRECATED("1.9", "Combine with Fileselector class instead")
def path_set(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_path_set(self.obj,
<const char *>path if path is not None else NULL)
@DEPRECATED("1.9", "Combine with Fileselector class instead")

View File

@ -90,6 +90,7 @@ using multiple inheritance, for example::
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -141,10 +142,12 @@ cdef class FileselectorEntry(LayoutClass):
return _ctouni(elm_fileselector_entry_window_title_get(self.obj))
def __set__(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_fileselector_entry_window_title_set(self.obj,
<const char *>title if title is not None else NULL)
def window_title_set(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_fileselector_entry_window_title_set(self.obj,
<const char *>title if title is not None else NULL)
def window_title_get(self):
@ -219,6 +222,7 @@ cdef class FileselectorEntry(LayoutClass):
@DEPRECATED("1.9", "Combine with Fileselector class instead")
def path_set(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_path_set(self.obj,
<const char *>path if path is not None else NULL)
@DEPRECATED("1.9", "Combine with Fileselector class instead")
@ -304,10 +308,12 @@ cdef class FileselectorEntry(LayoutClass):
return _ctouni(elm_fileselector_selected_get(self.obj))
def __set__(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_selected_set(self.obj,
<const char *>path if path is not None else NULL)
def selected_set(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_fileselector_selected_set(self.obj,
<const char *>path if path is not None else NULL)
def selected_get(self):

View File

@ -56,6 +56,7 @@ Default text parts of the flipselector items that you can use for are:
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -111,6 +112,7 @@ cdef class FlipSelectorItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
self.cb_func = callback
self.args = args
@ -177,6 +179,7 @@ cdef class FlipSelectorItem(ObjectItem):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.label = value
def __get__(self):
@ -266,6 +269,8 @@ cdef class FlipSelector(Object):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_flipselector_item_append(self.obj,
<const char *>label if label is not None else NULL,
cb, <void*>ret)
@ -293,6 +298,8 @@ cdef class FlipSelector(Object):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_flipselector_item_prepend(self.obj,
<const char *>label if label is not None else NULL,
cb, <void*>ret)

View File

@ -53,6 +53,8 @@ Default text parts of the frame widget that you can use for are:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -119,7 +119,7 @@ Possible values for the #ELM_POLICY_THROTTLE policy.
"""
from cpython cimport PyObject, Py_INCREF, Py_DECREF, \
from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String, \
PyMem_Malloc, PyMem_Free
from libc.stdint cimport uintptr_t
@ -162,6 +162,7 @@ cdef class FontProperties(object):
property name:
""":type: unicode"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.efp.name = value
def __get__(self):
@ -201,6 +202,7 @@ def init():
argv = <char **>PyMem_Malloc(argc * sizeof(char *))
for i in range(argc):
t = sys.argv[i]
if isinstance(t, unicode): t = PyUnicode_AsUTF8String(t)
arg = t
arg_len = len(arg)
argv[i] = <char *>PyMem_Malloc(arg_len + 1)
@ -344,6 +346,7 @@ def language_set(lang not None):
:param lang: Language to set, must be the full name of the locale
"""
if isinstance(lang, unicode): lang = PyUnicode_AsUTF8String(lang)
elm_language_set(<const char *>lang)
def cache_all_flush():
@ -371,6 +374,7 @@ def font_properties_get(font not None):
.. versionadded:: 1.8
"""
if isinstance(font, unicode): font = PyUnicode_AsUTF8String(font)
cdef FontProperties ret = FontProperties.__new__()
ret.efp = elm_font_properties_get(<const char *>font)
@ -407,6 +411,8 @@ def font_fontconfig_name_get(font_name, style = None):
cdef:
unicode ret
char *fc_name
if isinstance(font_name, unicode): font_name = PyUnicode_AsUTF8String(font_name)
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
fc_name = elm_font_fontconfig_name_get(
<const char *>font_name,
<const char *>style if style is not None else NULL
@ -462,4 +468,5 @@ def object_tree_dot_dump(evasObject top, path):
.. versionadded:: 1.8
"""
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
elm_object_tree_dot_dump(top.obj, <const char *>path)

View File

@ -280,7 +280,7 @@ include "tooltips.pxi"
from libc.string cimport strdup
from libc.stdint cimport uintptr_t
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String
from efl.eo cimport object_from_instance, _object_mapping_register, PY_REFCOUNT
from efl.utils.conversions cimport _ctouni, _touni
@ -324,6 +324,7 @@ cdef char *_py_elm_gengrid_item_text_get(void *data, Evas_Object *obj, const cha
return NULL
if ret is not None:
if isinstance(ret, unicode): ret = PyUnicode_AsUTF8String(ret)
return strdup(ret)
else:
return NULL

View File

@ -306,11 +306,13 @@ cdef class GengridItem(ObjectItem):
"""
def __set__(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_gengrid_item_tooltip_text_set(self.item,
<const char *>text if text is not None else NULL)
def tooltip_text_set(self, text):
# TODO: document this
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_gengrid_item_tooltip_text_set(self.item,
<const char *>text if text is not None else NULL)
@ -368,10 +370,12 @@ cdef class GengridItem(ObjectItem):
return _ctouni(elm_gengrid_item_tooltip_style_get(self.item))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_gengrid_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
def tooltip_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_gengrid_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
def tooltip_style_get(self):
@ -400,6 +404,7 @@ cdef class GengridItem(ObjectItem):
return _ctouni(elm_gengrid_item_cursor_get(self.item))
def __set__(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_gengrid_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
@ -407,6 +412,7 @@ cdef class GengridItem(ObjectItem):
elm_gengrid_item_cursor_unset(self.item)
def cursor_set(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_gengrid_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
def cursor_get(self):
@ -420,10 +426,12 @@ cdef class GengridItem(ObjectItem):
return _ctouni(elm_gengrid_item_cursor_style_get(self.item))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_gengrid_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
def cursor_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_gengrid_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
def cursor_style_get(self):

View File

@ -108,6 +108,8 @@ cdef class GengridItemClass:
pass
if item_style is not None:
if isinstance(item_style, unicode):
item_style = PyUnicode_AsUTF8String(item_style)
self._item_style = item_style
self.cls.item_style = <char *>self._item_style
@ -156,6 +158,7 @@ cdef class GengridItemClass:
return self._item_style.decode("UTF-8")
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
self._item_style = style
self.cls.item_style = <char *>style if style is not None else NULL

View File

@ -506,7 +506,7 @@ Selection modes
include "tooltips.pxi"
from cpython cimport Py_DECREF, Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, PY_REFCOUNT
@ -591,6 +591,7 @@ cdef char *_py_elm_genlist_item_text_get(void *data, Evas_Object *obj, const cha
return NULL
if ret is not None:
if isinstance(ret, unicode): ret = PyUnicode_AsUTF8String(ret)
return strdup(ret)
else:
return NULL

View File

@ -392,6 +392,7 @@ cdef class GenlistItem(ObjectItem):
Internally, this method calls :py:func:`tooltip_content_cb_set`
"""
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_genlist_item_tooltip_text_set(self.item,
<const char *>text if text is not None else NULL)
@ -447,6 +448,7 @@ cdef class GenlistItem(ObjectItem):
"""
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_genlist_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
@ -454,6 +456,7 @@ cdef class GenlistItem(ObjectItem):
return _ctouni(elm_genlist_item_tooltip_style_get(self.item))
def tooltip_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_genlist_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
def tooltip_style_get(self):
@ -490,6 +493,7 @@ cdef class GenlistItem(ObjectItem):
"""
def __set__(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_genlist_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
@ -500,6 +504,7 @@ cdef class GenlistItem(ObjectItem):
elm_genlist_item_cursor_unset(self.item)
def cursor_set(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_genlist_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
def cursor_get(self):
@ -517,6 +522,7 @@ cdef class GenlistItem(ObjectItem):
"""
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_genlist_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
@ -524,6 +530,7 @@ cdef class GenlistItem(ObjectItem):
return _ctouni(elm_genlist_item_cursor_style_get(self.item))
def cursor_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_genlist_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
def cursor_style_get(self):
@ -677,6 +684,7 @@ cdef class GenlistItem(ObjectItem):
.. seealso:: :py:func:`update()`
"""
if isinstance(parts, unicode): parts = PyUnicode_AsUTF8String(parts)
elm_genlist_item_fields_update(self.item,
<const char *>parts if parts is not None else NULL,
itf)
@ -726,6 +734,7 @@ cdef class GenlistItem(ObjectItem):
def decorate_mode_set(self, decorate_it_type, decorate_it_set):
a1 = decorate_it_type
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
elm_genlist_item_decorate_mode_set(self.item,
<const char *>a1 if a1 is not None else NULL,
decorate_it_set)

View File

@ -115,6 +115,10 @@ cdef class GenlistItemClass(object):
a2 = decorate_item_style
a3 = decorate_all_item_style
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
if isinstance(a3, unicode): a3 = PyUnicode_AsUTF8String(a3)
self._item_style = a1
self._decorate_item_style = a2
self._decorate_all_item_style = a3
@ -167,6 +171,7 @@ cdef class GenlistItemClass(object):
return self._item_style.decode("UTF-8")
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
self._item_style = style
self.cls.item_style = <char *>style if style is not None else NULL
@ -176,6 +181,7 @@ cdef class GenlistItemClass(object):
return self._decorate_item_style.decode("UTF-8")
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
self._decorate_item_style = style
self.cls.decorate_item_style = <char *>style if style is not None else NULL
@ -185,6 +191,7 @@ cdef class GenlistItemClass(object):
return self._decorate_all_item_style.decode("UTF-8")
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
self._decorate_all_item_style = style
self.cls.decorate_all_item_style = <char *>style if style is not None else NULL

View File

@ -157,7 +157,7 @@ Gesture types
"""
from cpython cimport Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni

View File

@ -112,6 +112,8 @@ Hover axis
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -73,7 +73,7 @@ Icon types
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance
@ -122,6 +122,8 @@ cdef class HoverselItem(ObjectItem):
:type callback: function
"""
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
if isinstance(icon_file, unicode): icon_file = PyUnicode_AsUTF8String(icon_file)
self.label = label
self.icon_file = icon_file
self.icon_type = icon_type
@ -177,6 +179,8 @@ cdef class HoverselItem(ObjectItem):
def __set__(self, value):
icon_file, icon_group, icon_type = value
a1, a2, a3 = icon_file, icon_group, icon_type
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
if self.item == NULL:
self.icon_file = a1
self.icon_group = a2
@ -204,6 +208,8 @@ cdef class HoverselItem(ObjectItem):
def icon_set(self, icon_file, icon_group, icon_type):
a1, a2, a3 = icon_file, icon_group, icon_type
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
if isinstance(a2, unicode): a2 = PyUnicode_AsUTF8String(a2)
if self.item == NULL:
self.icon_file = a1
self.icon_group = a2
@ -339,6 +345,9 @@ cdef class Hoversel(Button):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
if isinstance(icon_file, unicode): icon_file = PyUnicode_AsUTF8String(icon_file)
item = elm_hoversel_item_add(self.obj,
<const char *>label if label is not None else NULL,
<const char *>icon_file if icon_file is not None else NULL,

View File

@ -141,6 +141,8 @@ Icon type
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -183,11 +185,15 @@ cdef class Icon(Image):
else:
filename = value
group = None
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
elm_icon_thumb_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL)
def thumb_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
elm_icon_thumb_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL)
@ -226,11 +232,13 @@ cdef class Icon(Image):
return _ctouni(elm_icon_standard_get(self.obj))
def __set__(self, name):
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
if not elm_icon_standard_set(self.obj,
<const char *>name if name is not None else NULL):
raise RuntimeWarning("Setting standard icon failed")
def standard_set(self, name):
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
return elm_icon_standard_set(self.obj,
<const char *>name if name is not None else NULL)
def standard_get(self):

View File

@ -94,6 +94,7 @@ Image manipulation types
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance
@ -197,6 +198,8 @@ cdef class Image(Object):
else:
filename = value
group = None
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_image_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):
@ -211,6 +214,8 @@ cdef class Image(Object):
return (_ctouni(filename), _ctouni(group))
def file_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_image_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):

View File

@ -65,7 +65,7 @@ actually be reported.
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -161,6 +161,7 @@ cdef class IndexItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(letter, unicode): letter = PyUnicode_AsUTF8String(letter)
self.letter = letter
self.cb_func = callback

View File

@ -95,6 +95,8 @@ Slide modes
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -137,6 +137,8 @@ This widget emits the following signals:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -15,6 +15,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject, eina_list_free
@ -86,6 +89,7 @@ cdef class LayoutClass(Object):
if content is None:
content = swallow
swallow = None
if isinstance(swallow, unicode): swallow = PyUnicode_AsUTF8String(swallow)
if not elm_layout_content_set(self.obj,
<const char *>swallow if swallow is not None else NULL,
content.obj if content is not None else NULL):
@ -100,6 +104,7 @@ cdef class LayoutClass(Object):
:return: The swallowed object or None if none or an error occurred
"""
if isinstance(swallow, unicode): swallow = PyUnicode_AsUTF8String(swallow)
return object_from_instance(elm_layout_content_get(self.obj,
<const char *>swallow if swallow is not None else NULL))
@ -114,6 +119,7 @@ cdef class LayoutClass(Object):
:rtype: :py:class:`~efl.evas.Object`
"""
if isinstance(swallow, unicode): swallow = PyUnicode_AsUTF8String(swallow)
return object_from_instance(elm_layout_content_unset(self.obj,
<const char *>swallow if swallow is not None else NULL))
@ -129,6 +135,8 @@ cdef class LayoutClass(Object):
Raises RuntimeError if setting the text fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
if text is None:
# In this case we're guessing the user wants the only arg used
# as text
@ -150,6 +158,7 @@ cdef class LayoutClass(Object):
"""
# With part=None it should do the same as elm_object_text_get
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_layout_text_get(self.obj,
<const char *>part if part is not None else NULL))
@ -166,12 +175,16 @@ cdef class LayoutClass(Object):
"""
def __set__(self, value):
filename, group = value
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_layout_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):
raise RuntimeError("Could not set file.")
def file_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if not elm_layout_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL):
@ -226,6 +239,9 @@ cdef class LayoutClass(Object):
"""
def __set__(self, theme):
clas, group, style = theme
if isinstance(clas, unicode): clas = PyUnicode_AsUTF8String(clas)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
if not elm_layout_theme_set(self.obj,
<const char *>clas if clas is not None else NULL,
<const char *>group if group is not None else NULL,
@ -233,6 +249,9 @@ cdef class LayoutClass(Object):
raise RuntimeError("Could not set theme.")
def theme_set(self, clas, group, style):
if isinstance(clas, unicode): clas = PyUnicode_AsUTF8String(clas)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
if not elm_layout_theme_set(self.obj,
<const char *>clas if clas is not None else NULL,
<const char *>group if group is not None else NULL,
@ -253,6 +272,8 @@ cdef class LayoutClass(Object):
:type source: string
"""
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_layout_signal_emit(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL)
@ -281,6 +302,8 @@ cdef class LayoutClass(Object):
d = self._elm_layout_signal_cbs.setdefault(emission, {})
lst = d.setdefault(source, [])
if not lst:
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_layout_signal_callback_add(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -328,6 +351,8 @@ cdef class LayoutClass(Object):
d.pop(source)
if not d:
self._elm_layout_signal_cbs.pop(emission)
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_layout_signal_callback_del(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -358,6 +383,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_box_append(self.obj,
<const char *>part if part is not None else NULL,
child.obj):
@ -388,6 +414,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_box_prepend(self.obj,
<const char *>part if part is not None else NULL,
child.obj):
@ -420,6 +447,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_box_insert_before(self.obj,
<const char *>part if part is not None else NULL,
child.obj, reference.obj):
@ -452,6 +480,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_box_insert_at(self.obj,
<const char *>part if part is not None else NULL,
child.obj, pos):
@ -477,6 +506,7 @@ cdef class LayoutClass(Object):
:rtype: :py:class:`~efl.evas.Object`
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_layout_box_remove(self.obj,
<const char *>part if part is not None else NULL,
child.obj))
@ -505,6 +535,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if removing the children fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_box_remove_all(self.obj,
<const char *>part if part is not None else NULL,
clear):
@ -545,6 +576,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_table_pack(self.obj,
<const char *>part if part is not None else NULL,
child_obj.obj, col, row, colspan, rowspan):
@ -570,6 +602,7 @@ cdef class LayoutClass(Object):
:rtype: :py:class:`~efl.evas.Object`
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_layout_table_unpack(self.obj,
<const char *>part if part is not None else NULL,
child_obj.obj))
@ -598,6 +631,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if clearing the table fails
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if not elm_layout_table_clear(self.obj,
<const char *>part if part is not None else NULL,
clear):
@ -660,6 +694,7 @@ cdef class LayoutClass(Object):
:rtype: string
"""
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
return _ctouni(elm_layout_data_get(self.obj,
<const char *>key if key is not None else NULL))
@ -698,6 +733,8 @@ cdef class LayoutClass(Object):
Raises RuntimeError if setting the cursor fails
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
if not elm_layout_part_cursor_set(self.obj,
<const char *>part_name if part_name is not None else NULL,
<const char *>cursor if cursor is not None else NULL):
@ -712,6 +749,7 @@ cdef class LayoutClass(Object):
:rtype: string
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
return _ctouni(elm_layout_part_cursor_get(self.obj,
<const char *>part_name if part_name is not None else NULL))
@ -728,6 +766,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if unsetting the cursor fails
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
if not elm_layout_part_cursor_unset(self.obj,
<const char *>part_name if part_name is not None else NULL):
raise RuntimeError("Could not unset part cursor")
@ -746,6 +785,8 @@ cdef class LayoutClass(Object):
Raises RuntimeError if setting the cursor style fails
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
if not elm_layout_part_cursor_style_set(self.obj,
<const char *>part_name if part_name is not None else NULL,
<const char *>style if style is not None else NULL):
@ -762,6 +803,7 @@ cdef class LayoutClass(Object):
:rtype: string
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
return _ctouni(elm_layout_part_cursor_style_get(self.obj,
<const char *>part_name if part_name is not None else NULL))
@ -790,6 +832,7 @@ cdef class LayoutClass(Object):
Raises RuntimeError if setting the value fails
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
if not elm_layout_part_cursor_engine_only_set(self.obj,
<const char *>part_name if part_name is not None else NULL,
engine_only):
@ -805,6 +848,7 @@ cdef class LayoutClass(Object):
:rtype: bool
"""
if isinstance(part_name, unicode): part_name = PyUnicode_AsUTF8String(part_name)
return bool(elm_layout_part_cursor_engine_only_get(self.obj,
<const char *>part_name if part_name is not None else NULL))
@ -840,7 +884,7 @@ cdef class LayoutClass(Object):
:rtype: list of objects.
.. versionadded:: 1.9
"""
cdef:
Eina_List *l = elm_layout_content_swallow_list_get(self.obj)

View File

@ -158,7 +158,7 @@ Selection modes
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT
@ -217,6 +217,7 @@ cdef class ListItem(ObjectItem):
:param cb_data: An object associated with the callback.
"""
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
if icon is not None:
@ -703,6 +704,8 @@ cdef class List(Object):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_list_item_append(self.obj,
<const char *>label if label is not None else NULL,
icon.obj if icon is not None else NULL,
@ -731,6 +734,8 @@ cdef class List(Object):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_list_item_prepend(self.obj,
<const char *>label if label is not None else NULL,
icon.obj if icon is not None else NULL,
@ -760,6 +765,8 @@ cdef class List(Object):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_list_item_insert_before(self.obj,
before.item,
<const char *>label if label is not None else NULL,
@ -790,6 +797,8 @@ cdef class List(Object):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_list_item_insert_after(self.obj,
after.item,
<const char *>label if label is not None else NULL,

View File

@ -205,7 +205,7 @@ Map zoom modes
"""
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
@ -393,6 +393,7 @@ cdef class MapName(object):
raise TypeError("func must be callable")
data = (self, func, args, kwargs)
if isinstance(address, unicode): address = PyUnicode_AsUTF8String(address)
self.name = elm_map_name_add(map.obj,
<const char *>address if address is not None else NULL,
lon, lat, _map_name_callback, <void *>data)
@ -1224,10 +1225,14 @@ cdef class Map(Object):
return _ctouni(elm_map_user_agent_get(self.obj))
def __set__(self, user_agent):
if isinstance(user_agent, unicode):
user_agent = PyUnicode_AsUTF8String(user_agent)
elm_map_user_agent_set(self.obj,
<const char *>user_agent if user_agent is not None else NULL)
def user_agent_set(self, user_agent):
if isinstance(user_agent, unicode):
user_agent = PyUnicode_AsUTF8String(user_agent)
elm_map_user_agent_set(self.obj,
<const char *>user_agent if user_agent is not None else NULL)
def user_agent_get(self):
@ -1528,6 +1533,8 @@ cdef class Map(Object):
.. seealso:: :py:func:`sources_get`, :py:func:`source_get`
"""
if isinstance(source_name, unicode):
source_name = PyUnicode_AsUTF8String(source_name)
elm_map_source_set(self.obj, source_type,
<const char *>source_name if source_name is not None else NULL)

View File

@ -44,7 +44,7 @@ Default text parts of the menu items that you can use for are:
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
@ -67,6 +67,8 @@ cdef class MenuItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.parent = parent
self.label = label
self.icon = icon
@ -124,10 +126,12 @@ cdef class MenuItem(ObjectItem):
return _ctouni(elm_menu_item_icon_name_get(self.item))
def __set__(self, icon):
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
elm_menu_item_icon_name_set(self.item,
<const char *>icon if icon is not None else NULL)
def icon_name_set(self, icon):
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
elm_menu_item_icon_name_set(self.item,
<const char *>icon if icon is not None else NULL)
def icon_name_get(self):
@ -376,6 +380,9 @@ cdef class Menu(Object):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
item = elm_menu_item_add(self.obj,
parent.item if parent is not None else NULL,
<const char *>icon if icon is not None else NULL,

View File

@ -62,7 +62,7 @@ Default text parts of the multibuttonentry items that you can use for are:
"""
from cpython cimport Py_DECREF, Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT
@ -97,6 +97,7 @@ cdef char * _multibuttonentry_format_cb(int count, void *data) with gil:
try:
s = callback(count, *a, **ka)
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
except:
traceback.print_exc()
return NULL
@ -119,6 +120,7 @@ cdef class MultiButtonEntryItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
self.cb_func = callback
self.cb_data = cb_data
@ -284,6 +286,8 @@ cdef class MultiButtonEntry(Object):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_multibuttonentry_item_prepend(self.obj,
<const char *>label if label is not None else NULL,
cb, <void*>ret)
@ -306,6 +310,8 @@ cdef class MultiButtonEntry(Object):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_multibuttonentry_item_append(self.obj,
<const char *>label if label is not None else NULL,
cb, <void*>ret)
@ -328,6 +334,8 @@ cdef class MultiButtonEntry(Object):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_multibuttonentry_item_insert_before(self.obj,
before.item if before is not None else NULL,
<const char *>label if label is not None else NULL,
@ -351,6 +359,8 @@ cdef class MultiButtonEntry(Object):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_multibuttonentry_item_insert_after(self.obj,
after.item if after is not None else NULL,
<const char *>label if label is not None else NULL,

View File

@ -93,6 +93,8 @@ the top one can be interacted with this way.
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -145,6 +147,7 @@ cdef class NaviframeItem(ObjectItem):
:type item_style: string
"""
if isinstance(title_label, unicode): title_label = PyUnicode_AsUTF8String(title_label)
self.label = title_label
if prev_btn is not None:
@ -298,10 +301,12 @@ cdef class NaviframeItem(ObjectItem):
return _ctouni(elm_naviframe_item_style_get(self.item))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_naviframe_item_style_set(self.item,
<const char *>style if style is not None else NULL)
def style_set(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_naviframe_item_style_set(self.item,
<const char *>style if style is not None else NULL)
def style_get(self):

View File

@ -54,6 +54,8 @@ ELM_NOTIFY_ALIGN_FILL
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject

View File

@ -219,7 +219,8 @@ Defines the kind of action associated with the drop data if for XDND
"""
from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyObject_GetAttr, \
PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyObject_CheckBuffer
PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyObject_CheckBuffer, \
PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -385,6 +386,8 @@ cdef class Object(evasObject):
:type text: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_part_text_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>text if text is not None else NULL)
@ -400,6 +403,7 @@ cdef class Object(evasObject):
:rtype: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_object_part_text_get(self.obj,
<const char *>part if part is not None else NULL))
@ -413,10 +417,12 @@ cdef class Object(evasObject):
return _ctouni(elm_object_text_get(self.obj))
def __set__(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_text_set(self.obj,
<const char *>text if text is not None else NULL)
def text_set(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_text_set(self.obj,
<const char *>text if text is not None else NULL)
def text_get(self):
@ -437,6 +443,7 @@ cdef class Object(evasObject):
:type content: :py:class:`efl.evas.Object`
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
elm_object_part_content_set(self.obj,
<const char *>part if part is not None else NULL, content.obj)
@ -451,6 +458,7 @@ cdef class Object(evasObject):
:rtype: :py:class:`efl.evas.Object`
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_object_part_content_get(self.obj,
<const char *>part if part is not None else NULL))
@ -464,6 +472,7 @@ cdef class Object(evasObject):
:type part: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_object_part_content_unset(self.obj,
<const char *>part if part is not None else NULL))
@ -499,6 +508,7 @@ cdef class Object(evasObject):
# :type txt: string
# """
# if isinstance(txt, unicode): txt = PyUnicode_AsUTF8String(txt)
# elm_object_access_info_set(self.obj,
# <const char *>txt if txt is not None else NULL)
@ -524,6 +534,7 @@ cdef class Object(evasObject):
:rtype: :py:class:`~efl.elementary.object.Object`
"""
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
return object_from_instance(elm_object_name_find(self.obj,
<const char *>name if name is not None else NULL,
recurse))
@ -538,10 +549,12 @@ cdef class Object(evasObject):
return _ctouni(elm_object_style_get(self.obj))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_style_set(self.obj,
<const char *>style if style is not None else NULL)
def style_set(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_style_set(self.obj,
<const char *>style if style is not None else NULL)
def style_get(self):
@ -646,6 +659,9 @@ cdef class Object(evasObject):
:type source: string
"""
if isinstance(emission, unicode):
emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_object_signal_emit(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL)
@ -669,6 +685,10 @@ cdef class Object(evasObject):
d = self._elm_signal_cbs.setdefault(emission, {})
lst = d.setdefault(source, [])
if not lst:
if isinstance(emission, unicode):
emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode):
source = PyUnicode_AsUTF8String(source)
elm_object_signal_callback_add(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -713,6 +733,9 @@ cdef class Object(evasObject):
d.pop(source)
if not d:
self._elm_signal_cbs.pop(emission)
if isinstance(emission, unicode):
emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_object_signal_callback_del(self.obj,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL,
@ -849,6 +872,8 @@ cdef class Object(evasObject):
return _ctouni(elm_object_cursor_get(self.obj))
def __set__(self, cursor):
if isinstance(cursor, unicode):
cursor = PyUnicode_AsUTF8String(cursor)
elm_object_cursor_set(self.obj,
<const char *>cursor if cursor is not None else NULL)
@ -856,6 +881,7 @@ cdef class Object(evasObject):
elm_object_cursor_unset(self.obj)
def cursor_set(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_object_cursor_set(self.obj,
<const char *>cursor if cursor is not None else NULL)
def cursor_get(self):
@ -873,10 +899,12 @@ cdef class Object(evasObject):
return _ctouni(elm_object_cursor_style_get(self.obj))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_cursor_style_set(self.obj,
<const char *>style if style is not None else NULL)
def cursor_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_cursor_style_set(self.obj,
<const char *>style if style is not None else NULL)
def cursor_style_get(self):
@ -1106,12 +1134,14 @@ cdef class Object(evasObject):
"""
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_focus_highlight_style_set(self.obj,
<const char *>style if style is not None else NULL)
def __get__(self):
return elm_object_focus_highlight_style_get(self.obj)
def focus_highlight_style_set(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_focus_highlight_style_set(self.obj,
<const char *>style if style is not None else NULL)
def focus_highlight_style_get(self):
@ -1354,15 +1384,19 @@ cdef class Object(evasObject):
method calls :py:func:`tooltip_content_cb_set`
"""
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_tooltip_text_set(self.obj,
<const char *>text if text is not None else NULL)
def tooltip_domain_translatable_text_set(self, domain, text):
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_tooltip_domain_translatable_text_set(self.obj,
<const char *>domain if domain is not None else NULL,
<const char *>text if text is not None else NULL)
def tooltip_translatable_text_set(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_tooltip_translatable_text_set(self.obj,
<const char *>text if text is not None else NULL)
@ -1411,10 +1445,12 @@ cdef class Object(evasObject):
def __get__(self):
return _ctouni(elm_object_tooltip_style_get(self.obj))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_tooltip_style_set(self.obj,
<const char *>style if style is not None else NULL)
def tooltip_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_tooltip_style_set(self.obj,
<const char *>style if style is not None else NULL)
def tooltip_style_get(self):
@ -1463,6 +1499,9 @@ cdef class Object(evasObject):
@DEPRECATED("1.8", "Use :py:func:`domain_translatable_part_text_set` instead.")
def domain_translatable_text_part_set(self, part, domain, text):
"""domain_translatable_text_part_set(part, domain, text)"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_domain_translatable_part_text_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>domain if domain is not None else NULL,
@ -1493,6 +1532,9 @@ cdef class Object(evasObject):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_domain_translatable_part_text_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>domain if domain is not None else NULL,
@ -1501,18 +1543,23 @@ cdef class Object(evasObject):
def domain_translatable_text_set(self, domain, text):
"""A convenience function."""
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_domain_translatable_text_set(self.obj,
<const char *>domain if domain is not None else NULL,
<const char *>text if text is not None else NULL)
def translatable_part_text_set(self, part, text):
"""A convenience function."""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_translatable_part_text_set(self.obj,
<const char *>part if part is not None else NULL,
<const char *>text if text is not None else NULL)
@DEPRECATED("1.8", "Use :py:func:`translatable_part_text_get` instead.")
def translatable_text_part_get(self, part):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_object_translatable_part_text_get(self.obj,
<const char *>part if part is not None else NULL))
@ -1535,6 +1582,7 @@ cdef class Object(evasObject):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_object_translatable_part_text_get(self.obj,
<const char *>part if part is not None else NULL))
@ -1558,6 +1606,8 @@ cdef class Object(evasObject):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
elm_object_domain_part_text_translatable_set(self.obj,
<const char *>part,
<const char *>domain,
@ -1565,11 +1615,13 @@ cdef class Object(evasObject):
def part_text_translatable_set(self, part, bint translatable):
"""A convenience function."""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
elm_object_part_text_translatable_set(self.obj,
part, translatable)
def domain_text_translatable_set(self, domain, bint translatable):
"""A convenience function."""
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
elm_object_domain_text_translatable_set(self.obj, domain, translatable)
property translatable_text:
@ -1580,6 +1632,7 @@ cdef class Object(evasObject):
self.translatable_text_set(text)
def translatable_text_set(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_translatable_text_set(self.obj,
<const char *>text if text is not None else NULL)
def translatable_text_get(self):
@ -1625,6 +1678,7 @@ cdef class Object(evasObject):
e = intern(event)
lst = self._elmcallbacks.setdefault(e, [])
if isinstance(event, unicode): event = PyUnicode_AsUTF8String(event)
if not lst:
evas_object_smart_callback_add(self.obj,
<const char *>event if event is not None else NULL,
@ -1669,6 +1723,7 @@ cdef class Object(evasObject):
if lst:
return
self._elmcallbacks.pop(event)
if isinstance(event, unicode): event = PyUnicode_AsUTF8String(event)
evas_object_smart_callback_del(self.obj,
<const char *>event if event is not None else NULL,
_object_callback)
@ -1739,6 +1794,7 @@ cdef class Object(evasObject):
Py_buffer view
bint ret
if isinstance(buf, unicode): buf = PyUnicode_AsUTF8String(buf)
if not PyObject_CheckBuffer(buf):
raise TypeError(
"The provided object does not support buffer interface."

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport Py_DECREF, Py_INCREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF, Py_INCREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT
@ -198,6 +198,7 @@ cdef class ObjectItem(object):
:param content: The new content of the object item
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
elm_object_item_part_content_set(self.item,
<const char *>part if part is not None else NULL, content.obj)
@ -213,6 +214,7 @@ cdef class ObjectItem(object):
:rtype: :py:class:`~efl.evas.Object`
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_object_item_part_content_get(self.item,
<const char *>part if part is not None else NULL))
@ -226,6 +228,7 @@ cdef class ObjectItem(object):
:type part: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return object_from_instance(elm_object_item_part_content_unset(self.item,
<const char *>part if part is not None else NULL))
@ -258,6 +261,8 @@ cdef class ObjectItem(object):
:type text: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_item_part_text_set(self.item,
<const char *>part if part is not None else NULL,
<const char *>text if text is not None else NULL)
@ -273,6 +278,7 @@ cdef class ObjectItem(object):
:rtype: string
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_object_item_part_text_get(self.item,
<const char *>part if part is not None else NULL))
@ -298,6 +304,9 @@ cdef class ObjectItem(object):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_item_domain_translatable_part_text_set(self.item,
<const char *>part if part is not None else NULL,
<const char *>domain if domain is not None else NULL,
@ -317,6 +326,7 @@ cdef class ObjectItem(object):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return _ctouni(elm_object_item_translatable_part_text_get(self.item,
<const char *>part if part is not None else NULL))
@ -341,6 +351,8 @@ cdef class ObjectItem(object):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
if isinstance(domain, unicode): domain = PyUnicode_AsUTF8String(domain)
elm_object_item_domain_part_text_translatable_set(self.item,
<const char *>part,
<const char *>domain,
@ -356,10 +368,12 @@ cdef class ObjectItem(object):
return _ctouni(elm_object_item_text_get(self.item))
def __set__(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_item_text_set(self.item,
<const char *>text if text is not None else NULL)
def text_set(self, text):
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_item_text_set(self.item,
<const char *>text if text is not None else NULL)
def text_get(self):
@ -373,10 +387,12 @@ cdef class ObjectItem(object):
# """
# def __set__(self, txt):
# if isinstance(txt, unicode): txt = PyUnicode_AsUTF8String(txt)
# elm_object_item_access_info_set(self.item,
# <const char *>txt if txt is not None else NULL)
# def access_info_set(self, txt):
# if isinstance(txt, unicode): txt = PyUnicode_AsUTF8String(txt)
# elm_object_item_access_info_set(self.item,
# <const char *>txt if txt is not None else NULL)
@ -393,6 +409,8 @@ cdef class ObjectItem(object):
:type source: string
"""
if isinstance(emission, unicode): emission = PyUnicode_AsUTF8String(emission)
if isinstance(source, unicode): source = PyUnicode_AsUTF8String(source)
elm_object_item_signal_emit(self.item,
<const char *>emission if emission is not None else NULL,
<const char *>source if source is not None else NULL)
@ -438,6 +456,7 @@ cdef class ObjectItem(object):
method calls :py:func:`tooltip_content_cb_set`
"""
if isinstance(text, unicode): text = PyUnicode_AsUTF8String(text)
elm_object_item_tooltip_text_set(self.item,
<const char *>text if text is not None else NULL)
@ -504,6 +523,7 @@ cdef class ObjectItem(object):
"""
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
@ -514,6 +534,7 @@ cdef class ObjectItem(object):
self.tooltip_style_set(None)
def tooltip_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_item_tooltip_style_set(self.item,
<const char *>style if style is not None else NULL)
def tooltip_style_get(self):
@ -526,6 +547,7 @@ cdef class ObjectItem(object):
"""
def __set__(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_object_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
@ -536,6 +558,7 @@ cdef class ObjectItem(object):
elm_object_item_cursor_unset(self.item)
def cursor_set(self, cursor):
if isinstance(cursor, unicode): cursor = PyUnicode_AsUTF8String(cursor)
elm_object_item_cursor_set(self.item,
<const char *>cursor if cursor is not None else NULL)
def cursor_get(self):
@ -551,6 +574,7 @@ cdef class ObjectItem(object):
"""
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
@ -561,6 +585,7 @@ cdef class ObjectItem(object):
elm_object_item_cursor_style_set(self.item, NULL)
def cursor_style_set(self, style=None):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_object_item_cursor_style_set(self.item,
<const char *>style if style is not None else NULL)
def cursor_style_get(self):

View File

@ -41,6 +41,8 @@ Signals that you can add callbacks for are:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -65,11 +67,13 @@ cdef class Photo(Object):
"""
def __set__(self, filename):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if not elm_photo_file_set(self.obj,
<const char *>filename if filename is not None else NULL):
raise RuntimeError("Could not set file.")
def file_set(self, filename):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if not elm_photo_file_set(self.obj,
<const char *>filename if filename is not None else NULL):
raise RuntimeError("Could not set file.")
@ -86,11 +90,15 @@ cdef class Photo(Object):
else:
filename = value
group = None
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
elm_photo_thumb_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL)
def thumb_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(group, unicode): group = PyUnicode_AsUTF8String(group)
elm_photo_thumb_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>group if group is not None else NULL)

View File

@ -97,6 +97,7 @@ Photocam zoom modes
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register
@ -190,6 +191,8 @@ cdef class Photocam(Object):
"""
def __set__(self, filename):
# TODO: Return EvasLoadError
if isinstance(filename, unicode):
filename = PyUnicode_AsUTF8String(filename)
if elm_photocam_file_set(self.obj,
<const char *>filename if filename is not None else NULL) != 0:
raise RuntimeError("Could not set file")
@ -199,6 +202,8 @@ cdef class Photocam(Object):
def file_set(self, filename):
# TODO: Return EvasLoadError
if isinstance(filename, unicode):
filename = PyUnicode_AsUTF8String(filename)
if elm_photocam_file_set(self.obj,
<const char *>filename if filename is not None else NULL) != 0:
raise RuntimeError("Could not set file")

View File

@ -39,6 +39,8 @@ This widget emits the following signals:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -76,6 +78,7 @@ cdef class Plug(Object):
Raises RuntimeError if adding the child fails
"""
if isinstance(svcname, unicode): svcname = PyUnicode_AsUTF8String(svcname)
if not elm_plug_connect(self.obj,
<const char *>svcname if svcname is not None else NULL,
svcnum, svcsys):

View File

@ -179,7 +179,7 @@ Wrap modes
"""
from cpython cimport Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, PY_REFCOUNT
@ -233,6 +233,7 @@ cdef class PopupItem(ObjectItem):
if not callable(func):
raise TypeError("func is not None or callable")
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.label = label
self.icon = icon
self.cb_func = func
@ -312,6 +313,7 @@ cdef class Popup(LayoutClass):
if func is not None and callable(func):
cb = _object_item_callback
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_popup_item_append(self.obj,
<const char *>label if label is not None else NULL,

View File

@ -74,6 +74,8 @@ Default part names for the "recording" style:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -162,6 +164,7 @@ cdef class Progressbar(LayoutClass):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
return elm_progressbar_part_value_get(self.obj, <const char *>part)
def part_value_set(self, part not None, double value):
@ -172,6 +175,7 @@ cdef class Progressbar(LayoutClass):
.. versionadded:: 1.8
"""
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
elm_progressbar_part_value_set(self.obj, <const char *>part, value)
property span_size:
@ -221,10 +225,12 @@ cdef class Progressbar(LayoutClass):
return _ctouni(elm_progressbar_unit_format_get(self.obj))
def __set__(self, unit_format):
if isinstance(unit_format, unicode): unit_format = PyUnicode_AsUTF8String(unit_format)
elm_progressbar_unit_format_set(self.obj,
<const char *>unit_format if unit_format is not None else NULL)
def unit_format_set(self, unit_format):
if isinstance(unit_format, unicode): unit_format = PyUnicode_AsUTF8String(unit_format)
elm_progressbar_unit_format_set(self.obj,
<const char *>unit_format if unit_format is not None else NULL)
def unit_format_get(self):

View File

@ -140,6 +140,8 @@ Type that blocks the scroll movement in one or more direction.
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.evas cimport Evas_Object, Object as evasObject
from efl.eo cimport object_from_instance, _object_mapping_register
from efl.utils.conversions cimport _ctouni, _touni
@ -180,6 +182,8 @@ cdef class Scrollable(Object):
"""custom_widget_base_theme_set(widget, base)
"""
if isinstance(widget, unicode): widget = PyUnicode_AsUTF8String(widget)
if isinstance(base, unicode): base = PyUnicode_AsUTF8String(base)
elm_scroller_custom_widget_base_theme_set(self.obj,
<const char *>widget if widget is not None else NULL,
<const char *>base if base is not None else NULL)

View File

@ -53,6 +53,7 @@ Default text parts of the segment control items that you can use for are:
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance
@ -75,6 +76,7 @@ cdef class SegmentControlItem(ObjectItem):
object label
def __init__(self, evasObject icon = None, label = None, *args, **kwargs):
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.icon = icon
self.label = label
self.args = args
@ -266,6 +268,7 @@ cdef class SegmentControl(LayoutClass):
cdef SegmentControlItem ret = SegmentControlItem()
cdef Elm_Object_Item *item
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_segment_control_item_add(self.obj,
icon.obj if icon is not None else NULL,
<const char *>label if label is not None else NULL)
@ -312,6 +315,7 @@ cdef class SegmentControl(LayoutClass):
cdef SegmentControlItem ret = SegmentControlItem()
cdef Elm_Object_Item *item
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_segment_control_item_insert_at(self.obj,
icon.obj if icon is not None else NULL,
<const char *>label if label is not None else NULL, index)

View File

@ -73,6 +73,8 @@ Default text parts of the slider widget that you can use for are:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -137,10 +139,12 @@ cdef class Slider(LayoutClass):
return _ctouni(elm_slider_unit_format_get(self.obj))
def __set__(self, unit_format):
if isinstance(unit_format, unicode): unit_format = PyUnicode_AsUTF8String(unit_format)
elm_slider_unit_format_set(self.obj,
<const char *>unit_format if unit_format is not None else NULL)
def unit_format_set(self, unit_format):
if isinstance(unit_format, unicode): unit_format = PyUnicode_AsUTF8String(unit_format)
elm_slider_unit_format_set(self.obj,
<const char *>unit_format if unit_format is not None else NULL)
def unit_format_get(self):
@ -170,10 +174,12 @@ cdef class Slider(LayoutClass):
return _ctouni(elm_slider_indicator_format_get(self.obj))
def __set__(self, ind_format):
if isinstance(ind_format, unicode): ind_format = PyUnicode_AsUTF8String(ind_format)
elm_slider_indicator_format_set(self.obj,
<const char *>ind_format if ind_format is not None else NULL)
def indicator_format_set(self, ind_format):
if isinstance(ind_format, unicode): ind_format = PyUnicode_AsUTF8String(ind_format)
elm_slider_indicator_format_set(self.obj,
<const char *>ind_format if ind_format is not None else NULL)
def indicator_format_get(self):

View File

@ -78,7 +78,7 @@ This widget emits the following signals, besides the ones sent from
"""
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT
@ -498,6 +498,7 @@ cdef class Slideshow(LayoutClass):
"""
def __set__(self, transition):
if isinstance(transition, unicode): transition = PyUnicode_AsUTF8String(transition)
elm_slideshow_transition_set(self.obj,
<const char *>transition if transition is not None else NULL)
def __get__(self):
@ -611,6 +612,7 @@ cdef class Slideshow(LayoutClass):
"""
def __set__(self, layout):
if isinstance(layout, unicode): layout = PyUnicode_AsUTF8String(layout)
elm_slideshow_layout_set(self.obj,
<const char *>layout if layout is not None else NULL)
def __get__(self):

View File

@ -55,6 +55,8 @@ Available styles for it:
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -88,10 +90,12 @@ cdef class Spinner(LayoutClass):
return _ctouni(elm_spinner_label_format_get(self.obj))
def __set__(self, label_format):
if isinstance(label_format, unicode): label_format = PyUnicode_AsUTF8String(label_format)
elm_spinner_label_format_set(self.obj,
<const char *>label_format if label_format is not None else NULL)
def label_format_set(self, label_format):
if isinstance(label_format, unicode): label_format = PyUnicode_AsUTF8String(label_format)
elm_spinner_label_format_set(self.obj,
<const char *>label_format if label_format is not None else NULL)
def label_format_get(self):
@ -260,6 +264,7 @@ cdef class Spinner(LayoutClass):
:type label: unicode
"""
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
elm_spinner_special_value_add(self.obj, value,
<const char *>label if label is not None else NULL)

View File

@ -235,6 +235,7 @@ cdef class StoreItemInfo(object):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.info.sort_id = strdup(value)
def __get__(self):
@ -262,6 +263,7 @@ cdef class StoreItemInfoFilesystem(object):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.info_fs.path = strdup(value)
def __get__(self):
@ -310,6 +312,7 @@ cdef class Store(object):
"""
def __set__(self, value):
if isinstance(directory, unicode): directory = PyUnicode_AsUTF8String(directory)
elm_store_filesystem_directory_set(self.st,
<const char *>directory if directory is not None else NULL)
@ -317,6 +320,7 @@ cdef class Store(object):
return _ctouni(elm_store_filesystem_directory_get(self.st))
def filesystem_directory_set(self, directory):
if isinstance(directory, unicode): directory = PyUnicode_AsUTF8String(directory)
elm_store_filesystem_directory_set(self.st,
<const char *>directory if directory is not None else NULL)

View File

@ -21,6 +21,7 @@ cdef class StoreItemMapping(object):
"""
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
self.mapping.part = strdup(value)
def __get__(self):
@ -155,18 +156,21 @@ cdef class StoreItemMappingEmpty(StoreItemMapping):
cdef class StoreItemMappingNone(StoreItemMappingEmpty):
def __init__(self, part, data):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
self.mapping.type = enums.ELM_STORE_ITEM_MAPPING_NONE
self.mapping.part = part
self.mapping.offset = 0
cdef class StoreItemMappingLabel(StoreItemMappingEmpty):
def __init__(self, part, data):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
self.mapping.type = enums.ELM_STORE_ITEM_MAPPING_LABEL
self.mapping.part = part
self.mapping.offset = 0
cdef class StoreItemMappingState(StoreItemMappingEmpty):
def __init__(self, part, data):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
self.mapping.type = enums.ELM_STORE_ITEM_MAPPING_STATE
self.mapping.part = part
self.mapping.offset = 0
@ -178,6 +182,7 @@ cdef class StoreItemMappingPhoto(StoreItemMapping):
cdef Elm_Store_Item_Mapping_Photo details
def __init__(self, part, data, size):
if isinstance(part, unicode): part = PyUnicode_AsUTF8String(part)
self.mapping.type = enums.ELM_STORE_ITEM_MAPPING_PHOTO
self.mapping.part = part
self.mapping.offset = 0

View File

@ -85,7 +85,7 @@ overlays. Don't use this unless you really know what you are doing.
"""
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF
from libc.stdint cimport uintptr_t
from efl.eo cimport PY_REFCOUNT
@ -235,6 +235,7 @@ cdef class Theme(object):
:param string item: The Edje file path to be used
"""
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_overlay_add(self.th,
<const char *>item)
@ -247,6 +248,7 @@ cdef class Theme(object):
:type item: string
"""
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_overlay_del(self.th,
<const char *>item)
@ -285,6 +287,7 @@ cdef class Theme(object):
:type item: string
"""
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_extension_add(self.th,
<const char *>item)
@ -297,6 +300,7 @@ cdef class Theme(object):
:type item: string
"""
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_extension_del(self.th,
<const char *>item)
@ -330,6 +334,7 @@ cdef class Theme(object):
"""
def __set__(self, theme not None):
if isinstance(theme, unicode): theme = PyUnicode_AsUTF8String(theme)
elm_theme_set(self.th,
<const char *>theme if theme is not None else NULL)
@ -337,6 +342,7 @@ cdef class Theme(object):
return _ctouni(elm_theme_get(self.th))
def order_set(self, theme not None):
if isinstance(theme, unicode): theme = PyUnicode_AsUTF8String(theme)
elm_theme_set(self.th,
<const char *>theme if theme is not None else NULL)
@ -392,6 +398,7 @@ cdef class Theme(object):
:rtype: string
"""
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
return _ctouni(elm_theme_data_get(self.th,
<const char *>key if key is not None else NULL))
@ -415,6 +422,7 @@ def theme_list_item_path_get(f not None, bint in_search_path):
"""
cdef Eina_Bool path = in_search_path
if isinstance(f, unicode): f = PyUnicode_AsUTF8String(f)
return _ctouni(elm_theme_list_item_path_get(
<const char *>f if f is not None else NULL, &path))
@ -445,9 +453,11 @@ def theme_name_available_list():
# for compatibility
def theme_overlay_add(item not None):
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_overlay_add(NULL,
<const char *>item)
def theme_extension_add(item not None):
if isinstance(item, unicode): item = PyUnicode_AsUTF8String(item)
elm_theme_extension_add(NULL,
<const char *>item)

View File

@ -173,6 +173,8 @@ Thumb orientation
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -248,6 +250,8 @@ cdef class Thumb(Object):
else:
file_name = value
key = None
if isinstance(file_name, unicode): file_name = PyUnicode_AsUTF8String(file_name)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
elm_thumb_file_set(self.obj,
<const char *>file_name if file_name is not None else NULL,
<const char *>key if key is not None else NULL)

View File

@ -164,7 +164,7 @@ Where to position the item in the toolbar.
"""
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
@ -240,6 +240,8 @@ cdef class ToolbarItemState(object):
self.params = (callback, args, kwargs)
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.state = elm_toolbar_item_state_add(it.item,
<const char *>icon if icon is not None else NULL,
<const char *>label if label is not None else NULL,
@ -289,6 +291,8 @@ cdef class ToolbarItem(ObjectItem):
if not callable(callback):
raise TypeError("callback is not callable")
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
self.icon = icon
self.label = label
self.cb_func = callback
@ -536,10 +540,12 @@ cdef class ToolbarItem(ObjectItem):
return _ctouni(elm_toolbar_item_icon_get(self.item))
def __set__(self, ic):
if isinstance(ic, unicode): ic = PyUnicode_AsUTF8String(ic)
elm_toolbar_item_icon_set(self.item,
<const char *>ic if ic is not None else NULL)
def icon_set(self, ic):
if isinstance(ic, unicode): ic = PyUnicode_AsUTF8String(ic)
elm_toolbar_item_icon_set(self.item,
<const char *>ic if ic is not None else NULL)
def icon_get(self):
@ -614,6 +620,8 @@ cdef class ToolbarItem(ObjectItem):
self.icon_file_set(file_name, key)
def icon_file_set(self, file_name, key):
if isinstance(file_name, unicode): file_name = PyUnicode_AsUTF8String(file_name)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
if not elm_toolbar_item_icon_file_set(self.item,
<const char *>file_name if file_name is not None else NULL,
<const char *>key if key is not None else NULL):
@ -811,6 +819,8 @@ cdef class Toolbar(LayoutClass):
if callback is not None and callable(callback):
cb = _object_item_callback
if isinstance(icon, unicode): icon = PyUnicode_AsUTF8String(icon)
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
item = elm_toolbar_item_append(self.obj,
<const char *>icon if icon is not None else NULL,
@ -872,6 +882,7 @@ cdef class Toolbar(LayoutClass):
:rtype: :py:class:`ToolbarItem`
"""
if isinstance(label, unicode): label = PyUnicode_AsUTF8String(label)
return _object_item_to_python(elm_toolbar_item_find_by_label(self.obj,
<const char *>label if label is not None else NULL))

View File

@ -144,7 +144,7 @@ Tween modes
"""
from cpython cimport Py_INCREF, Py_DECREF
from cpython cimport PyUnicode_AsUTF8String, Py_INCREF, Py_DECREF
from efl.eo cimport _object_mapping_register
from efl.utils.conversions cimport _ctouni

View File

@ -35,6 +35,8 @@ These widgets emit the following signals, besides the ones sent from
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -67,12 +69,14 @@ cdef class Video(LayoutClass):
"""
def __set__(self, filename):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if not elm_video_file_set(self.obj,
<const char *>filename if filename is not None else NULL):
raise RuntimeError("Could not set file.")
# NOTE: clash with layout.file_set
def file_set(self, filename, group = None):
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if not elm_video_file_set(self.obj,
<const char *>filename if filename is not None else NULL):
raise RuntimeError("Could not set file.")

View File

@ -145,6 +145,7 @@ Web zoom modes
"""
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance
@ -455,12 +456,16 @@ cdef class Web(Object):
"""
def __set__(self, user_agent):
if isinstance(user_agent, unicode):
user_agent = PyUnicode_AsUTF8String(user_agent)
elm_web_useragent_set(self.obj, user_agent)
def __get__(self):
return _ctouni(elm_web_useragent_get(self.obj))
def useragent_set(self, user_agent):
if isinstance(user_agent, unicode):
user_agent = PyUnicode_AsUTF8String(user_agent)
elm_web_useragent_set(self.obj, user_agent)
def useragent_get(self):
@ -504,6 +509,7 @@ cdef class Web(Object):
"""
def __set__(self, url):
if isinstance(url, unicode): url = PyUnicode_AsUTF8String(url)
if not elm_web_url_set(self.obj, url):
raise RuntimeWarning
@ -511,6 +517,7 @@ cdef class Web(Object):
return _ctouni(elm_web_url_get(self.obj))
def url_set(self, url):
if isinstance(url, unicode): url = PyUnicode_AsUTF8String(url)
if not elm_web_url_set(self.obj, url):
raise RuntimeWarning
@ -636,6 +643,7 @@ cdef class Web(Object):
or failure
"""
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return bool(elm_web_text_search(self.obj,
string, case_sensitive, forward, wrap))
@ -653,6 +661,7 @@ cdef class Web(Object):
:return: number of matched @a string
"""
if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string)
return elm_web_text_matches_mark(self.obj, string, case_sensitive, highlight, limit)
def text_matches_unmark_all(self):

View File

@ -351,6 +351,8 @@ Illume manager to perform different actions.
"""
from cpython cimport PyUnicode_AsUTF8String
from efl.eo cimport _object_mapping_register, object_from_instance
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
@ -430,6 +432,7 @@ cdef class Window(Object):
:type parent: :py:class:`efl.evas.Object`
"""
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
self._set_obj(elm_win_add(parent.obj if parent is not None else NULL,
<const char *>name if name is not None else NULL,
type))
@ -487,10 +490,12 @@ cdef class Window(Object):
def __get__(self):
return _ctouni(elm_win_title_get(self.obj))
def __set__(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_win_title_set(self.obj,
<const char *>title if title is not None else NULL)
def title_set(self, title):
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
elm_win_title_set(self.obj,
<const char *>title if title is not None else NULL)
def title_get(self):
@ -505,7 +510,7 @@ cdef class Window(Object):
:return type: Elm_Win_Type
.. versionadded: 1.9
"""
return elm_win_type_get(self.obj)
@ -521,6 +526,7 @@ cdef class Window(Object):
self.icon_name_set(icon_name)
def icon_name_set(self, icon_name):
if isinstance(icon_name, unicode): icon_name = PyUnicode_AsUTF8String(icon_name)
elm_win_icon_name_set(self.obj,
<const char *>icon_name if icon_name is not None else NULL)
def icon_name_get(self):
@ -538,6 +544,7 @@ cdef class Window(Object):
self.role_set(role)
def role_set(self, role):
if isinstance(role, unicode): role = PyUnicode_AsUTF8String(role)
elm_win_role_set(self.obj,
<const char *>role if role is not None else NULL)
def role_get(self):
@ -890,6 +897,7 @@ cdef class Window(Object):
"""
def __set__(self, profile):
if isinstance(profile, unicode): profile = PyUnicode_AsUTF8String(profile)
elm_win_profile_set(self.obj,
<const char *>profile if profile is not None else NULL)
@ -897,6 +905,7 @@ cdef class Window(Object):
return _ctouni(elm_win_profile_get(self.obj))
def profile_set(self, profile):
if isinstance(profile, unicode): profile = PyUnicode_AsUTF8String(profile)
elm_win_profile_set(self.obj,
<const char *>profile if profile is not None else NULL)
def profile_get(self):
@ -1412,10 +1421,12 @@ cdef class Window(Object):
def __get__(self):
return _ctouni(elm_win_focus_highlight_style_get(self.obj))
def __set__(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_win_focus_highlight_style_set(self.obj,
<const char *>style if style is not None else NULL)
def focus_highlight_style_set(self, style):
if isinstance(style, unicode): style = PyUnicode_AsUTF8String(style)
elm_win_focus_highlight_style_set(self.obj,
<const char *>style if style is not None else NULL)
def focus_highlight_style_get(self):
@ -1539,6 +1550,7 @@ cdef class Window(Object):
Raises RuntimeError if creating a socket fails
"""
if isinstance(svcname, unicode): svcname = PyUnicode_AsUTF8String(svcname)
if not elm_win_socket_listen(self.obj, <const char *>svcname, svcnum, svcsys):
raise RuntimeError("Could not create a socket.")
@ -1873,6 +1885,8 @@ cdef class StandardWindow(Window):
"""
def __init__(self, name, title, *args, **kwargs):
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
if isinstance(title, unicode): title = PyUnicode_AsUTF8String(title)
self._set_obj(elm_win_util_standard_add(
<const char *>name if name is not None else NULL,
<const char *>title if title is not None else NULL))

View File

@ -15,6 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
from efl.eo cimport object_from_instance, _object_mapping_register, \
@ -169,6 +170,7 @@ def extension_may_play_get(filename):
.. versionadded:: 1.8
"""
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
return bool(emotion_object_extension_may_play_get(
<const char *>filename if filename is not None else NULL))
@ -203,6 +205,8 @@ cdef class Emotion(evasObject):
self._set_obj(emotion_object_add(canvas.obj))
_register_decorated_callbacks(self)
if isinstance(module_name, unicode):
module_name = PyUnicode_AsUTF8String(module_name)
if emotion_object_init(self.obj,
<const char *>module_name if module_name is not None else NULL) == 0:
raise EmotionModuleInitError("failed to initialize module '%s'" %
@ -248,12 +252,14 @@ cdef class Emotion(evasObject):
return _ctouni(emotion_object_file_get(self.obj))
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
emotion_object_file_set(self.obj,
<const char *> value if value is not None else NULL)
def file_get(self):
return _ctouni(emotion_object_file_get(self.obj))
def file_set(self, file_name):
if isinstance(file_name, unicode): file_name = PyUnicode_AsUTF8String(file_name)
emotion_object_file_set(self.obj,
<const char *> file_name if file_name is not None else NULL)
@ -429,12 +435,14 @@ cdef class Emotion(evasObject):
return _ctouni(emotion_object_video_subtitle_file_get(self.obj))
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
emotion_object_video_subtitle_file_set(self.obj,
<const char *>value if value is not None else NULL)
def video_subtitle_file_get(self):
return _ctouni(emotion_object_video_subtitle_file_get(self.obj))
def video_subtitle_file_set(self, file_name):
if isinstance(file_name, unicode): file_name = PyUnicode_AsUTF8String(file_name)
emotion_object_video_subtitle_file_set(self.obj,
<const char *>file_name if file_name is not None else NULL)
@ -1109,6 +1117,7 @@ cdef class Emotion(evasObject):
e = intern(event)
lst = self._emotion_callbacks.setdefault(e, [])
if not lst:
if isinstance(event, unicode): event = PyUnicode_AsUTF8String(event)
evas_object_smart_callback_add(self.obj,
<const char *>event if event is not None else NULL,
_emotion_callback, <void *>e)
@ -1142,6 +1151,7 @@ cdef class Emotion(evasObject):
if lst:
return
self._emotion_callbacks.pop(event)
if isinstance(event, unicode): event = PyUnicode_AsUTF8String(event)
evas_object_smart_callback_del(self.obj,
<const char *>event if event is not None else NULL,
_emotion_callback)

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyObject, Py_INCREF, Py_DECREF
from cpython cimport PyObject, Py_INCREF, Py_DECREF, PyUnicode_AsUTF8String
from libc.stdlib cimport malloc, free
from libc.string cimport memcpy, strdup
from libc.stdint cimport uintptr_t
@ -92,6 +92,7 @@ cdef void _object_mapping_register(char *name, object cls) except *:
raise ValueError("Object type name '%s' already registered." % name)
cdef object cls_name = cls.__name__
if isinstance(cls_name, unicode): cls_name = PyUnicode_AsUTF8String(cls_name)
EINA_LOG_DOM_DBG(PY_EFL_EO_LOG_DOMAIN,
"REGISTER: %s => %s", <char *>name, <char *>cls_name)

View File

@ -16,7 +16,7 @@
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
import traceback
from cpython cimport PyUnicode_AsUTF8String
from libc.stdint cimport uintptr_t
#from efl.eina cimport *
from efl.eo cimport Eo, object_from_instance, _object_mapping_register
@ -180,6 +180,7 @@ def render_method_lookup(name):
:rtype: int
"""
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
return evas_render_method_lookup(
<const char *>name if name is not None else NULL)

View File

@ -132,7 +132,11 @@ cdef class Canvas(Eo):
if isinstance(method, (int, long)):
engine_id = method
elif isinstance(method, (unicode, str)):
elif isinstance(method, unicode):
method = PyUnicode_AsUTF8String(method)
engine_id = evas_render_method_lookup(
<const char *>method if method is not None else NULL)
elif isinstance(method, str):
engine_id = evas_render_method_lookup(
<const char *>method if method is not None else NULL)
else:
@ -488,6 +492,7 @@ cdef class Canvas(Eo):
:rtype: :py:class:`efl.evas.Object`
"""
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
return object_from_instance(evas_object_name_find(self.obj,
<const char *>name if name is not None else NULL))
@ -532,10 +537,12 @@ cdef class Canvas(Eo):
evas_font_path_clear(self.obj)
def font_path_append(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
evas_font_path_append(self.obj,
<const char *>path if path is not None else NULL)
def font_path_prepend(self, path):
if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path)
evas_font_path_prepend(self.obj,
<const char *>path if path is not None else NULL)

View File

@ -1191,12 +1191,14 @@ cdef class Object(Eo):
return _ctouni(evas_object_name_get(self.obj))
def __set__(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_name_set(self.obj,
<const char *>value if value is not None else NULL)
def name_get(self):
return _ctouni(evas_object_name_get(self.obj))
def name_set(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_name_set(self.obj,
<const char *>value if value is not None else NULL)
@ -1738,6 +1740,7 @@ cdef class Object(Eo):
:see: evas_key_modifier_add
"""
if isinstance(keyname, unicode): keyname = PyUnicode_AsUTF8String(keyname)
if not evas_object_key_grab(self.obj, <const char *>keyname, modifiers, not_modifiers, exclusive):
raise RuntimeError("Could not grab key.")
@ -1759,6 +1762,7 @@ cdef class Object(Eo):
:see: evas_focus_get
"""
if isinstance(keyname, unicode): keyname = PyUnicode_AsUTF8String(keyname)
evas_object_key_ungrab(self.obj, <const char *>keyname, modifiers, not_modifiers)
property is_frame_object:

View File

@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
cdef class Box(Object):
"""

View File

@ -15,6 +15,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
from cpython cimport PyUnicode_AsUTF8String
cdef class EventPoint:
cdef void _set_obj(self, Evas_Point *obj):
self.obj = obj
@ -247,6 +249,7 @@ cdef class EventMouseIn:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMouseOut:
@ -293,6 +296,7 @@ cdef class EventMouseOut:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMouseDown:
@ -348,6 +352,7 @@ cdef class EventMouseDown:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMouseUp:
@ -403,6 +408,7 @@ cdef class EventMouseUp:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMouseMove:
@ -456,6 +462,7 @@ cdef class EventMouseMove:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMultiDown:
@ -539,6 +546,7 @@ cdef class EventMultiDown:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMultiUp:
@ -623,6 +631,7 @@ cdef class EventMultiUp:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMultiMove:
@ -693,6 +702,7 @@ cdef class EventMultiMove:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventMouseWheel:
@ -744,6 +754,7 @@ cdef class EventMouseWheel:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventKeyDown:
@ -801,6 +812,7 @@ cdef class EventKeyDown:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
@ -859,6 +871,7 @@ cdef class EventKeyUp:
def modifier_is_set(self, modifier):
self._check_validity()
if isinstance(modifier, unicode): modifier = PyUnicode_AsUTF8String(modifier)
return bool(evas_key_modifier_is_set(self.obj.modifiers, modifier))
cdef class EventHold:

View File

@ -177,6 +177,8 @@ cdef class Image(Object):
# :param key: The image key in file, or ``None``.
# """
# if isinstance(format, unicode): format = PyUnicode_AsUTF8String(format)
# if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
# evas_object_image_memfile_set(self.obj, data, size,
# <char *>format if format is not None else NULL,
# <char *>key if key is not None else NULL)
@ -203,6 +205,8 @@ cdef class Image(Object):
else:
filename, key = value
cdef int err
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
evas_object_image_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>key if key is not None else NULL)
@ -212,6 +216,8 @@ cdef class Image(Object):
def file_set(self, filename, key=None):
cdef int err
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
evas_object_image_file_set(self.obj,
<const char *>filename if filename is not None else NULL,
<const char *>key if key is not None else NULL)
@ -733,6 +739,9 @@ cdef class Image(Object):
:type flags: unicode
"""
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
if isinstance(key, unicode): key = PyUnicode_AsUTF8String(key)
if isinstance(flags, unicode): flags = PyUnicode_AsUTF8String(flags)
evas_object_image_save(self.obj, filename,
<const char *>key if key is not None else NULL,
<const char *>flags if flags is not None else NULL)
@ -1379,6 +1388,7 @@ def extension_can_load(filename):
.. note:: This function is threadsafe.
"""
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
return bool(evas_object_image_extension_can_load_get(
<const char *>filename))

View File

@ -91,6 +91,7 @@ cdef class Text(Object):
return _ctouni(evas_object_text_font_source_get(self.obj))
def font_source_set(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_text_font_source_set(self.obj,
<const char *>value if value is not None else NULL)
@ -124,6 +125,7 @@ cdef class Text(Object):
return (_ctouni(f), size)
def font_set(self, font, int size=10):
if isinstance(font, unicode): font = PyUnicode_AsUTF8String(font)
evas_object_text_font_set(self.obj,
<const char *>font if font is not None else NULL,
size)
@ -144,6 +146,7 @@ cdef class Text(Object):
return _ctouni(evas_object_text_text_get(self.obj))
def text_set(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_text_text_set(self.obj,
<const char *>value if value is not None else NULL)

View File

@ -61,6 +61,7 @@ cdef class Textblock(Object):
def style_set(self, value):
cdef Evas_Textblock_Style *style = evas_textblock_style_new()
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_textblock_style_set(style,
<const char *>value if value is not None else NULL)
evas_object_textblock_style_set(self.obj, style)
@ -82,6 +83,7 @@ cdef class Textblock(Object):
return _ctouni(evas_object_textblock_text_markup_get(self.obj))
def text_markup_set(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_textblock_text_markup_set(self.obj,
<const char *>value if value is not None else NULL)
@ -101,6 +103,7 @@ cdef class Textblock(Object):
return _ctouni(evas_object_textblock_replace_char_get(self.obj))
def replace_char_set(self, value):
if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
evas_object_textblock_replace_char_set(self.obj,
<const char *>value if value is not None else NULL)

View File

@ -262,6 +262,7 @@ cdef class Textgrid(Object):
"""
def __set__(self, font_source):
a1 = font_source
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
evas_object_textgrid_font_source_set(self.obj,
<const char *>a1 if a1 is not None else NULL)
@ -289,6 +290,7 @@ cdef class Textgrid(Object):
cdef int font_size
font_name, font_size = value
a1 = font_name
if isinstance(a1, unicode): a1 = PyUnicode_AsUTF8String(a1)
evas_object_textgrid_font_set(self.obj,
<const char *>a1 if a1 is not None else NULL,
font_size)

View File

@ -26,6 +26,8 @@ cdef uintptr_t _smart_object_class_new(name) except 0:
if cls_def == NULL:
return 0
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
#_smart_classes.append(<uintptr_t>cls_def)
cls_def.name = name
cls_def.version = EVAS_SMART_CLASS_VERSION

View File

@ -17,6 +17,7 @@
from libc.stdlib cimport malloc, free
from libc.string cimport strdup
from cpython cimport PyUnicode_AsUTF8String
from efl.c_eo cimport Eo as cEo
from efl.eo cimport Eo, object_from_instance
@ -85,6 +86,7 @@ cdef const char ** python_list_strings_to_array_of_strings(list strings) except
for i in range(arr_len):
s = strings[i]
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
array[i] = <const char *>strdup(s)
return array
@ -148,6 +150,7 @@ cdef list eina_list_strings_to_python_list(const Eina_List *lst):
cdef Eina_List *python_list_strings_to_eina_list(list strings):
cdef Eina_List *lst = NULL
for s in strings:
if isinstance(s, unicode): s = PyUnicode_AsUTF8String(s)
lst = eina_list_append(lst, eina_stringshare_add(s))
return lst

View File

@ -19,7 +19,7 @@ import traceback
import types
from functools import update_wrapper
from cpython cimport PY_VERSION_HEX
from cpython cimport PY_VERSION_HEX, PyUnicode_AsUTF8String
from efl.eina cimport EINA_LOG_DOM_WARN
from efl.utils.logger cimport PY_EFL_LOG_DOMAIN
@ -98,6 +98,7 @@ class WRAPPER(object):
msg += " " + self.message
msg2 = msg
if isinstance(msg2, unicode): msg2 = PyUnicode_AsUTF8String(msg2)
EINA_LOG_DOM_WARN(PY_EFL_LOG_DOMAIN, msg2, NULL)

View File

@ -20,7 +20,7 @@ from efl.eina cimport Eina_Log_Domain, Eina_Log_Level, \
eina_log_level_get, eina_log_domain_level_get, eina_log_domain_level_set, \
eina_log_print, EINA_LOG_DOM_DBG, EINA_LOG_DOM_INFO, EINA_LOG_DOM_WARN, \
EINA_LOG_DOM_ERR, EINA_LOG_DOM_CRIT
from cpython cimport PY_VERSION_HEX
from cpython cimport PyUnicode_AsUTF8String, PY_VERSION_HEX
import logging
import types
@ -72,6 +72,7 @@ eina_log_print_cb_set(py_eina_log_print_cb, NULL)
def setLevel(self, lvl):
cname = self.name
if isinstance(cname, unicode): cname = PyUnicode_AsUTF8String(cname)
eina_log_domain_level_set(cname, log_levels.index(lvl))
logging.Logger.setLevel(self, lvl)
@ -79,6 +80,7 @@ class PyEFLLogger(logging.Logger):
def __init__(self, name):
cname = name
if isinstance(cname, unicode): cname = PyUnicode_AsUTF8String(cname)
self.eina_log_domain = eina_log_domain_register(cname, NULL)
loggers[name] = self
logging.Logger.__init__(self, name)
@ -95,6 +97,7 @@ cdef object add_logger(object name):
# The logger has been instantiated already so lets add our own
# initialization for it.
cname = name
if isinstance(cname, unicode): cname = PyUnicode_AsUTF8String(cname)
log.eina_log_domain = eina_log_domain_register(cname, NULL)
loggers[name] = log
lvl = log.getEffectiveLevel()