Commit Graph

66 Commits

Author SHA1 Message Date
Kai Huuhko fbc22d850d Make Evas.SO iterator a generic Eo iterator and move to efl.eo 2015-03-09 19:36:42 +02:00
Davide Andreoli 9afb74906b Fix code to conform to recent Eo changes. 2015-02-25 21:44:31 +01:00
Davide Andreoli 1d8ffd1ed4 Restructured eo docs 2015-01-31 17:00:18 +01:00
Davide Andreoli bbb747eb5e New style enums for eo 2015-01-04 22:30:19 +01:00
Davide Andreoli a4f2cc37cc Another year has passed... 2015-01-02 20:03:53 +01:00
Davide Andreoli d3f98802b0 Optimize the _set_properties_from_keyword_args() function.
We do not need to check if the attribute exist to raise an exception, setattr() yet raise a well formatted expection in case of failure.

This way we avoid a dir() call and an IN check in a hot path.

The only drawback is that this change the raised exception in the case an attr not exist, from  AssertionError to AttributeError... I hope none was using that eception explicitly.
2014-11-22 14:25:39 +01:00
Davide Andreoli 9a78c4e22d Expose object_from_instance and the inverse to other C code
This create the efl.eo_api.h file that you can copy to your source if you want to use the exported api
2014-08-16 12:33:29 +02:00
Davide Andreoli 4a57a7deaa Follow recent Eo api changes
eo_event_global_freeze_get -> eo_event_global_freeze_count_get
eo_event__freeze_get -> eo_event_freeze_count_get
2014-06-02 17:21:42 +02:00
Davide Andreoli b3eef73b0e s/2013/2014/g 2014-04-14 22:21:03 +02:00
Davide Andreoli cc02387266 Adjust the bindings to work with Eo2 2014-04-14 21:41:38 +02:00
Kai Huuhko d65101b24b Code cleanup: Unused/misplaced cimports 2014-04-14 00:51:19 +03:00
Davide Andreoli beff74c28a added docs for Eo 2014-04-06 23:36:05 +02:00
Kai Huuhko d6dc3a2045 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
2014-04-06 23:48:16 +03:00
Kai Huuhko b547ff2aa2 Remove Python -> C string hacks 2014-04-06 01:50:29 +03:00
Kai Huuhko adf70fa26f Remove const hacks
They were a workaround for limitations in Cython <0.18
2014-04-05 03:13:15 +03:00
Kai Huuhko 6db1f9d0d6 Use uintptr_t instead of long or unsigned long for handling pointers. 2013-12-15 15:08:57 +02:00
Davide Andreoli 74244a5ac7 Python-EFL: fix the mess with the lgpl version.
Elm was lgpl3, COPYING was lgpl3, docs say lgpl3. So fix everything to be v3.
Also fix the COPING for Lesser: we must include gpl (in COPYING) AND lgpl (in COPYING.LESSER).
2013-12-07 17:54:58 +01:00
Kai Huuhko ca680c5a67 Elementary: Add an optimization for _set_properties_from_keyword_args
Return early when kwargs dict is empty.
2013-12-06 10:51:11 +02:00
Kai Huuhko 4bd9dd3243 Eo: Fix a Py2'ism. 2013-11-24 18:29:33 +02:00
Kai Huuhko f2b22e94bb Eo: Change _register_decorated_callbacks to not use hasattr/getattr
They actually get the value of a property, leading to unexpected
behavior. Iterate the class dict instead.
2013-11-24 17:56:08 +02:00
Kai Huuhko 225f061b05 Optimize exception propagation in several hot/time critical cases.
With "except *" a call is made to PyErr_Occurred on each call of a
function.

Adding a return value where possible and using an appropriate exception
value calls PyErr_Occurred only when that value is returned, ie.
an exception has been raised.

cdef void example_func() except *: <- PyErr_Occurred called on each call
cdef int example_func() except 0: <- PyErr_Occurred called only when
	an exception has been raised (the function thus returns 0)
2013-11-10 08:47:21 +02:00
Kai Huuhko e557b2fcb4 Eo: Add several methods, tests and more debug logging.
Methods:
 - parent_set/get
 - event_freeze(_get)/thaw
 - delete

Functions:
 - event_global_freeze(_get)/thaw

Moved enums to efl.eo.enums.pxd
2013-11-09 09:05:44 +02:00
Kai Huuhko be547283f0 Eo: Speed up, and fix a cornercase in, _properties_from_keyword_args.
hasattr tries getattr which can be variedly slow, so check dict instead.

This also fixes it in cases where the property doesn't have a __get__
function.
2013-10-30 03:19:03 +02:00
Kai Huuhko 1e40a8f5bb Simplify and correct string representation functions.
Calling str() uses __repr__ when __str__ is not found.

__repr__ should return a string with angle brackets when the object
cannot be reconstructed with exec(repr(obj)).
2013-10-28 18:55:58 +02:00
Kai Huuhko d6d440c3a6 Add support for loggers that have been initialized already.
This allows module initialization to be logged as well.

Changed add_logger to return the logger object instead of int.
2013-10-26 03:22:47 +03:00
Kai Huuhko 19e7d11f61 Resolved Py3 issues.
Fixes T459
2013-10-26 02:38:25 +03:00
Kai Huuhko 4771ca5ccb Move logger to its own module. 2013-10-24 22:58:09 +03:00
Kai Huuhko 8cbee5c44d Handle unknown domain messages in "efl" logger. 2013-10-23 21:49:56 +03:00
Kai Huuhko 7fbab02702 First attempt at integrating Eina Log with Python logging.
Has two loggers: efl and efl.eo.

To test, add handlers, formatters etc. and change levels using
normal Python logging utilities. The test messages come from
efl.eo init and class registration.
2013-10-23 14:34:42 +03:00
Kai Huuhko b981ce3840 New feature: Set properties using constructor keyword arguments.
Only applied to Elm Bubble for now as an example.
2013-10-20 14:34:53 +03:00
Kai Huuhko 9413b157b9 Evas/Eo: Fix couple of crashes related to Canvas cb's and Eo 2013-10-03 06:19:04 +03:00
Kai Huuhko 5f4a46da4b Move common conversion functions from efl.eo to efl.utils.conversions 2013-10-01 04:56:28 +03:00
Kai Huuhko 6587b5be67 Rename efl.pxd to efl.eina.pxd 2013-09-30 07:26:35 +03:00
Kai Huuhko 88db824a77 Change the _METHOD_DEPRECATED function into a decorator.
- move the decorator into a new package/module: utils/deprecated
 - simplify setup.py logic slightly, it still needs work
2013-09-20 12:01:50 +03:00
Davide Andreoli 5913721de9 Python-EFL: implemented decorators for edje.
Decorators implemented in a much more simple and generic
way than before, we can use them in other place too.

3 deco implemented:
@on_signal(emission, source)
@message_handler
@on_text_change

I choosed the 'strange' on_* naming convention to not
clash/confuse with normal callback functions, tell
me if you don't like.
2013-05-14 21:51:29 +02:00
Kai Huuhko 94df82ad33 Eo: Python objects should not be manipulated in __cinit__ and
__dealloc__ methods. Initializing them *seems* to be safe though.

And there's no need to initialize either the C objects to NULL nor
python objects to None, this gets done automatically by Cython, along
with initializing integers to 0.
2013-05-01 15:24:42 +00:00
Kai Huuhko d3cd5a4239 Eo: Add a boolean special method which does the same (opposite) as is_deleted().
Now you can write:

    if not my_obj:
        raise VeryBadError("My object is gone!")

and:

    if my_obj:
        my_obj.manipulate()

instead of:

    if my_obj.is_deleted()
        raise ErrorBadVery("Where did it go?")

and:

    if not my_obj.is_deleted():
        my_obj.manipulate()

But really, we should add NULL checks all over the place instead of
having the end developers checking for it.
2013-05-01 15:05:08 +00:00
Kai Huuhko f38a3145d1 Silence some compiler warnings. 2013-04-22 20:20:21 +03:00
Kai Huuhko fd7322fcda Disallow instantiating the base object classes. 2013-04-22 20:20:21 +03:00
Kai Huuhko 0d63acbee9 Elementary: Implement Accessible objects, with cbs TODO later. 2013-04-22 20:20:21 +03:00
Kai Huuhko 2f0c2dc6d7 Eo: Apparently Cython doesn't optimize .encode() so we should begin
exchanging it with the C function call PyUnicode_AsUTF8String.
2013-04-22 20:20:20 +03:00
Kai Huuhko f1972f6a6e Place the remnants of _cfruni and _fruni under six feet of soil.
Fix a braino in the py list to string array conversion function.
2013-04-04 11:31:24 +00:00
Kai Huuhko 2f6edccf6e Eo: remove _c?fruni from list conv funcs. 2013-04-01 18:24:45 +00:00
Davide Andreoli a960142166 Python-EFL: remove unused code (was the test to use the new Eo API). And use multiline when importing. 2013-03-31 21:18:03 +02:00
Davide Andreoli 5043aa38f0 Reorder _object_mapping_register for readability. 2013-03-31 15:26:30 +00:00
Kai Huuhko 49d1d1950a Move Eo init to beginning of the file so that the initialization is run
before anything else that's in the module init code path.
2013-03-31 15:09:50 +00:00
Kai Huuhko 21ec3e18cf Change the class lookup code to C only using an Eina Hash table. 2013-03-30 15:39:51 +00:00
Davide Andreoli 16ecc8ca4b * remove Eo.is_valid property as it do not check what it say
* Using Eina_Hash in object_mapping doesn't worth the pain
 * extended object mapping is not required anymore
2013-03-30 12:21:13 +01:00
Kai Huuhko 0cb72de9f1 Revert changes to pointer comparison style. 2013-03-28 21:34:31 +00:00
Kai Huuhko 4d9c1c929a Handle exceptions in eo cdef functions, don't expose _METHOD_DEPRECATED
to Python API needlesly, add some code optimizations and TODOs.
2013-03-28 16:54:51 +00:00