Enlightenment CVS committal

Author  : barbieri
Project : e17
Module  : proto

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


Modified Files:
        __init__.py evas.c_evas.pxd evas.c_evas.pyx 
        evas.c_evas_object_image.pxi 


Log Message:
Raise exception on image load error.

===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/__init__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- __init__.py 5 May 2007 05:51:47 -0000       1.3
+++ __init__.py 6 May 2007 17:28:10 -0000       1.4
@@ -53,6 +53,7 @@
 EVAS_FONT_HINTING_BYTECODE = 2
 
 
+EvasLoadError = c_evas.EvasLoadError
 Rect = c_evas.Rect
 
 class Canvas(c_evas.Canvas):
===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas.pxd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas.c_evas.pxd     5 May 2007 02:33:18 -0000       1.3
+++ evas.c_evas.pxd     6 May 2007 17:28:10 -0000       1.4
@@ -24,6 +24,16 @@
         EVAS_CALLBACK_RESTACK
 
 
+    cdef enum Evas_Load_Error:
+        EVAS_LOAD_ERROR_NONE = 0
+        EVAS_LOAD_ERROR_GENERIC = 1
+        EVAS_LOAD_ERROR_DOES_NOT_EXIST = 2
+        EVAS_LOAD_ERROR_PERMISSION_DENIED = 3
+        EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED = 4
+        EVAS_LOAD_ERROR_CORRUPT_FILE = 5
+        EVAS_LOAD_ERROR_UNKNOWN_FORMAT = 6
+
+
     ctypedef enum Evas_Button_Flags:
         EVAS_BUTTON_NONE
         EVAS_BUTTON_DOUBLE_CLICK
===================================================================
RCS file: /cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas.pyx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas.c_evas.pyx     5 May 2007 02:33:18 -0000       1.3
+++ evas.c_evas.pyx     6 May 2007 17:28:10 -0000       1.4
@@ -157,6 +157,25 @@
     return (h, s, v)
 
 
+class EvasLoadError(Exception):
+    def __init__(self, int code):
+        if code == EVAS_LOAD_ERROR_NONE:
+            msg = "No error on load"
+        elif code == EVAS_LOAD_ERROR_GENERIC:
+            msg = "A non-specific error occured"
+        elif code == EVAS_LOAD_ERROR_DOES_NOT_EXIST:
+            msg = "File (or file path) does not exist"
+        elif code == EVAS_LOAD_ERROR_PERMISSION_DENIED:
+            msg = "Permission deinied to an existing file (or path)"
+        elif code == EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED:
+            msg = "Allocation of resources failure prevented load"
+        elif code == EVAS_LOAD_ERROR_CORRUPT_FILE:
+            msg = "File corrupt (but was detected as a known format)"
+        elif code == EVAS_LOAD_ERROR_UNKNOWN_FORMAT:
+            msg = "File is not a known format"
+        Exception.__init__(self, msg)
+
+
 include "evas.c_evas_rect.pxi"
 include "evas.c_evas_canvas.pxi"
 include "evas.c_evas_object_events.pxi"
===================================================================
RCS file: 
/cvs/e/e17/proto/python-efl/python-evas/evas/evas.c_evas_object_image.pxi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- evas.c_evas_object_image.pxi        6 May 2007 17:26:56 -0000       1.3
+++ evas.c_evas_object_image.pxi        6 May 2007 17:28:10 -0000       1.4
@@ -16,11 +16,15 @@
 
     def file_set(self, char *filename, key=None):
         cdef char *k
+        cdef int err
         if key:
             k = key
         else:
             k = NULL
         evas_object_image_file_set(self.obj, filename, k)
+        err = evas_object_image_load_error_get(self.obj)
+        if err != EVAS_LOAD_ERROR_NONE:
+            raise EvasLoadError(err)
 
     def file_get(self):
         cdef char *f, *k



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to