Rename dialer main screen theme file

Add "in call" screen theme file
Rework TestView and EdjeGroup classes to allow the use of multiple edje groups and corresponding theme files
Add compile_theme script, making use of easy_e17
Fix bug in EdjeGroup.__init__() that made use of newly renamed variable f



git-svn-id: http://www.neo1973-germany.de/svn@107 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
Abraxa 2008-08-31 02:00:48 +00:00
parent 75cfd64932
commit efe7084165
6 changed files with 242 additions and 11 deletions

9
epydial/compile_theme Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
cd data/themes
for filename in *.edc
do
/opt/e17/bin/edje_cc -id ../images -fd ../fonts $filename
done

View file

@ -0,0 +1,203 @@
// incall.edc
// this is a theme for epydial, a pyneo dialer
//
// TODO: make the font colors shinier :)
//
// Signal1: "dialer_send"
// Parameter1.1: $"keynumber"
// Parameter1.2: "backspace"
// Parameter1.2: "dial"
data {
item: "author" "thomasg [thomas (a) gstaedtner (.) net]";
item: "version" "prototype";
item: "name" "epydial_default";
}
color_classes {
color_class {
name: "button_inactive";
color: 255 255 255 255;
color2: 25 215 0 255;
color3: 25 215 0 255;
}
color_class {
name: "button_active";
color: 0 0 0 255;
color2: 0 0 0 255;
color3: 0 0 0 255;
}
}
spectra {
spectrum {
name: "background";
color: 80 80 80 255 1;
color: 210 210 210 255 1;
}
spectrum {
name: "button";
color: 5 5 5 255 1;
color: 110 110 110 255 1;
color: 10 10 10 255 1;
}
spectrum {
name: "button_active";
color: 15 170 0 255 1;
color: 130 255 0 255 1;
color: 20 200 0 255 1;
}
}
#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \
part { \
name: "button_"button_number; \
type: GRADIENT; \
description { \
state: "default" 0; \
gradient { \
spectrum: "button"; \
rel1 { relative: 0 0; offset: 0 0; }; \
rel2 { relative: 0 0.75; offset: 0 0; }; \
} \
fill { \
spread: 1; \
angle: 1; \
size { relative: 1 0; offset: 0 0; }; \
} \
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
} \
description { \
state: "default" 0.5; \
inherit: "default" 0; \
gradient.spectrum: "button_active"; \
rel1.offset: 0 -5; \
rel2.offset: 0 5; \
} \
description { \
state: "default" 1; \
inherit: "default" 0; \
} \
} \
part { \
name: "button_accent_"button_number; \
type: RECT; \
description { \
state: "default" 0; \
color: 25 215 0 255; \
rel1 { \
to: "button_"button_number; \
relative: 0 0.95; \
} \
rel2.to: "button_"button_number; \
} \
} \
part { \
name: "button_"button_number"_caption"; \
type: TEXT; \
mouse_events: 0; \
effect: GLOW; \
description { \
state: "default" 0; \
color_class: "button_inactive"; \
rel1 { \
to: "button_"button_number; \
relative: 0 0; \
} \
rel2 { \
to: "button_"button_number; \
relative: 1 1; \
} \
text { \
text: button_caption; \
size: 18; \
font: "Sans:style=Bold,Edje-Vera"; \
} \
} \
} \
program { \
name: "button_"button_number"_signal_emit"; \
signal: "mouse,down,*"; \
source: "button_"button_number; \
action: SIGNAL_EMIT "dialer_send" button_caption; \
} \
program { \
name: "button_"button_number"_animation"; \
signal: "mouse,down,*"; \
source: "button_"button_number; \
action: STATE_SET "default" 0.5; \
target: "button_"button_number; \
} \
program { \
name: "button_"button_number"_animation_end"; \
signal: "mouse,up,*"; \
source: "button_"button_number; \
action: STATE_SET "default" 1; \
target: "button_"button_number; \
transition: DECELERATE 0.1; \
}
#define DESIGN_STRIPE(stripe_number, rel1x, rel1y, rel2x, rel2y) \
part { \
name: "design_stripe_"stripe_number; \
type: RECT; \
description { \
state: "default" 0; \
color: 0 0 0 255; \
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
} \
}
#define DESIGN_SEPERATOR(seperator_number, rel1x, rel1y, rel2x, rel2y) \
part { \
name: "design_seperator_"seperator_number; \
type: RECT; \
description { \
state: "defeault" 0; \
color: 255 255 255 100; \
rel1 { relative: rel1x rel1y; offset: -0.5 7; }; \
rel2 { relative: rel2x rel2y; offset: 0.5 -9; }; \
} \
}
collections {
group {
name: "pyneo/dialer/incall";
min: 100 100;
max: 800 800;
parts {
part {
name: "background";
type: GRADIENT;
description {
state: "default" 0;
gradient {
spectrum: "background";
rel1 { relative: 0 0; offset: 0 0; };
rel2 { relative: 0 1; offset: 0 0; };
}
fill {
spread: 1;
angle: 1;
size { relative: 1 0; offset: 0 0; };
}
rel1 { relative: 0 0; offset: 0 0; };
rel2 { relative: 1 1; offset: 0 0; };
}
}
/* stripes - just for design :) */
/* DESIGN_STRIPE(1, 1/2, 0.18, 1, 0.18);
DESIGN_STRIPE(2, 1/2, 0.22, 1, 0.22);
DESIGN_STRIPE(3, 1/2, 0.26, 1, 0.26); */
BUTTON(1, 0.1, 0.2, 0.9, 0.4, "End Call");
BUTTON(2, 0.1, 0.45, 0.9, 0.65, "Back To Dialer");
BUTTON(3, 0.1, 0.7, 0.9, 0.9, "Hold Call");
/* DESIGN_SEPERATOR(1, 1/3, 25/70, 1/3, 35/70); */
/* DESIGN_SEPERATOR(2, 2/3, 25/70, 2/3, 35/70); */
}
}
}

Binary file not shown.

View file

@ -11,8 +11,11 @@ FRAMETIME = 1.0 / 20
FULLSCREEN = True
TITLE = "epydial"
WM_INFO = ("epydial", "epydial")
EDJE_GROUP_NAME = "pyneo/dialer/main"
EDJE_FILE_NAME = "data/themes/dialer.edj"
EDJE_FILE_PATH = "data/themes/"
MAIN_GROUP_NAME = "pyneo/dialer/main"
INCALL_GROUP_NAME = "pyneo/dialer/incall"
from datetime import datetime
from dbus import SystemBus
@ -36,19 +39,29 @@ class EdjeGroup(edje.Edje):
def __init__(self, main, group):
self.main = main
if not os.path.exists(EDJE_FILE_NAME):
raise IOError("Edje theme file not found: " + EDJE_FILE_NAME)
# Theme file name is formed as follows:
# Last two group name parts, combined by underscore
# pyneo/dialer/main -> dialer_main.edj
group_parts = group.split("/")
file_name = EDJE_FILE_PATH + group_parts[-2] + "_" + group_parts[-1] + ".edj"
if not os.path.exists(file_name):
raise IOError("Edje theme file for group %s not found: %s" % (group, file_name))
try:
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=EDJE_FILE_NAME, group=group)
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=file_name, group=group)
except edje.EdjeLoadError, e:
raise SystemExit("Error loading %s: %s" % (f, e))
raise SystemExit("Error loading %s: %s" % (file_name, e))
self.size = self.main.evas_canvas.evas_obj.evas.size
class InCallScreen(EdjeGroup):
def __init__(self, main):
EdjeGroup.__init__(self, main, INCALL_GROUP_NAME)
class MainScreen(EdjeGroup):
def __init__(self, main):
EdjeGroup.__init__(self, main, EDJE_GROUP_NAME)
EdjeGroup.__init__(self, main, MAIN_GROUP_NAME)
self.text = []
dbus_ml = e_dbus.DBusEcoreMainLoop()
@ -154,10 +167,16 @@ class TestView(object):
self.evas_canvas = EvasCanvas(FULLSCREEN, "x11-16")
self.groups = {}
self.groups[EDJE_GROUP_NAME] = MainScreen(self)
self.evas_canvas.evas_obj.data[EDJE_GROUP_NAME] = self.groups[EDJE_GROUP_NAME]
self.groups[EDJE_GROUP_NAME].show()
self.groups[EDJE_GROUP_NAME].part_text_set("numberdisplay_text", "wait ...")
self.init_group(MAIN_GROUP_NAME, MainScreen(self))
self.init_group(INCALL_GROUP_NAME, InCallScreen(self))
self.groups[MAIN_GROUP_NAME].part_text_set("numberdisplay_text", "wait ...")
self.groups[MAIN_GROUP_NAME].show()
def init_group(self, name, instance):
self.groups[name] = instance
self.evas_canvas.evas_obj.data[name] = instance
class EvasCanvas(object):
def __init__(self, fullscreen, engine_name):