Enlightenment CVS committal

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

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


Modified Files:
        __init__.py edje.c_edje_object.pxi 


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-edje/edje/__init__.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- __init__.py 19 Jul 2007 16:07:06 -0000      1.4
+++ __init__.py 1 Sep 2007 15:59:30 -0000       1.5
@@ -2,62 +2,16 @@
 
 import c_edje
 
-shutdown = c_edje.shutdown
-
-frametime_set = c_edje.frametime_set
-frametime_get = c_edje.frametime_get
-
-freeze = c_edje.freeze
-thaw = c_edje.thaw
-
-fontset_append_get = c_edje.fontset_append_get
-fontset_append_set = c_edje.fontset_append_set
-
-file_collection_list = c_edje.file_collection_list
-file_group_exists = c_edje.file_group_exists
-
-file_data_get = c_edje.file_data_get
-
-file_cache_set = c_edje.file_cache_set
-file_cache_get = c_edje.file_cache_get
-file_cache_flush = c_edje.file_cache_flush
-
-collection_cache_set = c_edje.collection_cache_set
-collection_cache_get = c_edje.collection_cache_get
-collection_cache_flush = c_edje.collection_cache_flush
-
-color_class_set = c_edje.color_class_set
-color_class_del = c_edje.color_class_del
-color_class_list = c_edje.color_class_list
-
-text_class_set = c_edje.text_class_set
-text_class_del = c_edje.text_class_del
-text_class_list = c_edje.text_class_list
-
-message_signal_process = c_edje.message_signal_process
-
-EdjeLoadError = c_edje.EdjeLoadError
-
-Message = c_edje.Message
-MessageSignal = c_edje.MessageSignal
-MessageString = c_edje.MessageString
-MessageInt = c_edje.MessageInt
-MessageFloat = c_edje.MessageFloat
-MessageStringSet = c_edje.MessageStringSet
-MessageIntSet = c_edje.MessageIntSet
-MessageFloatSet = c_edje.MessageFloatSet
-MessageStringInt = c_edje.MessageStringInt
-MessageStringFloat = c_edje.MessageStringFloat
-MessageStringIntSet = c_edje.MessageStringIntSet
-MessageStringFloatSet = c_edje.MessageStringFloatSet
-
-
-class Edje(c_edje.Edje):
-    def __init__(self, canvas, file=None, group=None,
-                 size=None, pos=None, geometry=None, color=None, name=None):
-        c_edje.Edje.__init__(self, canvas)
-        self._new_obj()
-        self._set_common_params(file=file, group=group, size=size, pos=pos,
-                                geometry=geometry, color=color, name=name)
+from c_edje import Edje, shutdown, frametime_set, frametime_get, \
+     freeze, thaw, fontset_append_get, fontset_append_set, \
+     file_collection_list, file_group_exists, \
+     file_data_get, file_cache_set, file_cache_get, file_cache_flush, \
+     collection_cache_set, collection_cache_get, collection_cache_flush, \
+     color_class_set, color_class_del, color_class_list, \
+     text_class_set, text_class_del, text_class_list, \
+     message_signal_process, EdjeLoadError, \
+     Message, MessageSignal, MessageString, MessageInt, MessageFloat, \
+     MessageStringSet, MessageIntSet, MessageFloatSet, MessageStringInt, \
+     MessageStringFloat, MessageStringIntSet, MessageStringFloatSet
 
 c_edje.init()
===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-edje/edje/edje.c_edje_object.pxi,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- edje.c_edje_object.pxi      15 Aug 2007 15:09:09 -0000      1.13
+++ edje.c_edje_object.pxi      1 Sep 2007 15:59:30 -0000       1.14
@@ -80,10 +80,12 @@
     def __new__(self, *a, **ka):
         self._signal_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(edje_object_add(self._evas.obj))
             _register_decorated_callbacks(self)
+        self._set_common_params(**kargs)
 
     def _set_common_params(self, file=None, group=None, size=None, pos=None,
                            geometry=None, color=None, name=None):



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