Package screenlets :: Package plugins :: Module Evolution
[hide private]
[frames] | no frames]

Source Code for Module screenlets.plugins.Evolution

 1  # This program is free software: you can redistribute it and/or modify 
 2  # it under the terms of the GNU General Public License as published by 
 3  # the Free Software Foundation, either version 3 of the License, or 
 4  # (at your option) any later version. 
 5  #  
 6  # This program is distributed in the hope that it will be useful, 
 7  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 8  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 9  # GNU General Public License for more details. 
10  #  
11  # You should have received a copy of the GNU General Public License 
12  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
13   
14  #  Evolution api (c) Whise (Helder Fraga) 2008 <helder.fraga@hotmail.com> 
15   
16   
17 -def get_evolution_contacts():
18 """Returns a list of evolution contacts""" 19 contacts = [] 20 21 try: 22 import evolution 23 except ImportError, err: 24 print " !!!Please install python evolution bindings Unable to import evolution bindings:", err 25 return None 26 27 try: 28 if evolution: 29 for book_id in evolution.ebook.list_addressbooks(): 30 book = evolution.ebook.open_addressbook(book_id[1]) 31 if book: 32 for contact in book.get_all_contacts(): 33 34 contacts.append(contact) 35 except: 36 if evolution: 37 for book_id in evolution.list_addressbooks(): 38 book = evolution.open_addressbook(book_id[1]) 39 if book: 40 for contact in book.get_all_contacts(): 41 42 contacts.append(contact) 43 44 return contacts
45