Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorFredrik Wendt <fredrik@wendt.se>
Wed, 9 Jun 2010 19:39:41 +0000 (20:39 +0100)
committerFredrik Wendt <fredrik@wendt.se>
Wed, 9 Jun 2010 19:39:41 +0000 (20:39 +0100)
Signed-off-by: Fredrik Wendt <fredrik@wendt.se>

package/src/org/maemo/hermes/engine/hermes.py

index c69aeaf..d33357f 100644 (file)
@@ -30,7 +30,7 @@ class Hermes:
         self.matched = []
         self.unmatched = []
         self.friends = {}
         self.matched = []
         self.unmatched = []
         self.friends = {}
-        self.addresses = None
+        self.address_book = None
         
         # -- Other initialisation...
         #
         
         # -- Other initialisation...
         #
@@ -43,9 +43,9 @@ class Hermes:
         self._progress("Reading contacts...", 1, 10000)
         
         contacts = []
         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)
 
         # work out progress bar info
         total_contacts = len(contacts) * len(self._services)
@@ -109,7 +109,7 @@ class Hermes:
             print "committing changes to:", contact.get_name(), contact
             self._progress("Saving changes...", current_tick, total_ticks)
             current_tick += tick_increment
             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)
         
             
         self._progress('Finished', 1, -1)
         
@@ -131,9 +131,14 @@ class Hermes:
         econtact.props.full_name = friend['name']
         econtact.props.given_name = friend['first_name']
         econtact.props.family_name = friend['last_name']
         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())
         self.update_contact(contact, friend)
         
         print "Created [%s]" % (contact.get_name())
+        
+        
+    # -----------------------------------------------------------------------
+    def _get_address_book(self):
+        return evolution.ebook.open_addressbook('default')

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment