self.matched = []
self.unmatched = []
self.friends = {}
- self.addresses = None
+ self.address_book = None
# -- Other initialisation...
#
self._progress("Reading contacts...", 1, 10000)
contacts = []
- self.addresses = evolution.ebook.open_addressbook('default')
- for contact in self.addresses.get_all_contacts():
- contacts.append(Contact(self.addresses, contact))
+ self.address_book = self._get_address_book()
+ for contact in self.address_book.get_all_contacts():
+ contacts.append(Contact(self.address_book, contact))
# work out progress bar info
total_contacts = len(contacts) * len(self._services)
print "committing changes to:", contact.get_name(), contact
self._progress("Saving changes...", current_tick, total_ticks)
current_tick += tick_increment
- self.addresses.commit_contact(contact.get_econtact())
+ self.address_book.commit_contact(contact.get_econtact())
self._progress('Finished', 1, -1)
econtact.props.full_name = friend['name']
econtact.props.given_name = friend['first_name']
econtact.props.family_name = friend['last_name']
- contact = Contact(self.addresses, econtact)
+ contact = Contact(self.address_book, econtact)
- self.addresses.add_contact(contact.get_econtact())
+ self.address_book.add_contact(contact.get_econtact())
self.update_contact(contact, friend)
print "Created [%s]" % (contact.get_name())
+
+
+ # -----------------------------------------------------------------------
+ def _get_address_book(self):
+ return evolution.ebook.open_addressbook('default')