Enlightenment CVS committal

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

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


Modified Files:
        emotion.c_emotion.pxd emotion.c_emotion.pyx 


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-emotion/emotion/emotion.c_emotion.pxd,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- emotion.c_emotion.pxd       7 May 2007 19:54:01 -0000       1.1.1.1
+++ emotion.c_emotion.pxd       2 Sep 2007 15:11:54 -0000       1.2
@@ -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 "Emotion.h":
     ctypedef enum Emotion_Module:
         EMOTION_MODULE_XINE = 0
===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-emotion/emotion/emotion.c_emotion.pyx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- emotion.c_emotion.pyx       1 Sep 2007 15:59:30 -0000       1.5
+++ emotion.c_emotion.pyx       2 Sep 2007 15:11:54 -0000       1.6
@@ -45,6 +45,31 @@
             for opt, val in module_params.iteritems():
                 emotion_object_module_option_set(self.obj, opt, val)
 
+    def __str__(self):
+        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(%sfile=%r, geometry=(%d, %d, %d, %d), "
+                "color=(%d, %d, %d, %d), layer=%s, clip=%s, visible=%s)") % \
+               (self.__class__.__name__, name_str, self.file_get(), 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, "
+                "file=%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(), self.file_get(), x, y, w, h, r, g, b, a,
+                self.layer_get(), self.clip_get(), self.visible_get())
+
     def file_get(self):
         cdef char *f
         f = emotion_object_file_get(self.obj)



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