aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_video.py
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
commitb58be93f121c2ca240b888d1dd41896d4779927f (patch)
tree371d4e331b3e685e106b211ce3e28b31e9886ada /examples/elementary/test_video.py
parentPython-EFL: Cleanup and enable compilation of emotion, cleaned also the test. (diff)
downloadpython-efl-b58be93f121c2ca240b888d1dd41896d4779927f.tar.gz
move elementary and emotion tests in a new examples dir. Now tests/ contain only unittest while examples/ all the other tests that need user interaction
SVN revision: 83964
Diffstat (limited to 'examples/elementary/test_video.py')
-rw-r--r--examples/elementary/test_video.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/examples/elementary/test_video.py b/examples/elementary/test_video.py
new file mode 100644
index 0000000..8519eae
--- /dev/null
+++ b/examples/elementary/test_video.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_bt_open(bt, file, video):
+ if (file and video):
+ video.file_set(file)
+ video.play()
+
+def notify_show(video, event, no):
+ no.show()
+
+def notify_block(video, event, no):
+ no.timeout = 0.0
+ no.show()
+
+def notify_unblock(video, event, no):
+ no.timeout = 3.0
+ no.show()
+
+def video_clicked(obj):
+ win = elementary.Window("video", elementary.ELM_WIN_BASIC)
+ win.title = "video"
+ win.autodel = True
+ win.alpha = True # Needed to turn video fast path on
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bg)
+ bg.show()
+
+ video = elementary.Video(win)
+ video.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(video)
+ video.show()
+
+ notify = elementary.Notify(win)
+ notify.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
+ notify.timeout = 3.0
+
+ player = elementary.Player(win)
+ player.content = video
+ notify.content = player
+ player.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb)
+
+ bt = elementary.FileselectorButton(win)
+ bt.text = "Select Video"
+ bt.callback_file_chosen_add(my_bt_open, video)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.5, 0.1)
+ tb.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ tb.show()
+
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)
+
+ win.resize(800, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ video_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()