Forwarding for who don't follow the commit list:

Log:
Background object revised, now match the C api.

 CALL FOR HELP:
 Ok we need to do this work for each elm widget, it's a really
 annoing work to do, but it's also very easy.

 Someone want to help me in this revision work? It will take months for me
to do alone

 If you are intrested I'm using the c_elementary.pxd file as index,
 I will put a (DONE) on widget that are...well..done :)

 davemds



Author:       davemds
Date:         2012-05-11 13:42:09 -0700 (Fri, 11 May 2012)
New Revision: 70937
Trac:         http://trac.enlightenment.org/e/changeset/70937

Modified:
 trunk/BINDINGS/python/python-elementary/elementary/__init__.py
trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_background.pxi
trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd
trunk/BINDINGS/python/python-elementary/tests/test_bg.py

Modified: trunk/BINDINGS/python/python-elementary/elementary/__init__.py
===================================================================
--- trunk/BINDINGS/python/python-elementary/elementary/__init__.py
 2012-05-11 20:12:56 UTC (rev 70936)
+++ trunk/BINDINGS/python/python-elementary/elementary/__init__.py
 2012-05-11 20:42:09 UTC (rev 70937)
@@ -33,6 +33,12 @@
    focus_highlight_animate_set, preferred_engine_get,
preferred_engine_set, \
    engine_get, engine_set

+ELM_BG_OPTION_CENTER = 0
+ELM_BG_OPTION_SCALE = 1
+ELM_BG_OPTION_STRETCH = 2
+ELM_BG_OPTION_TILE = 3
+ELM_BG_OPTION_LAST = 4
+
 ELM_WIN_BASIC = 0
 ELM_WIN_DIALOG_BASIC = 1


Modified:
trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_background.pxi
===================================================================
---
trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_background.pxi
  2012-05-11 20:12:56 UTC (rev 70936)
+++
trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_background.pxi
  2012-05-11 20:42:09 UTC (rev 70937)
@@ -45,5 +45,91 @@
        """
        elm_bg_file_set(self.obj, filename, group)

+    def file_get(self):
+        """
+        Get the file (image or edje) used for the background

