diff --git a/epydial/compile_theme b/epydial/compile_theme index 3535404..efc0eb2 100755 --- a/epydial/compile_theme +++ b/epydial/compile_theme @@ -14,3 +14,5 @@ for theme in data/themes/*; do cd - > /dev/null fi done + +chmod -R 777 ./data/themes/blackwhite diff --git a/epydial/contacts_screen.py b/epydial/contacts_screen.py new file mode 100644 index 0000000..559b0ee --- /dev/null +++ b/epydial/contacts_screen.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +class ContactsScreen(EdjeGroup): + contact_offset = 0 + sorted_by = 'lastname' + detail = False + + def __init__(self, screen_manager): + EdjeGroup.__init__(self, screen_manager, CONTACTS_SCREEN_NAME) + self.show_contacts() + + def del_displayed_contacts(self): + x=1 + while x < 5: + self.part_text_set("contact_%s" %x, "") + x += 1 + + def show_contacts(self): + x = 1 + self.detail = False + self.del_displayed_contacts() + self.part_text_set("sort_by", "sorted by: %s" %self.sorted_by) + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("SELECT * FROM contacts ORDER BY %s LIMIT 4 OFFSET %s" %(self.sorted_by, self.contact_offset)) + for row in cursor: + self.part_text_set("contact_%s" %x, "%s, %s" %(row[1], row[0])) + x += 1 + + def show_contact_detail(self, detail_offset): + self.part_text_set("sort_by", "detail view") + self.detail = True + self.del_displayed_contacts() + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("SELECT * FROM contacts ORDER BY %s LIMIT 1 OFFSET %s" %(self.sorted_by, detail_offset)) + for row in cursor: + self.part_text_set("contact_1", "%s, %s" %(row[1], row[0])) + self.part_text_set("contact_2", "mobil: %s" %row[2]) + self.part_text_set("contact_3", "home: %s" %row[3]) + self.part_text_set("contact_4", "work: %s" %row[4]) + + @edje.decorators.signal_callback("mouse,up,1", "*") + def on_edje_signal_dialer_status_triggered(self, emission, source): + if self.detail == True: + if source == "button_10": + self.contact_offset = 0 + self.show_contacts() + if source == "button_12": + self.contact_offset += 1 + self.show_contact_detail(self.contact_offset) + if source == "button_11": + self.contact_offset -= 1 + self.show_contact_detail(self.contact_offset) + if source == "2": + PyneoController.gsm_dial(self.part_text_get("contact_2")[7:]) + if source == "3": + PyneoController.gsm_dial(self.part_text_get("contact_3")[6:]) + if source == "4": + PyneoController.gsm_dial(self.part_text_get("contact_4")[6:]) + elif self.detail == False: + if source == "1": + self.show_contact_detail(self.contact_offset) + if source == "2": + self.contact_offset += 1 + self.show_contact_detail(self.contact_offset) + if source == "3": + self.contact_offset += 2 + self.show_contact_detail(self.contact_offset) + if source == "4": + self.contact_offset += 3 + self.show_contact_detail(self.contact_offset) + if source == "button_10": + PyneoController.show_dialer_screen() + if source == "button_12": + self.contact_offset += 4 + self.show_contacts() + if source == "button_11": + self.contact_offset -= 4 + self.show_contacts() + if source == "headline" and self.sorted_by == "lastname": + self.sorted_by = 'firstname' + self.contact_offset = 0 + self.show_contacts() + elif source == "headline" and self.sorted_by == "firstname": + self.sorted_by = 'lastname' + self.contact_offset = 0 + self.show_contacts() + print 'source: ', source + diff --git a/epydial/data/db/my.sqlite b/epydial/data/db/my.sqlite new file mode 100755 index 0000000..7d51fb1 Binary files /dev/null and b/epydial/data/db/my.sqlite differ diff --git a/epydial/data/themes/blackwhite/calc_screen.edc b/epydial/data/themes/blackwhite/calc_screen.edc index 7141d46..d8600c1 100644 --- a/epydial/data/themes/blackwhite/calc_screen.edc +++ b/epydial/data/themes/blackwhite/calc_screen.edc @@ -6,7 +6,7 @@ // Signal1: data { - item: "author" "http://www.gurumeditation.it/blog/wp-content/uploads/releases/calculator03.tgz"; + item: "author" "thanks to dave andreoli, http://www.gurumeditation.it/blog/wp-content/uploads/releases/calculator03.tgz"; item: "version" "prototype"; item: "name" "epydial_blackwhite"; } @@ -179,7 +179,7 @@ collections { } } - parts { + parts { part { name: "background"; type: IMAGE; @@ -191,45 +191,41 @@ collections { image { normal: "bg.png"; } } } - part { - name: "bg_calc"; - type: IMAGE; - mouse_events: 1; - description { - state: "default" 0.0; - aspect: 0.9 0.9; - aspect_preference: BOTH; - image { - normal: "bg_calc.png"; - } - } - } - - part { - name: "display"; - type: TEXT; - mouse_events: 0; - description { - state: "default" 0.0; - color: 68 72 63 200; - rel1 { - relative: 0.07 0.09; - to: "bg_calc"; - } - rel2 { - relative: 0.93 0.22; - to: "bg_calc"; - } - text{ - font: "vera"; - size: 20; - fit: 0 1; - align: 1 0.5; - text: "012345"; - } - - } - } + part { + name: "bg_calc"; + type: IMAGE; + mouse_events: 1; + description { + state: "default" 0.0; + aspect: 0.9 0.9; + aspect_preference: BOTH; + image { normal: "bg_calc.png"; } + } + } + part { + name: "display"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 68 72 63 200; + rel1 { + relative: 0.07 0.09; + to: "bg_calc"; + } + rel2 { + relative: 0.93 0.22; + to: "bg_calc"; + } + text { + font: "vera"; + size: 20; + fit: 0 1; + align: 1 0.5; + text: "012345"; + } + } + } part { name: "num_bg"; diff --git a/epydial/data/themes/blackwhite/contacts_screen.edc b/epydial/data/themes/blackwhite/contacts_screen.edc new file mode 100755 index 0000000..870df44 --- /dev/null +++ b/epydial/data/themes/blackwhite/contacts_screen.edc @@ -0,0 +1,221 @@ +// contacts_screen.edc +// this is a theme for epydial, a pyneo dialer + +data { + item: "author" "thomasg [thomas (a) gstaedtner (.) net] , fgau (fgau@gau-net.de)"; + item: "version" "prototype"; + item: "name" "epydial_blackwhite"; +} + +fonts { + font: "Vera.ttf" "Vera"; + font: "VeraBd.ttf" "VeraBd"; +} + +images { + image: "bg.png" COMP; +} + +color_classes { + color_class { + name: "unvisible"; + color: 0 0 0 0; + color2: 128 128 128 255; + color3: 128 128 128 255; + } + color_class { + name: "button_inactive"; + color: 255 255 255 128; + color2: 128 128 128 255; + color3: 128 128 128 255;; + } + color_class { + name: "scale"; + color: 255 255 255 56; + color2: 0 0 0 255; + color3: 0 0 0 255; + } +} + +styles { + style { + name: "textblock_style"; + base: "font=Vera font_size=20 align=left valign=top color=#fff"; + tag: "h1" "+ font_size=28"; + tag: "/h1" "- \n"; + tag: "p" "+"; + tag: "/p" "- \n"; + tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005"; + tag: "/em" "-"; + tag: "br" "\n"; + tag: "c1" "+ color=#fff"; + tag: "/c1" "-"; + tag: "c2" "+ color=#f3f"; + tag: "/c2" "-"; + } +} + +#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \ +part { \ + name: "button_"button_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color_class: "unvisible"; \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ + description { \ + state: "default" 0.5; \ + inherit: "default" 0; \ + color_class: "unvisible"; \ + rel1.offset: 0 -5; \ + rel2.offset: 0 5; \ + } \ + description { \ + state: "default" 1; \ + inherit: "default" 0; \ + } \ +} \ +part { \ + name: "button_"button_number"_caption"; \ + type: TEXT; \ + mouse_events: 0; \ + 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"; \ + fit: 1 1; \ + } \ + } \ +} \ +program { \ + name: "button_"button_number"_signal_emit"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: SIGNAL_EMIT "hon_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 ITEM(item_number, rel1x, rel1y, rel2x, rel2y) \ +part { \ + name: item_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color_class: "scale"; \ + rel1 { relative: rel1x rel1y;}; \ + rel2 { relative: rel2x rel2y;}; \ + } \ +} \ +part { \ + name: "contact_"item_number; \ + type: TEXT; \ + mouse_events: 0; \ + description { \ + state: "default" 0; \ + color_class: "button_inactive"; \ + rel1 { \ + to: item_number; \ + relative: 1/20 0; \ + } \ + rel2 { \ + to: item_number; \ + relative: 19/20 1; \ + } \ + text { \ + text: ""; \ + size: 26; \ + font: "Sans:style=Bold,Edje-Vera"; \ + /*fit: 1 1; */\ + align: 0 0.5; \ + } \ + } \ +} \ + + +collections { + group { + name: "pyneo/contacts/screen"; + min: 100 100; + max: 800 800; + parts { + part { + name: "background"; + type: IMAGE; + mouse_events: 0; + description { + state: "default" 0; + rel1 { relative: 0 0; offset: 0 0; } + rel2 { relative: 1 1; offset: 0 0; } + image { normal: "bg.png"; } + } + } + part { + name: "headline"; + type: TEXT; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { relative: 1/20 1/20; } + rel2 { relative: 19/20 3/20; } + text { + text: "contacts"; + size: 20; + font: "VeraBd"; + fit: 1 1; + } + } + } + part { + name: "sort_by"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { relative: 1/20 3/20;} + rel2 { relative: 19/20 4/20; } + text { + text: "sorted by: last name"; + size: 10; + font: "Vera"; + fit: 1 1; + } + } + } + ITEM(1, 1/20, 9/40, 19/20, 14/40); + ITEM(2, 1/20, 15/40, 19/20, 20/40); + ITEM(3, 1/20, 21/40, 19/20, 26/40); + ITEM(4, 1/20, 27/40, 19/20, 32/40); + BUTTON(10, 0, 58/70 , 1/3, 68/70, "<"); + BUTTON(11, 1/3, 58/70, 2/3, 68/70, "<"); + BUTTON(12, 2/3, 58/70, 3/3, 68/70, ">"); + } + } +} diff --git a/epydial/data/themes/blackwhite/gps_status.edc b/epydial/data/themes/blackwhite/gps_status.edc index a78d8ad..206fb19 100644 --- a/epydial/data/themes/blackwhite/gps_status.edc +++ b/epydial/data/themes/blackwhite/gps_status.edc @@ -1,27 +1,22 @@ -// incall.edc -// this is a theme for epydial, a pyneo dialer -// -// TODO: make the font colors shinier :) -// -// Signal1: +// gps_status.edc +// this is a theme for epydial, a pyneo dialer and more data { - item: "author" "thomasg [thomas (a) gstaedtner (.) net]"; + item: "author" "thomasg [thomas (a) gstaedtner (.) net] , fgau (fgau@gau-net.de)"; item: "version" "prototype"; item: "name" "epydial_blackwhite"; } +fonts { + font: "Vera.ttf" "Vera"; + font: "VeraBd.ttf" "VeraBd"; +} + images { image: "bg.png" COMP; } color_classes { - color_class { - name: "black"; - color: 0 0 0 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - } color_class { name: "unvisible"; color: 0 0 0 0; @@ -34,12 +29,18 @@ color_classes { color2: 128 128 128 255; color3: 128 128 128 255;; } + color_class { + name: "scale"; + color: 255 255 255 64; + color2: 0 0 0 255; + color3: 0 0 0 255; + } } styles { style { name: "textblock_style"; - base: "font=sans.bold font_size=20 align=left valign=top color=#fff wrap=word"; + base: "font=Vera font_size=20 align=left valign=top color=#fff"; tag: "h1" "+ font_size=28"; tag: "/h1" "- \n"; tag: "p" "+"; @@ -47,6 +48,10 @@ styles { tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005"; tag: "/em" "-"; tag: "br" "\n"; + tag: "c1" "+ color=#fff"; + tag: "/c1" "-"; + tag: "c2" "+ color=#f3f"; + tag: "/c2" "-"; } } @@ -95,12 +100,6 @@ part { \ } \ } \ } \ -program { \ - name: "button_"button_number"_signal_emit"; \ - signal: "mouse,down,*"; \ - source: "button_"button_number; \ - action: SIGNAL_EMIT "gps_send" button_caption; \ -} \ program { \ name: "button_"button_number"_animation"; \ signal: "mouse,down,*"; \ @@ -126,6 +125,7 @@ collections { part { name: "background"; type: IMAGE; + mouse_events: 0; description { state: "default" 0; rel1 { relative: 0 0; offset: 0 0; }; @@ -136,16 +136,15 @@ collections { part { name: "headline"; type: TEXT; - mouse_events: 0; description { state: "default" 0; color_class: "button_inactive"; - rel1 { relative: 0 0; } - rel2 { relative: 1 1/7; } + rel1 { relative: 1/20 1/20; } + rel2 { relative: 19/20 3/20; } text { text: "gps status"; - size: 18; - font: "Sans:style=Bold,Edje-Vera"; + size: 20; + font: "VeraBd"; fit: 1 1; } } @@ -155,17 +154,33 @@ collections { type: TEXTBLOCK; mouse_events: 0; description { + state: "default" 0; color_class: "button_inactive"; align: 0.5 0.5; fixed: 1 1; - rel1 { relative: 0 3/20; } - rel2 { relative: 1 10/20; } + rel1 { relative: 0 4/20; } + rel2 { relative: 1 8/20; } text { text: "gps"; style: "textblock_style"; } } - } /* end fix_caption */ + } + part { + name: "gps_track"; + type: TEXTBLOCK; + description { + color_class: "button_inactive"; + align: 0.5 0.5; + fixed: 1 1; + rel1 { relative: 0 9/20; } + rel2 { relative: 1 11/20; } + text { + text: "track log: off"; + style: "textblock_style"; + } + } + } BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on"); BUTTON(12, 0, 58/70 , 1/3, 68/70, "<"); BUTTON(13, 2/3, 58/70, 3/3, 68/70, ">"); diff --git a/epydial/data/themes/blackwhite/gsm_status.edc b/epydial/data/themes/blackwhite/gsm_status.edc index 2961e89..99583ff 100644 --- a/epydial/data/themes/blackwhite/gsm_status.edc +++ b/epydial/data/themes/blackwhite/gsm_status.edc @@ -1,12 +1,8 @@ -// incall.edc -// this is a theme for epydial, a pyneo dialer -// -// TODO: make the font colors shinier :) -// -// Signal1: +// gsm_status.edc +// this is a theme for epydial, a pyneo dialer and more data { - item: "author" "thomasg [thomas (a) gstaedtner (.) net]"; + item: "author" "thomasg [thomas (a) gstaedtner (.) net] , fgau (fgau@gau-net.de)"; item: "version" "prototype"; item: "name" "epydial_blackwhite"; } @@ -21,12 +17,6 @@ images { } color_classes { - color_class { - name: "black"; - color: 0 0 0 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - } color_class { name: "unvisible"; color: 0 0 0 0; @@ -105,9 +95,8 @@ part { \ text { \ text: button_caption; \ size: 18; \ - font: "VeraBd"; \ + font: "Sans:style=Bold,Edje-Vera"; \ fit: 1 1; \ - align: alignx aligny; \ } \ } \ } \ @@ -269,6 +258,7 @@ collections { part { name: "background"; type: IMAGE; + mouse_events: 0; description { state: "default" 0; rel1 { relative: 0 0; offset: 0 0; }; @@ -279,41 +269,70 @@ collections { part { name: "headline"; type: TEXT; - mouse_events: 0; description { state: "default" 0; color_class: "button_inactive"; - rel1 { relative: 0 0; } - rel2 { relative: 1 1/7; } + rel1 { relative: 1/20 1/20; } + rel2 { relative: 19/20 3/20; } text { - text: "settings"; - size: 10; + text: "gsm status"; + size: 20; font: "VeraBd"; fit: 1 1; } } } part { - name: "pwr_caption"; + name: "device_caption"; type: TEXTBLOCK; mouse_events: 0; description { color_class: "button_inactive"; align: 0.5 0.5; fixed: 1 1; - rel1 { relative: 0 3/20; } - rel2 { relative: 1 10/20; } + rel1 { relative: 0 4/20; } + rel2 { relative: 1 7/20; } text { text: ""; style: "textblock_style"; } } - } /* end gsm_caption */ + } + part { + name: "gsm_details_caption"; + type: TEXTBLOCK; + mouse_events: 0; + description { + color_class: "button_inactive"; + align: 0.5 0.5; + fixed: 1 1; + rel1 { relative: 0 8/20; } + rel2 { relative: 1 11/20; } + text { + text: ""; + style: "textblock_style"; + } + } + } + part { + name: "scan_operator_caption"; + type: TEXTBLOCK; + mouse_events: 0; + description { + color_class: "button_inactive"; + align: 0.5 0.5; + fixed: 1 1; + rel1 { relative: 0 12/20; } + rel2 { relative: 1 16/20; } + text { + text: "scan operator:"; + style: "textblock_style"; + } + } + } BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on", button_inactive, 0.5, 0.5); BUTTON(12, 0, 58/70 , 1/3, 68/70, "<", button_inactive, 0.5, 0.5); - HBAR("beer level", button_inactive, 1, 0, 26/70, 1, 36/70, 10); - HBAR("brightness", button_inactive, 1, 0, 36/70, 1, 46/70, 10); - HBAR("volume", button_inactive, 1, 0, 46/70, 1, 56/70, 10); + /*HBAR("brightness", button_inactive, 1, 0, 46/70, 1, 56/70, 10);*/ } } } diff --git a/epydial/data/themes/blackwhite/hon_screen.edc b/epydial/data/themes/blackwhite/hon_screen.edc index a46656f..5f8deb6 100644 --- a/epydial/data/themes/blackwhite/hon_screen.edc +++ b/epydial/data/themes/blackwhite/hon_screen.edc @@ -1,27 +1,22 @@ -// incall.edc +// hon_screen.edc // this is a theme for epydial, a pyneo dialer -// -// TODO: make the font colors shinier :) -// -// Signal1: data { - item: "author" "thomasg [thomas (a) gstaedtner (.) net]"; + item: "author" "thomasg [thomas (a) gstaedtner (.) net] , fgau (fgau@gau-net.de)"; item: "version" "prototype"; item: "name" "epydial_blackwhite"; } +fonts { + font: "Vera.ttf" "Vera"; + font: "VeraBd.ttf" "VeraBd"; +} + images { image: "bg.png" COMP; } color_classes { - color_class { - name: "black"; - color: 0 0 0 255; - color2: 0 0 0 255; - color3: 0 0 0 255; - } color_class { name: "unvisible"; color: 0 0 0 0; @@ -34,12 +29,18 @@ color_classes { color2: 128 128 128 255; color3: 128 128 128 255;; } + color_class { + name: "scale"; + color: 255 255 255 64; + color2: 0 0 0 255; + color3: 0 0 0 255; + } } styles { style { name: "textblock_style"; - base: "font=sans.bold font_size=20 align=left valign=top color=#fff wrap=word"; + base: "font=Vera font_size=20 align=left valign=top color=#fff"; tag: "h1" "+ font_size=28"; tag: "/h1" "- \n"; tag: "p" "+"; @@ -47,6 +48,10 @@ styles { tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005"; tag: "/em" "-"; tag: "br" "\n"; + tag: "c1" "+ color=#fff"; + tag: "/c1" "-"; + tag: "c2" "+ color=#f3f"; + tag: "/c2" "-"; } } @@ -139,12 +144,12 @@ collections { description { state: "default" 0; color_class: "button_inactive"; - rel1 { relative: 0 0; } - rel2 { relative: 1 1/7; } + rel1 { relative: 1/20 1/20; } + rel2 { relative: 19/20 3/20; } text { text: "hot or not"; - size: 18; - font: "Sans:style=Bold,Edje-Vera"; + size: 20; + font: "VeraBd"; fit: 1 1; } } diff --git a/epydial/data/themes/blackwhite/pix_screen.edc b/epydial/data/themes/blackwhite/pix_screen.edc new file mode 100755 index 0000000..85115ba --- /dev/null +++ b/epydial/data/themes/blackwhite/pix_screen.edc @@ -0,0 +1,215 @@ +// pix_screen.edc +// this is a theme for epydial, a pyneo dialer + +data { + item: "author" "thomasg [thomas (a) gstaedtner (.) net] , fgau (fgau@gau-net.de)"; + item: "version" "prototype"; + item: "name" "epydial_blackwhite"; +} + +fonts { + font: "Vera.ttf" "Vera"; + font: "VeraBd.ttf" "VeraBd"; +} + +images { + image: "bg.png" COMP; +} + +color_classes { + color_class { + name: "unvisible"; + color: 0 0 0 0; + color2: 128 128 128 255; + color3: 128 128 128 255; + } + color_class { + name: "button_inactive"; + color: 255 255 255 128; + color2: 128 128 128 255; + color3: 128 128 128 255;; + } + color_class { + name: "scale"; + color: 255 255 255 64; + color2: 0 0 0 255; + color3: 0 0 0 255; + } +} + +styles { + style { + name: "textblock_style"; + base: "font=Vera font_size=20 align=left valign=top color=#fff"; + tag: "h1" "+ font_size=28"; + tag: "/h1" "- \n"; + tag: "p" "+"; + tag: "/p" "- \n"; + tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005"; + tag: "/em" "-"; + tag: "br" "\n"; + tag: "c1" "+ color=#fff"; + tag: "/c1" "-"; + tag: "c2" "+ color=#f3f"; + tag: "/c2" "-"; + } +} + +#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \ +part { \ + name: "button_"button_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color_class: "unvisible"; \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ + description { \ + state: "default" 0.5; \ + inherit: "default" 0; \ + color_class: "unvisible"; \ + rel1.offset: 0 -5; \ + rel2.offset: 0 5; \ + } \ + description { \ + state: "default" 1; \ + inherit: "default" 0; \ + } \ +} \ +part { \ + name: "button_"button_number"_caption"; \ + type: TEXT; \ + mouse_events: 0; \ + 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"; \ + fit: 1 1; \ + } \ + } \ +} \ +program { \ + name: "button_"button_number"_signal_emit"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: SIGNAL_EMIT "hon_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; \ +} + +collections { + group { + name: "pyneo/pix/screen"; + min: 100 100; + max: 800 800; + parts { + part { + name: "background"; + type: IMAGE; + description { + state: "default" 0; + rel1 { relative: 0 0; offset: 0 0; } + rel2 { relative: 1 1; offset: 0 0; } + image { normal: "bg.png"; } + } + } + part { + name: "headline"; + type: TEXT; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { relative: 1/20 1/20; } + rel2 { relative: 19/20 3/20; } + text { + text: "pix viewer"; + size: 20; + font: "VeraBd"; + fit: 1 1; + } + } + } + part { + name: "filename"; + type: TEXT; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { relative: 0 1/7;} + rel2 { relative: 1 1/5; } + text { + text: "filename"; + size: 10; + font: "Sans:style=Bold,Edje-Vera"; + fit: 1 1; + } + } + } + part { + name: "rev"; + type: RECT; + description { + color: 0 0 0 0; + state: "default" 0; + rel1 { relative: 0 0; } + rel2 { relative: 1/2 57/70; } + } + } + part { + name: "pre"; + type: RECT; + description { + color: 0 0 0 0; + state: "default" 0; + rel1 { relative: 1/2 0; } + rel2 { relative: 1 57/70; } + } + } + part { + name: "clipper"; + type: RECT; + description { + rel1 { relative: 1/2 1/2; offset: -180 -180; } + rel2 { relative: 1/2 1/2; offset: 180 180; } + } + } + part { + name: "icon"; + type: SWALLOW; + mouse_events: 0; + clip_to: "clipper"; + description { + /*fixed: 1 1;*/ + rel1 { relative: 1/2 1/2; offset: -180 -180; } + rel2 { relative: 1/2 1/2; offset: 180 180; } + } + } /*end icon swallow */ + BUTTON(10, 0, 58/70 , 1/3, 68/70, "<"); + } + } +} diff --git a/epydial/dialer_screen.py b/epydial/dialer_screen.py index 3f684fa..b44ea46 100644 --- a/epydial/dialer_screen.py +++ b/epydial/dialer_screen.py @@ -62,8 +62,8 @@ class DialerScreen(EdjeGroup): self.part_text_set("signalq_text", "%s dBm /"%str(rssi)) def display_time(self): - self.part_text_set("time_text", datetime.now().strftime('%H:%M')); - return True; + self.part_text_set("time_text", datetime.now().strftime('%H:%M')) + return True @edje.decorators.signal_callback("dialer_send", "*") @@ -114,7 +114,7 @@ class DialerScreen(EdjeGroup): self.text = [] self.part_text_set("numberdisplay_text", "".join(self.text)) PyneoController.power_status_gsm() - PyneoController.get_pwr_status() + PyneoController.get_device_status() PyneoController.show_gsm_status_screen() elif source == "dial" and ''.join(self.text) == "2": print '--- Gps Status' @@ -127,11 +127,21 @@ class DialerScreen(EdjeGroup): self.text =[] self.part_text_set("numberdisplay_text", "".join(self.text)) PyneoController.show_calc_screen() + elif source == "dial" and ''.join(self.text) == "4": + print '--- Pix' + self.text =[] + self.part_text_set("numberdisplay_text", "".join(self.text)) + PyneoController.show_pix_screen() elif source == "dial" and ''.join(self.text) == "6": print '--- Hon Screen' self.text = [] self.part_text_set("numberdisplay_text", "".join(self.text)) PyneoController.show_hon_screen() + elif source == "dial" and ''.join(self.text) == "7": + print '--- Contacts Screen' + self.text = [] + self.part_text_set("numberdisplay_text", "".join(self.text)) + PyneoController.show_contacts_screen() elif source == "dial": PyneoController.show_incall_screen('outgoing') PyneoController.gsm_dial("".join(self.text)) diff --git a/epydial/epydial.py b/epydial/epydial.py index e716997..0d1acda 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -17,6 +17,9 @@ APP_TITLE = "epydial" WM_INFO = ("epydial", "epydial") EDJE_FILE_PATH = "data/themes/blackwhite/" +PIX_FILE_PATH = "/media/card/hon/" +TRACK_FILE_PATH = "/media/card/track/" +DB_FILE_PATH = "data/db/my.sqlite" DIALER_SCREEN_NAME = "pyneo/dialer/main" INCALL_SCREEN_NAME = "pyneo/dialer/incall" @@ -24,6 +27,8 @@ GSM_STATUS_SCREEN_NAME = "pyneo/gsm/status" GPS_STATUS_SCREEN_NAME = "pyneo/gps/status" HON_SCREEN_NAME = "pyneo/hon/screen" CALC_SCREEN_NAME = "pyneo/calc/screen" +PIX_SCREEN_NAME = "pyneo/pix/screen" +CONTACTS_SCREEN_NAME = "pyneo/contacts/screen" from datetime import datetime from dbus import SystemBus @@ -42,8 +47,9 @@ from pyneo.dbus_support import * from pyneo.sys_support import pr_set_name from ConfigParser import SafeConfigParser -#import cairo +from sqlite3 import connect +#import cairo class EdjeGroup(edje.Edje): def __init__(self, group_manager, group): @@ -79,6 +85,7 @@ class PyneoController(object): hon = None gsm_wireless = None gsm_keyring = None + gsm_sms = None hon_hotornot = None gsm_wireless_status = None @@ -112,6 +119,7 @@ class PyneoController(object): try: class_.gsm = object_by_url('dbus:///org/pyneo/GsmDevice') class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless')) + class_.gsm_sms = object_by_url(class_.gsm.GetDevice('shortmessage_storage')) class_.pwr = object_by_url('dbus:///org/pyneo/Power') class_.gps = object_by_url('dbus:///org/pyneo/GpsLocation') class_.hon = object_by_url('dbus:///org/pyneo/HotOrNot') @@ -133,21 +141,24 @@ class PyneoController(object): # Register our own D-Bus callbacks class_.gsm_wireless.connect_to_signal("Status", class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS) class_.pwr.connect_to_signal("Status", class_.on_pwr_status, dbus_interface=DIN_POWERED) + class_.gsm_sms.connect_to_signal('New', class_.check_new_sms, dbus_interface=DIN_STORAGE) @classmethod def get_pwr_status(class_): status = class_.pwr.GetStatus(dbus_interface=DIN_POWERED) class_.on_pwr_status(status) + @classmethod + def get_device_status(class_): + class_.notify_callbacks("device_status", class_.gsm.GetStatus(dbus_interface=DIN_POWERED)) + @classmethod def power_status_gsm(class_): class_.notify_callbacks("power_status_gsm", class_.gsm.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) @classmethod def get_hon(class_): - status = class_.hon_hotornot.GetHotOrNot(dbus_interface=DIN_HOTORNOT) - print '---get hon', status - class_.notify_callbacks("get_hon", status) + class_.notify_callbacks("get_hon", class_.hon_hotornot.GetHotOrNot(dbus_interface=DIN_HOTORNOT)) @classmethod def vote_hon(class_, vote): @@ -205,33 +216,33 @@ class PyneoController(object): @classmethod def gsm_dial(class_, number): - class_.notify_callbacks("gsm_phone_call_start") - os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore') - + class_.notify_callbacks("gsm_phone_call_start") name = class_.gsm_wireless.Initiate(number, dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200) call = object_by_url(name) - - # Initialize "active call" counter - class_._calls[call] = 1 @classmethod def gsm_hangup(class_): + os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') + class_.call_type = 'nix' call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1') call.Hangup(dbus_interface=DIN_CALL) - os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') @classmethod def gsm_accept(class_): + os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore') call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1') call.Accept(dbus_interface=DIN_CALL) - os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore') + + @classmethod + def gsm_details(class_): + class_.notify_callbacks("gsm_details", class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS)) @classmethod def on_gsm_wireless_status(class_, status_map): status = dedbusmap(status_map) class_.gsm_net_status = status - print "GSM NET Status: " + str(status) + print 'GSM NET Status: %s'%status if status.has_key('stat'): nw_status = status['stat'] @@ -240,6 +251,7 @@ class PyneoController(object): class_.notify_callbacks("gsm_unregistered") elif nw_status in (1, 5): class_.notify_callbacks("gsm_registered") + class_.first_check_new_sms elif nw_status == 2: class_.notify_callbacks("gsm_registering") elif nw_status == 3: @@ -249,14 +261,15 @@ class PyneoController(object): if status.has_key('phone_activity_status'): ph_status = status['phone_activity_status'] - - if ph_status == 0: - class_.notify_callbacks("gsm_phone_call_end") - os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') - if ph_status == 3: - class_.notify_callbacks("gsm_phone_ringing") - if ph_status == 4: - class_.notify_callbacks("gsm_phone_call_start") + + if class_.call_type != 'outgoing': + if ph_status == 0: + class_.notify_callbacks("gsm_phone_call_end") + os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') + if ph_status == 3: + class_.notify_callbacks("gsm_phone_ringing") + if ph_status == 4: + class_.notify_callbacks("gsm_phone_call_start") if status.has_key('rssi'): class_.notify_callbacks("gsm_signal_strength_change", status['rssi']) @@ -267,6 +280,8 @@ class PyneoController(object): if status.has_key('number'): class_.notify_callbacks("gsm_number_display", status['number']) + class_.notify_callbacks("gsm_details", status) + @classmethod def on_gsm_keyring_status(class_, status_map): status = dedbusmap(status_map) @@ -370,6 +385,10 @@ class PyneoController(object): def show_calc_screen(class_): class_.notify_callbacks("show_calc_screen") + @classmethod + def show_pix_screen(class_): + class_.notify_callbacks("show_pix_screen") + @classmethod def brightness_change(class_, up_down): if up_down == 'button_right_bg_brightness': @@ -381,13 +400,59 @@ class PyneoController(object): class_.pwr.SetBrightness(class_.brightness_value, dbus_interface=DIN_POWER) class_.notify_callbacks("brightness_change", class_.brightness_value) + @classmethod + def scan_operator(class_): + class_.notify_callbacks("scan_operator", dedbusmap(class_.gsm_wireless.Scan(timeout=100.0, dbus_interface=DIN_WIRELESS, ))) + + @classmethod + def show_contacts_screen(class_): + class_.notify_callbacks("show_contacts_screen") + + @classmethod + def check_new_sms(class_, newmap,): + def InsertSms(status, from_msisdn, time, text): + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES ('" \ + + status + "', '" + from_msisdn + "', '" + time + "', '" + text + "')") + connection.commit() + + res = dedbusmap(newmap) + for n in res: + sm = object_by_url(n) + content = dedbusmap(sm.GetContent()) + InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8')) + print '--- NEW SMS:', content['from_msisdn'], content['time'], content['text'].encode('utf-8') + class_.gsm_sms.DeleteAll() + + @classmethod + def first_check_new_sms(class_): + def InsertSms(status, from_msisdn, time, text): + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES ('" \ + + status + "', '" + from_msisdn + "', '" + time + "', '" + text + "')") + connection.commit() + + try: + res = class_.gsm_sms.ListAll() + for n in res: + sm = object_by_url(n) + content = dedbusmap(sm.GetContent()) + InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8')) + except: + print '--- NULL new sms' + class_.gsm_sms.DeleteAll() + from dialer_screen import * from incall_screen import * from gsm_status_screen import * from gps_status_screen import * from hon_screen import * -from calc_screen import * +from calc_screen import * +from pix_screen import * +from contacts_screen import * class Dialer(object): screens = None @@ -410,7 +475,9 @@ class Dialer(object): PyneoController.register_callback("show_dialer_screen", self.on_call_end) PyneoController.register_callback("show_hon_screen", self.on_hon_screen) PyneoController.register_callback("show_calc_screen", self.on_calc_screen) - + PyneoController.register_callback("show_pix_screen", self.on_pix_screen) + PyneoController.register_callback("show_contacts_screen", self.on_contacts_screen) + # Initialize the D-Bus interface to pyneo dbus_ml = e_dbus.DBusEcoreMainLoop() self.system_bus = SystemBus(mainloop=dbus_ml) @@ -468,6 +535,14 @@ class Dialer(object): self.init_screen(CALC_SCREEN_NAME, CalcScreen(self)) self.show_screen(CALC_SCREEN_NAME) + def on_pix_screen(self): + self.init_screen(PIX_SCREEN_NAME, PixScreen(self)) + self.show_screen(PIX_SCREEN_NAME) + + def on_contacts_screen(self): + self.init_screen(CONTACTS_SCREEN_NAME, ContactsScreen(self)) + self.show_screen(CONTACTS_SCREEN_NAME) + class EvasCanvas(object): def __init__(self, fullscreen, engine_name): diff --git a/epydial/gps_status_screen.py b/epydial/gps_status_screen.py index e6b9654..81fa2b7 100644 --- a/epydial/gps_status_screen.py +++ b/epydial/gps_status_screen.py @@ -8,6 +8,11 @@ __license__ = "GPL3" from epydial import * class GpsStatusScreen(EdjeGroup): + status_track = "off" + file_track = None + trackpoints = None + track_timer = None + def __init__(self, screen_manager): EdjeGroup.__init__(self, screen_manager, GPS_STATUS_SCREEN_NAME) @@ -24,17 +29,50 @@ class GpsStatusScreen(EdjeGroup): def on_gps_position_change(self, status): if status['fix'] == 3: - self.part_text_set("gps_caption", "fix: %s
long/lat: %s/%s
altitude: %s
kph/course: %s/%s
satellites: %s"%(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites'])) + self.part_text_set("gps_caption", \ + "fix: %s
long/lat: %s/%s
altitude: %s
kph/course: %s/%s
satellites: %s" \ + %(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites'])) + + if self.status_track == "on" and status['latitude'] and status['longitude']: + self.trackpoints += 1 + self.track_timer += 1 + self.file_track.write('%s,%s,%s\n' %(self.trackpoints, status['latitude'], status['longitude'])) + self.part_text_set("gps_track", "track log: on
trackpoints: %s" %self.trackpoints) + if self.track_timer == 60: + self.file_track.flush() + self.track_timer = 0 + else: self.part_text_set("gps_caption", "fix: NIX FIX") - - @edje.decorators.signal_callback("gps_send", "*") + + def start_tracking(self): + self.status_track = "on" + self.part_text_set("gps_track", "track log: on") + + if not os.path.exists(TRACK_FILE_PATH): + os.mkdir(TRACK_FILE_PATH) + self.file_track = open(TRACK_FILE_PATH + 'track.log', 'w') + self.trackpoints = self.track_timer = 0 + + def stop_tracking(self): + self.status_track = "off" + self.part_text_set("gps_track", "track log: off") + self.file_track.close() + self.trackpoints = self.track_timer = 0 + + @edje.decorators.signal_callback("mouse,up,1", "*") def on_edje_signal_dialer_status_triggered(self, emission, source): status = self.part_text_get("button_11_caption") - if source == "<": + if source == "headline" and self.status_track == "off": + self.start_tracking() + elif source == "headline" and self.status_track == "on": + self.stop_tracking() + if source == "button_12": PyneoController.show_dialer_screen() - if source == "on" and status == "on": + if source == "button_13": + pass #TODO pylgrim integration + if source == "button_11" and status == "on": PyneoController.power_down_gps() - elif source == "on" and status == "off": + elif source == "button_11" and status == "off": PyneoController.power_up_gps() diff --git a/epydial/gsm_status_screen.py b/epydial/gsm_status_screen.py index a6a50eb..c4ae0ce 100644 --- a/epydial/gsm_status_screen.py +++ b/epydial/gsm_status_screen.py @@ -13,17 +13,47 @@ class GsmStatusScreen(EdjeGroup): def register_pyneo_callbacks(self): PyneoController.register_callback("power_status_gsm", self.on_power_status_gsm) - PyneoController.register_callback("pwr_status_change", self.on_pwr_status_change) + PyneoController.register_callback("device_status", self.on_device_status) + PyneoController.register_callback("gsm_details", self.on_gsm_details) + PyneoController.register_callback("scan_operator", self.on_scan_operator) PyneoController.register_callback("brightness_change", self.on_brightness_change) + def on_scan_operator(self, status): + operator = 'scan operator:
' + for n, v in status.items(): + operator += v['oper'] + '
' + print 'provider', n, ':', v['oper'] + self.part_text_set("scan_operator_caption", operator) + def on_brightness_change(self, status): - if status == 10: bar = '| ' - else: bar = '|' - self.part_text_set("button_5_caption", status/10*bar) - self.part_text_set("top_description_Brightness", "Brightness %s"%status+"%") + self.part_text_set("description_brightness", "brightness %s"%status+"%") + + def on_device_status(self, status): + self.part_text_set("device_caption", \ + "imei: %s
model: %s
revision: %s
manufacturer: %s" \ + %(status['imei'], status['model'], status['revision'], status['manufacturer'])) - def on_pwr_status_change(self, status): - self.part_text_set("pwr_caption", "battemp: %s
chgmode: %s
chgstate: %s
chgcur: %s
battvolt: %f"%(status['battemp'], status['chgmode'], status['chgstate'], status['chgcur'], status['battvolt'])) + def on_gsm_details(self, status): + global oper, lac, ci, rssi, mcc, cc, country + if status.has_key('oper'): + oper = status['oper'] + if status.has_key('lac'): + lac = status['lac'] + if status.has_key('ci'): + ci = status['ci'] + if status.has_key('rssi'): + rssi = status['rssi'] + if status.has_key('mcc'): + mcc = status['mcc'] + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("SELECT * FROM mcc WHERE mcc='" + str(mcc) + "'") + for row in cursor: + country = row[0] + cc = row[1] + self.part_text_set("gsm_details_caption", \ + "operator: %s
lac/ci: %s/%s
rssi: %s
mcc/cc/country: %s/%s/%s" \ + %(oper, lac, ci, rssi, mcc, cc, country)) def on_power_status_gsm(self, status): if status: p_status = "on" @@ -35,15 +65,16 @@ class GsmStatusScreen(EdjeGroup): @edje.decorators.signal_callback("mouse,up,1", "*") def on_edje_signal_dialer_status_triggered(self, emission, source): status = self.part_text_get("button_11_caption") + if source == "headline": + PyneoController.scan_operator() if source == "button_12": PyneoController.show_dialer_screen() elif source == "on" and status == "on": PyneoController.power_down_gsm() elif source == "on" and status == "off": PyneoController.power_up_gsm() - elif source == "button_right_bg_brightness": - PyneoController.brightness_change(source) - elif source == "button_left_bg_brightness": - PyneoController.brightness_change(source) - print 'settings source: ', source +# elif source == "button_right_bg_brightness": +# PyneoController.brightness_change(source) +# elif source == "button_left_bg_brightness": +# PyneoController.brightness_change(source) diff --git a/epydial/incall_screen.py b/epydial/incall_screen.py index 7ab1959..a418825 100644 --- a/epydial/incall_screen.py +++ b/epydial/incall_screen.py @@ -15,14 +15,21 @@ class InCallScreen(EdjeGroup): PyneoController.register_callback("gsm_number_display", self.on_gsm_number_display) def on_gsm_number_display(self, number): - self.part_text_set("incall_number_text", number) + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + cursor.execute("SELECT * FROM contacts WHERE mobil LIKE '%" + str(number) + "' OR home LIKE '%" + str(number) + "' OR work LIKE '%" + str(number) + "'") + for row in cursor: + CallerNamemap = row[0], row[1], row[2], row[3], row[4] + + if CallerNamemap[1] and CallerNamemap[0]: + self.part_text_set("incall_number_text", "%s"% (CallerNamemap[1] + ', ' + CallerNamemap[0])) + else: + self.part_text_set("incall_number_text", "unbekannt") @edje.decorators.signal_callback("dialer_incall_send", "*") def on_edje_signal_dialer_incall_triggered(self, emission, source): if source == "Hangup Call": - print source PyneoController.gsm_hangup() if source == "Accept Call": - print source PyneoController.gsm_accept() - + print source