Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : proto/python-efl

Dir     : e17/proto/python-efl/python-edje/edje


Modified Files:
        edje.c_edje.pxd edje.c_edje_object.pxi python.pxd 


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-edje/edje/edje.c_edje.pxd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje.c_edje.pxd     7 Jul 2007 00:42:01 -0000       1.3
+++ edje.c_edje.pxd     2 Sep 2007 15:11:54 -0000       1.4
@@ -1,6 +1,10 @@
 cimport evas.c_evas
 import evas.c_evas
 
+cdef extern from "python_evas_utils.h":
+    int PY_REFCOUNT(object)
+
+
 cdef extern from "Edje.h":
     ####################################################################
     # Enumerations
===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-edje/edje/edje.c_edje_object.pxi,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- edje.c_edje_object.pxi      1 Sep 2007 15:59:30 -0000       1.14
+++ edje.c_edje_object.pxi      2 Sep 2007 15:11:54 -0000       1.15
@@ -98,6 +98,33 @@
             w, h = self.size_min_get()
             self.size_set(w, h)
 
+    def __str__(self):
+        x, y, w, h = self.geometry_get()
+        r, g, b, a = self.color_get()
+        file, group = self.file_get()
+        name = self.name_get()
+        if name:
+            name_str = "name=%r, "
+        else:
+            name_str = ""
+        return ("%s(%sfile=%r, group=%r, geometry=(%d, %d, %d, %d), "
+                "color=(%d, %d, %d, %d), layer=%s, clip=%s, visible=%s)") % \
+               (self.__class__.__name__, name_str, file, group, 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()
+        file, group = self.file_get()
+        return ("%s(0x%x, type=%r, refcount=%d, Evas_Object=0x%x, name=%r, "
+                "file=%r, group=%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(), PY_REFCOUNT(self), <unsigned long>self.obj,
+                self.name_get(), file, group, x, y, w, h, r, g, b, a,
+                self.layer_get(), self.clip_get(), self.visible_get())
+
     def data_get(self, char *key):
         cdef char *s
         s = edje_object_data_get(self.obj, key)
===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-edje/edje/python.pxd,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- python.pxd  3 May 2007 21:56:06 -0000       1.1.1.1
+++ python.pxd  2 Sep 2007 15:11:54 -0000       1.2
@@ -77,8 +77,3 @@
     int PyObject_CheckReadBuffer(obj)
     int PyObject_AsReadBuffer(obj, void **buffer, Py_ssize_t *buffer_len) 
except -1
     int PyObject_AsWriteBuffer(obj, void **buffer, Py_ssize_t *buffer_len) 
except -1
-
-
-
-cdef extern from "Numeric/arrayobject.h":
-    int REFCOUNT(object)



-------------------------------------------------------------------------
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

Reply via email to