davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=3765021dc0fce7b1bd63396a4e05665e7ff45554

commit 3765021dc0fce7b1bd63396a4e05665e7ff45554
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Tue Apr 14 21:22:38 2015 +0200

    New 1.14 API: elm.Slider.indicator_visible_mode
    
    with test
---
 efl/elementary/slider.pxd          | 11 +++++++++
 efl/elementary/slider.pyx          | 19 ++++++++++++++++
 examples/elementary/test_slider.py | 46 ++++++++++++++++++++++++++++++++++----
 3 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/efl/elementary/slider.pxd b/efl/elementary/slider.pxd
index 0a1a9be..6f4915e 100644
--- a/efl/elementary/slider.pxd
+++ b/efl/elementary/slider.pxd
@@ -1,6 +1,15 @@
 from efl.evas cimport Eina_Bool, Evas_Object, Evas_Coord
 
 cdef extern from "Elementary.h":
+
+    cpdef enum Elm_Slider_Indicator_Visible_Mode:
+        ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT
+        ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS
+        ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS
+        ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE
+    ctypedef enum Elm_Slider_Indicator_Visible_Mode:
+        pass
+
     Evas_Object *   elm_slider_add(Evas_Object *parent)
     void            elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size)
     Evas_Coord      elm_slider_span_size_get(const Evas_Object *obj)
@@ -20,5 +29,7 @@ cdef extern from "Elementary.h":
     Eina_Bool       elm_slider_inverted_get(const Evas_Object *obj)
     void            elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool 
show)
     Eina_Bool       elm_slider_indicator_show_get(const Evas_Object *obj)
+    void            elm_slider_indicator_visible_mode_set(const Evas_Object 
*obj, Elm_Slider_Indicator_Visible_Mode indicator_visible_mode)
+    Elm_Slider_Indicator_Visible_Mode  
elm_slider_indicator_visible_mode_get(const Evas_Object *obj)
     void            elm_slider_step_set(Evas_Object *obj, double step)
     double          elm_slider_step_get(const Evas_Object *obj)
diff --git a/efl/elementary/slider.pyx b/efl/elementary/slider.pyx
index 32635c7..4f49453 100644
--- a/efl/elementary/slider.pyx
+++ b/efl/elementary/slider.pyx
@@ -375,6 +375,25 @@ cdef class Slider(LayoutClass):
     def indicator_show_get(self):
         return bool(elm_slider_indicator_show_get(self.obj))
 
+
+    property indicator_visible_mode:
+        """The visible mode of indicator
+
+        :type: :ref:`Elm_Slider_Indicator_Visible_Mode`
+
+        .. versionadded:: 1.14
+
+        """
+        def __set__(self, indicator_visible_mode):
+            elm_slider_indicator_visible_mode_set(self.obj, 
indicator_visible_mode)
+        def __get__(self):
+            return elm_slider_indicator_visible_mode_get(self.obj)
+
+    def indicator_visible_mode_set(self, indicator_visible_mode):
+        elm_slider_indicator_visible_mode_set(self.obj, indicator_visible_mode)
+    def indicator_visible_mode_get(self):
+        return elm_slider_indicator_visible_mode_get(self.obj)
+
     property step:
         """The step by which slider indicator will move.
 
diff --git a/examples/elementary/test_slider.py 
b/examples/elementary/test_slider.py
index e1d0ae1..c69e44d 100644
--- a/examples/elementary/test_slider.py
+++ b/examples/elementary/test_slider.py
@@ -12,9 +12,15 @@ from efl.elementary.window import StandardWindow
 from efl.elementary.box import Box
 from efl.elementary.button import Button
 from efl.elementary.frame import Frame
+from efl.elementary.label import Label
 from efl.elementary.list import List
 from efl.elementary.icon import Icon
-from efl.elementary.slider import Slider
+from efl.elementary.radio import Radio
+from efl.elementary.slider import Slider, \
+    ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT, \
+    ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, \
+    ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS, \
+    ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE
 
 
 ALIGN_CENTER = 0.5, 0.5
@@ -77,6 +83,7 @@ def slider_clicked(obj):
     bx.pack_end(sl)
     sl.show()
 
+    # manual step
     step = step_size_calculate(0, 9)
     sl = Slider(bx, unit_format="%1.0f units", indicator_format="%1.0f",
         span_size=120, min_max=(0, 9), text="Manual step", step=step,
@@ -174,9 +181,8 @@ def slider_clicked(obj):
 
     # normal vertical slider
     sl = Slider(bx2, text="Vertical", unit_format="%1.1f units", span_size=60,
-        size_hint_align=FILL_VERT,
-        size_hint_weight=EXPAND_VERT, indicator_show=False,
-        value=0.2, scale=1.0, horizontal=False)
+        size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT,
+        value=0.2, scale=1.0, horizontal=False, indicator_format="%.1f")
     sl.callback_changed_add(change_print_cb, sl)
     bx2.pack_end(sl)
     sl.show()
@@ -206,6 +212,38 @@ def slider_clicked(obj):
     bt.show()
     bx2.pack_end(bt)
 
+    # box for indicator visible mode
+    bx2 = Box(win,size_hint_weight=EXPAND_HORIZ, horizontal=True)
+    bx.pack_end(bx2)
+    bx2.show()
+
+    lb = Label(win, text="Indicator mode:")
+    bx2.pack_end(lb)
+    lb.show()
+    
+    rd = rdg = Radio(win, text="Default", 
state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT)
+    rd.callback_changed_add(lambda r: 
sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT))
+    bx2.pack_end(rd)
+    rd.show()
+
+    rd = Radio(win, text="Always", 
state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS)
+    rd.callback_changed_add(lambda r: 
sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS))
+    rd.group_add(rdg)
+    bx2.pack_end(rd)
+    rd.show()
+
+    rd = Radio(win, text="On Focus", 
state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS)
+    rd.callback_changed_add(lambda r: 
sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS))
+    rd.group_add(rdg)
+    bx2.pack_end(rd)
+    rd.show()
+
+    rd = Radio(win, text="None", 
state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE)
+    rd.callback_changed_add(lambda r: 
sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE))
+    rd.group_add(rdg)
+    bx2.pack_end(rd)
+    rd.show()
+
 if __name__ == "__main__":
     elementary.init()
 

-- 


Reply via email to