New 1.20 API: elm.Spinner min/max,reached events
with test
This commit is contained in:
parent
5864a9dd2d
commit
6bd7daa883
|
@ -33,6 +33,8 @@ Emitted signals
|
||||||
so it avoids possibly expensive reactions to the value change.
|
so it avoids possibly expensive reactions to the value change.
|
||||||
- ``spinner,drag,start`` - When dragging has started.
|
- ``spinner,drag,start`` - When dragging has started.
|
||||||
- ``spinner,drag,stop`` - When dragging has stopped.
|
- ``spinner,drag,stop`` - When dragging has stopped.
|
||||||
|
- ``min,reached`` - Called when spinner value reached min (since 1.20)
|
||||||
|
- ``max,reached`` - Called when spinner value reached max (since 1.20)
|
||||||
|
|
||||||
|
|
||||||
Available styles
|
Available styles
|
||||||
|
|
|
@ -387,5 +387,27 @@ cdef class Spinner(LayoutClass):
|
||||||
def callback_drag_stop_del(self, func):
|
def callback_drag_stop_del(self, func):
|
||||||
self._callback_del("spinner,drag,stop", func)
|
self._callback_del("spinner,drag,stop", func)
|
||||||
|
|
||||||
|
def callback_min_reached_add(self, func, *args, **kwargs):
|
||||||
|
"""When spinner value reached min.
|
||||||
|
|
||||||
|
.. versionadded:: 1.20
|
||||||
|
|
||||||
|
"""
|
||||||
|
self._callback_add("min,reached", func, args, kwargs)
|
||||||
|
|
||||||
|
def callback_min_reached_del(self, func):
|
||||||
|
self._callback_del("min,reached", func)
|
||||||
|
|
||||||
|
def callback_max_reached_add(self, func, *args, **kwargs):
|
||||||
|
"""When spinner value reached max.
|
||||||
|
|
||||||
|
.. versionadded:: 1.20
|
||||||
|
|
||||||
|
"""
|
||||||
|
self._callback_add("max,reached", func, args, kwargs)
|
||||||
|
|
||||||
|
def callback_max_reached_del(self, func):
|
||||||
|
self._callback_del("max,reached", func)
|
||||||
|
|
||||||
|
|
||||||
_object_mapping_register("Elm.Spinner", Spinner)
|
_object_mapping_register("Elm.Spinner", Spinner)
|
||||||
|
|
|
@ -34,6 +34,8 @@ def spinner_clicked(obj):
|
||||||
sp = Spinner(win, label_format="Percentage %%%1.2f something",
|
sp = Spinner(win, label_format="Percentage %%%1.2f something",
|
||||||
step=5.0, min_max=(0.0, 100.0), size_hint_weight=EXPAND_BOTH,
|
step=5.0, min_max=(0.0, 100.0), size_hint_weight=EXPAND_BOTH,
|
||||||
size_hint_align=FILL_HORIZ)
|
size_hint_align=FILL_HORIZ)
|
||||||
|
sp.callback_min_reached_add(lambda o: print("Min reached"))
|
||||||
|
sp.callback_max_reached_add(lambda o: print("Max reached"))
|
||||||
bx.pack_end(sp)
|
bx.pack_end(sp)
|
||||||
sp.show()
|
sp.show()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue