Initial import

git-svn-id: http://www.neo1973-germany.de/svn@197 46df4e5c-bc4e-4628-a0fc-830ba316316d
main
Paulus 16 years ago
parent 4178cdb08e
commit 2c51e6c632

@ -0,0 +1,583 @@
collections {
group {
name, "main";
min, 480 640;
max, 1024 768;
parts {
#define COLOR_DEFAULT 30 30 30 255
#define COLOR_CLICKED 80 80 80 255
part {
name, "background";
type, RECT;
mouse_events, 0;
description {
state, "default" 0.0;
min, 480 640;
max, 1024 768;
color, 200 200 200 200;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
}
}
}
part {
name, "button_mute";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
}
rel2 {
relative, 1.0 0.15;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
}
rel2 {
relative, 1.0 0.15;
offset, 0 0;
}
}
}
part {
name, "button_snapshot";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.15;
offset, 0 0;
}
rel2 {
relative, 1.0 0.3;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.15;
offset, 0 0;
}
rel2 {
relative, 1.0 0.3;
offset, 0 0;
}
}
}
part {
name, "button_lock";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.3;
offset, 0 0;
}
rel2 {
relative, 1.0 0.45;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.3;
offset, 0 0;
}
rel2 {
relative, 1.0 0.45;
offset, 0 0;
}
}
}
part {
name, "button_standby";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.45;
offset, 0 0;
}
rel2 {
relative, 1.0 0.6;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.45;
offset, 0 0;
}
rel2 {
relative, 1.0 0.6;
offset, 0 0;
}
}
}
part {
name, "button_shutdown";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.6;
offset, 0 0;
}
rel2 {
relative, 1.0 0.75;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.6;
offset, 0 0;
}
rel2 {
relative, 1.0 0.75;
offset, 0 0;
}
}
}
part {
name, "button_exit";
type, RECT;
mouse_events, 1;
description {
state, "default" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_DEFAULT;
rel1 {
relative, 0.0 0.75;
offset, 0 0;
}
rel2 {
relative, 1.0 1.0;
offset, 0 0;
}
}
description {
state, "clicked" 0.0;
min, 400 80;
max, 400 80;
align, 0.5 0.5;
color, COLOR_CLICKED;
rel1 {
relative, 0.0 0.75;
offset, 0 0;
}
rel2 {
relative, 1.0 1.0;
offset, 0 0;
}
}
}
part {
name, "text_mute";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_mute";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_mute";
}
text {
text, "(UN-)MUTE";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
part {
name, "text_snapshot";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_snapshot";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_snapshot";
}
text {
text, "SNAPSHOT";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
part {
name, "text_lock";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_lock";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_lock";
}
text {
text, "LOCK";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
part {
name, "text_standby";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_standby";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_standby";
}
text {
text, "STANDBY";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
part {
name, "text_shutdown";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_shutdown";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_shutdown";
}
text {
text, "SHUTDOWN";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
part {
name, "text_exit";
type, TEXT;
mouse_events, 0;
description {
state, "default" 0.0;
rel1 {
relative, 0.0 0.0;
offset, 0 0;
to, "button_exit";
}
rel2 {
relative, 1.0 1.0;
offset, -1 -1;
to, "button_exit";
}
text {
text, "EXIT";
font, "sans serif";
size, 26;
align, 0.5 0.5;
}
}
}
} /* Close Parts */
programs {
program {
name, "mute_click";
signal, "mouse,down,1";
source, "button_mute";
action, STATE_SET "clicked" 0.0;
target, "button_mute";
}
program {
name, "mute_unclick";
signal, "mouse,up,1";
source, "button_mute";
action, STATE_SET "default" 0.0;
target, "button_mute";
}
program {
name, "mute_signal";
signal, "mouse,down,1";
source, "button_mute";
action, SIGNAL_EMIT "mute" "button";
in, 0.0 0.0;
}
//snapshot
program {
name, "snapshot_click";
signal, "mouse,down,1";
source, "button_snapshot";
action, STATE_SET "clicked" 0.0;
target, "button_snapshot";
}
program {
name, "snapshot_unclick";
signal, "mouse,up,1";
source, "button_snapshot";
action, STATE_SET "default" 0.0;
target, "button_snapshot";
}
program {
name, "snapshot_signal";
signal, "mouse,down,1";
source, "button_snapshot";
action, SIGNAL_EMIT "snapshot" "button";
in, 0.0 0.0;
}
//lock
program {
name, "lock_click";
signal, "mouse,down,1";
source, "button_lock";
action, STATE_SET "clicked" 0.0;
target, "button_lock";
}
program {
name, "lock_unclick";
signal, "mouse,up,1";
source, "button_lock";
action, STATE_SET "default" 0.0;
target, "button_lock";
}
program {
name, "lock_signal";
signal, "mouse,down,1";
source, "button_lock";
action, SIGNAL_EMIT "lock" "button";
in, 0.0 0.0;
}
//standby
program {
name, "standby_click";
signal, "mouse,down,1";
source, "button_standby";
action, STATE_SET "clicked" 0.0;
target, "button_standby";
}
program {
name, "standby_unclick";
signal, "mouse,up,1";
source, "button_standby";
action, STATE_SET "default" 0.0;
target, "button_standby";
}
program {
name, "standby_signal";
signal, "mouse,down,1";
source, "button_standby";
action, SIGNAL_EMIT "standby" "button";
in, 0.0 0.0;
}
//shutdown
program {
name, "shutdown_click";
signal, "mouse,down,1";
source, "button_shutdown";
action, STATE_SET "clicked" 0.0;
target, "button_shutdown";
}
program {
name, "shutdown_unclick";
signal, "mouse,up,1";
source, "button_shutdown";
action, STATE_SET "default" 0.0;
target, "button_shutdown";
}
program {
name, "shutdown_signal";
signal, "mouse,down,1";
source, "button_shutdown";
action, SIGNAL_EMIT "shutdown" "button";
in, 0.0 0.0;
}
//exit
program {
name, "exit_click";
signal, "mouse,down,1";
source, "button_exit";
action, STATE_SET "clicked" 0.0;
target, "button_exit";
}
program {
name, "exit_unclick";
signal, "mouse,up,1";
source, "button_exit";
action, STATE_SET "default" 0.0;
target, "button_exit";
}
program {
name, "exit_signal";
signal, "mouse,down,1";
source, "button_exit";
action, SIGNAL_EMIT "exit" "button";
in, 0.0 0.0;
}
} /* Close Prog */
} /* Close Group */
} /* Close Coll */

Binary file not shown.

@ -0,0 +1,130 @@
#!/usr/bin/python
'''
authors: Pau1us <paulus.mail@oleco.net>
license: gpl v2 or later
PyBat is a tool to set usb in host or devices mode aund to set the charging speed.
'''
import ecore
import ecore.evas
import edje
import sys
import os
import e_dbus
import time
from dbus import SystemBus, Interface
# 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 = 1 # not options.no_fullscreen
edje.frametime_set(1.0 / options.fps)
# Load and setup UI
ee.title = "auxmenu"
ee.name_class = ("auxmenu", "auxmenu")
canvas = ee.evas
edje_file = os.path.join(os.path.dirname(sys.argv[0]), "auxmenu.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 remember 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)
class auxmenuclass:
def __init__(self, edje_obj):
print "init"
def button_pressed(self, edje_obj, signal, source):
if signal == "mute":
print "mute"
elif signal == "snapshot":
print "snapshot"
os.system("gpe-scap &")
elif signal == "lock":
print "lock"
elif signal == "standby":
print "standby"
os.system("apm -s")
elif signal == "shutdown":
print "shutdown"
os.system("halt")
ecore.main_loop_quit()
menu = auxmenuclass(edje_obj)
edje_obj.signal_callback_add("*", "button", menu.button_pressed)
#edje_obj.signal_callback_add("StopSelected", "*", icon_selected)
# Give focus to object, show window and enter event loop
edje_obj.focus = True
ee.show()
ecore.main_loop_begin()
Loading…
Cancel
Save