Commit graph

58 commits

Author SHA1 Message Date
emdete
e1b977dfad add a startup script
git-svn-id: http://www.neo1973-germany.de/svn@182 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-10-01 19:50:44 +00:00
emdete
771d4a6513 reduced & beautified generating script
added a clean script for generated stuff
removed generated stuff


git-svn-id: http://www.neo1973-germany.de/svn@181 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-10-01 19:42:40 +00:00
emdete
00e3e597d7 remove absolute path to edje_cc
git-svn-id: http://www.neo1973-germany.de/svn@180 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-10-01 11:34:14 +00:00
emdete
343ce9be5a always check for errors!
git-svn-id: http://www.neo1973-germany.de/svn@179 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-10-01 11:13:29 +00:00
fgau
a364a9459e more than 4 digist for pin are possible
git-svn-id: http://www.neo1973-germany.de/svn@172 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-26 16:39:26 +00:00
fgau
6005068e07 add some more gps status information
git-svn-id: http://www.neo1973-germany.de/svn@171 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-23 04:57:24 +00:00
fgau
e0864bdd30 add gps status edje
git-svn-id: http://www.neo1973-germany.de/svn@170 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-21 13:36:09 +00:00
fgau
c6fc5cc11e add fix or no fix
git-svn-id: http://www.neo1973-germany.de/svn@169 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-21 13:31:37 +00:00
fgau
1d4693fdcb click 2, click dial, power gps on/off
git-svn-id: http://www.neo1973-germany.de/svn@168 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-19 16:18:23 +00:00
fgau
2f044ce7d9 add blinkenlights if phone ringing
git-svn-id: http://www.neo1973-germany.de/svn@149 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-15 17:51:27 +00:00
fgau
5b8c60044b add screenlock/unlock. press # for 2 sec
git-svn-id: http://www.neo1973-germany.de/svn@148 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-15 14:34:19 +00:00
fgau
e5cc83fe82 show incomming number
git-svn-id: http://www.neo1973-germany.de/svn@141 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-11 16:08:30 +00:00
fgau
cd4acf969e update blackwhite theme
git-svn-id: http://www.neo1973-germany.de/svn@140 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-10 18:09:11 +00:00
fgau
387dafaf5d remove the timer for backspace. thx thomas ;)
git-svn-id: http://www.neo1973-germany.de/svn@139 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-10 15:18:52 +00:00
thomasg
c882ebc859 git-svn-id: http://www.neo1973-germany.de/svn@138 46df4e5c-bc4e-4628-a0fc-830ba316316d 2008-09-10 09:20:27 +00:00
fgau
cd8cc144aa cosmetic repair
git-svn-id: http://www.neo1973-germany.de/svn@137 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-09 20:31:24 +00:00
fgau
6c2757563f add special backspace (only blackwhite theme)
git-svn-id: http://www.neo1973-germany.de/svn@136 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-09 16:50:46 +00:00
fgau
fd1f322c6d rename something in dialer_incall.edc
git-svn-id: http://www.neo1973-germany.de/svn@135 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-08 17:46:22 +00:00
Abraxa
c928be9617 Fix improper call handing surrounding gsm_phone_call_start and gsm_phone_ringing
git-svn-id: http://www.neo1973-germany.de/svn@134 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-08 07:11:09 +00:00
fgau
2cd242f769 add some pix for blackwhite theme
git-svn-id: http://www.neo1973-germany.de/svn@133 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-07 17:40:05 +00:00
fgau
814c3c2c7d add a new dialer_incall.edc (only blackwhite theme)
git-svn-id: http://www.neo1973-germany.de/svn@132 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-07 14:52:44 +00:00
fgau
a8f9e5c2c8 add display_time
git-svn-id: http://www.neo1973-germany.de/svn@131 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-06 17:27:28 +00:00
fgau
0cdeb0797b reduced numberdisplay field
git-svn-id: http://www.neo1973-germany.de/svn@130 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-06 16:01:24 +00:00
fgau
68653a2a17 set default theme
git-svn-id: http://www.neo1973-germany.de/svn@129 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-06 15:02:41 +00:00
fgau
90fb77598d add operator and signal strength
git-svn-id: http://www.neo1973-germany.de/svn@128 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-06 14:45:30 +00:00
Abraxa
6b9a7d964f Added authors
git-svn-id: http://www.neo1973-germany.de/svn@127 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-05 22:37:37 +00:00
Abraxa
df4b16c228 Add evas image and font caching
git-svn-id: http://www.neo1973-germany.de/svn@126 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-05 22:35:35 +00:00
fgau
fb27f65bcb add End Call
git-svn-id: http://www.neo1973-germany.de/svn@125 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-03 18:07:49 +00:00
Abraxa
1a15a98a75 Fix signal callback
git-svn-id: http://www.neo1973-germany.de/svn@124 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-03 16:26:57 +00:00
Abraxa
24fa27ff11 Add missing join() in MainScreen.on_edje_numberkey_triggered()
Add phone status callbacks to PyneoControl (gsm_phone_ringing and friends)
Change if/if/if structure to if/elif/elif to be more efficient
Make PyneoControl able to send parameters to callbacks when they're called
Use these parameters to submit values where meaningful (e.g. sim_key_required)
Make Dialer class switch screens on call status changes



git-svn-id: http://www.neo1973-germany.de/svn@123 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-03 06:05:41 +00:00
Abraxa
02593e9bb2 Make PyneoControl.gsm_hangup() delete terminated calls from its internal list
git-svn-id: http://www.neo1973-germany.de/svn@122 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-03 05:32:45 +00:00
Abraxa
6f254d30e6 Make PyneoControl.gsm_dial() work as expected
Add PyneoControl.gsm_hangup()



git-svn-id: http://www.neo1973-germany.de/svn@121 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 23:33:27 +00:00
Abraxa
ce0260dbc1 Rework SIM D-Bus object intialization, placing it in its own method so it can have its own try-again-timer
Make debug output a little more descriptive



git-svn-id: http://www.neo1973-germany.de/svn@120 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 23:26:10 +00:00
Abraxa
2a739e1378 Remove PyneoController's "init" event and the corresponding callbacks. It was part of the initial PyneoControl draft, no longer used.
git-svn-id: http://www.neo1973-germany.de/svn@119 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 23:21:01 +00:00
Abraxa
bff85c8a79 Simplify handling of PyneoController._callbacks
git-svn-id: http://www.neo1973-germany.de/svn@118 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 23:19:24 +00:00
fgau
60f1bd4e8f split the dbus initialisation and fixed gsm_wireless_status
git-svn-id: http://www.neo1973-germany.de/svn@117 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 16:57:10 +00:00
Abraxa
8e6d08c3b2 Rename PyneoInterface to PyneoController, as things had to be redesigned
Add generic callbacks to PyneoController
Enhance GSM handling in PyneoController
Make MainScreen interface with PyneoController



git-svn-id: http://www.neo1973-germany.de/svn@116 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-02 07:59:03 +00:00
Abraxa
8f99c6edd8 Remove unneeded edje_cc comment at end of file
Make spaces between classes two lines long
Add PyneoInterface singleton class
Rename global TITLE constant to APP_TITLE
Add initial callback structure, preparing GUI integration



git-svn-id: http://www.neo1973-germany.de/svn@115 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-09-01 09:12:24 +00:00
fgau
fe4d2bb963 add files for blackwhite theme
git-svn-id: http://www.neo1973-germany.de/svn@114 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-31 18:01:36 +00:00
fgau
b3b00bb611 added isdigit in correct syntax
git-svn-id: http://www.neo1973-germany.de/svn@111 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-31 09:54:32 +00:00
Abraxa
5064c05317 Make epydial able to handle multiple themes
Update the locations in data/
Update the theme compile script



