Commit graph

202 commits

Author SHA1 Message Date
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
Abraxa
25495587d0 Simplify EvasCanvas.__init__() parameters
Rename f in EvasCanvas.__init__() to engine



git-svn-id: http://www.neo1973-germany.de/svn@100 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 23:49:52 +00:00
Abraxa
974ba5cae1 Add FRAMETIME constant to remove magic number supplied to edje.frametime_set()
Make EvasCanvas.__init__() honor the WIDTH and HEIGHT constants



git-svn-id: http://www.neo1973-germany.de/svn@99 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 22:22:31 +00:00
Abraxa
1fc87d074d Group imports by category (system, efl, others)
Sort imports alphabetically
Remove duplicate imports (import os / import os.path)
Remove comments where there was already code in the same line (comments on separate lines are better)
Fix whitespace / tab indentation where necessary



git-svn-id: http://www.neo1973-germany.de/svn@98 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 21:45:58 +00:00
Abraxa
3b5fd004fa Remove code that checks for the edje theme file since the execution order is non-linear
Introduce the EDJE_FILE_NAME global constant to avoid having magic strings all over the place
Add a check for the edje theme file in edje_group.__init__()
On error, raise an IOError with message string, not a raw string exception as in the initial code



git-svn-id: http://www.neo1973-germany.de/svn@97 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 21:29:33 +00:00
Abraxa
8a22c63d1e Introduce EDJE_GROUP_NAME to replace static magic strings
git-svn-id: http://www.neo1973-germany.de/svn@96 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 21:14:14 +00:00
Abraxa
4cd74d1fea Rename global variable FS to FULLSCREEN in order to make it self-descriptive
Make EvasCanvas.__init__() honor the fullscreen parameter instead of using the global variable directly




git-svn-id: http://www.neo1973-germany.de/svn@95 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 21:10:06 +00:00
fgau
6be4f6a3a5 #!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
__author__ = ""
__version__ = "prototype"
__copyright__ = "Copyright (c) 2008"
__license__ = "GPL3"

WIDTH = 480
HEIGHT = 640
FS = True
TITLE = "epydial"
WM_INFO = ("epydial", "epydial")

import os
import sys
import ecore
import ecore.evas
import evas.decorators
import edje.decorators
import edje
from dbus import SystemBus
from e_dbus import DBusEcoreMainLoop
import e_dbus
from datetime import datetime
from os import system # alsactl is used with a sytem call
from pyneo.dbus_support import *
from pyneo.sys_support import pr_set_name

from ConfigParser import SafeConfigParser
from os.path import exists
import time
from time import sleep

#import sqlite3

for i in "data/themes/dialer.edj".split():
	if os.path.exists( i ):
		global edjepath
		edjepath = i
		break
else:
	raise "Edje not found"
	
class edje_group(edje.Edje):
	def __init__(self, main, group):
		self.main = main
		global edjepath
		f = edjepath
		try:
			edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=f, 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 dialer_main(edje_group):
	def __init__(self, main):
		edje_group.__init__(self, main, "pyneo/dialer/main")
		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': # TODO unify!
			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, ): # TODO unify!
			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 ...")
				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, )
				sleep(20)
				call = object_by_url(name)
				call.Hangup(dbus_interface=DIN_CALL)

class TestView(object):
	def __init__(self):
		edje.frametime_set(1.0 / 20)
		self.evas_canvas = EvasCanvas(fullscreen=FS, engine="x11-16", size="480x640")
		
		self.groups = {}
		self.groups["pyneo/dialer/main"] = dialer_main(self)
        	self.evas_canvas.evas_obj.data["pyneo/dialer/main"] = self.groups["pyneo/dialer/main"]
		self.groups["pyneo/dialer/main"].show()
		self.groups["pyneo/dialer/main"].part_text_set("numberdisplay_text", "wait ...")

