diff options
author | Kai Huuhko <kai.huuhko@gmail.com> | 2012-06-26 07:20:25 +0000 |
---|---|---|
committer | Kai Huuhko <kai.huuhko@gmail.com> | 2012-06-26 07:20:25 +0000 |
commit | 4b7d6514822cf9c09d7e6bc0e80b783938e17e61 (patch) | |
tree | 1e9d54f6641edf3e35e998f46cfec9e96889036d | |
parent | c3f43bce2bfc390edfb967c9f489d6e13e8ab058 (diff) | |
download | python-elementary-4b7d6514822cf9c09d7e6bc0e80b783938e17e61.tar.gz python-elementary-4b7d6514822cf9c09d7e6bc0e80b783938e17e61.tar.bz2 python-elementary-4b7d6514822cf9c09d7e6bc0e80b783938e17e61.zip |
python-elementary: Test and fixes for Video/Player.
SVN revision: 72853
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | elementary/elementary.c_elementary_video.pxi | 4 | ||||
-rw-r--r-- | tests/test.py | 4 | ||||
-rw-r--r-- | tests/test_video.py | 79 |
4 files changed, 85 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index 4615fa0..0b52b90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -136,6 +136,7 @@ examples_files = \ tests/test_thumb.py \ tests/test_toolbar.py \ tests/test_tooltip.py \ + tests/test_video.py \ tests/test_web.py \ tests/test_win.py diff --git a/elementary/elementary.c_elementary_video.pxi b/elementary/elementary.c_elementary_video.pxi index d4c1ab5..09b71bd 100644 --- a/elementary/elementary.c_elementary_video.pxi +++ b/elementary/elementary.c_elementary_video.pxi @@ -30,7 +30,7 @@ cdef public class Video(LayoutClass) [object PyElementaryVideo, type PyElementar Object.__init__(self, parent.evas) self._set_obj(elm_video_add(parent.obj)) - def video_file_set(self, filename): + def file_set(self, filename): """Define the file or URI that will be the video source. This function will explicitly define a file or URI as a source @@ -49,7 +49,7 @@ cdef public class Video(LayoutClass) [object PyElementaryVideo, type PyElementar """ return bool(elm_video_file_set(self.obj, _cfruni(filename))) - property video_file: + property file: """Define the file or URI that will be the video source. Setting this property will explicitly define a file or URI as a source diff --git a/tests/test.py b/tests/test.py index b52d0c3..891fc33 100644 --- a/tests/test.py +++ b/tests/test.py @@ -58,6 +58,7 @@ from test_table import table_clicked from test_thumb import thumb_clicked from test_toolbar import toolbar_clicked from test_tooltip import tooltip_clicked +from test_video import video_clicked from test_web import web_clicked from test_win import window_states_clicked @@ -116,6 +117,7 @@ items = [("3D", [ ("Photo", photo_clicked), ("Slideshow", slideshow_clicked), ("Thumb", thumb_clicked), + ("Video", video_clicked), ]), ("Lists", [ ("List", list_clicked), @@ -173,7 +175,7 @@ items = [("3D", [ ("Web", [ ("Web", web_clicked), ]), - ("Window / Backgroud", [ + ("Window / Background", [ ("Bg Plain", bg_plain_clicked), ("Bg Image", bg_image_clicked), ("InnerWindow", inner_window_clicked), diff --git a/tests/test_video.py b/tests/test_video.py new file mode 100644 index 0000000..ae56658 --- /dev/null +++ b/tests/test_video.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# encoding: utf-8 +import os +import elementary +import edje +import ecore +import evas + +def my_bt_open(bt, file, *args, **kwargs): + video = args[0] + + if (file): + video.file = 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() |