Compare commits

...

9 Commits

Author SHA1 Message Date
Kai Huuhko 6c98e8c460 Bump version number for release 1.10.1 2014-08-18 09:47:06 +03:00
Davide Andreoli 9fa3f3a893 Fix emotion.__repr__ function
self.type_get() is not a function, dunno what was the intention here
2014-08-18 09:20:59 +03:00
godfath3r ccfc4b0082 doc: add cleanup command in INSTALL file.
Reviewers: kuuko

Reviewed By: kuuko

Projects: #python_bindings_for_efl

Differential Revision: https://phab.enlightenment.org/D1224
2014-08-18 09:20:03 +03:00
Kai Huuhko c1497e1028 Fix build from tarball with Cython installed 2014-07-02 12:12:49 +03:00
Kai Huuhko 43c3d0521a Elementary: Fix object item tooltips
It would be an ABI breakage if the tooltips had ever worked in
the first place but apparently they never did.
2014-07-02 12:12:44 +03:00
Kai Huuhko 9434ccf64a Elementary.entry: Fix ref leak in filter callback handling. 2014-06-17 08:27:53 +03:00
Kai Huuhko bca990eed7 Elementary.multibuttonentry: Inject a Python object to created items 2014-06-17 08:27:08 +03:00
Kai Huuhko 53e7af4905 Documentation: warnings-- 2014-06-17 08:26:46 +03:00
Kai Huuhko 878c5f114c warnings-- 2014-06-17 08:26:12 +03:00
20 changed files with 167 additions and 101 deletions

16
INSTALL
View File

@ -48,7 +48,15 @@
3. INSTALLATION:
3. CLEANUP:
-----------
* For cleaning up
python setup.py clean_generated_files
4. INSTALLATION:
----------------
* For system-wide installation (needs administrator privileges):
@ -69,7 +77,7 @@
4. DOCUMENTATION:
5. DOCUMENTATION:
-----------------
To build the docs for the bindings you need to have Sphinx installed, for
@ -87,7 +95,7 @@
up with empty documentation.
5. TESTS and EXAMPLES:
6. TESTS and EXAMPLES:
----------------------
The tests/ folder contains all the unit tests available, you can run individual
@ -101,7 +109,7 @@
6. UNINSTALL:
7. UNINSTALL:
-------------
Unfortunately setup.py does not provide a way to remove the installed packages,

View File

@ -1,5 +1,5 @@
include README.rst INSTALL COPYING COPYING.LESSER AUTHORS changes.html
recursive-include efl *.c *.h *.pyx *.pxi
recursive-include efl *.c *.h *.pyx *.pxi *.pxd
graft include
graft tests
recursive-exclude tests *.pyc

View File

@ -1,5 +1,5 @@
#################
PYTHON-EFL 1.10.0
PYTHON-EFL 1.10.1
#################
EFL is a collection of libraries for handling many common tasks a

1
TODO
View File

@ -5,7 +5,6 @@ BUGS
* Elm.Map: overlays_show segfaults, scrollers in examples are jumpy
* Elementary: when we use custom function callbacks we usually leak some
reference around, some examples:
- Entry.markup_filter_append()
- Fileselector.custom_filter_append()
- Multibuttonentry.format_function_set()
- Multibuttonentry.filter_append()

View File

@ -101,11 +101,3 @@ API Reference
filedownload
filemonitor
Inheritance diagram
-------------------
.. inheritance-diagram::
efl.ecore
:parts: 2

View File

@ -3,5 +3,32 @@
:class:`efl.evas.Object` Class
==============================
.. _Evas_Keys:
Key Input Functions
===================
Functions which feed key events to the canvas.
As explained in :ref:`evas_main_intro_not_evas`, Evas is **not** aware of input
systems at all. Then, the user, if using it crudely (evas_new()),
will have to feed it with input events, so that it can react
somehow. If, however, the user creates a canvas by means of the
Ecore_Evas wrapper, it will automatically bind the chosen display
engine's input events to the canvas, for you.
This group presents the functions dealing with the feeding of key
events to the canvas. On most of them, one has to reference a given
key by a name (``keyname`` argument). Those are
**platform dependent** symbolic names for the keys. Sometimes
you'll get the right ``keyname`` by simply using an ASCII
value of the key name, but it won't be like that always.
Typical platforms are Linux frame buffer (Ecore_FB) and X server
(Ecore_X) when using Evas with Ecore and Ecore_Evas. Please refer
to your display engine's documentation when using evas through an
Ecore helper wrapper when you need the ``keyname``'s.
.. autoclass:: efl.evas.Object
:inherited-members:

