diff --git a/zadje_klon/01-app_launcher.edc b/zadje_klon/01-app_launcher.edc new file mode 100644 index 0000000..671f49c --- /dev/null +++ b/zadje_klon/01-app_launcher.edc @@ -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(); + } + } + } + } +} + + + diff --git a/zadje_klon/01-app_launcher.edc.bak b/zadje_klon/01-app_launcher.edc.bak new file mode 100644 index 0000000..671f49c --- /dev/null +++ b/zadje_klon/01-app_launcher.edc.bak @@ -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(); + } + } + } + } +} + + + diff --git a/zadje_klon/01-app_launcher.edj b/zadje_klon/01-app_launcher.edj new file mode 100644 index 0000000..149a08c Binary files /dev/null and b/zadje_klon/01-app_launcher.edj differ diff --git a/zadje_klon/01-app_launcher.py b/zadje_klon/01-app_launcher.py new file mode 100644 index 0000000..dfc74f2 --- /dev/null +++ b/zadje_klon/01-app_launcher.py @@ -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" +''' diff --git a/zadje_klon/VeraBd.ttf b/zadje_klon/VeraBd.ttf new file mode 100644 index 0000000..51d6111 Binary files /dev/null and b/zadje_klon/VeraBd.ttf differ diff --git a/zadje_klon/bg.png b/zadje_klon/bg.png new file mode 100644 index 0000000..ff69695 Binary files /dev/null and b/zadje_klon/bg.png differ diff --git a/zadje_klon/cursor.png b/zadje_klon/cursor.png new file mode 100644 index 0000000..7da87a5 Binary files /dev/null and b/zadje_klon/cursor.png differ diff --git a/zadje_klon/hotornot.png b/zadje_klon/hotornot.png new file mode 100644 index 0000000..b51863e Binary files /dev/null and b/zadje_klon/hotornot.png differ diff --git a/zadje_klon/location-off.png b/zadje_klon/location-off.png new file mode 100644 index 0000000..396be6c Binary files /dev/null and b/zadje_klon/location-off.png differ diff --git a/zadje_klon/maybe.png b/zadje_klon/maybe.png new file mode 100644 index 0000000..e682af3 Binary files /dev/null and b/zadje_klon/maybe.png differ diff --git a/zadje_klon/no.png b/zadje_klon/no.png new file mode 100644 index 0000000..668f79e Binary files /dev/null and b/zadje_klon/no.png differ diff --git a/zadje_klon/phone-asleep.png b/zadje_klon/phone-asleep.png new file mode 100644 index 0000000..2f30886 Binary files /dev/null and b/zadje_klon/phone-asleep.png differ diff --git a/zadje_klon/power.png b/zadje_klon/power.png new file mode 100644 index 0000000..9b6d1f5 Binary files /dev/null and b/zadje_klon/power.png differ diff --git a/zadje_klon/yes.png b/zadje_klon/yes.png new file mode 100644 index 0000000..febd076 Binary files /dev/null and b/zadje_klon/yes.png differ