|
|
2010-03-20
, 13:44
|
|
|
Posts: 288 |
Thanked: 113 times |
Joined on Dec 2009
@ Germany
|
#2
|
|
|
2010-03-22
, 22:28
|
|
Posts: 196 |
Thanked: 54 times |
Joined on Jan 2010
@ UK
|
#3
|
What happens if a contact hast more numbers assigned to the category "Mobile" or "Mobile (home)" ....
In the case I showed above, only the last number for "Mobile" is shown.
|
|
2010-03-23
, 18:40
|
|
|
Posts: 288 |
Thanked: 113 times |
Joined on Dec 2009
@ Germany
|
#4
|
I get only the first mobile number, if I have more than one.
Did you find any solution to this?
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import evolution
def on_Contact_clicked():
abook = evolution.ebook.open_addressbook("default")
contacts = abook.get_all_contacts()
#contacts.sort(key=lambda obj: obj.get_name())
for econtact in contacts:
numbers = econtact.get_property('phone')
print numbers
#--> <gpointer at 0x1bf4b0>
on_Contact_clicked()
|
|
2010-03-24
, 15:24
|
|
Posts: 15 |
Thanked: 4 times |
Joined on Mar 2010
|
#5
|
In [1]: import evolution
In [2]: abook = evolution.ebook.open_addressbook("default")
In [3]: type(abook)
Out[3]: <type 'ebook.EBook'>
In [4]: contacts = abook.get_all_contacts()
In [5]: type(contacts)
Out[5]: <type 'list'>
In [6]: contacts.sort(key=lambda obj: obj.get_name())
In [7]: contacts
Out[7]: []
In [20]: evolution.ebook.list_addressbooks()
Out[20]: []
|
|
2010-03-24
, 20:29
|
|
|
Posts: 288 |
Thanked: 113 times |
Joined on Dec 2009
@ Germany
|
#6
|
>>> contacts [<ebook.EContact object at 0x4075f8f0 (EContact at 0x1ddf80)>, <ebook.EContact object at 0x4075f210 (EContact at 0x1c1d78)>, <ebook.EContact object at 0x4075fcb0 (EContact at 0x1de230)>, <ebook.EContact object at 0x40761620 (EContact at 0x1f0bb0)>, ... <ebook.EContact object at 0x4075f670 (EContact at 0x1dddb0)>, <ebook.EContact object at 0x4075f3c8 (EContact at 0x1c1900)>, <ebook.EContact object at 0x40761a30 (EContact at 0x1f0e90)>] >>> len(contacts) 192
|
|
2010-03-24
, 20:46
|
|
Posts: 15 |
Thanked: 4 times |
Joined on Mar 2010
|
#7
|
Isn't it?Nokia-N900-51-1:~/.osso-abook$ pwd /home/user/.osso-abook Nokia-N900-51-1:~/.osso-abook$ /bin/ls avatars db photos Nokia-N900-51-1:~/.osso-abook$ /bin/ls db/ IMEI:356211000457518.changes.db index_full_name.db PC Suite Data Sync.changes.db index_im_jabber.db PC Suite.changes.db index_last_first.db addressbook.db index_phone.db fre1.changes.db log.0000000001 index_email.db running_id.db index_first_last.db tp-cache
|
|
2010-03-24
, 21:26
|
|
|
Posts: 288 |
Thanked: 113 times |
Joined on Dec 2009
@ Germany
|
#8
|

|
|
2010-03-24
, 21:43
|
|
Posts: 15 |
Thanked: 4 times |
Joined on Mar 2010
|
#9
|
I've found the reason...
Nokia-N900-51-1:~/MyDocs/.images/40d$ sudo gainroot
Root shell enabled
BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso26+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/home/user/MyDocs/.images/40d # su - user
~ $ id
uid=29999(user) gid=29999(users)
~ $ ipython
In [1]: import evolution
In [2]: abook = evolution.ebook.open_addressbook("default")
In [3]: abook.get_all_contacts()
Out[3]:
[<ebook.EContact object at 0x445cb0 (EContact at 0x4a7b50)>,
<ebook.EContact object at 0x456f80 (EContact at 0x4a7b68)>,
<ebook.EContact object at 0x456e40 (EContact at 0x4a7b80)>,
|
|
2010-03-24
, 23:37
|
|
Posts: 15 |
Thanked: 4 times |
Joined on Mar 2010
|
#10
|
contacts = abook.get_all_contacts()
In [104]: me = [c for c in contacts if 'Tomasz' in str(c.get_name())][0]
In [105]: me
Out[105]: <ebook.EContact object at 0x457238 (EContact at 0x4a7d20)>
In [106]: me.get_name()
Out[106]: 'Tomasz'
In [109]: for p in phone_attributes:
print p, me.get_property(p)
.....:
.....:
assistant-phone None
business-phone None
business-phone-2 None
business-fax None
callback-phone None
car-phone None
company-phone None
home-phone +4822****
home-phone-2 None
home-fax None
isdn-phone None
mobile-phone +48600****
other-phone +4822****
other-fax None
pager None
primary-phone None
radio None
telex None
tty None
I need to generate a list of contactas and a corresponding list with phone numbers for my program www2sms.
So far I came up with this solution:
#!/usr/bin/env python # -*- coding: utf-8 -*- # import evolution name_attributes = [ "full-name", "given-name", "family-name", "nickname" ] phone_attributes = [ "assistant-phone", "business-phone", "business-phone-2", "business-fax", "callback-phone", "car-phone", "company-phone", "home-phone", "home-phone-2", "home-fax", "isdn-phone", "mobile-phone", "other-phone", "other-fax", "pager", "primary-phone", "radio", "telex", "tty", ] def on_Contact_clicked(): single_contact = [] single_contact_numbers = [] contact_list = [] phone_list = [] abook = evolution.ebook.open_addressbook("default") contacts = abook.get_all_contacts() contacts.sort(key=lambda obj: obj.get_name()) for econtact in contacts: #help(econtact) single_contact = [econtact.get_property(name_attributes[2]), econtact.get_property(name_attributes[1])] for phone_attribute in phone_attributes: single_contact_numbers.append(econtact.get_property(phone_attribute)) contact_list.append(single_contact) phone_list.append(single_contact_numbers) single_contact = [] single_contact_numbers = [] ID = 0 for contact in contact_list: print ID print "--> %s, %s" %(contact[0], contact[1]) print "~~~> %s" %(phone_list[ID][11]) ID += 1 on_Contact_clicked()Has anyone an idea?
Thanks a lot
Bjoern
My website:
- olausson.de
- gallery.olausson.de
My Applications: