2008-10-01 21:50:48 +00:00
|
|
|
#!/usr/bin/env python2.5
|
|
|
|
# -*- coding: utf-8 -*-
|
2008-11-07 15:51:51 +00:00
|
|
|
__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)"
|
2008-10-01 21:50:48 +00:00
|
|
|
__version__ = "prototype"
|
|
|
|
__copyright__ = "Copyright (c) 2008"
|
|
|
|
__license__ = "GPL3"
|
|
|
|
|
|
|
|
from epydial import *
|
|
|
|
|
|
|
|
class InCallScreen(EdjeGroup):
|
|
|
|
def __init__(self, screen_manager):
|
|
|
|
EdjeGroup.__init__(self, screen_manager, INCALL_SCREEN_NAME)
|
|
|
|
|
|
|
|
def register_pyneo_callbacks(self):
|
|
|
|
PyneoController.register_callback("gsm_number_display", self.on_gsm_number_display)
|
|
|
|
|
|
|
|
def on_gsm_number_display(self, number):
|
2008-12-08 15:21:53 +00:00
|
|
|
connection = connect(DB_FILE_PATH)
|
|
|
|
cursor = connection.cursor()
|
2008-12-23 17:21:25 +00:00
|
|
|
try:
|
|
|
|
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]
|
2008-12-08 15:21:53 +00:00
|
|
|
|
2008-12-23 17:21:25 +00:00
|
|
|
if CallerNamemap[2] == str(number): source = 'mobil'
|
|
|
|
elif CallerNamemap[3] == str(number): source = 'home'
|
|
|
|
elif CallerNamemap[4] == str(number): source = 'work'
|
|
|
|
|
|
|
|
if CallerNamemap[1] and CallerNamemap[0]:
|
|
|
|
self.part_text_set("incall_number_text", "%s: %s"% (source, CallerNamemap[1] + ', ' + CallerNamemap[0]))
|
|
|
|
except:
|
|
|
|
self.part_text_set("incall_number_text", "unknown")
|
2008-10-01 21:50:48 +00:00
|
|
|
|
|
|
|
@edje.decorators.signal_callback("dialer_incall_send", "*")
|
|
|
|
def on_edje_signal_dialer_incall_triggered(self, emission, source):
|
|
|
|
if source == "Hangup Call":
|
|
|
|
PyneoController.gsm_hangup()
|
|
|
|
if source == "Accept Call":
|
2008-11-03 18:34:09 +00:00
|
|
|
PyneoController.gsm_accept()
|
2008-12-08 15:21:53 +00:00
|
|
|
print source
|