diff options
author | Dave Andreoli <dave@gurumeditation.it> | 2015-04-14 21:22:38 +0200 |
---|---|---|
committer | Dave Andreoli <dave@gurumeditation.it> | 2015-04-14 21:22:38 +0200 |
commit | 3765021dc0fce7b1bd63396a4e05665e7ff45554 (patch) | |
tree | bef4d6c777d7a191848bcb3dd2487958c3963a24 | |
parent | e8172a5cfe0ffd1b15b5bf9862a3dd4fc09ebfdb (diff) |
New 1.14 API: elm.Slider.indicator_visible_mode
with test
-rw-r--r-- | efl/elementary/slider.pxd | 11 | ||||
-rw-r--r-- | efl/elementary/slider.pyx | 19 | ||||
-rw-r--r-- | 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 @@ | |||
1 | from efl.evas cimport Eina_Bool, Evas_Object, Evas_Coord | 1 | from efl.evas cimport Eina_Bool, Evas_Object, Evas_Coord |
2 | 2 | ||
3 | cdef extern from "Elementary.h": | 3 | cdef extern from "Elementary.h": |
4 | |||
5 | cpdef enum Elm_Slider_Indicator_Visible_Mode: | ||
6 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT | ||
7 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS | ||
8 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS | ||
9 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE | ||
10 | ctypedef enum Elm_Slider_Indicator_Visible_Mode: | ||
11 | pass | ||
12 | |||
4 | Evas_Object * elm_slider_add(Evas_Object *parent) | 13 | Evas_Object * elm_slider_add(Evas_Object *parent) |
5 | void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size) | 14 | void elm_slider_span_size_set(Evas_Object *obj, Evas_Coord size) |
6 | Evas_Coord elm_slider_span_size_get(const Evas_Object *obj) | 15 | Evas_Coord elm_slider_span_size_get(const Evas_Object *obj) |
@@ -20,5 +29,7 @@ cdef extern from "Elementary.h": | |||
20 | Eina_Bool elm_slider_inverted_get(const Evas_Object *obj) | 29 | Eina_Bool elm_slider_inverted_get(const Evas_Object *obj) |
21 | void elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool show) | 30 | void elm_slider_indicator_show_set(Evas_Object *obj, Eina_Bool show) |
22 | Eina_Bool elm_slider_indicator_show_get(const Evas_Object *obj) | 31 | Eina_Bool elm_slider_indicator_show_get(const Evas_Object *obj) |
32 | void elm_slider_indicator_visible_mode_set(const Evas_Object *obj, Elm_Slider_Indicator_Visible_Mode indicator_visible_mode) | ||
33 | Elm_Slider_Indicator_Visible_Mode elm_slider_indicator_visible_mode_get(const Evas_Object *obj) | ||
23 | void elm_slider_step_set(Evas_Object *obj, double step) | 34 | void elm_slider_step_set(Evas_Object *obj, double step) |
24 | double elm_slider_step_get(const Evas_Object *obj) | 35 | 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): | |||
375 | def indicator_show_get(self): | 375 | def indicator_show_get(self): |
376 | return bool(elm_slider_indicator_show_get(self.obj)) | 376 | return bool(elm_slider_indicator_show_get(self.obj)) |
377 | 377 | ||
378 | |||
379 | property indicator_visible_mode: | ||
380 | """The visible mode of indicator | ||
381 | |||
382 | :type: :ref:`Elm_Slider_Indicator_Visible_Mode` | ||
383 | |||
384 | .. versionadded:: 1.14 | ||
385 | |||
386 | """ | ||
387 | def __set__(self, indicator_visible_mode): | ||
388 | elm_slider_indicator_visible_mode_set(self.obj, indicator_visible_mode) | ||
389 | def __get__(self): | ||
390 | return elm_slider_indicator_visible_mode_get(self.obj) | ||
391 | |||
392 | def indicator_visible_mode_set(self, indicator_visible_mode): | ||
393 | elm_slider_indicator_visible_mode_set(self.obj, indicator_visible_mode) | ||
394 | def indicator_visible_mode_get(self): | ||
395 | return elm_slider_indicator_visible_mode_get(self.obj) | ||
396 | |||
378 | property step: | 397 | property step: |
379 | """The step by which slider indicator will move. | 398 | """The step by which slider indicator will move. |
380 | 399 | ||
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 | |||
12 | from efl.elementary.box import Box | 12 | from efl.elementary.box import Box |
13 | from efl.elementary.button import Button | 13 | from efl.elementary.button import Button |
14 | from efl.elementary.frame import Frame | 14 | from efl.elementary.frame import Frame |
15 | from efl.elementary.label import Label | ||
15 | from efl.elementary.list import List | 16 | from efl.elementary.list import List |
16 | from efl.elementary.icon import Icon | 17 | from efl.elementary.icon import Icon |
17 | from efl.elementary.slider import Slider | 18 | from efl.elementary.radio import Radio |
19 | from efl.elementary.slider import Slider, \ | ||
20 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT, \ | ||
21 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, \ | ||
22 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS, \ | ||
23 | ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE | ||
18 | 24 | ||
19 | 25 | ||
20 | ALIGN_CENTER = 0.5, 0.5 | 26 | ALIGN_CENTER = 0.5, 0.5 |
@@ -77,6 +83,7 @@ def slider_clicked(obj): | |||
77 | bx.pack_end(sl) | 83 | bx.pack_end(sl) |
78 | sl.show() | 84 | sl.show() |
79 | 85 | ||
86 | # manual step | ||
80 | step = step_size_calculate(0, 9) | 87 | step = step_size_calculate(0, 9) |
81 | sl = Slider(bx, unit_format="%1.0f units", indicator_format="%1.0f", | 88 | sl = Slider(bx, unit_format="%1.0f units", indicator_format="%1.0f", |
82 | span_size=120, min_max=(0, 9), text="Manual step", step=step, | 89 | span_size=120, min_max=(0, 9), text="Manual step", step=step, |
@@ -174,9 +181,8 @@ def slider_clicked(obj): | |||
174 | 181 | ||
175 | # normal vertical slider | 182 | # normal vertical slider |
176 | sl = Slider(bx2, text="Vertical", unit_format="%1.1f units", span_size=60, | 183 | sl = Slider(bx2, text="Vertical", unit_format="%1.1f units", span_size=60, |
177 | size_hint_align=FILL_VERT, | 184 | size_hint_align=FILL_VERT, size_hint_weight=EXPAND_VERT, |
178 | size_hint_weight=EXPAND_VERT, indicator_show=False, | 185 | value=0.2, scale=1.0, horizontal=False, indicator_format="%.1f") |
179 | value=0.2, scale=1.0, horizontal=False) | ||
180 | sl.callback_changed_add(change_print_cb, sl) | 186 | sl.callback_changed_add(change_print_cb, sl) |
181 | bx2.pack_end(sl) | 187 | bx2.pack_end(sl) |
182 | sl.show() | 188 | sl.show() |
@@ -206,6 +212,38 @@ def slider_clicked(obj): | |||
206 | bt.show() | 212 | bt.show() |
207 | bx2.pack_end(bt) | 213 | bx2.pack_end(bt) |
208 | 214 | ||
215 | # box for indicator visible mode | ||
216 | bx2 = Box(win,size_hint_weight=EXPAND_HORIZ, horizontal=True) | ||
217 | bx.pack_end(bx2) | ||
218 | bx2.show() | ||
219 | |||
220 | lb = Label(win, text="Indicator mode:") | ||
221 | bx2.pack_end(lb) | ||
222 | lb.show() | ||
223 | |||
224 | rd = rdg = Radio(win, text="Default", state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT) | ||
225 | rd.callback_changed_add(lambda r: sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT)) | ||
226 | bx2.pack_end(rd) | ||
227 | rd.show() | ||
228 | |||
229 | rd = Radio(win, text="Always", state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS) | ||
230 | rd.callback_changed_add(lambda r: sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS)) | ||
231 | rd.group_add(rdg) | ||
232 | bx2.pack_end(rd) | ||
233 | rd.show() | ||
234 | |||
235 | rd = Radio(win, text="On Focus", state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS) | ||
236 | rd.callback_changed_add(lambda r: sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS)) | ||
237 | rd.group_add(rdg) | ||
238 | bx2.pack_end(rd) | ||
239 | rd.show() | ||
240 | |||
241 | rd = Radio(win, text="None", state_value=ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE) | ||
242 | rd.callback_changed_add(lambda r: sl.indicator_visible_mode_set(ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE)) | ||
243 | rd.group_add(rdg) | ||
244 | bx2.pack_end(rd) | ||
245 | rd.show() | ||
246 | |||
209 | if __name__ == "__main__": | 247 | if __name__ == "__main__": |
210 | elementary.init() | 248 | elementary.init() |
211 | 249 | ||