aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-08-09 09:51:24 +0200
committerDave Andreoli <dave@gurumeditation.it>2016-08-09 09:51:24 +0200
commit48eec126bbe8cbb6f151040eced672ad158e3d2a (patch)
tree6b852710f31c15dcfe3f0b69d8dbe6d77f9bdaf1
parentFix definition of oe functions (diff)
downloadpython-efl-48eec126bbe8cbb6f151040eced672ad158e3d2a.tar.gz
New 1.18 API: elm.Transit.revert()
with test
-rw-r--r--efl/elementary/transit.pxi23
-rw-r--r--efl/elementary/transit_cdef.pxi1
-rw-r--r--examples/elementary/test_transit_bezier.py18
3 files changed, 40 insertions, 2 deletions
diff --git a/efl/elementary/transit.pxi b/efl/elementary/transit.pxi
index d1d5c6a..2d6b08a 100644
--- a/efl/elementary/transit.pxi
+++ b/efl/elementary/transit.pxi
@@ -343,7 +343,6 @@ cdef class Transit(object):
def __get__(self):
return elm_transit_tween_mode_get(self.obj)
-
property tween_mode_factor:
"""Transit animation acceleration factor.
@@ -455,6 +454,28 @@ cdef class Transit(object):
"""
elm_transit_go_in(self.obj, seconds)
+ def revert(self):
+ """This can be used to reverse play an ongoing transition.
+
+ It shows effect only when an animation is going on.
+ If this function is called twice transition will go in forward
+ direction as normal one.
+ If a repeat count is set, this function call will revert just the
+ ongoing cycle and once it is reverted back completely, the transition
+ will go in forward direction.
+ If an autoreverse is set for the transition and this function is called
+ in the midst of the transition the ongoing transition will be reverted
+ and once it is done, the transition will begin again and complete a
+ full auto reverse cycle.
+
+ :return: ``True`` if the transition is reverted, ``False`` otherwise.
+ :rtype: bool
+
+ .. versionadded:: 1.18
+
+ """
+ return bool(elm_transit_revert(self.obj))
+
property paused:
"""Pause/Resume the transition.
diff --git a/efl/elementary/transit_cdef.pxi b/efl/elementary/transit_cdef.pxi
index 57fe735..f4455f8 100644
--- a/efl/elementary/transit_cdef.pxi
+++ b/efl/elementary/transit_cdef.pxi
@@ -65,6 +65,7 @@ cdef extern from "Elementary.h":
double elm_transit_duration_get(Elm_Transit *transit)
void elm_transit_go(Elm_Transit *transit)
void elm_transit_go_in(Elm_Transit *transit, double seconds)
+ Eina_Bool elm_transit_revert(Elm_Transit *transit)
void elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused)
Eina_Bool elm_transit_paused_get(Elm_Transit *transit)
double elm_transit_progress_value_get(Elm_Transit *transit)
diff --git a/examples/elementary/test_transit_bezier.py b/examples/elementary/test_transit_bezier.py
index b1cdf24..8a70a20 100644
--- a/examples/elementary/test_transit_bezier.py
+++ b/examples/elementary/test_transit_bezier.py
@@ -23,6 +23,7 @@ CTRL_W, CTRL_H = 15, 15
ctrl_pt1 = None
ctrl_pt2 = None
label = None
+revert_btn = None
bezier_lines = []
def clamp(minimum, x, maximum):
@@ -79,6 +80,7 @@ def ctrl_pt_mouse_move_cb(obj, event):
update_curve()
def transit_del_cb(obj):
+ revert_btn.disabled = True
for w in ctrl_pt1, ctrl_pt2, ctrl_pt1.data["line"], ctrl_pt2.data["line"]:
w.show()
@@ -92,14 +94,22 @@ def btn_clicked_cb(btn):
transit.del_cb_set(transit_del_cb)
transit.go()
+ revert_btn.disabled = False
+ revert_btn.data['transit'] = transit
for w in ctrl_pt1, ctrl_pt2, ctrl_pt1.data["line"], ctrl_pt2.data["line"]:
w.hide()
+def revert_btn_clicked_cb(btn):
+ transit = btn.data['transit']
+ transit.revert()
+
def transit_bezier_clicked(obj, item=None):
- global ctrl_pt1, ctrl_pt2, label, bezier_lines
+ global ctrl_pt1, ctrl_pt2, label, bezier_lines, revert_btn
win = Window("transit_bezier", ELM_WIN_BASIC, title="Transit Bezier",
autodel=True, size=(WIN_W, WIN_H))
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
# BG. Fix window size
bg = Background(win, size_hint_min=(WIN_W, WIN_H))
@@ -145,6 +155,12 @@ def transit_bezier_clicked(obj, item=None):
label = Label(win, size=(WIN_W, 50), pass_events=True)
label.show()
+ # Revert btn
+ btn = Button(win, text="Revert", size=(70,50), pos=(100,0), disabled=True)
+ btn.callback_clicked_add(revert_btn_clicked_cb)
+ btn.show()
+ revert_btn = btn
+
# Button
btn = Button(win, text="Go", size=(BTN_SIZE,BTN_SIZE),
pos=(0, WIN_H - BTN_SIZE))