EvasObject: added the Eo position property

and deprecate the legacy name: pos
This commit is contained in:
Davide Andreoli 2015-01-24 20:04:31 +01:00
parent e091fc6064
commit 6422f5a149
2 changed files with 32 additions and 2 deletions

View File

@ -17,6 +17,7 @@
from cpython cimport Py_INCREF, Py_DECREF
from efl.utils.conversions cimport eina_list_objects_to_python_list
from efl.utils.deprecated cimport DEPRECATED
cdef int _object_free_wrapper_resources(Object obj) except 0:
@ -406,11 +407,13 @@ cdef class Object(Eo):
"""
evas_object_resize(self.obj, w, h)
property pos:
property position:
"""Object's position on the X and Y coordinates.
:type: (int **x**, int **y**)
.. versionadded:: 1.14
"""
def __get__(self): # replicated to avoid performance hit
cdef int x, y
@ -422,10 +425,38 @@ cdef class Object(Eo):
x, y = spec
evas_object_move(self.obj, x, y)
def position_get(self):
cdef int x, y
evas_object_geometry_get(self.obj, &x, &y, NULL, NULL)
return (x, y)
def position_set(self, int x, int y):
evas_object_move(self.obj, x, y)
property pos:
"""Object's position on the X and Y coordinates.
:type: (int **x**, int **y**)
.. deprecated:: 1.14
Use the position property instead
"""
def __get__(self): # replicated to avoid performance hit
cdef int x, y
evas_object_geometry_get(self.obj, &x, &y, NULL, NULL)
return (x, y)
def __set__(self, spec):
cdef int x, y
x, y = spec
evas_object_move(self.obj, x, y)
@DEPRECATED("1.14", "Use position_get() instead.")
def pos_get(self):
cdef int x, y
evas_object_geometry_get(self.obj, &x, &y, NULL, NULL)
return (x, y)
@DEPRECATED("1.14", "Use position_set() instead.")
def pos_set(self, int x, int y):
evas_object_move(self.obj, x, y)

View File

@ -29,7 +29,6 @@ TODO
* properties that need to be fixed:
- visibility
- file
- position
* What when we create the same widget more than one time ?