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:
|
2009-02-02 13:50:32 +00:00
|
|
|
cursor.execute("SELECT * FROM contacts WHERE mobil LIKE %s OR home LIKE %s OR work LIKE %s" % (number, number, number))
|
2008-12-23 17:21:25 +00:00
|
|
|
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]:
|
2009-02-02 13:50:32 +00:00
|
|
|
self.part_text_set("incall_number_text", "%s: %s, %s" % (source, CallerNamemap[1], CallerNamemap[0]))
|
2008-12-23 17:21:25 +00:00
|
|
|
except:
|
2009-02-02 13:50:32 +00:00
|
|
|
self.part_text_set("incall_number_text", "??? %s ???" % number)
|
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":
|
2009-02-04 17:30:33 +00:00
|
|
|
PyneoController.stop_ringtone()
|
2008-10-01 21:50:48 +00:00
|
|
|
PyneoController.gsm_hangup()
|
|
|
|
if source == "Accept Call":
|
2009-02-04 17:30:33 +00:00
|
|
|
PyneoController.stop_ringtone()
|
2008-11-03 18:34:09 +00:00
|
|
|
PyneoController.gsm_accept()
|
2008-12-08 15:21:53 +00:00
|
|
|
print source
|