Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : proto

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


Modified Files:
        __init__.py emotion.c_emotion.pyx 


Log Message:
Fix usage of Pyrex __new__, it was causing problems with inheritance.

Pyrex's __new__() method is confusing, you cannot raise exceptions and
every method should have the same signature, otherwise you'll get error
from the parent class. This method, AFAIU is just meant to ensure
things are initialized once.

I moved my code to be executed from __init__(), then I can do regular
python things, as check for correct type of parameters.



===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-emotion/emotion/__init__.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -3 -r1.1.1.1 -r1.2
--- __init__.py 7 May 2007 19:54:01 -0000       1.1.1.1
+++ __init__.py 19 Jul 2007 15:06:44 -0000      1.2
@@ -34,13 +34,12 @@
 EmotionModuleInitError = c_emotion.EmotionModuleInitError
 
 class Emotion(c_emotion.Emotion):
-    def __new__(type, canvas, module_filename="emotion_decoder_xine.so",
-                module_params=None, size=None, pos=None, geometry=None,
-                color=None, name=None):
-        obj = c_emotion.Emotion.__new__(type, canvas)
-        obj._new_obj()
-        obj._set_common_params(module_filename=module_filename,
-                               module_params=module_params,
-                               size=size, pos=pos, geometry=geometry,
-                               color=color, name=name)
-        return obj
+    def __init__(self, canvas, module_filename="emotion_decoder_xine.so",
+                 module_params=None, size=None, pos=None, geometry=None,
+                 color=None, name=None):
+        c_emotion.Emotion.__init__(self, canvas)
+        self_new_obj()
+        self._set_common_params(module_filename=module_filename,
+                                module_params=module_params,
+                                size=size, pos=pos, geometry=geometry,
+                                color=color, name=name)
===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-emotion/emotion/emotion.c_emotion.pyx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- emotion.c_emotion.pyx       17 Jul 2007 23:07:20 -0000      1.3
+++ emotion.c_emotion.pyx       19 Jul 2007 15:06:44 -0000      1.4
@@ -19,7 +19,7 @@
 
 
 cdef class Emotion(evas.c_evas.Object):
-    def __new__(self, evas.c_evas.Canvas evas):
+    def __new__(self, *a, **ka):
         self._emotion_callbacks = {}
 
     def _new_obj(self):



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to