aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary
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 /examples/elementary
parentFix definition of oe functions (diff)
downloadpython-efl-48eec126bbe8cbb6f151040eced672ad158e3d2a.tar.gz
New 1.18 API: elm.Transit.revert()
with test
Diffstat (limited to 'examples/elementary')
-rw-r--r--examples/elementary/test_transit_bezier.py18
1 files changed, 17 insertions, 1 deletions
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))