class EvasCanvas(object):
	def __init__(self, fullscreen, engine, size):
		if engine == "x11":
			f = ecore.evas.SoftwareX11
#		elif engine == "x11-16":
#			if ecore.evas.engine_type_supported_get("software_x11_16"):
#				f = ecore.evas.SoftwareX11_16
		else:
			print "warning: x11-16 is not supported, fallback to x11"
			f = ecore.evas.SoftwareX11

		self.evas_obj = f(w=480, h=640)
		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 = FS
#		self.evas_obj.size = size
		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@94 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-28 16:12:33 +00:00
fgau
14791e602a initialisation
git-svn-id: http://www.neo1973-germany.de/svn@93 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-08-27 21:26:20 +00:00
kriss
d515d0a41c FEATURE: Added manual theme loading (commented out)
git-svn-id: http://www.neo1973-germany.de/svn@92 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-31 00:22:42 +00:00
kriss
b0d2be73a9 FEATURE: Added platform detection and got for Backlight and Bluetooth working on GTA02
git-svn-id: http://www.neo1973-germany.de/svn@91 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-31 00:21:45 +00:00
kriss
25e1cb447f MINOR: Added debug messages
git-svn-id: http://www.neo1973-germany.de/svn@90 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-31 00:18:22 +00:00
kriss
ab9af88105 BUGFIX: actually initialize superclass of BatteryPannel, fix error handling
git-svn-id: http://www.neo1973-germany.de/svn@89 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-28 17:25:49 +00:00
kriss
b99303cdd9 FEATURE: Include Battery Monitor from HdR - Thanks (not usable yet, still bug hunting on my part)
git-svn-id: http://www.neo1973-germany.de/svn@88 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-28 17:17:28 +00:00
kriss
1f8d903c31 FEATURE: Not using shell script for wifi configuration anymore... - ToDo allow for encryption
git-svn-id: http://www.neo1973-germany.de/svn@87 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-28 15:22:07 +00:00
kriss
934f76224a BUGFIX: Fixing issue causing SettingsGUI not to startup on GTA02 - see Ticket http://neo1973-germany.de/ticket/4 - Thanks to Birdack for reporting and submitting the patch!
git-svn-id: http://www.neo1973-germany.de/svn@86 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-28 15:18:11 +00:00
kriss
49839b2e81 BUGFIX: Allow for stratup without root access (to WiFi interface)
git-svn-id: http://www.neo1973-germany.de/svn@85 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-26 18:14:07 +00:00
kriss
02a0875646 FEATURE: First implementation of a WiFi panel. Done by John Beaven as part of the mofi project: http://projects.openmoko.org/projects/mofi/ - Thanks!
git-svn-id: http://www.neo1973-germany.de/svn@84 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-26 18:05:00 +00:00
fgau
1a7fad14af have fun ;)
git-svn-id: http://www.neo1973-germany.de/svn@83 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-16 18:19:21 +00:00
fgau
eadc7e789e svn test and add pyaccel directory
git-svn-id: http://www.neo1973-germany.de/svn@82 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-16 15:33:40 +00:00
kriss
6a78924855 Release 0.2 - grid of lines
git-svn-id: http://www.neo1973-germany.de/svn@81 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 18:35:35 +00:00
kriss
d1cd97cf39 FEATURE: Added marker lines to ease meter-reading
git-svn-id: http://www.neo1973-germany.de/svn@80 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 18:32:00 +00:00
kriss
6f321a441c FIX: Changed size to get smaller screenshots ;-)
git-svn-id: http://www.neo1973-germany.de/svn@79 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 18:30:13 +00:00
kriss
72a0eaf057 0.1 - grid of dots
git-svn-id: http://www.neo1973-germany.de/svn@78 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 16:20:16 +00:00
kriss
de3ea32632 0.1 - grid of dots
git-svn-id: http://www.neo1973-germany.de/svn@77 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 16:02:26 +00:00
kriss
93267b7c0f FIX: Seperated from prior codebase
git-svn-id: http://www.neo1973-germany.de/svn@76 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 16:01:38 +00:00
kriss
29339fc3f4 Initial import
git-svn-id: http://www.neo1973-germany.de/svn@75 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-07-02 15:17:15 +00:00
kriss
c78e13b4da FEATURE: Compress Data
CLEANUP: Separating out much of the concern of the large pyPenNotes.py file into SaveRestore.py and UserDrawingArea.py

