Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl
Dir : e17/proto/python-efl/python-evas/evas Modified Files: evas.c_evas.pxd evas.c_evas_canvas.pxi evas.c_evas_object.pxi python.pxd python_evas_utils.h Log Message: Remove dependency on Numeric/array.h, improved __str__ and __repr__ and simplified ecore classes. * Numeric/array.h was just required to print reference count, this macro is now in python_evas_utils.h and we're clean. * __str__ was too verbose and not informative, it was improved with other attributes like color, geometry, name, clip and layer, but reference count and wrapped pointer are not there anymore, they made into new __repr__. * Following previous patch from Caio, this version remove class redefinition in ecore/__init__.py, also these classes were redone to work better, and the results are good, with less lines of code and better consistency. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas.pxd,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evas.c_evas.pxd 22 Aug 2007 14:29:54 -0000 1.11 +++ evas.c_evas.pxd 2 Sep 2007 15:11:54 -0000 1.12 @@ -1,5 +1,6 @@ cdef extern from "python_evas_utils.h": - pass + int PY_REFCOUNT(object) + cdef extern from "Evas.h": #################################################################### =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_canvas.pxi,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- evas.c_evas_canvas.pxi 1 Sep 2007 15:59:30 -0000 1.10 +++ evas.c_evas_canvas.pxi 2 Sep 2007 15:11:54 -0000 1.11 @@ -34,9 +34,17 @@ self._set_obj(evas_new()) def __str__(self): - return "%s(0x%x, refcount=%d, Evas_Object=0x%x)" % \ + w, h = self.size_get() + return "%s(size=(%d, %d), method=%r)" % \ + (self.__class__.__name__, w, h, self.output_method_get()) + + def __repr__(self): + w, h = self.size_get() + return ("%s(0x%x, refcount=%d, Evas_Object=0x%x, size=(%d, %d), " + "method=%r)") % \ (self.__class__.__name__, <unsigned long>self, - python.REFCOUNT(self), <unsigned long>self.obj) + PY_REFCOUNT(self), <unsigned long>self.obj, + w, h, self.output_method_get()) def output_method_set(self, method): "Set canvas render method, can be either a name or id." =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_object.pxi,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evas.c_evas_object.pxi 1 Sep 2007 15:59:30 -0000 1.11 +++ evas.c_evas_object.pxi 2 Sep 2007 15:11:54 -0000 1.12 @@ -72,10 +72,29 @@ self._evas = evas def __str__(self): - return "%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x)" % \ + x, y, w, h = self.geometry_get() + r, g, b, a = self.color_get() + name = self.name_get() + if name: + name_str = "name=%r, " + else: + name_str = "" + return ("%s(%sgeometry=(%d, %d, %d, %d), color=(%d, %d, %d, %d), " + "layer=%s, clip=%s, visible=%s)") % \ + (self.__class__.__name__, name_str, x, y, w, h, + r, g, b, a, self.layer_get(), self.clip_get(), + self.visible_get()) + + def __repr__(self): + x, y, w, h = self.geometry_get() + r, g, b, a = self.color_get() + return ("%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x, name=%r, " + "geometry=(%d, %d, %d, %d), color=(%d, %d, %d, %d), " + "layer=%s, clip=%r, visible=%s)") % \ (self.__class__.__name__, <unsigned long>self, - self.type_get(), python.REFCOUNT(self), - <unsigned long>self.obj) + self.type_get(), PY_REFCOUNT(self), <unsigned long>self.obj, + self.name_get(), x, y, w, h, r, g, b, a, self.layer_get(), + self.clip_get(), self.visible_get()) cdef int _unset_obj(self) except 0: assert self.obj != NULL, "Object must wrap something" =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/python.pxd,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- python.pxd 6 May 2007 17:26:13 -0000 1.3 +++ python.pxd 2 Sep 2007 15:11:54 -0000 1.4 @@ -87,7 +87,3 @@ # methodobject.h object PyMethod_New(object func, object self, object cls) - - -cdef extern from "Numeric/arrayobject.h": - int REFCOUNT(object) =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/python_evas_utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- python_evas_utils.h 30 Apr 2007 20:17:48 -0000 1.1 +++ python_evas_utils.h 2 Sep 2007 15:11:54 -0000 1.2 @@ -17,4 +17,7 @@ Evas_Point canvas; } Evas_Position; +#define PY_REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt) + + #endif /* _PYTHON_EVAS_UTILS_H_ */ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs