added zadje clon with edje animations instead of evas

git-svn-id: http://www.neo1973-germany.de/svn@19 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
josch 2008-03-04 09:32:23 +00:00
parent 24089c0b00
commit 51acd2b799
14 changed files with 726 additions and 0 deletions

View file

@ -0,0 +1,310 @@
fonts {
font: "VeraBd.ttf" "Sans";
}
images {
image: "bg.png" COMP;
image: "phone-asleep.png" COMP;
image: "power.png" COMP;
image: "location-off.png" COMP;
image: "hotornot.png" COMP;
image: "maybe.png" COMP;
image: "yes.png" COMP;
image: "no.png" COMP;
}
collections {
group {
name: "main";
min: 480 640;
script {
public selected = 0;
public pulsing = 0;
public stop_pulsing_timer_id = 0;
const Float:pulse_timeout = 10.0;
public unselect() {
if (get_int(selected) == 0)
return;
run_program(get_int(selected));
set_int(selected, 0);
}
public stop_pulsing() {
if (get_int(pulsing) == 0)
return;
set_state(get_int(pulsing), "default", 0.0);
set_int(pulsing, 0);
if (get_int(stop_pulsing_timer_id) != 0) {
cancel_timer(get_int(stop_pulsing_timer_id));
set_int(stop_pulsing_timer_id, 0);
}
}
public stop_pulsing_cb(val) {
stop_pulsing();
return 0;
}
public item_alpha = 0;
public item_timer = 0;
public alpha_change() {
custom_state(PART:"hotornot_area", "default", 0.0);
set_state_val(PART:"hotornot_area", STATE_COLOR, 255, 255, 255, get_int(item_alpha));
set_state(PART:"hotornot_area", "custom", 0.0);
set_int(item_alpha, get_int(item_alpha) +10);
timer(0.1, "alpha_change", 1);
}
public y_position = 0;
public scroll_down() {
new x1;
new Float: y1;
new x2;
new Float: y2;
custom_state(PART:"scrolling_area", "default", 0.0);
get_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
get_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
y1 = y1 + 0.01;
y2 = y2 + 0.01;
set_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
set_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
set_state(PART:"scrolling_area", "custom", 0.0);
timer(0.1, "scroll_down", 1);
}
}
parts {
part {
name: "bg";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
image { normal: "bg.png"; }
fill {
size {relative: 0 0;offset: 160 160;}
}
}
}
part {
name: "scrolling_area";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 1;}
color: 0 0 0 0;
}
}
#define ICON(part_name, pos, part_label) \
part { \
name: part_name"_area"; \
type: RECT; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
rel1 { relative: 0 0.25*pos; offset: 5 5; to: "scrolling_area"; } \
rel2 { relative: 1 0.25*(pos+1); offset: -5 -5; to: "scrolling_area"; } \
color: 255 255 255 128; \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 64; \
} \
} \
part { \
name: part_name; \
type: IMAGE; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
aspect: 1.0 1.0;\
align: 0.0 0.0; \
rel1 { relative: 0 0.25*pos; offset: 10 10; to: "scrolling_area"; } \
rel2 { relative: 0 0.25*(pos+1); offset: 0 -10; to: "scrolling_area"; } \
image { normal: part_name".png"; } \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 128; \
} \
} \
part { \
name: part_name"_label"; \
type: TEXT; \
effect: SHADOW; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
rel1 { relative: 1 0; to: part_name; } \
rel2 { relative: 1 0.25; to_y: part_name; to_x: "scrolling_area"; } \
align: 0.0 0.0; \
color: 255 255 255 255; \
color2: 0 0 0 255; \
color3: 0 0 0 255; \
text { \
font: "Sans"; \
size: 18; \
text: part_label; \
min: 1 1; \
fit: 1 1; \
align: 0 0; \
} \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 255; \
color2: 0 0 0 255; \
color3: 0 0 0 255; \
} \
}
ICON("hotornot", 0, "Hotornot")
ICON("location-off", 1, "GPS")
ICON("power", 2, "power mgmt")
ICON("phone-asleep", 3, "telefon")
part {
name: "up";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 0.25;}
color: 0 0 0 0;
}
}
part {
name: "down";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 { relative: 0 0.5;}
rel2 { relative: 1 0.75;}
color: 0 0 0 0;
}
}
part {
name: "maybe";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.125 0.78;}
rel2 { relative: 0.125 1;}
image { normal: "maybe.png"; }
}
}
part {
name: "yes";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.625 0.78;}
rel2 { relative: 0.625 1;}
image { normal: "yes.png"; }
}
}
part {
name: "no";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.875 0.78;}
rel2 { relative: 0.875 1;}
image { normal: "no.png"; }
}
}
part {
name: "Dinge";
type: TEXT;
effect: SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 0.125;}
align: 0.0 0.0;
color: 255 187 0 255;
color2: 0 0 0 255;
color3: 0 0 0 255;
text {
font: "Sans";
size: 18;
text: "Dinge";
min: 1 1;
fit: 1 1;
align: 0.5 0;
}
}
}
programs {
program {
name: "scrollup";
signal: "mouse,clicked,1";
source: "up";
action: STATE_SET up5 0.0;
target: "hotornot_area";
transition: LINEAR 0.2;
script {
// alpha_change();
/*
new x1;
new Float: y1;
new x2;
new Float: y2;
custom_state(PART:"scrolling_area", "default", 0.0);
get_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
get_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
y1 = y1 - 0.25;
y2 = y2 - 0.25;
set_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
set_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
set_state(PART:"scrolling_area", "custom", 0.0);*/
}
}
program {
name: "scrolldown";
signal: "mouse,clicked,1";
source: "down";
script {
scroll_down();
}
}
}
}
}

View file

@ -0,0 +1,310 @@
fonts {
font: "VeraBd.ttf" "Sans";
}
images {
image: "bg.png" COMP;
image: "phone-asleep.png" COMP;
image: "power.png" COMP;
image: "location-off.png" COMP;
image: "hotornot.png" COMP;
image: "maybe.png" COMP;
image: "yes.png" COMP;
image: "no.png" COMP;
}
collections {
group {
name: "main";
min: 480 640;
script {
public selected = 0;
public pulsing = 0;
public stop_pulsing_timer_id = 0;
const Float:pulse_timeout = 10.0;
public unselect() {
if (get_int(selected) == 0)
return;
run_program(get_int(selected));
set_int(selected, 0);
}
public stop_pulsing() {
if (get_int(pulsing) == 0)
return;
set_state(get_int(pulsing), "default", 0.0);
set_int(pulsing, 0);
if (get_int(stop_pulsing_timer_id) != 0) {
cancel_timer(get_int(stop_pulsing_timer_id));
set_int(stop_pulsing_timer_id, 0);
}
}
public stop_pulsing_cb(val) {
stop_pulsing();
return 0;
}
public item_alpha = 0;
public item_timer = 0;
public alpha_change() {
custom_state(PART:"hotornot_area", "default", 0.0);
set_state_val(PART:"hotornot_area", STATE_COLOR, 255, 255, 255, get_int(item_alpha));
set_state(PART:"hotornot_area", "custom", 0.0);
set_int(item_alpha, get_int(item_alpha) +10);
timer(0.1, "alpha_change", 1);
}
public y_position = 0;
public scroll_down() {
new x1;
new Float: y1;
new x2;
new Float: y2;
custom_state(PART:"scrolling_area", "default", 0.0);
get_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
get_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
y1 = y1 + 0.01;
y2 = y2 + 0.01;
set_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
set_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
set_state(PART:"scrolling_area", "custom", 0.0);
timer(0.1, "scroll_down", 1);
}
}
parts {
part {
name: "bg";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
image { normal: "bg.png"; }
fill {
size {relative: 0 0;offset: 160 160;}
}
}
}
part {
name: "scrolling_area";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 1;}
color: 0 0 0 0;
}
}
#define ICON(part_name, pos, part_label) \
part { \
name: part_name"_area"; \
type: RECT; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
rel1 { relative: 0 0.25*pos; offset: 5 5; to: "scrolling_area"; } \
rel2 { relative: 1 0.25*(pos+1); offset: -5 -5; to: "scrolling_area"; } \
color: 255 255 255 128; \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 64; \
} \
} \
part { \
name: part_name; \
type: IMAGE; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
aspect: 1.0 1.0;\
align: 0.0 0.0; \
rel1 { relative: 0 0.25*pos; offset: 10 10; to: "scrolling_area"; } \
rel2 { relative: 0 0.25*(pos+1); offset: 0 -10; to: "scrolling_area"; } \
image { normal: part_name".png"; } \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 128; \
} \
} \
part { \
name: part_name"_label"; \
type: TEXT; \
effect: SHADOW; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
rel1 { relative: 1 0; to: part_name; } \
rel2 { relative: 1 0.25; to_y: part_name; to_x: "scrolling_area"; } \
align: 0.0 0.0; \
color: 255 255 255 255; \
color2: 0 0 0 255; \
color3: 0 0 0 255; \
text { \
font: "Sans"; \
size: 18; \
text: part_label; \
min: 1 1; \
fit: 1 1; \
align: 0 0; \
} \
} \
description { \
state: "up" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 255; \
color2: 0 0 0 255; \
color3: 0 0 0 255; \
} \
}
ICON("hotornot", 0, "Hotornot")
ICON("location-off", 1, "GPS")
ICON("power", 2, "power mgmt")
ICON("phone-asleep", 3, "telefon")
part {
name: "up";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 0.25;}
color: 0 0 0 0;
}
}
part {
name: "down";
type: RECT;
mouse_events: 1;
description {
state: "default" 0.0;
rel1 { relative: 0 0.5;}
rel2 { relative: 1 0.75;}
color: 0 0 0 0;
}
}
part {
name: "maybe";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.125 0.78;}
rel2 { relative: 0.125 1;}
image { normal: "maybe.png"; }
}
}
part {
name: "yes";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.625 0.78;}
rel2 { relative: 0.625 1;}
image { normal: "yes.png"; }
}
}
part {
name: "no";
type: IMAGE;
mouse_events: 0;
description {
state: "default" 0.0;
aspect: 1.0 1.0;
align: 0.5 0.0;
rel1 { relative: 0.875 0.78;}
rel2 { relative: 0.875 1;}
image { normal: "no.png"; }
}
}
part {
name: "Dinge";
type: TEXT;
effect: SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 { relative: 0 0;}
rel2 { relative: 1 0.125;}
align: 0.0 0.0;
color: 255 187 0 255;
color2: 0 0 0 255;
color3: 0 0 0 255;
text {
font: "Sans";
size: 18;
text: "Dinge";
min: 1 1;
fit: 1 1;
align: 0.5 0;
}
}
}
programs {
program {
name: "scrollup";
signal: "mouse,clicked,1";
source: "up";
action: STATE_SET up5 0.0;
target: "hotornot_area";
transition: LINEAR 0.2;
script {
// alpha_change();
/*
new x1;
new Float: y1;
new x2;
new Float: y2;
custom_state(PART:"scrolling_area", "default", 0.0);
get_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
get_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
y1 = y1 - 0.25;
y2 = y2 - 0.25;
set_state_val(PART:"scrolling_area", STATE_REL1, x1, y1);
set_state_val(PART:"scrolling_area", STATE_REL2, x2, y2);
set_state(PART:"scrolling_area", "custom", 0.0);*/
}
}
program {
name: "scrolldown";
signal: "mouse,clicked,1";
source: "down";
script {
scroll_down();
}
}
}
}
}

