Enlightenment CVS committal Author : barbieri Project : e17 Module : proto/python-efl
Dir : e17/proto/python-efl/python-emotion/emotion Modified Files: __init__.py emotion.c_emotion.pyx Log Message: Cleanup: simplify construction of wrappers for already existent objects. Before I had one class redefinition in __init__.py for each used class, this was used to have an end-user constructor that would call evas to create new objects, while the base class would start shallow and would accept Evas_Object with _set_obj(). Caio noticed that we should instead have end-user constructor in the base class and use Class.__new__() to avoid calling it when we require, like Object_from_instance(). Patch by Caio Marcelo with minor adjustments. =================================================================== RCS file: /cvs/e/e17/proto/python-efl/python-emotion/emotion/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- __init__.py 19 Jul 2007 16:05:25 -0000 1.3 +++ __init__.py 1 Sep 2007 15:59:30 -0000 1.4 @@ -2,6 +2,8 @@ import c_emotion +from c_emotion import Emotion, EmotionModuleInitError + EMOTION_EVENT_MENU1 = 0 EMOTION_EVENT_MENU2 = 1 EMOTION_EVENT_MENU3 = 2 @@ -30,16 +32,3 @@ EMOTION_EVENT_8 = 25 EMOTION_EVENT_9 = 26 EMOTION_EVENT_10 = 27 - -EmotionModuleInitError = c_emotion.EmotionModuleInitError - -class Emotion(c_emotion.Emotion): - 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.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- emotion.c_emotion.pyx 19 Jul 2007 15:06:44 -0000 1.4 +++ emotion.c_emotion.pyx 1 Sep 2007 15:59:30 -0000 1.5 @@ -22,11 +22,14 @@ def __new__(self, *a, **ka): self._emotion_callbacks = {} - def _new_obj(self): + def __init__(self, evas.c_evas.Canvas canvas not None, **kargs): + evas.c_evas.Object.__init__(self, canvas) if self.obj == NULL: self._set_obj(emotion_object_add(self._evas.obj)) + self._set_common_params(**kargs) - def _set_common_params(self, char *module_filename, + def _set_common_params(self, + char *module_filename="emotion_decoder_xine.so", module_params=None, size=None, pos=None, geometry=None, color=None, name=None): evas.c_evas.Object._set_common_params(self, size=size, pos=pos, ------------------------------------------------------------------------- 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