unbroke the emotion example
* copy the theme edj in source, instead of searching for an installed one from the c example, that is not installed by default enymore. * fix usage/import of enums * add the 'p' key to toggle pause state
This commit is contained in:
parent
f4ec2ed959
commit
cacde3e38a
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -8,17 +9,11 @@ from efl import edje
|
||||||
from efl import emotion
|
from efl import emotion
|
||||||
from efl.emotion import Emotion
|
from efl.emotion import Emotion
|
||||||
from efl import elementary
|
from efl import elementary
|
||||||
from efl.elementary.window import Window
|
from efl.elementary.window import Window, ELM_WIN_BASIC
|
||||||
|
|
||||||
|
|
||||||
def pkgconfig_variable(pkg, var):
|
script_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
output = subprocess.check_output(["pkg-config", "--variable=" + var, pkg])
|
theme_file = os.path.join(script_path, "theme.edj")
|
||||||
return output.decode("utf-8").strip()
|
|
||||||
|
|
||||||
|
|
||||||
prefix_dir = pkgconfig_variable("emotion", "prefix")
|
|
||||||
data_dir = prefix_dir + "/share/emotion/data"
|
|
||||||
theme_file = data_dir + "/theme.edj"
|
|
||||||
|
|
||||||
|
|
||||||
class MyDecoratedEmotion(Emotion):
|
class MyDecoratedEmotion(Emotion):
|
||||||
|
@ -237,6 +232,11 @@ class AppKeyboardEvents(object):
|
||||||
print("\tspu channels: %d" % mw.vid.spu_channel_count())
|
print("\tspu channels: %d" % mw.vid.spu_channel_count())
|
||||||
print("\tseekable: %s" % mw.vid.seekable)
|
print("\tseekable: %s" % mw.vid.seekable)
|
||||||
|
|
||||||
|
def toggle_pause(win):
|
||||||
|
for mw in win.data["movie_windows"]:
|
||||||
|
mw.vid.play = not mw.vid.play
|
||||||
|
print("play is now %s" % mw.vid.play)
|
||||||
|
|
||||||
def fullscreen_change(win):
|
def fullscreen_change(win):
|
||||||
win.fullscreen = not win.fullscreen
|
win.fullscreen = not win.fullscreen
|
||||||
print("fullscreen is now %s" % win.fullscreen)
|
print("fullscreen is now %s" % win.fullscreen)
|
||||||
|
@ -288,6 +288,7 @@ class AppKeyboardEvents(object):
|
||||||
"s": (shaped_change,),
|
"s": (shaped_change,),
|
||||||
"b": (bordless_change,),
|
"b": (bordless_change,),
|
||||||
"q": (main_delete_request,),
|
"q": (main_delete_request,),
|
||||||
|
"p": (toggle_pause,),
|
||||||
}
|
}
|
||||||
def __call__(self, win, info):
|
def __call__(self, win, info):
|
||||||
try:
|
try:
|
||||||
|
@ -338,12 +339,11 @@ if __name__ == "__main__"or True:
|
||||||
elementary.init()
|
elementary.init()
|
||||||
|
|
||||||
# elementary window
|
# elementary window
|
||||||
win = Window("test-emotion", elementary.ELM_WIN_BASIC)
|
win = Window("test-emotion", ELM_WIN_BASIC)
|
||||||
win.title_set("python-emotion test application")
|
win.title_set("python-emotion test application")
|
||||||
win.callback_delete_request_add(lambda o: elementary.exit())
|
win.callback_delete_request_add(lambda o: elementary.exit())
|
||||||
win.on_key_down_add(AppKeyboardEvents())
|
win.on_key_down_add(AppKeyboardEvents())
|
||||||
|
|
||||||
|
|
||||||
# edje main scene object
|
# edje main scene object
|
||||||
scene = edje.Edje(win.evas, file=theme_file, group="background")
|
scene = edje.Edje(win.evas, file=theme_file, group="background")
|
||||||
win.resize_object_add(scene)
|
win.resize_object_add(scene)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue