Package screenlets :: Package plugins :: Module Evolution

[hide private]
[frames] | no frames]

# Source Code for Module screenlets.plugins.Evolution

     1  # This application is released under the GNU General Public License
     2  # v3 (or, at your option, any later version). You can find the full
     3  # text of the license under http://www.gnu.org/licenses/gpl.txt.
     4  # By using, editing and/or distributing this software you agree to
     5  # the terms and conditions of this license.
     6  # Thank you for using free software!
     7
     8  #  Evolution api (c) Whise (Helder Fraga) 2008 <helder.fraga@hotmail.com>
     9
    10
    11 -def get_evolution_contacts():
    12          """Returns a list of evolution contacts"""
    13          contacts = []
    14
    15          try:
    16                  import evolution
    17          except ImportError, err:
    18                  print " !!!Please install python evolution bindings Unable to import evolution bindings:", err
    19                  return None
    20
    21          try:
    22                  if evolution:
    23                          for book_id in evolution.ebook.list_addressbooks():
    24                                  book = evolution.ebook.open_addressbook(book_id[1])
    25                                  if book:
    26                                          for contact in book.get_all_contacts():
    27
    28                                                  contacts.append(contact)
    29          except:
    30                  if evolution:
    31                          for book_id in evolution.list_addressbooks():
    32                                  book = evolution.open_addressbook(book_id[1])
    33                                  if book:
    34                                          for contact in book.get_all_contacts():
    35
    36                                                  contacts.append(contact)
    37
    38          return contacts
    39