View File

@ -3,6 +3,8 @@
.. module:: efl.evas
.. _evas_main_intro:
What is Evas?
-------------
@ -27,6 +29,7 @@ wish, thus keeping it small and lean. It has several display
back-ends, letting it display on several display systems, making it
portable for cross-device and cross-platform development.
.. _evas_main_intro_not_evas:
What Evas is not?
-----------------
@ -41,6 +44,7 @@ should be polled from various sources and fed to Evas. Similarly, it will
not create windows or report windows updates to your system, rather just
drawing the pixels and reporting to the user the areas that were changed.
.. _evas_main_work:
How does Evas work?
-------------------

View File

@ -203,7 +203,9 @@ ELM_DAY_LAST = enums.ELM_DAY_LAST
cdef class CalendarMark(object):
"""An item for the Calendar widget.
"""
An item for the Calendar widget.
A mark that will be drawn in the calendar respecting the insertion
time and periodicity. It will emit the type as signal to the widget theme.
@ -235,7 +237,7 @@ cdef class CalendarMark(object):
def __init__(self, evasObject cal, mark_type, mark_time,
Elm_Calendar_Mark_Repeat_Type repeat):
"""
"""Create a new Calendar mark
:param mark_type: A string used to define the type of mark. It will be
emitted to the theme, that should display a related modification on these

View File

@ -661,7 +661,7 @@ cdef class Configuration(object):
property text_classes_list:
"""Get Elementary's list of supported text classes.
:type: list of :ref:`Elm_Text_Class`
:type: list of tuples (name, desc)
"""
def __get__(self):
@ -691,7 +691,7 @@ cdef class Configuration(object):
the default font properties for that class coming from the theme in
use. There is no need to free this list.
:type: list of :ref:`Elm_Font_Overlay`
:type: list of tuples (text_class, font, size)
"""
def __get__(self):
@ -732,7 +732,7 @@ cdef class Configuration(object):
:param font: Font name and style string
:type font: string
:param size: Font size
:type size: :ref:`Evas_Font_Size`
:type size: int
"""
a1 = text_class
@ -783,7 +783,7 @@ cdef class Configuration(object):
"""
def __get__(self):
cdef:
Eina_List *lst = elm_config_color_overlay_list_get()
const Eina_List *lst = elm_config_color_overlay_list_get()
Elm_Color_Overlay *ov
const char *color_class

View File

@ -719,18 +719,21 @@ cdef void py_elm_entry_filter_cb(void *data, Evas_Object *entry, char **text) wi
"""
cdef:
Entry en = object_from_instance(entry)
object ret
cb_func, cb_data = <object>data
try:
ret = cb_func(en, _touni(text[0]), cb_data)
except Exception:
traceback.print_exc()
for cb_func, cb_data in en.markup_filters:
try:
ret = cb_func(en, _touni(text[0]), cb_data)
except Exception:
traceback.print_exc()
if ret is None:
free(text[0])
text[0] = NULL
return
if isinstance(ret, unicode): ret = PyUnicode_AsUTF8String(ret)
text[0] = strdup(<char *>ret)
class EntryAnchorInfo(object):
@ -810,6 +813,11 @@ cdef class Entry(LayoutClass):
"""
cdef list markup_filters
def __cinit__(self):
self.markup_filters = []
def __init__(self, evasObject parent, *args, **kwargs):
"""By default, entries are:
@ -1403,13 +1411,16 @@ cdef class Entry(LayoutClass):
.. versionadded:: 1.8
"""
if not callable(func):
raise TypeError("func must be callable")
if not self.markup_filters:
elm_entry_markup_filter_append(self.obj,
py_elm_entry_filter_cb,
NULL)
cb_data = (func, data)
# TODO: This is now a ref leak. It should be stored somewhere and
# deleted in the remove method.
Py_INCREF(cb_data)
elm_entry_markup_filter_append(self.obj,
py_elm_entry_filter_cb,
<void *>cb_data)
self.markup_filters.append(cb_data)
def markup_filter_prepend(self, func, data=None):
"""Prepend a markup filter function for text inserted in the entry
@ -1423,11 +1434,16 @@ cdef class Entry(LayoutClass):
.. versionadded:: 1.8
"""
if not callable(func):
raise TypeError("func must be callable")
if not self.markup_filters:
elm_entry_markup_filter_append(self.obj,
py_elm_entry_filter_cb,
NULL)
cb_data = (func, data)
Py_INCREF(cb_data)
elm_entry_markup_filter_prepend(self.obj,
py_elm_entry_filter_cb,
<void *>cb_data)
self.markup_filters.insert(0, cb_data)
def markup_filter_remove(self, func, data=None):
"""Remove a markup filter from the list
@ -1441,11 +1457,24 @@ cdef class Entry(LayoutClass):
.. versionadded:: 1.8
"""
cb_data = (func, data)
Py_INCREF(cb_data)
f = None
d = None
lst = self.markup_filters
for i, (f, d) in enumerate(lst):
if func is f and data is d:
break
if f is not func or d is not data:
raise ValueError("Callback was not registered with this object.")
lst.pop(i)
if lst:
return
elm_entry_markup_filter_remove(self.obj,
py_elm_entry_filter_cb,
<void *>cb_data)
NULL)
@DEPRECATED("1.8", "Use the module level markup_to_utf8() method instead.")
def markup_to_utf8(self, string):

View File

@ -319,11 +319,11 @@ cdef class GengridItem(ObjectItem):
def tooltip_content_cb_set(self, func, *args, **kargs):
"""Set the content to be shown in the tooltip object
Setup the tooltip to object. The object can have only one tooltip,
so any previews tooltip data is removed. ``func(args, kargs)`` will
be called every time that need show the tooltip and it should return a
valid Evas_Object. This object is then managed fully by tooltip system
and is deleted when the tooltip is gone.
Setup the tooltip to object. The object can have only one tooltip, so
any previews tooltip data is removed. ``func(owner, item, tooltip,
args, kargs)`` will be called every time that need show the tooltip and
it should return a valid Evas_Object. This object is then managed fully
by tooltip system and is deleted when the tooltip is gone.
:param func: Function to be create tooltip content, called when
need show tooltip.
@ -334,9 +334,9 @@ cdef class GengridItem(ObjectItem):
cdef void *cbdata
data = (func, self, args, kargs)
data = (func, args, kargs)
Py_INCREF(data)
# FIXME: refleak?
# DECREF is in data_del_cb
cbdata = <void *>data
elm_gengrid_item_tooltip_content_cb_set(self.item,
_tooltip_item_content_create,

View File

@ -399,11 +399,11 @@ cdef class GenlistItem(ObjectItem):
def tooltip_content_cb_set(self, func, *args, **kargs):
"""Set the content to be shown in the tooltip object
Setup the tooltip to object. The object can have only one tooltip,
so any previews tooltip data is removed. ``func(args,kargs)`` will
be called every time that need show the tooltip and it should return
a valid Evas_Object. This object is then managed fully by tooltip
system and is deleted when the tooltip is gone.
Setup the tooltip to object. The object can have only one tooltip, so
any previews tooltip data is removed. ``func(owner, item, tooltip,
args, kargs)`` will be called every time that need show the tooltip and
it should return a valid Evas_Object. This object is then managed fully
by tooltip system and is deleted when the tooltip is gone.
:param func: Function to be create tooltip content, called when
need show tooltip.
@ -414,8 +414,9 @@ cdef class GenlistItem(ObjectItem):
cdef void *cbdata
data = (func, self, args, kargs)
data = (func, args, kargs)
Py_INCREF(data)
# DECREF is in data_del_cb
cbdata = <void *>data
elm_genlist_item_tooltip_content_cb_set(self.item,
_tooltip_item_content_create,
@ -598,15 +599,9 @@ cdef class GenlistItem(ObjectItem):
.. versionadded:: 1.9
"""
cdef:
Eina_List *l = elm_genlist_item_subitems_get(self.item)
list ret = list()
while l:
ret.append(object_from_instance(<Evas_Object*>l.data))
l = l.next
return ret
return _object_item_list_to_python(
elm_genlist_item_subitems_get(self.item)
)
property expanded:
"""This function flags the item of type #ELM_GENLIST_ITEM_TREE as

View File

@ -39,11 +39,14 @@ This widget emits the following signals, besides the ones sent from
- ``item,selected`` - this is called when an item is selected by
api, user interaction, and etc. this is also called when a
user press back space while cursor is on the first field of
entry.
entry. event_info contains the item.
- ``item,added`` - when a new multi-button entry item is added.
event_info contains the item.
- ``item,deleted`` - when a multi-button entry item is deleted.
event_info contains the item.
- ``item,clicked`` - this is called when an item is clicked by user
interaction. Both "item,selected" and "item,clicked" are needed.
event_info contains the item.
- ``clicked`` - when multi-button entry is clicked.
- ``focused`` - when multi-button entry is focused.
- ``unfocused`` - when multi-button entry is unfocused.
@ -67,13 +70,18 @@ from libc.stdint cimport uintptr_t
from efl.eo cimport _object_mapping_register, object_from_instance, PY_REFCOUNT
from efl.utils.conversions cimport _ctouni
from efl.evas cimport Object as evasObject
from efl.evas cimport Object as evasObject, evas_object_smart_callback_add
from libc.string cimport strdup
from object cimport Object
import traceback
from object_item cimport _object_item_callback, _object_item_callback2, \
_object_item_to_python, _object_item_list_to_python, ObjectItem
_object_item_to_python, _object_item_list_to_python, ObjectItem, \
elm_object_item_data_get
def _cb_object_item_conv(uintptr_t addr):
cdef Elm_Object_Item *it = <Elm_Object_Item *>addr
return _object_item_to_python(it)
cdef Eina_Bool _multibuttonentry_filter_callback(Evas_Object *obj, \
const char *item_label, void *item_data, void *data) with gil:
@ -235,17 +243,27 @@ cdef class MultiButtonEntryItem(ObjectItem):
def next_get(self):
return _object_item_to_python(elm_multibuttonentry_item_next_get(self.item))
cdef void _py_elm_mbe_item_added_cb(
void *data, Evas_Object *o, void *event_info) with gil:
cdef:
MultiButtonEntryItem it
Elm_Object_Item *item = <Elm_Object_Item *>event_info
if elm_object_item_data_get(item) == NULL:
it = MultiButtonEntryItem.__new__(MultiButtonEntryItem)
it._set_obj(item)
cdef class MultiButtonEntry(Object):
"""This is the class that actually implements the widget."""
def __init__(self, evasObject parent, *args, **kwargs):
self._set_obj(elm_multibuttonentry_add(parent.obj))
evas_object_smart_callback_add(
self.obj, "item,added",
_py_elm_mbe_item_added_cb, NULL
)
self._set_properties_from_keyword_args(kwargs)
#
# TODO: Add callbacks for item added and item deleted, inject
# the python instance into Elm_Object_Item's data
#
property entry:
"""The Entry object child of the multibuttonentry.
@ -470,28 +488,28 @@ cdef class MultiButtonEntry(Object):
Py_INCREF(cbdata)
def callback_item_selected_add(self, func, *args, **kwargs):
self._callback_add("item,selected", func, *args, **kwargs)
self._callback_add_full("item,selected", _cb_object_item_conv, func, *args, **kwargs)
def callback_item_selected_del(self, func):
self._callback_del("item,selected", func)
self._callback_del_full("item,selected", _cb_object_item_conv, func)
def callback_item_added_add(self, func, *args, **kwargs):
self._callback_add("item,added", func, *args, **kwargs)
self._callback_add_full("item,added", _cb_object_item_conv, func, *args, **kwargs)
def callback_item_added_del(self, func):
self._callback_del("item,added", func)
self._callback_del_full("item,added", _cb_object_item_conv, func)
def callback_item_deleted_add(self, func, *args, **kwargs):
self._callback_add("item,deleted", func, *args, **kwargs)
self._callback_add_full("item,deleted", _cb_object_item_conv, func, *args, **kwargs)
def callback_item_deleted_del(self, func):
self._callback_del("item,deleted", func)
self._callback_del_full("item,deleted", _cb_object_item_conv, func)
def callback_item_clicked_add(self, func, *args, **kwargs):
self._callback_add("item,clicked", func, *args, **kwargs)
self._callback_add_full("item,clicked", _cb_object_item_conv, func, *args, **kwargs)
def callback_item_clicked_del(self, func):
self._callback_del("item,clicked", func)
self._callback_del_full("item,clicked", _cb_object_item_conv, func)
def callback_clicked_add(self, func, *args, **kwargs):
self._callback_add("clicked", func, *args, **kwargs)

View File

@ -102,7 +102,7 @@ Focus direction
.. versionadded:: 1.8.1
.. _Elm_Focus_Move_Policy
.. _Elm_Focus_Move_Policy:
Focus move policy
=================
@ -119,7 +119,7 @@ Focus move policy
.. versionadded:: 1.10
.. _Elm_Focus_Autoscroll_Mode
.. _Elm_Focus_Autoscroll_Mode:
Focus autoscroll mode
=====================

View File

@ -477,12 +477,11 @@ cdef class ObjectItem(object):
def tooltip_content_cb_set(self, func, *args, **kargs):
"""Set the content to be shown in the tooltip object
Setup the tooltip to object. The object can have only one tooltip,
so any previews tooltip data is removed. ``func(owner, tooltip,
args, kargs)`` will be called every time that need show the tooltip
and it should return a valid Evas_Object. This object is then
managed fully by tooltip system and is deleted when the tooltip is
gone.
Setup the tooltip to object. The object can have only one tooltip, so
any previews tooltip data is removed. ``func(owner, item, tooltip,
args, kargs)`` will be called every time that need show the tooltip and
it should return a valid Evas_Object. This object is then managed fully
by tooltip system and is deleted when the tooltip is gone.
:param func: Function to be create tooltip content, called when
need show tooltip.
@ -495,8 +494,8 @@ cdef class ObjectItem(object):
cdef void *cbdata
data = (func, args, kargs)
# FIXME: refleak
Py_INCREF(data)
# DECREF is in data_del_cb
cbdata = <void *>data
elm_object_item_tooltip_content_cb_set(self.item, _tooltip_item_content_create,
cbdata, _tooltip_item_data_del_cb)

View File

@ -42,7 +42,7 @@ cdef Evas_Object *_tooltip_item_content_create(void *data, Evas_Object *o, Evas_
tooltip = object_from_instance(t)
item = _object_item_to_python(<Elm_Object_Item *>it)
(func, args, kargs) = <object>data
ret = func(obj, item, *args, **kargs)
ret = func(obj, item, tooltip, *args, **kargs)
if not ret:
return NULL
return ret.obj

View File

@ -508,7 +508,7 @@ cdef class Window(Object):
:return type: Elm_Win_Type
.. versionadded: 1.9
"""
return elm_win_type_get(self.obj)
@ -836,7 +836,7 @@ cdef class Window(Object):
"""
def __set__(self, list profiles):
cdef:
const char **array
const char **array = NULL
unsigned int arr_len = len(profiles)
unsigned int i
@ -862,7 +862,7 @@ cdef class Window(Object):
def available_profiles_set(self, list profiles):
cdef:
const char **array
const char **array = NULL
unsigned int arr_len = len(profiles)
unsigned int i

View File

@ -223,11 +223,10 @@ cdef class Emotion(evasObject):
def __repr__(self):
x, y, w, h = self.geometry_get()
r, g, b, a = self.color_get()
return ("<%s(%#x, type=%r, name=%r, "
"file=%r, geometry=(%d, %d, %d, %d), "
return ("<%s(%#x, name=%r, file=%r, geometry=(%d, %d, %d, %d), "
"color=(%d, %d, %d, %d), layer=%s, clip=%r, visible=%s) %s>") % \
(self.__class__.__name__, <uintptr_t><void *>self,
self.type_get(), self.name_get(), self.file_get(),
self.name_get(), self.file_get(),
x, y, w, h, r, g, b, a,
self.layer_get(), self.clip_get(), self.visible_get(),
evasObject.__repr__(self))

View File

@ -16,6 +16,7 @@
# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
cimport efl.evas.enums as enums
from efl.utils.conversions cimport eina_list_strings_to_python_list
EVAS_LAYER_MIN = enums.EVAS_LAYER_MIN
EVAS_LAYER_MAX = enums.EVAS_LAYER_MAX
@ -310,14 +311,7 @@ def font_path_global_list():
.. versionadded: 1.10
"""
cdef Eina_List *lst = evas_font_path_global_list()
ret = []
while lst != NULL:
ret.append(<char*> lst.data)
lst = lst.next
return ret
return eina_list_strings_to_python_list(evas_font_path_global_list())

View File

@ -13,7 +13,7 @@ script_path = os.path.dirname(os.path.abspath(__file__))
# python-efl version
VERSION = "1.10"
RELEASE = "1.10.0"
RELEASE = "1.10.1"
# Add git commit count for dev builds
if RELEASE.split(".")[2] == "99":