aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_video.py
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
commitcf1f98bbf611ad14662254988a48529cfedcf49c (patch)
tree870be59a45571058abf7d380dbf6ecc359ad5748 /examples/elementary/test_video.py
parentElementary.progressbar: Style "recording" -> "double" (diff)
downloadpython-efl-cf1f98bbf611ad14662254988a48529cfedcf49c.tar.gz
Elementary: Improve the rest of the examples.
Summary of changes: - Make use of constructor keyword args - Most scripts are now working directory agnostic - Enabled evas textgrid example - Printed messages are slightly better formatted
Diffstat (limited to 'examples/elementary/test_video.py')
-rw-r--r--examples/elementary/test_video.py54
1 files changed, 20 insertions, 34 deletions
diff --git a/examples/elementary/test_video.py b/examples/elementary/test_video.py
index 64d6a3b..a1bc51d 100644
--- a/examples/elementary/test_video.py
+++ b/examples/elementary/test_video.py
@@ -1,22 +1,23 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
-from efl import ecore
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EVAS_CALLBACK_MOUSE_MOVE, EVAS_CALLBACK_MOUSE_IN, EVAS_CALLBACK_MOUSE_OUT
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
-from efl.elementary.notify import Notify
+from efl.elementary.notify import Notify, ELM_NOTIFY_ORIENT_BOTTOM
from efl.elementary.fileselector_button import FileselectorButton
from efl.elementary.table import Table
from efl.elementary.video import Video, Player
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
-def my_bt_open(bt, file, video):
- if (file and video):
- video.file_set(file)
+def my_bt_open(bt, vfile, video):
+ if (vfile and video):
+ video.file_set(vfile)
video.play()
def notify_show(video, event, no):
@@ -31,49 +32,34 @@ def notify_unblock(video, event, no):
no.show()
def video_clicked(obj):
- win = Window("video", elementary.ELM_WIN_BASIC)
- win.title = "video"
- win.autodel = True
+ win = StandardWindow("video", "video", autodel=True, size=(800, 600))
win.alpha = True # Needed to turn video fast path on
- bg = Background(win)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- win.resize_object_add(bg)
- bg.show()
-
- video = Video(win)
- video.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ video = Video(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(video)
video.show()
- notify = Notify(win)
- notify.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
- notify.timeout = 3.0
+ player = Player(win, content=video)
+ player.show()
- player = Player(win)
- player.content = video
+ notify = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM, timeout=3.0)
notify.content = player
- player.show()
- tb = Table(win)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
- bt = FileselectorButton(win)
- bt.text = "Select Video"
+ bt = FileselectorButton(win, text="Select Video",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
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)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)
- win.resize(800, 600)
win.show()