patch from haakeyar Thanks a lot!

--- Full Ticket Message ---

UserDrawingArea.py is a widget that the user can draw on and you can receive tha strokes that the user has drawn.

SaveRestore contains classes for saving and loading the data. It is split into two closes. A base class takes care of things in common for all file formats, while a subclass implements the actual file format. This way, we could easily implement other file formats, for example a text format where only parts of the file are loaded, to improve loading speed, or ability to save to an sqlite file.

In the base class, I have implemented a simple compression of the notes. Points closer than QUALITY_LOSS (currently set at 5) pixels are merged. This compressed a test note file with 77% and you can barely see the difference. I have attached the original file, the compressed file and a a file with two notes file, the compressed first and the original last (open this file in the original pyPenNotes and switch between the notes to see the difference).
There are also other ways to compress the notes even more (no need for more than two points in a straight line), but I have not implemented that (yet).

Maybe it would be better to move the compression to UserDrawingArea - it would have both good and bad sides.

pyPenNotes.py still has too much responsibility in my opinion - it both displays the window and coordinates SaveRestore and UserDrawingArea, but I haven't done anything about that (yet).

If you want to discuss any of the changes, feel free to contact me on IRC or mail me at my nick at gmail dot com if you want to discuss the changes. 

git-svn-id: http://www.neo1973-germany.de/svn@74 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-24 19:33:46 +00:00
kriss
a4d3e62796 FEATURE: Compress Data
CLEANUP: Separating out much of the concern of the large pyPenNotes.py file into SaveRestore.py and UserDrawingArea.py

patch from haakeyar Thanks a lot!

--- Full Ticket Message ---

UserDrawingArea.py is a widget that the user can draw on and you can receive tha strokes that the user has drawn.

SaveRestore contains classes for saving and loading the data. It is split into two closes. A base class takes care of things in common for all file formats, while a subclass implements the actual file format. This way, we could easily implement other file formats, for example a text format where only parts of the file are loaded, to improve loading speed, or ability to save to an sqlite file.

In the base class, I have implemented a simple compression of the notes. Points closer than QUALITY_LOSS (currently set at 5) pixels are merged. This compressed a test note file with 77% and you can barely see the difference. I have attached the original file, the compressed file and a a file with two notes file, the compressed first and the original last (open this file in the original pyPenNotes and switch between the notes to see the difference).
There are also other ways to compress the notes even more (no need for more than two points in a straight line), but I have not implemented that (yet).

Maybe it would be better to move the compression to UserDrawingArea - it would have both good and bad sides.

pyPenNotes.py still has too much responsibility in my opinion - it both displays the window and coordinates SaveRestore and UserDrawingArea, but I haven't done anything about that (yet).

If you want to discuss any of the changes, feel free to contact me on IRC or mail me at my nick at gmail dot com if you want to discuss the changes. 

git-svn-id: http://www.neo1973-germany.de/svn@73 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-24 18:21:45 +00:00
kriss
b5d1f2c08c BUGFIX: use configured command when calling hciconfig - Thanks haakeyar!
git-svn-id: http://www.neo1973-germany.de/svn@72 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-05 21:40:51 +00:00
emdete
b599c882ce adjusted pathes
git-svn-id: http://www.neo1973-germany.de/svn@71 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-04 06:28:07 +00:00
kriss
f4b55d18c7 CLEANUP: quite some code cleanups by haakeyar - thanks!
FEATURE: remove rulers when the second tollbar is not visible