git-svn-id: http://www.neo1973-germany.de/svn@110 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-31 07:56:51 +00:00
Abraxa
aedb86b36d Add Dialer.get_evas()
Rename parameters from "main" to "screen_manager", as that's what the Dialer class is 



git-svn-id: http://www.neo1973-germany.de/svn@109 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-31 04:15:56 +00:00
Abraxa
6465961301 Rename TestView to Dialer
Rename Dialer.groups to Dialer.screens
Rename *_GROUP_NAME to *_SCREEN_NAME
Add Dialer.show_screen() method



git-svn-id: http://www.neo1973-germany.de/svn@108 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-31 03:50:33 +00:00
Abraxa
efe7084165 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
2008-08-31 02:00:48 +00:00
fgau
75cfd64932 fixed the star issue ;)
git-svn-id: http://www.neo1973-germany.de/svn@106 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-30 12:53:53 +00:00
fgau
97b8bdf84e add python foo with help from the master. autoscale for display is ... TODO: scrolling to left
git-svn-id: http://www.neo1973-germany.de/svn@105 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-29 21:29:30 +00:00
fgau
c126221a2a 4 digits for sim pin. TODO: the first digit is not visible
git-svn-id: http://www.neo1973-germany.de/svn@104 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-29 20:15:30 +00:00
fgau
72cf62094a only numerics for sim pin
git-svn-id: http://www.neo1973-germany.de/svn@103 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-29 18:55:11 +00:00
fgau
8f56a23473 #!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
__author__ = ""
__version__ = "prototype"
__copyright__ = "Copyright (c) 2008"
__license__ = "GPL3"

WIDTH = 480
HEIGHT = 640
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"

from datetime import datetime
from dbus import SystemBus
import os
import sys
import time

import e_dbus
import ecore
import ecore.evas
import edje.decorators
import edje
import evas.decorators

from pyneo.dbus_support import *
from pyneo.sys_support import pr_set_name

from ConfigParser import SafeConfigParser

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)
		
		try:
			edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=EDJE_FILE_NAME, group=group)
		except edje.EdjeLoadError, e:
			raise SystemExit("Error loading %s: %s" % (f, e))
		
		self.size = self.main.evas_canvas.evas_obj.evas.size

