Babiloo port to Nokia S60 series

Bug #308014 reported by cpina
4
Affects Status Importance Assigned to Milestone
Babiloo
In Progress
Medium
Unassigned

Bug Description

Hello,

Bug/Wish: Babiloo is not available to be executed in the Python for Nokia mobiles, S60 series.

Thanks,

Carles

Tags: s60 nokia
Revision history for this message
Kapis (capiscuas) wrote :

we should start by creating a new package named s60 in the code.

ideas for the interface:

- it should be able to download dictionaries from the internet (we'll have a xmlrpc method for that using our server).
- interface should install dictionaries from the files of the mobilephone and be able to reproduce sounds (for those dictionaries with sound attached).
- etc

Revision history for this message
cpina (carles-pina) wrote :

-Autocompleting is very important: in these small devices it's hard to type

Revision history for this message
Kapis (capiscuas) wrote :

Marco has tried few lines in the S60 and he has been able to do magic already.
Autocomplete search in s60 is enable by default, no need to code. He can show a selection list of words and also pronounce the word.
Here is the code:

# import the application user interface framework module
import appuifw
import audio

# define the list of items (items must written in unicode! -> put a u in front)
L = [u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen', u'camera', u'keys', u'cálice', u'físico']

# create the selection list
index = appuifw.selection_list(choices=L , search_field=1)

# use the result of the selection to trigger some action
text = L[index]

audio.say(text)
appuifw.note(text, "info")

Revision history for this message
cpina (carles-pina) wrote :

Very interesting Ivan/Marco.

I will add 10.000 words in this mailing list to know if it works fast enough or doesn't and inform you.

Cheers,

Revision history for this message
cpina (carles-pina) wrote :

Hello,

This loads a file with words:
# import the application user interface framework module
import appuifw
import audio
import codecs
import string

dictionary = u"e:\\python\\words.dat"

f=codecs.open(dictionary,encoding="utf-8")
L = f.readlines()

L = map(string.rstrip,L)

# create the selection list
index = appuifw.selection_list(choices=L , search_field=1)

# use the result of the selection to trigger some action
text = L[index]

#audio.say(text)
appuifw.note(text, "info")

Talk with you a bit later (I will leave now for one or two hours), I'm thinking if it's worst to port all Babiloo to S60's or just use a simpler text format and load in more simple way. Not porting dict, XML, etc. etc. formats and use this approach...

Cheers,

Revision history for this message
cpina (carles-pina) wrote :

About my previous comment: change "worst" by "worth" please :-)

More thoughts:
I'm thinking to use Babiloo desktop "parsers" to read different dictionaries format and generate a simple format for the Nokia S60. Python in Nokia is a bit old version, doesn't have all modules, Nokia is not as fast as a desktop machine, etc.

We could maybe generate a Pickle object (dictionary) to with all entries and definition by each dictionary. We could use this dictionary to get a list and populate the selection_list, or maybe have the dictionary and a simple list (to be faster populating the list).

Or not use pickle and use a text representation of the list and eval it. I prefer Pickle.

The file words.dat that I used contains 8000 words and it's fast (to load and to use the autocompletion search).

Cheers,

Revision history for this message
Kapis (capiscuas) wrote :

Hi carles, Marco has succeed importing the format Stardict which is an extension of the DICTD format, inside the core.

Let's try first to see if using the python 2.2 of the S60 we can use our babiloo core dictionaries to use directly the words from it.

Those formats are optimized so the content of all the words is not loaded in memory and compressed in a file.

Revision history for this message
cpina (carles-pina) wrote :

Hi Ivan, Marco,

Ok, we will measure if it's worth or not worth to prepare a special output for S60.
Just following the sentence: "premature optimization is the root of all evil." (Knuth, Donald)

Revision history for this message
Kapis (capiscuas) wrote :

latest discovers from Marco is that when using python 2.2, the only 2 libraries that the core doesn't support is the

import bisect

and

from __future__ import with_statement

those are not important libraries, from bisect we only use a function to optimize the sorted insertion in our __keys list.
and the __future__ is only for warnings about the syntax changes of python 3.0

Revision history for this message
Marco Ferreira (mferreira) wrote :

One more update on method not available on S60:

using 'yield' returns 'invalid syntax' .... wierd

Revision history for this message
Marco Ferreira (mferreira) wrote :

More than wonderful news on PyS60, which I missed for a few days:

http://discussion.forum.nokia.com/forum/showthread.php?t=154215

PyS69 1.9 is a pre-2.0, I'm gonna do some tests on this new version, which uses python 2.5 core \o/

If all goes well, most of the core code will be used, if not all :)

Changed in babiloo:
importance: Undecided → Medium
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.