From 0969b8fc23ce7b4ca64819e2e633683c1404cf0c Mon Sep 17 00:00:00 2001 From: fgau Date: Mon, 8 Dec 2008 15:21:53 +0000 Subject: [PATCH] add pix viewer, contacts etc. git-svn-id: http://www.neo1973-germany.de/svn@213 46df4e5c-bc4e-4628-a0fc-830ba316316d --- epydial/compile_theme | 2 + epydial/contacts_screen.py | 97 ++++++++ epydial/data/db/my.sqlite | Bin 0 -> 18432 bytes .../data/themes/blackwhite/calc_screen.edc | 78 +++---- .../themes/blackwhite/contacts_screen.edc | 221 ++++++++++++++++++ epydial/data/themes/blackwhite/gps_status.edc | 71 +++--- epydial/data/themes/blackwhite/gsm_status.edc | 73 +++--- epydial/data/themes/blackwhite/hon_screen.edc | 39 ++-- epydial/data/themes/blackwhite/pix_screen.edc | 215 +++++++++++++++++ epydial/dialer_screen.py | 16 +- epydial/epydial.py | 121 ++++++++-- epydial/gps_status_screen.py | 50 +++- epydial/gsm_status_screen.py | 55 ++++- epydial/incall_screen.py | 15 +- 14 files changed, 892 insertions(+), 161 deletions(-) create mode 100644 epydial/contacts_screen.py create mode 100755 epydial/data/db/my.sqlite create mode 100755 epydial/data/themes/blackwhite/contacts_screen.edc create mode 100755 epydial/data/themes/blackwhite/pix_screen.edc 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 0000000000000000000000000000000000000000..7d51fb1e12cd63e1c2f3460640259449cd3f2294 GIT binary patch literal 18432 zcmeHPd2AfldEc2?t$Z!X<&vUln$n|WnxaXOGjDD>vdv4BL{X+mN{a0y*5mGwJLc{T zJ-Z{CbRBnG6ljqaN!tF=AVrfjDbS)pf*df~)IrcFXnLh-i?rz(q<+wfw+2zu~d9Fsg|L(=*wOBxUYnER)I9@J+9q z@twmr!*>?nt(VmL<66J-=x{*p%_tvH&da|pU%{W(U$1r!JbdtAPfw4ObT`Cm)hmf= zwVwXCWqN6La%GmSOirDfWk=JtqwM(6dP6kg`cbwr`}&npb~K19 z%rNO@F7vL8GA+MHzDfE-=3994>Ulk!KQJ(8dP}p@?812n-i+aDHrHHBRUK1x#x-r6 zYonY`sP+W6MpR=ihBd2rer-)uq6Qmb>u3mAT-%A)*~E!qwkgWx?U9CGt%~HnTXF-v z=F{$T({rxsI_9Q{HD^?_CQN678@m$+Y(=b(vNM&)V@qDC62!qeyAsye`S6NI^3FKM zGQZwnVNmr0Z;U+@*VyE06tA&WzX8$&{<;#D#af7`WpBLZ`9bSFi@bG=jeIZif-!a` zSPSb+#eT<|WTB}Nv5UK-Ppo*NcIM^-{e$K#ZD5x>mTozkWpD?ZP_1!prrfb641Gj( z=DZ444_FzbRz1H#^heMzFB%v~x^Bv0uH?a&m`okz+Jwp{G>*wG1ZC!zDr_SRf(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DWAeKx6 z-xm~>LW?X|_QGh|5s6WRVoHnbbzy{@+cafM2w+fnr}M76C>lcfEke4ciGe3mN&gQ> zJfobHzbL;>`XBsx{q>R@NX~ZVerU=+?k>>(ukZ>BVUmH4+^fCP=i&D6>wh58_FDfB GB>opN;(!"); + } + } +} 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