class MainScreen(EdjeGroup):
	def __init__(self, main):
		EdjeGroup.__init__(self, main, EDJE_GROUP_NAME)
		self.text = []
		
		dbus_ml = e_dbus.DBusEcoreMainLoop()
		self.system_bus = SystemBus(mainloop=dbus_ml)
		
		ecore.timer_add(5, self.init_dbus)

	def init_dbus(self):
		try:
			self.gsm = object_by_url('dbus:///org/pyneo/GsmDevice')
			self.wireless = object_by_url('dbus:///org/pyneo/gsmdevice/Network')
			self.keyring = object_by_url('dbus:///org/pyneo/GsmDevice')
		except Exception, e:
			print e
			#if not self.dbus_timer:
			#	self.dbus_timer = ecore.timer_add(2, self.init_dbus)
			# We had an error, keep the timer running
			#return True
		
		# No error, all went well
		#if self.dbus_timer: self.dbus_timer.stop()
		# D-Bus is ready, let's init GSM
		self.gsm_on()

	def gsm_on(self):
		try:
			if self.gsm.GetPower('sample', dbus_interface=DIN_POWERED, ):
				print '---', 'gsm device is already on'
			else:
				self.gsm.SetPower('sample', True, dbus_interface=DIN_POWERED, )
				print '---', 'switching device on'
		except Exception, e:
			print e
			#if not self.gsm_timer:
			#	self.gsm_timer = ecore.timer_add(5, self.gsm_on)
			# We had an error, keep the timer running
			#return True
		# No error
		#if self.gsm_timer: self.gsm_timer.stop()
		# GSM ready, let's ask SIM PIN
		self.sim_pin()

	def sim_pin(self):
		self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
		if self.res['code'] != 'READY':
			print '---', 'opening keyring'
			self.part_text_set("numberdisplay_text", "Enter " + self.res['code'])
			self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
		else:
			print '---', 'already authorized'
			self.nw_register()

	def nw_register(self):
		self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
		if not self.nw_res['stat'] in (1, 5, ):
			print '---', 'registering to gsm network'
			self.wireless.Register(dbus_interface=DIN_WIRELESS)
			self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
		else:
			self.part_text_set("numberdisplay_text", "please dial")
			print '---', 'already registered'

	@edje.decorators.signal_callback("dialer_send", "*")
	def on_edje_signal_numberkey_triggered(self, emission, source):
		if self.res['code'] != 'READY':
			if source in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "*", ):
				self.text.append(source)
				print ''.join(self.text)
				self.part_text_set("numberdisplay_text", "".join(self.text))
			elif source == "backspace":
				self.text = self.text[:-1]
				print ''.join(self.text)
				self.part_text_set("numberdisplay_text", "".join(self.text))
			elif source == "dial":
				print '---', 'send pin'
				self.keyring.Open(''.join(self.text), dbus_interface=DIN_KEYRING, )
				self.part_text_set("numberdisplay_text", "register ...")
				self.nw_register()
		else:
			if source in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "*", ):
				self.text.append(source)
				print ''.join(self.text)
				self.part_text_set("numberdisplay_text", "".join(self.text))
			elif source == "backspace":
				self.text = self.text[:-1]
				print ''.join(self.text)
				self.part_text_set("numberdisplay_text", "".join(self.text))
			elif source == "dial":
				print '---', 'dial number'
				self.part_text_set("numberdisplay_text", "calling ...")
				os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
				name = self.wireless.Initiate(''.join(self.text), dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200, )
				time.sleep(20)
				call = object_by_url(name)
				call.Hangup(dbus_interface=DIN_CALL)

class TestView(object):
	def __init__(self):
		edje.frametime_set(FRAMETIME)
		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 ...")

class EvasCanvas(object):
	def __init__(self, fullscreen, engine_name):
		if engine_name == "x11":
			engine = ecore.evas.SoftwareX11
#		elif engine_name == "x11-16":
#			if ecore.evas.engine_type_supported_get("software_x11_16"):
#				engine = ecore.evas.SoftwareX11_16
		else:
			print "warning: x11-16 is not supported, falling back to x11"
			engine = ecore.evas.SoftwareX11
		
		self.evas_obj = engine(w=WIDTH, h=HEIGHT)
		self.evas_obj.callback_delete_request = self.on_delete_request
		self.evas_obj.callback_resize = self.on_resize
		
		self.evas_obj.title = TITLE
		self.evas_obj.name_class = WM_INFO
		self.evas_obj.fullscreen = fullscreen
#		self.evas_obj.size = str(WIDTH) + 'x' + str(HEIGHT)
		self.evas_obj.show()

	def on_resize(self, evas_obj):
		x, y, w, h = evas_obj.evas.viewport
		size = (w, h)
		for key in evas_obj.data.keys():
			evas_obj.data[key].size = size

	def on_delete_request(self, evas_obj):
		ecore.main_loop_quit()

if __name__ == "__main__":
	TestView()
	ecore.main_loop_begin()

'''
export LDFLAGS="$LDFLAGS -L/opt/e17/lib"
export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH="$PATH:/opt/e17/bin"
export PYTHONPATH="/home/fgau/usr/lib/python2.5/site-packages"

edje_cc -v -id ../images -fd ../fonts *edc
'''



git-svn-id: http://www.neo1973-germany.de/svn@102 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-29 15:36:52 +00:00
Abraxa
af2f8a6f9b Rename edje_group and dialer_main classes to EdjeGroup and MainScreen, respectively
git-svn-id: http://www.neo1973-germany.de/svn@101 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-29 00:05:18 +00:00