+        @return: The tuple (filename, group)
+        """
+        cdef const_char_ptr filename, group
+
+        elm_bg_file_get(self.obj, &filename, &group)
+        if filename == NULL:
+            filename = ""
+        if group == NULL:
+            group = ""
+        return (filename, group)
+
+    property file:
+        def __get__(self):
+            return self.file_get()
+
+        def __set__(self, value):
+            self.file_set(value)
+
+    def option_set(self, option):
+        """
+        Set the mode of display of the background
+
+        @param: B{option} choose from Elm_Bg_Option
+        """
+        elm_bg_option_set(self.obj, option)
+
+    def option_get(self):
+        """
+        Get the mode of display of the background
+
+        @return: the current mode
+        """
+        return elm_bg_option_get(self.obj)
+
+    property option:
+        def __get__(self):
+            return self.option_get()
+
+        def __set__(self, value):
+            self.option_set(value)
+
+    def color_set(self, r, g, b):
+        """
+        Set the color of the bg
+
+        @param B{r} the red component (range: 0 to 255)
+        @param B{g} the green component (range: 0 to 255)
+        @param B{b} the blue component (range: 0 to 255)
+        """
+        elm_bg_color_set(self.obj, r, g, b)
+
+    def color_get(self):
+        """
+        Get the color of the bg
+
+        @return: the tuple (r, g, b)
+        """
+        cdef int r, g, b
+
+        elm_bg_color_get(self.obj, &r, &g, &b)
+        return (r, g, b)
+
+    property color:
+        def __get__(self):
+            return self.color_get()
+
+        def __set__(self, value):
+            self.color_set(*value)
+
+    def load_size_set(self, w, h):
+        """
+        Set the load size of the background image
+
+        @param B{w} width
+        @param B{h} height
+        """
+        elm_bg_load_size_set(self.obj, w, h)
+
+    property load_size:
+        def __set__(self, value):
+            self.load_size_set(*value)
+
+
 _elm_widget_type_register("bg", Background)

Modified:
trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd
===================================================================
---
trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd
2012-05-11 20:12:56 UTC (rev 70936)
+++
trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd
2012-05-11 20:42:09 UTC (rev 70937)
@@ -186,6 +186,13 @@
        ELM_BUBBLE_POS_BOTTOM_LEFT
        ELM_BUBBLE_POS_BOTTOM_RIGHT

+    ctypedef enum Elm_Bg_Option:
+        ELM_BG_OPTION_CENTER
+        ELM_BG_OPTION_SCALE
+        ELM_BG_OPTION_STRETCH
+        ELM_BG_OPTION_TILE
+        ELM_BG_OPTION_LAST
+
    ctypedef struct Elm_Entry_Anchor_Info:
        char *name
        int   button
@@ -202,6 +209,7 @@
        evas.c_evas.Eina_Bool hover_top
        evas.c_evas.Eina_Bool hover_bottom

+
    ctypedef char *(*GenlistItemLabelGetFunc)(void *data,
evas.c_evas.Evas_Object *obj, const_char_ptr part)
    ctypedef evas.c_evas.Evas_Object *(*GenlistItemIconGetFunc)(void *data,
evas.c_evas.Evas_Object *obj, const_char_ptr part)
    ctypedef evas.c_evas.Eina_Bool (*GenlistItemStateGetFunc)(void *data,
evas.c_evas.Evas_Object *obj, const_char_ptr part)
@@ -414,9 +422,15 @@
    void elm_win_inwin_activate(evas.c_evas.Evas_Object *obj)
    void elm_win_inwin_content_set(evas.c_evas.Evas_Object *obj,
evas.c_evas.Evas_Object *content)

-    # Background object
+    # Background object (DONE)
    evas.c_evas.Evas_Object *elm_bg_add(evas.c_evas.Evas_Object *parent)
-    void elm_bg_file_set(evas.c_evas.Evas_Object *obj, char *file, char
*group)
+    void                     elm_bg_file_set(evas.c_evas.Evas_Object *obj,
char *file, char *group)
+    void                     elm_bg_file_get(evas.c_evas.Evas_Object *obj,
char **file, char **group)
+    void                     elm_bg_option_set(evas.c_evas.Evas_Object
*obj, Elm_Bg_Option option)
+    Elm_Bg_Option            elm_bg_option_get(evas.c_evas.Evas_Object
*obj)
+    void                     elm_bg_color_set(evas.c_evas.Evas_Object
*obj, int r, int g, int b)
+    void                     elm_bg_color_get(evas.c_evas.Evas_Object
*obj, int *r, int *g, int *b)
+    void                     elm_bg_load_size_set(evas.c_evas.Evas_Object
*obj, evas.c_evas.Evas_Coord w, evas.c_evas.Evas_Coord h)

    # Icon object
    evas.c_evas.Evas_Object *elm_icon_add(evas.c_evas.Evas_Object *parent)

Modified: trunk/BINDINGS/python/python-elementary/tests/test_bg.py
===================================================================
--- trunk/BINDINGS/python/python-elementary/tests/test_bg.py    2012-05-11
20:12:56 UTC (rev 70936)
+++ trunk/BINDINGS/python/python-elementary/tests/test_bg.py    2012-05-11
20:42:09 UTC (rev 70937)
@@ -29,6 +29,7 @@
    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.file_set("images/plant_01.jpg")
+    bg.option_set(elementary.ELM_BG_OPTION_SCALE)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

@@ -36,6 +37,10 @@
    win.size_hint_max_set(320, 320)
    win.resize(320, 320)
    win.show()
+
+    (filename, group) = bg.file_get()
+    print("Background image: '%s'  group: '%s'" % (filename, group))
+    print("Option: %d" % (bg.option_get()))
 # }}}

 #----- Main -{{{-


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to