git-svn-id: http://www.neo1973-germany.de/svn@70 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-02 17:37:18 +00:00
kriss
bfec9a3ce3 CLEANUP: gettings comments in sync again
git-svn-id: http://www.neo1973-germany.de/svn@69 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-02 13:35:20 +00:00
kriss
8b8d6545aa FIX: get space for one more bluetooth peer before scrollbar desaster happens ;-)
git-svn-id: http://www.neo1973-germany.de/svn@68 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-04-02 13:33:09 +00:00
kriss
3c172d34e0 MANAGE: Adding directory to archiv patches.
git-svn-id: http://www.neo1973-germany.de/svn@67 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-25 20:06:27 +00:00
kriss
dbf974b473 Author: haakeyar
If you run pyPenNotes without a .penNotes.strokes_data-file, the pyPenNotes.pen_notes[] list is emptied in pyPenNotes.load(). This gives various unexpected behaviour, including not being able to save the notes you created.


git-svn-id: http://www.neo1973-germany.de/svn@66 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-25 19:49:03 +00:00
PatrickBeck
512b36e1ac delete unitc.png
git-svn-id: http://www.neo1973-germany.de/svn@65 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-22 14:36:23 +00:00
PatrickBeck
e7c4954285 preview shot from unitc in action
git-svn-id: http://www.neo1973-germany.de/svn@64 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-22 14:04:28 +00:00
kriss
254d60bbfc DOC: added scaled screenshot (240x320)
git-svn-id: http://www.neo1973-germany.de/svn@63 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-16 01:47:06 +00:00
kriss
1638c15ed3 Tagging the 0.8 release - <<the blue release>>
git-svn-id: http://www.neo1973-germany.de/svn@62 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-16 00:34:14 +00:00
kriss
fb1ca209ef DOC: Screenshots Version 0.8
git-svn-id: http://www.neo1973-germany.de/svn@61 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-16 00:28:47 +00:00
kriss
5d293b46f5 BUGFIX: Optimize strings and borders to fit layout on Neo1973
BUGFIX: Do not set default route yet
FEATURE: Add Label with visible Name
FEATURE: Generate IP Address from configured mask + last byte of BT Address
FEATURE: Set pand state from actual deamon state
OPTIMIZATION: Only wait until hci- and ifconfig are finished instead of fixed time
CLEANUP: Remove unused functions

git-svn-id: http://www.neo1973-germany.de/svn@60 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-16 00:18:18 +00:00
kriss
12551ae94f COMMENT: How to make process_running() to include process parameters.
git-svn-id: http://www.neo1973-germany.de/svn@59 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 23:22:59 +00:00
kriss
a079e81ea5 CLEANUP: Using new function in Processinterface.py to find out if pppd is running.
git-svn-id: http://www.neo1973-germany.de/svn@58 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 22:50:47 +00:00
kriss
e9387fc973 FEATURE: Added function process_running() to look up if a process is running (by name).
TEST: Added test function for process_running().

git-svn-id: http://www.neo1973-germany.de/svn@57 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 22:44:52 +00:00
kriss
23d326155b TEST: renamed copy/test script
git-svn-id: http://www.neo1973-germany.de/svn@56 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 22:15:06 +00:00
kriss
8ad2797b73 CONFIG: Setting Bluetooth scan interval to 10 seconds.
git-svn-id: http://www.neo1973-germany.de/svn@55 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 21:48:10 +00:00
kriss
ca22e6af6a CLEANUP: Hi Patrick, nice project! You can use show_all there, keep going, it's great. :-)
git-svn-id: http://www.neo1973-germany.de/svn@54 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-15 02:17:01 +00:00
PatrickBeck
94b026a797 README added
git-svn-id: http://www.neo1973-germany.de/svn@53 46df4e5c-bc4e-4628-a0fc-830ba316316d
2008-03-14 19:16:50 +00:00