Binary file not shown.

View file

@ -0,0 +1,106 @@
#!/usr/bin/env python
import ecore
import ecore.evas
import edje
import sys
import os
# Parse command line
from optparse import OptionParser
def parse_geometry(option, opt, value, parser):
try:
w, h = value.split("x")
w = int(w)
h = int(h)
except Exception, e:
raise optparse.OptionValueError("Invalid format for %s" % option)
parser.values.geometry = (w, h)
usage = "usage: %prog [options]"
op = OptionParser(usage=usage)
op.add_option("-e", "--engine", type="choice",
choices=("x11", "x11-16"), default="x11-16",
help=("which display engine to use (x11, x11-16), "
"default=%default"))
op.add_option("-n", "--no-fullscreen", action="store_true",
help="do not launch in fullscreen")
op.add_option("-g", "--geometry", type="string", metavar="WxH",
action="callback", callback=parse_geometry,
default=(480, 640),
help="use given window geometry")
op.add_option("-f", "--fps", type="int", default=50,
help="frames per second to use, default=%default")
# Handle options and create output window
options, args = op.parse_args()
if options.engine == "x11":
f = ecore.evas.SoftwareX11
elif options.engine == "x11-16":
if ecore.evas.engine_type_supported_get("software_x11_16"):
f = ecore.evas.SoftwareX11_16
else:
print "warning: x11-16 is not supported, fallback to x11"
f = ecore.evas.SoftwareX11
w, h = options.geometry
ee = f(w=w, h=h)
ee.fullscreen = 0 # not options.no_fullscreen
edje.frametime_set(1.0 / options.fps)
# Load and setup UI
ee.title = "Edje App Launcher Demo"
ee.name_class = ("Edje_App_Launcher_Demo", "Edje_App_Launcher_Demo")
canvas = ee.evas
edje_file = os.path.join(os.path.dirname(sys.argv[0]), "01-app_launcher.edj")
try:
edje_obj = edje.Edje(canvas, file=edje_file, group="main")
except Exception, e: # should be EdjeLoadError, but it's wrong on python2.5
raise SystemExit("Failed to load Edje file: %s" % edje_file)
# resize edje to fit our window, show and remeber it for later use
edje_obj.size = canvas.size
edje_obj.show()
ee.data["edje"] = edje_obj
# Setup callbacks for resize, keydown and selected item
def resize_cb(ee):
r = ee.evas.rect
ee.data["edje"].size = r.size
ee.callback_resize = resize_cb
def key_down_cb(bg, event, ee):
k = event.key
if k == "Escape":
ecore.main_loop_quit()
if k in ("F6", "f"):
ee.fullscreen = not ee.fullscreen
edje_obj.on_key_down_add(key_down_cb, ee)
def icon_selected(edje_obj, signal, source):
print "icon_selected", source
edje_obj.signal_callback_add("selected", "*", icon_selected)
# Give focus to object, show window and enter event loop
edje_obj.focus = True
ee.show()
ecore.main_loop_begin()
'''
export CPPFLAGS="$CPPFLAGS -I/opt/e17/include"
export LDFLAGS="$LDFLAGS -L/opt/e17/lib"
export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH="$PATH:/opt/e17/bin"
export PYTHONPATH="/home/josch/usr/lib/python2.5/site-packages"
'''

BIN
zadje_klon/VeraBd.ttf Normal file

Binary file not shown.

BIN
zadje_klon/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
zadje_klon/cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
zadje_klon/hotornot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
zadje_klon/location-off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
zadje_klon/maybe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
zadje_klon/no.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
zadje_klon/phone-asleep.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
zadje_klon/power.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

BIN
zadje_klon/yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB