You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(5) |
Jun
(43) |
Jul
(2) |
Aug
(6) |
Sep
(13) |
Oct
(5) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Stas Z. <sta...@us...> - 2005-06-10 09:23:50
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15923 Modified Files: Gmail.py Log Message: Added a comment as a reminder Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Gmail.py 10 Jun 2005 09:22:07 -0000 1.17 --- Gmail.py 10 Jun 2005 09:23:42 -0000 1.18 *************** *** 78,81 **** --- 78,84 ---- return (0,(name,pas)) + ######## Everything below this point will become part of a seperate module ##### + ######## Leave it here until the new contacts frontend is functional ########### + def upload_local_contacts(addrfile,ga): """Returns the contacts from the local file which don't have a ID entry. |
From: Stas Z. <sta...@us...> - 2005-06-10 09:22:19
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14894 Modified Files: Changelog Gmail.py GuiQT.py TODO Log Message: Commented out the old contacts parts Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** GuiQT.py 8 Jun 2005 13:33:20 -0000 1.33 --- GuiQT.py 10 Jun 2005 09:22:07 -0000 1.34 *************** *** 27,32 **** from AboutDialog_forms import FormAbout from HelpDialog_forms import FormHelp ! from AddressEditorDialog_forms import FormAddressEditor ! from AddressEditDialog_forms import FormAddressEdit from AddressDialog_forms import FormAddress --- 27,32 ---- from AboutDialog_forms import FormAbout from HelpDialog_forms import FormHelp ! ##from AddressEditorDialog_forms import FormAddressEditor ! ##from AddressEditDialog_forms import FormAddressEdit from AddressDialog_forms import FormAddress *************** *** 270,275 **** --- 270,278 ---- class Help(FormHelp): + """This will only be functional when GA is installed. When you run from sources + the help files path is not set properly.""" def __init__(self,parent=None, name=None, modal=0, fl=0): if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) + FormHelp.__init__(self,parent,name,modal,fl) try: text = open(os.path.join(helppath,'index.html'),'r').read() *************** *** 279,283 **** QMessageBox.Ok) return ! FormHelp.__init__(self,parent,name,modal,fl) self.textBrowser1.mimeSourceFactory().setFilePath(QStringList(helppath)) self.textBrowser1.setText(text) --- 282,286 ---- QMessageBox.Ok) return ! self.textBrowser1.mimeSourceFactory().setFilePath(QStringList(helppath)) self.textBrowser1.setText(text) *************** *** 297,305 **** def pushButtonEdit_clicked(self): # seems we must prevent the garbage collector from removing the observer # object so we make it a class attribute. ! self.Myobs = Observer(self._load) #ad = AddressBook.ABMainWindow(parent=self,observer=self.Myobs,file=addrfile) ! AddressBookEditorDialog(parent=self) def pushButtonOk_clicked(self): --- 300,309 ---- def pushButtonEdit_clicked(self): + pass # seems we must prevent the garbage collector from removing the observer # object so we make it a class attribute. ! ##self.Myobs = Observer(self._load) #ad = AddressBook.ABMainWindow(parent=self,observer=self.Myobs,file=addrfile) ! ##AddressBookEditorDialog(parent=self) def pushButtonOk_clicked(self): *************** *** 403,544 **** return objlist ! class AddressBookEditorDialog(FormAddressEditor): ! def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) ! FormAddressEditor.__init__(self,parent,name,modal,fl) ! self.parent = parent ! self.parent_observer = observer ! self.loaded_local_file = None ! self.ga = None# we want to test if we already have a Gmail account ! text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ ! "before making changes you should (re)import your contacts list.\n\n"+\ ! "Shall I import your Gmail contacts list now?" ! ans = QMessageBox.information(self,"Question", text, ! QMessageBox.Cancel,QMessageBox.Ok) ! if ans == 1: ! self.pushButtonImport_clicked() ! else: ! conlist = Gmail.load_addressfile(addrfile) ! self._load(conlist) ! self.loaded_local_file = 1 ! self.show() ! ! def pushButtonImport_clicked(self): ! print "FormAddressEditor.pushButtonImport_clicked()" ! # The observer is passed to Login, after succes Login will call the observers ! # _login_success method ! self.progress_dlg = ProgressDialog(self,"Importing contacts",2) ! obs = Observer(self._login_success) ! # this looks like a hack but Login is used by other objects also. ! Login(parent=self.parent,observer=obs) ! ! def _login_success(self,ga): ! """This is the method which is called through the observer by the Login.""" ! # ga is the Gmail account after a succseful login ! self.ga = ga ! self.progress_dlg.update() ! # Get the contacts and merge them with the local copy ! # The new local copy will be saved on disk and returnt to the caller. ! conlist = Gmail.import_contacts(addrfile,self.ga) ! self.loaded_local_file = None ! self._load(conlist) ! ! def _load( self, conlist): ! """Loads a contacts list into the widget.""" ! self.listViewContacts.clear() ! for line in conlist: ! item = QListViewItem(self.listViewContacts) ! try: ! item.setText(0,line[0]) ! item.setText(1,line[1]) ! item.setText(2,line[2][:60]) ! item.setText(3,line[3]) ! except Exception,info: ! if GQ_DEBUG: ! logging.warning("Reading addressbook failed, %s" % str(info)) ! print info ! return ! self.parent._load(addrfile)# fill the parents view ! try: ! self.progress_dlg.update() ! except: ! pass ! ! def pushButtonOk_clicked(self): ! print "FormAddressEditor.pushButtonOk_clicked()" ! text = "Your contacts are kept in a local file on this system and you\n"+\ ! "should summit it to your Gmail contacts list to keep everything\n"+\ ! "in sync.\n\n"+\ ! "WARNING,\n"+\ ! "when summiting these contacts to your Gmail account the online Gmail\n"+\ ! "the contacts list will be cleared and you will loose any changes you made online.\n\n"+\ ! "Should I upload these contacts to your Gmail accounts contacts list?" ! ans = QMessageBox.information(self,"Question", text, ! QMessageBox.Cancel,QMessageBox.Ok) ! if ans == 1: ! if not self.ga: ! obs = Observer(self._export_contacts) ! Login(parent=self.parent,observer=obs) ! else: ! self._export_contacts(self.ga) ! self.pushButtonCancel_clicked() ! ! def _export_contacts(self,ga): ! Gmail.export_contacts(addrfile,ga) ! ! def pushButtonCancel_clicked(self): ! # XXX we should also update the parent with the new contacts. ! self.done(1) ! ! def pushButtonEdit_clicked(self): ! print "FormAddressEditor.pushButtonEdit_clicked()" ! entry = self.listViewContacts.selectedItem() ! if not self.ga: ! text = "You're not logged in your Gmail account.\n"+\ ! "Hit the 'Import contacts' button to login and\n"+\ ! "then you can edit the contacts." ! QMessageBox.information(self,"Information", text,QMessageBox.Ok) ! return ! AddressBookEditDialog(entry,parent=self,ga=self.ga) ! ! def listView3_clicked(self,a0): ! print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" ! ! def lineEditSearch_textChanged(self,a0): ! print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" ! ! def pushButtonAdd_clicked(self): ! print "FormAddressEditor.pushButtonAdd_clicked(): Not implemented yet" ! ! def pushButtonRemove_clicked(self): ! print "FormAddressEditor.pushButtonRemove_clicked(): Not implemented yet" ! def pushButtonHelp_clicked(self): ! print "FormAddressEditor.pushButtonHelp_clicked(): Not implemented yet" ! ! class AddressBookEditDialog(FormAddressEdit): ! def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None,ga=None): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) ! FormAddressEdit.__init__(self,parent,name,modal,fl) ! self.parent = parent ! self.parent_observer = observer ! self.entry = entry ! self.ga = ga ! name, email, notes,self.id = entry.text(0),entry.text(1),entry.text(2),entry.text(3) ! if GQ_DEBUG: logging.debug("received entry: %s %s %s %s" % (name,email,notes,self.id)) ! self.lineEditName.setText(name) ! self.lineEditEmail.setText(email) ! self.textEditNotes.setText(notes) ! self.show() ! ! def pushButtonOk_clicked(self): ! print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" ! self.entry.repaint()#update the entry in the view ! name = str(self.lineEditName.text()) ! email = str(self.lineEditEmail.text()) ! notes = str(self.textEditNotes.text()) ! Gmail.store_address(addrfile,name,email,notes,id=self.id,ga=self.ga) ! ! def pushButtonCancel_clicked(self): ! self.done(1) --- 407,566 ---- return objlist ! ######## Everything below this point will become part of a seperate module ##### ! ######## Leave it here until the new contacts frontend is functional ########### ! ##class AddressBookEditorDialog(FormAddressEditor): ! ## def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! ## if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) ! ## FormAddressEditor.__init__(self,parent,name,modal,fl) ! ## self.parent = parent ! ## self.parent_observer = observer ! ## self.loaded_local_file = None ! ## self.selecteditem = None ! ## self.ga = None# we want to test if we already have a Gmail account ! ## text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ ! ## "before making changes you should (re)import your contacts list.\n\n"+\ ! ## "Shall I import your Gmail contacts list now?" ! ## ans = QMessageBox.information(self,"Question", text, ! ## QMessageBox.Cancel,QMessageBox.Ok) ! ## if ans == 1: ! ## self.pushButtonImport_clicked() ! ## else: ! ## conlist = Gmail.load_addressfile(addrfile) ! ## self._load(conlist) ! ## self.loaded_local_file = 1 ! ## self.show() ! ## ! ## def pushButtonImport_clicked(self): ! ## print "FormAddressEditor.pushButtonImport_clicked()" ! ## # The observer is passed to Login, after succes Login will call the observers ! ## # _login_success method ! ## self.progress_dlg = ProgressDialog(self,"Importing contacts",2) ! ## obs = Observer(self._login_success) ! ## # this looks like a hack but Login is used by other objects also. ! ## Login(parent=self.parent,observer=obs) ! ## ! ## def _login_success(self,ga): ! ## """This is the method which is called through the observer by the Login.""" ! ## # ga is the Gmail account after a succseful login ! ## self.ga = ga ! ## self.progress_dlg.update() ! ## # Get the contacts and merge them with the local copy ! ## # The new local copy will be saved on disk and returnt to the caller. ! ## conlist = Gmail.import_contacts(addrfile,self.ga) ! ## self.loaded_local_file = None ! ## self._load(conlist) ! ## ! ## def _load( self, conlist): ! ## """Loads a contacts list into the widget.""" ! ## self.listViewContacts.clear() ! ## nameshash = {}# used also as a lookup hash ! ## for line in conlist: ! ## item = QListViewItem(self.listViewContacts) ! ## try: ! ## nameshash[line[0]] = item ! ## item.setText(0,line[0]) ! ## item.setText(1,line[1]) ! ## item.setText(2,line[2][:60]) ! ## item.setText(3,line[3]) ! ## except Exception,info: ! ## if GQ_DEBUG: ! ## logging.warning("Reading addressbook failed, %s" % str(info)) ! ## print info ! ## return ! ## self.parent._load(addrfile)# fill the parents view ! ## try: ! ## self.progress_dlg.update() ! ## except: ! ## pass ! ## ! ## def pushButtonOk_clicked(self): ! ## print "FormAddressEditor.pushButtonOk_clicked()" ! ## text = "Your contacts are kept in a local file on this system and you\n"+\ ! ## "should summit it to your Gmail contacts list to keep everything\n"+\ ! ## "in sync.\n\n"+\ ! ## "WARNING,\n"+\ ! ## "when summiting these contacts to your Gmail account the online Gmail\n"+\ ! ## "the contacts list will be cleared and you will loose any changes you made online.\n\n"+\ ! ## "Should I upload these contacts to your Gmail accounts contacts list?" ! ## ans = QMessageBox.information(self,"Question", text, ! ## QMessageBox.Cancel,QMessageBox.Ok) ! ## if ans == 1: ! ## if not self.ga: ! ## obs = Observer(self._export_contacts) ! ## Login(parent=self.parent,observer=obs) ! ## else: ! ## self._export_contacts(self.ga) ! ## self.pushButtonCancel_clicked() ! ## ! ## def _export_contacts(self,ga): ! ## Gmail.export_contacts(addrfile,ga) ! ## ! ## def pushButtonCancel_clicked(self): ! ## # XXX we should also update the parent with the new contacts. ! ## self.done(1) ! ## ! ## def pushButtonEdit_clicked(self): ! ## print "FormAddressEditor.pushButtonEdit_clicked()" ! ## entry = self.listViewContacts.selectedItem() ! ## if not self.ga: ! ## text = "You're not logged in your Gmail account.\n"+\ ! ## "Hit the 'Import contacts' button to login and\n"+\ ! ## "then you can edit the contacts." ! ## QMessageBox.information(self,"Information", text,QMessageBox.Ok) ! ## return ! ## AddressBookEditDialog(entry,parent=self,ga=self.ga) ! ## ! ## def listView3_clicked(self,a0): ! ## print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" ! ## ! ## def lineEditSearch_textChanged(self,a0): ! ## print "FormAddressEditor.lineEditSearch_textChanged(const QString&)" ! ## if not self.nameshash: return ! ## # a0 is the text object ! ## txt = str(a0) ! ## for k,v in self.nameshash.items(): ! ## if txt in k: ! ## if self.selecteditem: ! ## self.selecteditem.setSelected(0) ! ## self.selecteditem.repaint() ! ## v.setSelected(1) ! ## v.repaint() ! ## self.selecteditem = v ! ## break ! ## ! ## def pushButtonAdd_clicked(self): ! ## print "FormAddressEditor.pushButtonAdd_clicked(): Not implemented yet" ! ## ! ## def pushButtonRemove_clicked(self): ! ## print "FormAddressEditor.pushButtonRemove_clicked(): Not implemented yet" ! ## ! ## def pushButtonHelp_clicked(self): ! ## print "FormAddressEditor.pushButtonHelp_clicked(): Not implemented yet" ! ## ! ##class AddressBookEditDialog(FormAddressEdit): ! ## def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None,ga=None): ! ## if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) ! ## FormAddressEdit.__init__(self,parent,name,modal,fl) ! ## self.parent = parent ! ## self.parent_observer = observer ! ## self.entry = entry ! ## self.ga = ga ! ## name, email, notes,self.id = entry.text(0),entry.text(1),entry.text(2),entry.text(3) ! ## if GQ_DEBUG: logging.debug("received entry: %s %s %s %s" % (name,email,notes,self.id)) ! ## self.lineEditName.setText(name) ! ## self.lineEditEmail.setText(email) ! ## self.textEditNotes.setText(notes) ! ## self.show() ! ## ! ## def pushButtonOk_clicked(self): ! ## print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" ! ## self.entry.repaint()#update the entry in the view ! ## name = str(self.lineEditName.text()) ! ## email = str(self.lineEditEmail.text()) ! ## notes = str(self.textEditNotes.text()) ! ## Gmail.store_address(addrfile,name,email,notes,id=self.id,ga=self.ga) ! ## ! ## def pushButtonCancel_clicked(self): ! ## self.done(1) Index: Changelog =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Changelog,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Changelog 6 Jun 2005 18:26:08 -0000 1.15 --- Changelog 10 Jun 2005 09:22:07 -0000 1.16 *************** *** 2,7 **** * Replaced addressbook with a frontend for the Gmail contacts. * Added some progress dialogs. - * GA now saves the contacts to disk in case there's a error in handling - the online Gmail contacts. * Fork of libgmail is now complete, and it's called libgmail2. * Changed the debugging output. --- 2,5 ---- Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TODO 8 Jun 2005 13:33:20 -0000 1.12 --- TODO 10 Jun 2005 09:22:07 -0000 1.13 *************** *** 11,12 **** --- 11,16 ---- Add button callbacks Check if the logic is sound and we don't loose contacts + + Contacts stuff still sucks (local) + + Make sure any progressdialogs are closed when a cancel button is pressed. Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Gmail.py 8 Jun 2005 12:28:17 -0000 1.16 --- Gmail.py 10 Jun 2005 09:22:07 -0000 1.17 *************** *** 119,122 **** --- 119,124 ---- # And upload it to Gmail upload_local_contacts(addrfile,ga) + # Retrieve Gmail contacts so that we have get an id for the new contact. + import_contacts(addrfile,ga) # stuff is stored in a file like this: # name&&addr&¬es&&id |
From: Stas Z. <sta...@us...> - 2005-06-08 13:33:36
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1325 Modified Files: GuiQT.py TODO Log Message: Minor update Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** GuiQT.py 8 Jun 2005 12:28:17 -0000 1.32 --- GuiQT.py 8 Jun 2005 13:33:20 -0000 1.33 *************** *** 525,533 **** self.entry = entry self.ga = ga ! self.name, self.email, self.notes,self.id = entry.text(0),entry.text(1),entry.text(2),entry.text(3) ! if GQ_DEBUG: logging.debug("received entry: %s %s %s %s" % (self.name,self.email,self.notes,self.id)) ! self.lineEditName.setText(self.name) ! self.lineEditEmail.setText(self.email) ! self.textEditNotes.setText(self.notes) self.show() --- 525,533 ---- self.entry = entry self.ga = ga ! name, email, notes,self.id = entry.text(0),entry.text(1),entry.text(2),entry.text(3) ! if GQ_DEBUG: logging.debug("received entry: %s %s %s %s" % (name,email,notes,self.id)) ! self.lineEditName.setText(name) ! self.lineEditEmail.setText(email) ! self.textEditNotes.setText(notes) self.show() *************** *** 535,539 **** print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! Gmail.store_address(addrfile,self.name,self.email,self.notes,id=self.id,ga=self.ga) def pushButtonCancel_clicked(self): --- 535,542 ---- print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! name = str(self.lineEditName.text()) ! email = str(self.lineEditEmail.text()) ! notes = str(self.textEditNotes.text()) ! Gmail.store_address(addrfile,name,email,notes,id=self.id,ga=self.ga) def pushButtonCancel_clicked(self): Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TODO 8 Jun 2005 12:28:17 -0000 1.11 --- TODO 8 Jun 2005 13:33:20 -0000 1.12 *************** *** 9,13 **** New addressbook ! edit contact doesn't work as it should. ! Check if the logic is sound and we don't loose contacts --- 9,12 ---- New addressbook ! Add button callbacks Check if the logic is sound and we don't loose contacts |
From: Stas Z. <sta...@us...> - 2005-06-08 12:28:27
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29431 Modified Files: AboutDialog_forms.py AddressDialog.ui AddressDialog_forms.py AddressEditDialog_forms.py AddressEditorDialog_forms.py Gmail.py GmailAgent.py GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py TODO Log Message: Debugged contacts frontend Added some more features. Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Gmail.py 6 Jun 2005 18:26:08 -0000 1.15 --- Gmail.py 8 Jun 2005 12:28:17 -0000 1.16 *************** *** 23,26 **** --- 23,27 ---- def login(name,pas): + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: login") ga = libgmail2.GmailAccount(name,pas) try: *************** *** 34,37 **** --- 35,39 ---- def send_message(obj): """obj is a class with all the info, see GuiQt.py.win.send_message""" + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: send_message") header = obj.mailheader *************** *** 48,51 **** --- 50,54 ---- def store_login(name,pas): + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: store_login") rcfile = os.path.expanduser('~/.gmailagent') configdict = ConfigParser.ConfigParser() *************** *** 64,67 **** --- 67,71 ---- def load_login(rcfile): + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: load_login") configdict = ConfigParser.ConfigParser() #rcfile = os.path.expanduser('~/.gmailagent') *************** *** 80,86 **** This function is called whenever the user logs into Gmail. Returns error message on faillure, None on succes.""" ! if GM_DEBUG: logging.debug("Starting upload_local_contacts") contacts = load_addressfile(addrfile) for line in contacts: if not line[3]: logging.debug("Adding %s %s %s %s to Gmail" % line) --- 84,91 ---- This function is called whenever the user logs into Gmail. Returns error message on faillure, None on succes.""" ! if GM_DEBUG: logging.debug("\n>>>>>>>> Function: upload_local_contacts") contacts = load_addressfile(addrfile) for line in contacts: + if GM_DEBUG: logging.debug("Found local contact %s %s %s %s" % line) if not line[3]: logging.debug("Adding %s %s %s %s to Gmail" % line) *************** *** 88,97 **** return ("Unable to add contact %s %s %s %s" % line) # Now we reload the contacts to create a new local contacts list ! import_contacts(addrfile,ga) ! def store_address(addrfile,name,addr,notes='',id=''): """The contacts will be stored in the local copy on disk. ! If the id is given """ # stuff is stored in a file like this: # name&&addr&¬es&&id --- 93,122 ---- return ("Unable to add contact %s %s %s %s" % line) # Now we reload the contacts to create a new local contacts list ! #import_contacts(addrfile,ga) ! ! def store_address(addrfile,name,addr,notes='',id='',ga=None): """The contacts will be stored in the local copy on disk. ! If the id is given we assume the contact has a valid Gmail id and ! the contact is removed from the online contacts and replaced by the ! given contact. It will get a new id from Gmail. """ + if GM_DEBUG: + logging.debug("\n>>>>>>>> Function: store_address") + logging.debug("store contact %s %s %s %s %s" % (name,addr,notes,id,ga)) + if id and ga: + if GM_DEBUG: logging.debug("Found id, removing original contact first") + contacts = ga.getContacts() + contact = contacts.getContactById(id) + if contact: + if not ga.removeContact(contact): + logging.warning("Failed to remove contact %s" % contact) + else: + # Build the new local file with the contacts from Gmail + import_contacts(addrfile,ga) + # now we add the new contact to the local file + store_address(addrfile,name,addr,notes) + # And upload it to Gmail + upload_local_contacts(addrfile,ga) # stuff is stored in a file like this: # name&&addr&¬es&&id *************** *** 113,116 **** --- 138,142 ---- # It's a new entry line = "%s&&%s&&%s&&%s\n" % (name,addr,notes,id) + if GM_DEBUG: logging.debug("Found new contact %s" % line) try: f = open(addrfile,'a') *************** *** 124,127 **** --- 150,154 ---- def load_addressfile(filename): + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: load_addressfile") try: f = open(filename,'r') *************** *** 139,145 **** def import_contacts(addrfile,ga): """This gets the gmail contacts create a new local contacts list on disk.""" contacts = ga.getContacts().getAllContacts() if contacts: ! # remove local file, we can remove it because the login method will make # that the contacts are syncronized. logging.debug("Removing local file") --- 166,175 ---- def import_contacts(addrfile,ga): """This gets the gmail contacts create a new local contacts list on disk.""" + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: import_contacts") + upload_local_contacts(addrfile,ga) contacts = ga.getContacts().getAllContacts() + logging.debug("Contacts imported:\n%s" % contacts) if contacts: ! # remove local file, we can remove it because the upload_local_contacts method will make sure # that the contacts are syncronized. logging.debug("Removing local file") *************** *** 160,163 **** --- 190,194 ---- It will return a message on any error. It returns None on succes.""" + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: export_contacts") entries = load_addressfile(addrfile) if len(entries) < 1: *************** *** 190,193 **** --- 221,225 ---- """Save the contact in case of an error. This is an attempt to prevent data loss in case of an error when interacting with Gmail contacts.""" + if GM_DEBUG: logging.debug("\n>>>>>>>> Function: save_contacts") try: f = open(os.path.expanduser('~/.GmailContacts.pickle'),'w') Index: AddressDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog.ui,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AddressDialog.ui 2 Jun 2005 13:33:16 -0000 1.4 --- AddressDialog.ui 8 Jun 2005 12:28:17 -0000 1.5 *************** *** 152,171 **** <widget class="QPushButton"> <property name="name"> - <cstring>pushButtonEdit</cstring> - </property> - <property name="geometry"> - <rect> - <x>20</x> - <y>360</y> - <width>106</width> - <height>26</height> - </rect> - </property> - <property name="text"> - <string>Edit addressbook</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> <cstring>pushButtonCancel</cstring> </property> --- 152,155 ---- *************** *** 289,292 **** --- 273,308 ---- </property> </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButtonImport</cstring> + </property> + <property name="geometry"> + <rect> + <x>160</x> + <y>360</y> + <width>120</width> + <height>26</height> + </rect> + </property> + <property name="text"> + <string>Import contacts</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>pushButtonEdit</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>360</y> + <width>110</width> + <height>26</height> + </rect> + </property> + <property name="text"> + <string>Edit addressbook</string> + </property> + </widget> </widget> <images> *************** *** 347,350 **** --- 363,372 ---- <slot>lineEditSearch_textChanged(const QString&)</slot> </connection> + <connection> + <sender>pushButtonImport</sender> + <signal>clicked()</signal> + <receiver>FormAddress</receiver> + <slot>pushButtonImport_clicked()</slot> + </connection> </connections> <includes> Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AddressDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.12 --- AddressDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.13 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 140,146 **** self.textLabel3.setGeometry(QRect(10,320,120,20)) - self.pushButtonEdit = QPushButton(self,"pushButtonEdit") - self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) - self.pushButtonCancel = QPushButton(self,"pushButtonCancel") self.pushButtonCancel.setGeometry(QRect(460,360,106,26)) --- 140,143 ---- *************** *** 166,169 **** --- 163,172 ---- self.listViewBook.setShowSortIndicator(1) + self.pushButtonImport = QPushButton(self,"pushButtonImport") + self.pushButtonImport.setGeometry(QRect(160,360,120,26)) + + self.pushButtonEdit = QPushButton(self,"pushButtonEdit") + self.pushButtonEdit.setGeometry(QRect(20,360,110,26)) + self.languageChange() *************** *** 179,182 **** --- 182,186 ---- self.connect(self.listViewSend,SIGNAL("clicked(QListViewItem*)"),self.listViewSend_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) + self.connect(self.pushButtonImport,SIGNAL("clicked()"),self.pushButtonImport_clicked) *************** *** 190,194 **** QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) self.textLabel3.setText(self.__tr("Search for a name:")) - self.pushButtonEdit.setText(self.__tr("Edit addressbook")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.pushButtonOk.setText(self.__tr("Ok")) --- 194,197 ---- *************** *** 197,200 **** --- 200,205 ---- self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) + self.pushButtonImport.setText(self.__tr("Import contacts")) + self.pushButtonEdit.setText(self.__tr("Edit addressbook")) Index: AddressEditorDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog_forms.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AddressEditorDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.5 --- AddressEditorDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.6 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AboutDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.22 --- AboutDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.23 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GuiQT.py 6 Jun 2005 18:26:08 -0000 1.31 --- GuiQT.py 8 Jun 2005 12:28:17 -0000 1.32 *************** *** 61,64 **** --- 61,65 ---- """Classic observer to monitor changes in some model""" def __init__(self,func): + if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) self.func = func def update(self,*args): *************** *** 73,91 **** class ProgressDialog: ! def __init__(self,parent,label='',steps=1,modal=0): ! self.QPD = QProgressDialog(label,"Dismiss", steps, parent, "progress", modal) ! self.index = 1 ! self.parent = parent ! self.QPD.show() ! def set_label(self,label): ! qlabel = QLabel(self.parent,label) ! self.QPD.setLabel(qlabel) ! def update(self): ! self.QPD.setProgress(self.index) ! Qapplication.processEvents() ! self.index += 1 class win(Form1): def __init__(self, parent=None, name=None, fl=0,att=[],application=None): Form1.__init__(self,parent,name,fl) global Qapplication --- 74,94 ---- class ProgressDialog: ! def __init__(self,parent,label='',steps=1,modal=0): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) ! self.QPD = QProgressDialog(label,"Dismiss", steps, parent, "progress", modal) ! self.index = 1 ! self.parent = parent ! self.QPD.show() ! def set_label(self,label): ! qlabel = QLabel(self.parent,label) ! self.QPD.setLabel(qlabel) ! def update(self): ! self.QPD.setProgress(self.index) ! Qapplication.processEvents() ! self.index += 1 class win(Form1): def __init__(self, parent=None, name=None, fl=0,att=[],application=None): + if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) Form1.__init__(self,parent,name,fl) global Qapplication *************** *** 107,110 **** --- 110,114 ---- def pushButtonSend_clicked(self): + # get all the data from the dialog modal=0 *************** *** 117,121 **** to = str(self.lineEditTo.text()) if not to: ! if GQ_DEBUG: logging.warning("MyDialog.buttonSend_clicked()\nYou must specify a recipient address") QMessageBox.critical(self, "ERROR", "You must specify a recipient address", --- 121,126 ---- to = str(self.lineEditTo.text()) if not to: ! if GQ_DEBUG: ! logging.warning("No recipient address specified") QMessageBox.critical(self, "ERROR", "You must specify a recipient address", *************** *** 179,183 **** def pushButtonAdress_clicked(self): # lineEditTo.setCurrentText will called when the model calls the update method of the obs ! """The 'To:' field is filled by the AddressBookDialog through the observer""" self.obs = Observer(self.lineEditTo.setText) ad = AddressBookDialog(self,observer=self.obs) --- 184,188 ---- def pushButtonAdress_clicked(self): # lineEditTo.setCurrentText will called when the model calls the update method of the obs ! #The 'To:' field is filled by the AddressBookDialog through the observer self.obs = Observer(self.lineEditTo.setText) ad = AddressBookDialog(self,observer=self.obs) *************** *** 191,194 **** --- 196,200 ---- class Login(FormLogin): def __init__(self, parent=None, name=None, modal=1, fl=0,observer=None): + if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) FormLogin.__init__(self,parent,name,modal,fl) self.parent = parent *************** *** 233,238 **** if self.obs: self.obs.update(result[2]) ! self.progress_dlg.set_label("Uploading new contacts, if any") ! Gmail.upload_local_contacts(addrfile,result[2]) self.progress_dlg.update() if self.keepsettings: --- 239,245 ---- if self.obs: self.obs.update(result[2]) ! #if GQ_DEBUG: logging.debug("Uploading new contacts, if any") ! #self.progress_dlg.set_label("Uploading new contacts, if any") ! #Gmail.upload_local_contacts(addrfile,result[2]) self.progress_dlg.update() if self.keepsettings: *************** *** 252,255 **** --- 259,263 ---- class About(FormAbout): def __init__(self, parent=None, name=None, modal=0, fl=0): + if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) import version FormAbout.__init__(self,parent,name,modal,fl) *************** *** 263,266 **** --- 271,275 ---- class Help(FormHelp): def __init__(self,parent=None, name=None, modal=0, fl=0): + if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) try: text = open(os.path.join(helppath,'index.html'),'r').read() *************** *** 274,290 **** self.textBrowser1.setText(text) self.show() ! ! class AddressBookDialog(FormAddress): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("AddressBookDialog start") FormAddress.__init__(self,parent,name,modal,fl) self.parent = parent self.selecteditem = None self.parent_observer = observer ! if os.path.exists(file): self._load(file) - self.filename = file self.show() --- 283,297 ---- self.textBrowser1.setText(text) self.show() ! class AddressBookDialog(FormAddress): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) FormAddress.__init__(self,parent,name,modal,fl) self.parent = parent self.selecteditem = None self.parent_observer = observer ! self.progress_dlg = None if os.path.exists(file): self._load(file) self.show() *************** *** 345,349 **** self.selecteditem = v break ! def _load( self, filename): """Loads a local address file into the widget.""" --- 352,373 ---- self.selecteditem = v break ! ! def pushButtonImport_clicked(self): ! print "FormAddressEditor.pushButtonImport_clicked()" ! # The observer is passed to Login, after succes Login will call the observers ! # _login_success method ! obs = Observer(self._login_success) ! # this looks like a hack but Login is used by other objects also. ! Login(parent=self.parent,observer=obs) ! ! def _login_success(self,ga): ! """This is the method which is called through the observer by the Login.""" ! # ga is the Gmail account after a succseful login ! self.ga = ga ! # Get the contacts and merge them with the local copy ! # The new local copy will be saved on disk and returnt to the caller. ! Gmail.import_contacts(addrfile,self.ga) ! self._load(addrfile) ! def _load( self, filename): """Loads a local address file into the widget.""" *************** *** 365,369 **** if GQ_DEBUG: logging.debug("nameshash, %s" % nameshash) self.nameshash = nameshash ! def getSelection(self,listview): """Get all the selected items in a listview""" --- 389,393 ---- if GQ_DEBUG: logging.debug("nameshash, %s" % nameshash) self.nameshash = nameshash ! def getSelection(self,listview): """Get all the selected items in a listview""" *************** *** 381,385 **** class AddressBookEditorDialog(FormAddressEditor): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("AddressBookEditorDialog start") FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent --- 405,409 ---- class AddressBookEditorDialog(FormAddressEditor): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent *************** *** 404,416 **** # The observer is passed to Login, after succes Login will call the observers # _login_success method - if self.loaded_local_file: - text = "You have an local contacts file loaded, when you import one\n"+\ - "from Gmail it will be merged with the local file.\n\n"+\ - "Do you want to import Gmail contacts and merge them with\n"+\ - "your local copy?" - ans = QMessageBox.information(self,"Question", text, - QMessageBox.Cancel,QMessageBox.Ok) - if ans != 1: - return self.progress_dlg = ProgressDialog(self,"Importing contacts",2) obs = Observer(self._login_success) --- 428,431 ---- *************** *** 445,449 **** return self.parent._load(addrfile)# fill the parents view ! self.progress_dlg.update() def pushButtonOk_clicked(self): --- 460,467 ---- return self.parent._load(addrfile)# fill the parents view ! try: ! self.progress_dlg.update() ! except: ! pass def pushButtonOk_clicked(self): *************** *** 454,458 **** "WARNING,\n"+\ "when summiting these contacts to your Gmail account the online Gmail\n"+\ ! "contacts list will be cleared and you will loose any changes you made online.\n\n"+\ "Should I upload these contacts to your Gmail accounts contacts list?" ans = QMessageBox.information(self,"Question", text, --- 472,476 ---- "WARNING,\n"+\ "when summiting these contacts to your Gmail account the online Gmail\n"+\ ! "the contacts list will be cleared and you will loose any changes you made online.\n\n"+\ "Should I upload these contacts to your Gmail accounts contacts list?" ans = QMessageBox.information(self,"Question", text, *************** *** 501,505 **** class AddressBookEditDialog(FormAddressEdit): def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None,ga=None): ! if GQ_DEBUG: logging.debug("AddressBookEditDialog start") FormAddressEdit.__init__(self,parent,name,modal,fl) self.parent = parent --- 519,523 ---- class AddressBookEditDialog(FormAddressEdit): def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None,ga=None): ! if GQ_DEBUG: logging.debug("\n>>>>>>>> Class: %s" % self.__class__.__name__) FormAddressEdit.__init__(self,parent,name,modal,fl) self.parent = parent *************** *** 517,521 **** print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! Gmail.store_address(addrfile,self.name,self.email,self.notes,self.id) def pushButtonCancel_clicked(self): --- 535,539 ---- print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! Gmail.store_address(addrfile,self.name,self.email,self.notes,id=self.id,ga=self.ga) def pushButtonCancel_clicked(self): Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MainWin_forms.py 6 Jun 2005 18:26:08 -0000 1.25 --- MainWin_forms.py 8 Jun 2005 12:28:17 -0000 1.26 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Mon Jun 6 20:34:32 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HelpDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.11 --- HelpDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.12 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AddressEditDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.6 --- AddressEditDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.7 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** LoginDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.25 --- LoginDialog_forms.py 8 Jun 2005 12:28:17 -0000 1.26 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Mon Jun 6 20:34:33 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GmailAgent.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GmailAgent.py 6 Jun 2005 18:26:08 -0000 1.14 --- GmailAgent.py 8 Jun 2005 12:28:17 -0000 1.15 *************** *** 21,25 **** #import out# enable this to redirect streams to a file, when run from a app ! GM_DEBUG = 0 from qt import * import sys,os --- 21,25 ---- #import out# enable this to redirect streams to a file, when run from a app ! GM_DEBUG = 1 from qt import * import sys,os *************** *** 28,61 **** import logging - class LogStream: - """Class to redirect debug messages to a file like object. - The GUI could call the 'set_stream' method to redirect the stream to a object. - This object must have a write() method. - Bt default this class redirect to sys.stdout""" - def __init__(self): - self.out = sys.stdout - def set_stream(self,strm): - self.out = strm - def write(self,stuff): - self.out.write(stuff) - def flush(self): - pass ! try: ! rootLogger = logging.getLogger('Default') ! rootLogger.setLevel(logging.DEBUG) ! ls_default = LogStream() ! streamHandler = logging.StreamHandler(ls_default) ! formatter = logging.Formatter('GmailAgent: %(levelname)-8s %(message)s') ! streamHandler.setFormatter(formatter) ! rootLogger.addHandler(streamHandler) ! ! ## logging.basicConfig(level=logging.DEBUG,\ ! ## format='GmailAgent:%(asctime)s %(levelname)s %(message)s') except TypeError: # Python <=2.3? pass ! ### We should use a file object to the LogStream object ####### for debugging ##f = open('/tmp/gmailagent.out','w') --- 28,40 ---- import logging ! try: ! logging.basicConfig(level=logging.DEBUG,\ ! format='GmailAgent:%(module)s,%(lineno)d; %(levelname)s %(message)s') except TypeError: # Python <=2.3? pass ! ### We should use a file object to the LogStream object?? ####### for debugging ##f = open('/tmp/gmailagent.out','w') *************** *** 110,113 **** --- 89,93 ---- ### Start GUI + if GM_DEBUG: print "\n===== Starting GUI =======" import GuiQT app = QApplication(sys.argv) Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TODO 6 Jun 2005 18:26:08 -0000 1.10 --- TODO 8 Jun 2005 12:28:17 -0000 1.11 *************** *** 9,12 **** New addressbook ! upload_local_contacts needs to be finished Check if the logic is sound and we don't loose contacts --- 9,13 ---- New addressbook ! edit contact doesn't work as it should. ! Check if the logic is sound and we don't loose contacts |
From: Stas Z. <sta...@us...> - 2005-06-06 18:26:18
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28749 Modified Files: AboutDialog_forms.py AddressDialog_forms.py AddressEditDialog_forms.py AddressEditorDialog.ui AddressEditorDialog_forms.py Changelog Gmail.py GmailAgent.e3p GmailAgent.py GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py Makefile TODO Log Message: Refactor the contacts, again :-) Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Gmail.py 3 Jun 2005 15:27:56 -0000 1.14 --- Gmail.py 6 Jun 2005 18:26:08 -0000 1.15 *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! GM_DEBUG = 0 import libgmail2,urllib2,logging,ConfigParser,os,pickle --- 19,23 ---- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! GM_DEBUG = 1 import libgmail2,urllib2,logging,ConfigParser,os,pickle *************** *** 74,78 **** --- 74,97 ---- return (0,(name,pas)) + def upload_local_contacts(addrfile,ga): + """Returns the contacts from the local file which don't have a ID entry. + Contacts without an ID are considered local only and must be added to the Gmail + contacts list. + This function is called whenever the user logs into Gmail. + Returns error message on faillure, None on succes.""" + if GM_DEBUG: logging.debug("Starting upload_local_contacts") + contacts = load_addressfile(addrfile) + for line in contacts: + if not line[3]: + logging.debug("Adding %s %s %s %s to Gmail" % line) + if not ga.addContact(line[0],line[1],line[2]):#libgmail2 checks for exception + return ("Unable to add contact %s %s %s %s" % line) + # Now we reload the contacts to create a new local contacts list + import_contacts(addrfile,ga) + def store_address(addrfile,name,addr,notes='',id=''): + """The contacts will be stored in the local copy on disk. + If the id is given + """ # stuff is stored in a file like this: # name&&addr&¬es&&id *************** *** 90,94 **** else: for line in lines: ! if id in line and name in line and addr in line: return # It's a new entry --- 109,113 ---- else: for line in lines: ! if name in line and addr in line: return # It's a new entry *************** *** 119,124 **** def import_contacts(addrfile,ga): ! """This adds the gmail contacts to the address file and saves it to disk""" contacts = ga.getContacts().getAllContacts() for obj in contacts: store_address(addrfile,\ --- 138,150 ---- def import_contacts(addrfile,ga): ! """This gets the gmail contacts create a new local contacts list on disk.""" contacts = ga.getContacts().getAllContacts() + if contacts: + # remove local file, we can remove it because the login method will make + # that the contacts are syncronized. + logging.debug("Removing local file") + open(addrfile,'w').close() + else: + return for obj in contacts: store_address(addrfile,\ *************** *** 144,148 **** save_contacts(contacts) for contact in contacts: ! if GM_DEBUG: logging.debug("Removing contact", contact) ga.removeContact(contact) except Exception,info: --- 170,174 ---- save_contacts(contacts) for contact in contacts: ! if GM_DEBUG: logging.debug("Removing contact %s", contact) ga.removeContact(contact) except Exception,info: *************** *** 152,158 **** return "An error occured, tried to save your contacts to\n%s and %s" %\ ('~/.GmailContacts.txt','~/.GmailContacts.pickle') ! # Now we fill the contacts list again try: for entry in entries: apply(ga.addContact,entry[:-1]) except Exception,info: --- 178,185 ---- return "An error occured, tried to save your contacts to\n%s and %s" %\ ('~/.GmailContacts.txt','~/.GmailContacts.pickle') ! # Now we fill the contacts list again from the local file. try: for entry in entries: + if GM_DEBUG: logging.debug("Adding contact %s", entry) apply(ga.addContact,entry[:-1]) except Exception,info: Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** AddressDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.11 --- AddressDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.12 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: Changelog =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Changelog,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Changelog 16 May 2005 08:53:14 -0000 1.14 --- Changelog 6 Jun 2005 18:26:08 -0000 1.15 *************** *** 1,2 **** --- 1,10 ---- + GmailAgent (0.7) + * Replaced addressbook with a frontend for the Gmail contacts. + * Added some progress dialogs. + * GA now saves the contacts to disk in case there's a error in handling + the online Gmail contacts. + * Fork of libgmail is now complete, and it's called libgmail2. + * Changed the debugging output. + GmailAgent (0.6) * New release. Index: GmailAgent.e3p =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.e3p,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GmailAgent.e3p 3 Jun 2005 15:27:56 -0000 1.13 --- GmailAgent.e3p 6 Jun 2005 18:26:08 -0000 1.14 *************** *** 2,6 **** <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-02, 21:21:40 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> --- 2,6 ---- <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-06, 17:29:27 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> Index: AddressEditorDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog_forms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AddressEditorDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.4 --- AddressEditorDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.5 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Fri Jun 3 20:57:50 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 23,35 **** - self.listViewContacts = QListView(self,"listViewContacts") - self.listViewContacts.addColumn(self.__tr("Name")) - self.listViewContacts.addColumn(self.__tr("Email address")) - self.listViewContacts.addColumn(self.__tr("Notes")) - self.listViewContacts.setGeometry(QRect(10,40,560,290)) - self.listViewContacts.setSelectionMode(QListView.Single) - self.listViewContacts.setAllColumnsShowFocus(1) - self.listViewContacts.setShowSortIndicator(1) - self.textLabel1_2 = QLabel(self,"textLabel1_2") self.textLabel1_2.setGeometry(QRect(10,350,100,20)) --- 23,26 ---- *************** *** 60,63 **** --- 51,67 ---- self.pushButtonEdit.setGeometry(QRect(130,10,90,26)) + self.listViewContacts = QListView(self,"listViewContacts") + self.listViewContacts.addColumn(self.__tr("Name")) + self.listViewContacts.addColumn(self.__tr("Email address")) + self.listViewContacts.addColumn(self.__tr("Notes")) + self.listViewContacts.addColumn(self.__tr("Gmail ID")) + self.listViewContacts.header().setClickEnabled(0,self.listViewContacts.header().count() - 1) + self.listViewContacts.setGeometry(QRect(10,40,560,290)) + self.listViewContacts.setFrameShape(QListView.StyledPanel) + self.listViewContacts.setFrameShadow(QListView.Sunken) + self.listViewContacts.setSelectionMode(QListView.Single) + self.listViewContacts.setAllColumnsShowFocus(1) + self.listViewContacts.setShowSortIndicator(1) + self.languageChange() *************** *** 78,87 **** def languageChange(self): self.setCaption(self.__tr("GmailAgent - Addressbook editor")) - self.listViewContacts.header().setLabel(0,self.__tr("Name")) - self.listViewContacts.header().setLabel(1,self.__tr("Email address")) - self.listViewContacts.header().setLabel(2,self.__tr("Notes")) - self.listViewContacts.clear() - item = QListViewItem(self.listViewContacts,None) - self.textLabel1_2.setText(self.__tr("Search a contact:")) self.pushButtonAdd.setText(self.__tr("Add contact")) --- 82,85 ---- *************** *** 94,97 **** --- 92,102 ---- self.pushButtonEdit.setText(self.__tr("Edit contact")) QToolTip.add(self.pushButtonEdit,self.__tr("Edit a selected contact")) + self.listViewContacts.header().setLabel(0,self.__tr("Name")) + self.listViewContacts.header().setLabel(1,self.__tr("Email address")) + self.listViewContacts.header().setLabel(2,self.__tr("Notes")) + self.listViewContacts.header().setLabel(3,self.__tr("Gmail ID")) + self.listViewContacts.clear() + item = QListViewItem(self.listViewContacts,None) + Index: Makefile =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile 2 Jun 2005 13:33:17 -0000 1.8 --- Makefile 6 Jun 2005 18:26:08 -0000 1.9 *************** *** 8,10 **** pyuic AddressEditDialog.ui -o AddressEditDialog_forms.py pyuic AddressEditorDialog.ui -o AddressEditorDialog_forms.py ! \ No newline at end of file --- 8,10 ---- pyuic AddressEditDialog.ui -o AddressEditDialog_forms.py pyuic AddressEditorDialog.ui -o AddressEditorDialog_forms.py ! \ No newline at end of file Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AboutDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.21 --- AboutDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.22 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** GuiQT.py 3 Jun 2005 18:59:53 -0000 1.30 --- GuiQT.py 6 Jun 2005 18:26:08 -0000 1.31 *************** *** 71,80 **** txt, "Not implemented yet", QMessageBox.Ok) ! class win(Form1): def __init__(self, parent=None, name=None, fl=0,att=[],application=None): Form1.__init__(self,parent,name,fl) ! self.app = application ! self.nameshash = {} self.mailheader = {'to':'','subject':'','cc':'','bc':''} self.mailbody = '' --- 71,94 ---- txt, "Not implemented yet", QMessageBox.Ok) ! ! class ProgressDialog: ! def __init__(self,parent,label='',steps=1,modal=0): ! self.QPD = QProgressDialog(label,"Dismiss", steps, parent, "progress", modal) ! self.index = 1 ! self.parent = parent ! self.QPD.show() ! def set_label(self,label): ! qlabel = QLabel(self.parent,label) ! self.QPD.setLabel(qlabel) ! def update(self): ! self.QPD.setProgress(self.index) ! Qapplication.processEvents() ! self.index += 1 ! class win(Form1): def __init__(self, parent=None, name=None, fl=0,att=[],application=None): Form1.__init__(self,parent,name,fl) ! global Qapplication ! Qapplication = application self.mailheader = {'to':'','subject':'','cc':'','bc':''} self.mailbody = '' *************** *** 85,88 **** --- 99,103 ---- def closeEvent(self,ev): + """Called when the user closes the window""" ans = QMessageBox.information(self, "Question", "Do you really want to quit?", *************** *** 98,104 **** steps = 2 label = "Sending message,\nPlease wait" ! self.progress_dlg = QProgressDialog(label,"Dismiss", steps, self, "progress", modal) ! self.progress_dlg.show() ! to = str(self.lineEditTo.text()) if not to: --- 113,118 ---- steps = 2 label = "Sending message,\nPlease wait" ! self.progress_dlg = ProgressDialog(self,label,steps) ! to = str(self.lineEditTo.text()) if not to: *************** *** 122,127 **** """This will send the message to Gmail and stores the address(es) in the addressbook.""" ! self.progress_dlg.setProgress(1) ! self.app.processEvents()# needed to update progress_dlg obj = Message() --- 136,140 ---- """This will send the message to Gmail and stores the address(es) in the addressbook.""" ! self.progress_dlg.update() obj = Message() *************** *** 138,143 **** QMessageBox.Ok) else: ! self.progress_dlg.setProgress(2) ! self.app.processEvents() adrlist = self.mailheader['to'].split(',') for adr in adrlist: --- 151,155 ---- QMessageBox.Ok) else: ! self.progress_dlg.update() adrlist = self.mailheader['to'].split(',') for adr in adrlist: *************** *** 152,156 **** "Info",result[1], QMessageBox.Ok) ! def Form1Help_activate(self): print "Form1.Form1Help_activate()" --- 164,169 ---- "Info",result[1], QMessageBox.Ok) ! self.progress_dlg = None# cleanup ! def Form1Help_activate(self): print "Form1.Form1Help_activate()" *************** *** 202,207 **** if not log or not pas: return - #self.parent.login['login'] = log - #self.parent.login['passwrd'] = pas self._do_login(log,pas) --- 215,218 ---- *************** *** 211,216 **** --- 222,229 ---- # int is 0 or 1; 0 is succes, 1 is faillure # ga is the Gmail account object + self.progress_dlg = ProgressDialog(self,"Log into Gmail",2) result = Gmail.login(log,pas) self.pushButtonCancel_clicked() + self.progress_dlg.update() if result[0]: QMessageBox.critical(self, *************** *** 218,224 **** QMessageBox.Ok) else: - #self.parent.progress_dlg.setProgress(1) if self.obs: self.obs.update(result[2]) if self.keepsettings: result = Gmail.store_login(log,pas) --- 231,239 ---- QMessageBox.Ok) else: if self.obs: self.obs.update(result[2]) + self.progress_dlg.set_label("Uploading new contacts, if any") + Gmail.upload_local_contacts(addrfile,result[2]) + self.progress_dlg.update() if self.keepsettings: result = Gmail.store_login(log,pas) *************** *** 267,271 **** self.parent = parent self.selecteditem = None ! self.obs = observer if os.path.exists(file): --- 282,286 ---- self.parent = parent self.selecteditem = None ! self.parent_observer = observer if os.path.exists(file): *************** *** 290,295 **** if nameslist: names = ','.join(nameslist) ! if self.obs and names: ! self.obs.update(names) self.pushButtonCancel_clicked() --- 305,310 ---- if nameslist: names = ','.join(nameslist) ! if self.parent_observer and names: ! self.parent_observer.update(names) self.pushButtonCancel_clicked() *************** *** 373,378 **** self.ga = None# we want to test if we already have a Gmail account text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ ! "before making changes to this copy you should (re)import your\n"+\ ! "contacts list.\n\n"+\ "Shall I import your Gmail contacts list now?" ans = QMessageBox.information(self,"Question", text, --- 388,392 ---- self.ga = None# we want to test if we already have a Gmail account text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ ! "before making changes you should (re)import your contacts list.\n\n"+\ "Shall I import your Gmail contacts list now?" ans = QMessageBox.information(self,"Question", text, *************** *** 384,388 **** self._load(conlist) self.loaded_local_file = 1 - # XXX fill the widget with the vals from nameshash self.show() --- 398,401 ---- *************** *** 400,403 **** --- 413,417 ---- if ans != 1: return + self.progress_dlg = ProgressDialog(self,"Importing contacts",2) obs = Observer(self._login_success) # this looks like a hack but Login is used by other objects also. *************** *** 408,411 **** --- 422,426 ---- # ga is the Gmail account after a succseful login self.ga = ga + self.progress_dlg.update() # Get the contacts and merge them with the local copy # The new local copy will be saved on disk and returnt to the caller. *************** *** 423,429 **** item.setText(1,line[1]) item.setText(2,line[2][:60]) except Exception,info: ! if GQ_DEBUG: logging.warning("Reading addressbook failed, %s" % str(info)) ! return def pushButtonOk_clicked(self): --- 438,449 ---- item.setText(1,line[1]) item.setText(2,line[2][:60]) + item.setText(3,line[3]) except Exception,info: ! if GQ_DEBUG: ! logging.warning("Reading addressbook failed, %s" % str(info)) ! print info ! return ! self.parent._load(addrfile)# fill the parents view ! self.progress_dlg.update() def pushButtonOk_clicked(self): *************** *** 456,460 **** print "FormAddressEditor.pushButtonEdit_clicked()" entry = self.listViewContacts.selectedItem() ! AddressBookEditDialog(entry,parent=self) def listView3_clicked(self,a0): --- 476,486 ---- print "FormAddressEditor.pushButtonEdit_clicked()" entry = self.listViewContacts.selectedItem() ! if not self.ga: ! text = "You're not logged in your Gmail account.\n"+\ ! "Hit the 'Import contacts' button to login and\n"+\ ! "then you can edit the contacts." ! QMessageBox.information(self,"Information", text,QMessageBox.Ok) ! return ! AddressBookEditDialog(entry,parent=self,ga=self.ga) def listView3_clicked(self,a0): *************** *** 474,478 **** class AddressBookEditDialog(FormAddressEdit): ! def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): if GQ_DEBUG: logging.debug("AddressBookEditDialog start") FormAddressEdit.__init__(self,parent,name,modal,fl) --- 500,504 ---- class AddressBookEditDialog(FormAddressEdit): ! def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None,ga=None): if GQ_DEBUG: logging.debug("AddressBookEditDialog start") FormAddressEdit.__init__(self,parent,name,modal,fl) *************** *** 480,485 **** self.parent_observer = observer self.entry = entry ! self.name, self.email, self.notes = entry.text(0),entry.text(1),entry.text(2) ! if GQ_DEBUG: logging.debug("receiced entry: %s %s %s" % (self.name,self.email,self.notes)) self.lineEditName.setText(self.name) self.lineEditEmail.setText(self.email) --- 506,512 ---- self.parent_observer = observer self.entry = entry ! self.ga = ga ! self.name, self.email, self.notes,self.id = entry.text(0),entry.text(1),entry.text(2),entry.text(3) ! if GQ_DEBUG: logging.debug("received entry: %s %s %s %s" % (self.name,self.email,self.notes,self.id)) self.lineEditName.setText(self.name) self.lineEditEmail.setText(self.email) *************** *** 490,497 **** print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! Gmail.store_address(addrfile,self.name,self.email,self.notes) def pushButtonCancel_clicked(self): self.done(1) ! ! --- 517,523 ---- print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" self.entry.repaint()#update the entry in the view ! Gmail.store_address(addrfile,self.name,self.email,self.notes,self.id) def pushButtonCancel_clicked(self): self.done(1) ! Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** MainWin_forms.py 3 Jun 2005 18:59:53 -0000 1.24 --- MainWin_forms.py 6 Jun 2005 18:26:08 -0000 1.25 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** HelpDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.10 --- HelpDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.11 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AddressEditDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.5 --- AddressEditDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.6 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Fri Jun 3 20:57:50 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** LoginDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.24 --- LoginDialog_forms.py 6 Jun 2005 18:26:08 -0000 1.25 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Mon Jun 6 14:43:04 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GmailAgent.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GmailAgent.py 16 May 2005 09:56:24 -0000 1.13 --- GmailAgent.py 6 Jun 2005 18:26:08 -0000 1.14 *************** *** 27,37 **** # Perhaps it would be better to use getopt import logging try: ! logging.basicConfig(level=logging.DEBUG,\ ! format='GmailAgent:%(asctime)s %(levelname)s %(message)s') except TypeError: ! # Python 2.3 pass ####### for debugging ##f = open('/tmp/gmailagent.out','w') --- 27,61 ---- # Perhaps it would be better to use getopt import logging + + class LogStream: + """Class to redirect debug messages to a file like object. + The GUI could call the 'set_stream' method to redirect the stream to a object. + This object must have a write() method. + Bt default this class redirect to sys.stdout""" + def __init__(self): + self.out = sys.stdout + def set_stream(self,strm): + self.out = strm + def write(self,stuff): + self.out.write(stuff) + def flush(self): + pass + try: ! rootLogger = logging.getLogger('Default') ! rootLogger.setLevel(logging.DEBUG) ! ls_default = LogStream() ! streamHandler = logging.StreamHandler(ls_default) ! formatter = logging.Formatter('GmailAgent: %(levelname)-8s %(message)s') ! streamHandler.setFormatter(formatter) ! rootLogger.addHandler(streamHandler) ! ! ## logging.basicConfig(level=logging.DEBUG,\ ! ## format='GmailAgent:%(asctime)s %(levelname)s %(message)s') except TypeError: ! # Python <=2.3? pass + ### We should use a file object to the LogStream object ####### for debugging ##f = open('/tmp/gmailagent.out','w') Index: AddressEditorDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog.ui,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AddressEditorDialog.ui 3 Jun 2005 18:59:53 -0000 1.4 --- AddressEditorDialog.ui 6 Jun 2005 18:26:08 -0000 1.5 *************** *** 30,108 **** <string>GmailAgent - Addressbook editor</string> </property> - <widget class="QListView"> - <column> - <property name="text"> - <string>Name</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Email address</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Notes</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <item> - <property name="text"> - <string></string> - </property> - <property name="text"> - <string></string> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap></pixmap> - </property> - <property name="pixmap"> - <pixmap></pixmap> - </property> - <property name="pixmap"> - <pixmap></pixmap> - </property> - </item> - <property name="name"> - <cstring>listViewContacts</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>40</y> - <width>560</width> - <height>290</height> - </rect> - </property> - <property name="selectionMode"> - <enum>Single</enum> - </property> - <property name="allColumnsShowFocus"> - <bool>true</bool> - </property> - <property name="showSortIndicator"> - <bool>true</bool> - </property> - </widget> <widget class="QLabel"> <property name="name"> --- 30,33 ---- *************** *** 255,258 **** --- 180,281 ---- </property> </widget> + <widget class="QListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Email address</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Notes</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Gmail ID</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string></string> + </property> + <property name="text"> + <string></string> + </property> + <property name="text"> + <string></string> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <property name="name"> + <cstring>listViewContacts</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>40</y> + <width>560</width> + <height>290</height> + </rect> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="selectionMode"> + <enum>Single</enum> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="showSortIndicator"> + <bool>true</bool> + </property> + </widget> </widget> <connections> Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TODO 3 Jun 2005 15:27:56 -0000 1.9 --- TODO 6 Jun 2005 18:26:08 -0000 1.10 *************** *** 9,12 **** New addressbook ! add a new entry (refactor addressbook editor dialog) Check if the logic is sound and we don't loose contacts --- 9,12 ---- New addressbook ! upload_local_contacts needs to be finished Check if the logic is sound and we don't loose contacts |
From: Stas Z. <sta...@us...> - 2005-06-03 19:00:06
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11905 Modified Files: AboutDialog_forms.py AddressDialog_forms.py AddressEditDialog_forms.py AddressEditorDialog.ui AddressEditorDialog.ui.h AddressEditorDialog_forms.py GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py Log Message: redesigned the contacts editor. Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** GuiQT.py 3 Jun 2005 15:27:56 -0000 1.29 --- GuiQT.py 3 Jun 2005 18:59:53 -0000 1.30 *************** *** 464,467 **** --- 464,476 ---- print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" + def pushButtonAdd_clicked(self): + print "FormAddressEditor.pushButtonAdd_clicked(): Not implemented yet" + + def pushButtonRemove_clicked(self): + print "FormAddressEditor.pushButtonRemove_clicked(): Not implemented yet" + + def pushButtonHelp_clicked(self): + print "FormAddressEditor.pushButtonHelp_clicked(): Not implemented yet" + class AddressBookEditDialog(FormAddressEdit): def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** MainWin_forms.py 3 Jun 2005 15:27:56 -0000 1.23 --- MainWin_forms.py 3 Jun 2005 18:59:53 -0000 1.24 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HelpDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.9 --- HelpDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.10 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AddressEditDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.4 --- AddressEditDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.5 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Fri Jun 3 20:57:50 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** LoginDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.23 --- LoginDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.24 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** AboutDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.20 --- AboutDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.21 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditorDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog_forms.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddressEditorDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.3 --- AddressEditorDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.4 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Fri Jun 3 20:57:50 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 23,48 **** - self.pushButtonImport = QPushButton(self,"pushButtonImport") - self.pushButtonImport.setGeometry(QRect(20,380,106,26)) - - self.pushButtonCancel = QPushButton(self,"pushButtonCancel") - self.pushButtonCancel.setGeometry(QRect(450,380,106,26)) - self.pushButtonCancel.setDefault(1) - - self.pushButtonOk = QPushButton(self,"pushButtonOk") - self.pushButtonOk.setGeometry(QRect(320,380,106,26)) - - self.textLabel1 = QLabel(self,"textLabel1") - self.textLabel1.setGeometry(QRect(100,10,380,20)) - - self.pushButtonEdit = QPushButton(self,"pushButtonEdit") - self.pushButtonEdit.setGeometry(QRect(170,380,106,26)) - - self.textLabel1_2 = QLabel(self,"textLabel1_2") - self.textLabel1_2.setGeometry(QRect(20,350,100,20)) - - self.lineEditSearch = QLineEdit(self,"lineEditSearch") - self.lineEditSearch.setGeometry(QRect(124,350,160,20)) - self.listViewContacts = QListView(self,"listViewContacts") self.listViewContacts.addColumn(self.__tr("Name")) --- 23,26 ---- *************** *** 54,57 **** --- 32,63 ---- self.listViewContacts.setShowSortIndicator(1) + self.textLabel1_2 = QLabel(self,"textLabel1_2") + self.textLabel1_2.setGeometry(QRect(10,350,100,20)) + + self.lineEditSearch = QLineEdit(self,"lineEditSearch") + self.lineEditSearch.setGeometry(QRect(110,350,170,20)) + + self.pushButtonAdd = QPushButton(self,"pushButtonAdd") + self.pushButtonAdd.setGeometry(QRect(240,10,100,26)) + + self.pushButtonRemove = QPushButton(self,"pushButtonRemove") + self.pushButtonRemove.setGeometry(QRect(360,10,100,26)) + + self.pushButtonHelp = QPushButton(self,"pushButtonHelp") + self.pushButtonHelp.setGeometry(QRect(10,380,100,26)) + + self.pushButtonOk = QPushButton(self,"pushButtonOk") + self.pushButtonOk.setGeometry(QRect(340,380,100,26)) + + self.pushButtonCancel = QPushButton(self,"pushButtonCancel") + self.pushButtonCancel.setGeometry(QRect(460,380,100,26)) + self.pushButtonCancel.setDefault(1) + + self.pushButtonImport = QPushButton(self,"pushButtonImport") + self.pushButtonImport.setGeometry(QRect(10,10,100,26)) + + self.pushButtonEdit = QPushButton(self,"pushButtonEdit") + self.pushButtonEdit.setGeometry(QRect(130,10,90,26)) + self.languageChange() *************** *** 65,78 **** self.connect(self.listViewContacts,SIGNAL("clicked(QListViewItem*)"),self.listView3_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) def languageChange(self): self.setCaption(self.__tr("GmailAgent - Addressbook editor")) - self.pushButtonImport.setText(self.__tr("Import contacts")) - self.pushButtonCancel.setText(self.__tr("Cancel")) - self.pushButtonOk.setText(self.__tr("Ok")) - self.textLabel1.setText(self.__tr("<h3>Select the address you want to edit and hit the 'Edit' button</h3>")) - self.pushButtonEdit.setText(self.__tr("Edit")) - self.textLabel1_2.setText(self.__tr("Search for a name:")) self.listViewContacts.header().setLabel(0,self.__tr("Name")) self.listViewContacts.header().setLabel(1,self.__tr("Email address")) --- 71,81 ---- self.connect(self.listViewContacts,SIGNAL("clicked(QListViewItem*)"),self.listView3_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) + self.connect(self.pushButtonAdd,SIGNAL("clicked()"),self.pushButtonAdd_clicked) + self.connect(self.pushButtonRemove,SIGNAL("clicked()"),self.pushButtonRemove_clicked) + self.connect(self.pushButtonHelp,SIGNAL("clicked()"),self.pushButtonHelp_clicked) def languageChange(self): self.setCaption(self.__tr("GmailAgent - Addressbook editor")) self.listViewContacts.header().setLabel(0,self.__tr("Name")) self.listViewContacts.header().setLabel(1,self.__tr("Email address")) *************** *** 81,84 **** --- 84,97 ---- item = QListViewItem(self.listViewContacts,None) + self.textLabel1_2.setText(self.__tr("Search a contact:")) + self.pushButtonAdd.setText(self.__tr("Add contact")) + self.pushButtonRemove.setText(self.__tr("Remove contact")) + self.pushButtonHelp.setText(self.__tr("Help")) + self.pushButtonOk.setText(self.__tr("OK")) + self.pushButtonCancel.setText(self.__tr("Cancel")) + self.pushButtonImport.setText(self.__tr("Import contacts")) + QToolTip.add(self.pushButtonImport,self.__tr("Import contacts from a Gmail account")) + self.pushButtonEdit.setText(self.__tr("Edit contact")) + QToolTip.add(self.pushButtonEdit,self.__tr("Edit a selected contact")) *************** *** 101,104 **** --- 114,126 ---- print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" + def pushButtonAdd_clicked(self): + print "FormAddressEditor.pushButtonAdd_clicked(): Not implemented yet" + + def pushButtonRemove_clicked(self): + print "FormAddressEditor.pushButtonRemove_clicked(): Not implemented yet" + + def pushButtonHelp_clicked(self): + print "FormAddressEditor.pushButtonHelp_clicked(): Not implemented yet" + def __tr(self,s,c = None): return qApp.translate("FormAddressEditor",s,c) Index: AddressEditorDialog.ui.h =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog.ui.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddressEditorDialog.ui.h 2 Jun 2005 13:33:17 -0000 1.1 --- AddressEditorDialog.ui.h 3 Jun 2005 18:59:53 -0000 1.2 *************** *** 50,51 **** --- 50,69 ---- } + + + void FormAddressEditor::pushButtonAdd_clicked() + { + + } + + + void FormAddressEditor::pushButtonRemove_clicked() + { + + } + + + void FormAddressEditor::pushButtonHelp_clicked() + { + + } Index: AddressEditorDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog.ui,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddressEditorDialog.ui 3 Jun 2005 15:27:56 -0000 1.3 --- AddressEditorDialog.ui 3 Jun 2005 18:59:53 -0000 1.4 *************** *** 30,218 **** <string>GmailAgent - Addressbook editor</string> </property> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonImport</cstring> </property> <property name="geometry"> <rect> ! <x>20</x> ! <y>380</y> ! <width>106</width> ! <height>26</height> </rect> </property> ! <property name="text"> ! <string>Import contacts</string> </property> </widget> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> ! <x>450</x> ! <y>380</y> ! <width>106</width> ! <height>26</height> </rect> </property> <property name="text"> ! <string>Cancel</string> </property> ! <property name="default"> ! <bool>true</bool> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> ! <x>320</x> ! <y>380</y> ! <width>106</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Ok</string> </property> </widget> ! <widget class="QLabel"> <property name="name"> ! <cstring>textLabel1</cstring> </property> <property name="geometry"> <rect> ! <x>100</x> <y>10</y> ! <width>380</width> ! <height>20</height> </rect> </property> <property name="text"> ! <string><h3>Select the address you want to edit and hit the 'Edit' button</h3></string> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonEdit</cstring> </property> <property name="geometry"> <rect> ! <x>170</x> <y>380</y> ! <width>106</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Edit</string> </property> </widget> ! <widget class="QLabel"> <property name="name"> ! <cstring>textLabel1_2</cstring> </property> <property name="geometry"> <rect> ! <x>20</x> ! <y>350</y> <width>100</width> ! <height>20</height> </rect> </property> <property name="text"> ! <string>Search for a name:</string> </property> </widget> ! <widget class="QLineEdit"> <property name="name"> ! <cstring>lineEditSearch</cstring> </property> <property name="geometry"> <rect> ! <x>124</x> ! <y>350</y> ! <width>160</width> ! <height>20</height> </rect> </property> - </widget> - <widget class="QListView"> - <column> - <property name="text"> - <string>Name</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Email address</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <column> - <property name="text"> - <string>Notes</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizable"> - <bool>true</bool> - </property> - </column> - <item> <property name="text"> ! <string></string> </property> ! <property name="text"> ! <string></string> </property> ! <property name="text"> ! <string></string> </property> ! <property name="pixmap"> ! <pixmap></pixmap> </property> ! <property name="pixmap"> ! <pixmap></pixmap> </property> ! <property name="pixmap"> ! <pixmap></pixmap> </property> ! </item> <property name="name"> ! <cstring>listViewContacts</cstring> </property> <property name="geometry"> <rect> ! <x>10</x> ! <y>40</y> ! <width>560</width> ! <height>290</height> </rect> </property> ! <property name="selectionMode"> ! <enum>Single</enum> ! </property> ! <property name="allColumnsShowFocus"> ! <bool>true</bool> </property> ! <property name="showSortIndicator"> ! <bool>true</bool> </property> </widget> --- 30,256 ---- <string>GmailAgent - Addressbook editor</string> </property> ! <widget class="QListView"> ! <column> ! <property name="text"> ! <string>Name</string> ! </property> ! <property name="clickable"> ! <bool>true</bool> ! </property> ! <property name="resizable"> ! <bool>true</bool> ! </property> ! </column> ! <column> ! <property name="text"> ! <string>Email address</string> ! </property> ! <property name="clickable"> ! <bool>true</bool> ! </property> ! <property name="resizable"> ! <bool>true</bool> ! </property> ! </column> ! <column> ! <property name="text"> ! <string>Notes</string> ! </property> ! <property name="clickable"> ! <bool>true</bool> ! </property> ! <property name="resizable"> ! <bool>true</bool> ! </property> ! </column> ! <item> ! <property name="text"> ! <string></string> ! </property> ! <property name="text"> ! <string></string> ! </property> ! <property name="text"> ! <string></string> ! </property> ! <property name="pixmap"> ! <pixmap></pixmap> ! </property> ! <property name="pixmap"> ! <pixmap></pixmap> ! </property> ! <property name="pixmap"> ! <pixmap></pixmap> ! </property> ! </item> <property name="name"> ! <cstring>listViewContacts</cstring> </property> <property name="geometry"> <rect> ! <x>10</x> ! <y>40</y> ! <width>560</width> ! <height>290</height> </rect> </property> ! <property name="selectionMode"> ! <enum>Single</enum> ! </property> ! <property name="allColumnsShowFocus"> ! <bool>true</bool> ! </property> ! <property name="showSortIndicator"> ! <bool>true</bool> </property> </widget> ! <widget class="QLabel"> <property name="name"> ! <cstring>textLabel1_2</cstring> </property> <property name="geometry"> <rect> ! <x>10</x> ! <y>350</y> ! <width>100</width> ! <height>20</height> </rect> </property> <property name="text"> ! <string>Search a contact:</string> </property> ! </widget> ! <widget class="QLineEdit"> ! <property name="name"> ! <cstring>lineEditSearch</cstring> ! </property> ! <property name="geometry"> ! <rect> ! <x>110</x> ! <y>350</y> ! <width>170</width> ! <height>20</height> ! </rect> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonAdd</cstring> </property> <property name="geometry"> <rect> ! <x>240</x> ! <y>10</y> ! <width>100</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Add contact</string> </property> </widget> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonRemove</cstring> </property> <property name="geometry"> <rect> ! <x>360</x> <y>10</y> ! <width>100</width> ! <height>26</height> </rect> </property> <property name="text"> ! <string>Remove contact</string> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonHelp</cstring> </property> <property name="geometry"> <rect> ! <x>10</x> <y>380</y> ! <width>100</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Help</string> </property> </widget> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> ! <x>340</x> ! <y>380</y> <width>100</width> ! <height>26</height> </rect> </property> <property name="text"> ! <string>OK</string> </property> </widget> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> ! <x>460</x> ! <y>380</y> ! <width>100</width> ! <height>26</height> </rect> </property> <property name="text"> ! <string>Cancel</string> </property> ! <property name="default"> ! <bool>true</bool> </property> ! </widget> ! <widget class="QPushButton"> ! <property name="name"> ! <cstring>pushButtonImport</cstring> </property> ! <property name="geometry"> ! <rect> ! <x>10</x> ! <y>10</y> ! <width>100</width> ! <height>26</height> ! </rect> </property> ! <property name="text"> ! <string>Import contacts</string> </property> ! <property name="toolTip" stdset="0"> ! <string>Import contacts from a Gmail account</string> </property> ! </widget> ! <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonEdit</cstring> </property> <property name="geometry"> <rect> ! <x>130</x> ! <y>10</y> ! <width>90</width> ! <height>26</height> </rect> </property> ! <property name="text"> ! <string>Edit contact</string> </property> ! <property name="toolTip" stdset="0"> ! <string>Edit a selected contact</string> </property> </widget> *************** *** 255,258 **** --- 293,314 ---- <slot>lineEditSearch_textChanged(const QString&)</slot> </connection> + <connection> + <sender>pushButtonAdd</sender> + <signal>clicked()</signal> + <receiver>FormAddressEditor</receiver> + <slot>pushButtonAdd_clicked()</slot> + </connection> + <connection> + <sender>pushButtonRemove</sender> + <signal>clicked()</signal> + <receiver>FormAddressEditor</receiver> + <slot>pushButtonRemove_clicked()</slot> + </connection> + <connection> + <sender>pushButtonHelp</sender> + <signal>clicked()</signal> + <receiver>FormAddressEditor</receiver> + <slot>pushButtonHelp_clicked()</slot> + </connection> </connections> <includes> *************** *** 266,269 **** --- 322,328 ---- <slot>listView3_clicked( QListViewItem * )</slot> <slot>lineEditSearch_textChanged( const QString & )</slot> + <slot>pushButtonAdd_clicked()</slot> + <slot>pushButtonRemove_clicked()</slot> + <slot>pushButtonHelp_clicked()</slot> </slots> <layoutdefaults spacing="6" margin="11"/> Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AddressDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.10 --- AddressDialog_forms.py 3 Jun 2005 18:59:53 -0000 1.11 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Fri Jun 3 20:57:49 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # |
From: Stas Z. <sta...@us...> - 2005-06-03 15:28:05
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2794 Modified Files: AboutDialog_forms.py AddressDialog_forms.py AddressEditDialog_forms.py AddressEditorDialog.ui AddressEditorDialog_forms.py Gmail.py GmailAgent.e3p GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py TODO Log Message: Massive update to the new online addressbook Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Gmail.py 2 Jun 2005 19:07:16 -0000 1.13 --- Gmail.py 3 Jun 2005 15:27:56 -0000 1.14 *************** *** 20,24 **** GM_DEBUG = 0 ! import libgmail2,urllib2,logging,ConfigParser,os def login(name,pas): --- 20,24 ---- GM_DEBUG = 0 ! import libgmail2,urllib2,logging,ConfigParser,os,pickle def login(name,pas): *************** *** 121,127 **** """This adds the gmail contacts to the address file and saves it to disk""" contacts = ga.getContacts().getAllContacts() - copy = load_addressfile(addrfile) - #print "contacts",contacts - #print "copy",copy for obj in contacts: store_address(addrfile,\ --- 121,124 ---- *************** *** 130,133 **** obj.getNotes(),\ obj.getId()) ! return load_addressfile(addrfile) --- 127,190 ---- obj.getNotes(),\ obj.getId()) ! return load_addressfile(addrfile) ! ! def export_contacts(addrfile,ga): ! """This will remove the contacts at the online contacts list and replace ! it with the local copy fom disk. ! It will return a message on any error. ! It returns None on succes.""" ! entries = load_addressfile(addrfile) ! if len(entries) < 1: ! text = "Failed to load address file, %s" % addrfile ! if GM_DEBUG: logging.critical(text) ! return text ! try: ! contacts = ga.getContacts().getAllContacts() ! # Just to test save_contacts ! save_contacts(contacts) ! for contact in contacts: ! if GM_DEBUG: logging.debug("Removing contact", contact) ! ga.removeContact(contact) ! except Exception,info: ! logging.critical(str(info)) ! if contacts: ! save_contacts(contacts) ! return "An error occured, tried to save your contacts to\n%s and %s" %\ ! ('~/.GmailContacts.txt','~/.GmailContacts.pickle') ! # Now we fill the contacts list again ! try: ! for entry in entries: ! apply(ga.addContact,entry[:-1]) ! except Exception,info: ! logging.critical(str(info)) ! save_contacts(contacts) + def save_contacts(contacts): + """Save the contact in case of an error. This is an attempt to prevent + data loss in case of an error when interacting with Gmail contacts.""" + try: + f = open(os.path.expanduser('~/.GmailContacts.pickle'),'w') + pickle.dump(contacts,f) + ## XXX TODO: some way to load the pickled object and restore it + except Exception,info: + text = "Attempt to pickle the contacts %s" % str(info) + logging.critical(text) + f.close() + try: + f =open(os.path.expanduser('~/.GmailContacts.txt'),'w') + text = "#An error occured in GmailAgent and these contacts are saved\n"+\ + "#to this file in an attempt to save them\n"+\ + "#A contact is saved as follows:\n"+\ + "#GmailID Name email notes\n" + f.write(text) + for con in contacts: + name,email,notes,id = con.getName(),con.getEmail(),con.getNotes(),con.getId() + f.write("%s %s %s %s\n" % (con.getId(),\ + con.getName(),\ + con.getEmail(),\ + con.getNotes())) + f.close() + except Exception,info: + logging.critical(str(info)) + return str(info) + Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AddressDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.9 --- AddressDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.10 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GmailAgent.e3p =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.e3p,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GmailAgent.e3p 2 Jun 2005 19:07:16 -0000 1.12 --- GmailAgent.e3p 3 Jun 2005 15:27:56 -0000 1.13 *************** *** 2,6 **** <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-02, 17:15:36 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> --- 2,6 ---- <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-02, 21:21:40 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> *************** *** 55,58 **** --- 55,61 ---- <Name>AddressEditorDialog_forms.py</Name> </Source> + <Source> + <Name>libgmail2.py</Name> + </Source> </Sources> <Forms> Index: AddressEditorDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog_forms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AddressEditorDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.2 --- AddressEditorDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.3 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Thu Jun 2 21:05:08 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 50,53 **** --- 50,55 ---- self.listViewContacts.addColumn(self.__tr("Notes")) self.listViewContacts.setGeometry(QRect(10,40,560,290)) + self.listViewContacts.setSelectionMode(QListView.Single) + self.listViewContacts.setAllColumnsShowFocus(1) self.listViewContacts.setShowSortIndicator(1) Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AboutDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.19 --- AboutDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.20 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** GuiQT.py 2 Jun 2005 19:07:16 -0000 1.28 --- GuiQT.py 3 Jun 2005 15:27:56 -0000 1.29 *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! GQ_DEBUG = 0 from qt import * --- 19,23 ---- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! GQ_DEBUG = 1 from qt import * *************** *** 193,196 **** --- 193,197 ---- self.lineEditLogin.setText(log) self.lineEditPass.setText(pas) + self.setModal(1) self.show() *************** *** 227,231 **** QMessageBox.Ok) - def pushButtonCancel_clicked(self): print "FormLogin.pushButtonCancel_clicked()" --- 228,231 ---- *************** *** 268,272 **** self.selecteditem = None self.obs = observer ! #self.ga = None# we want to test if we already have a Gmail account if os.path.exists(file): self._load(file) --- 268,272 ---- self.selecteditem = None self.obs = observer ! if os.path.exists(file): self._load(file) *************** *** 366,382 **** class AddressBookEditorDialog(FormAddressEditor): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("AddressBookDialog start") FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent self.parent_observer = observer text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ "before making changes to this copy you should (re)import your\n"+\ "contacts list.\n\n"+\ "Shall I import your Gmail contacts list now?" ! if QMessageBox.information(self,"Question", text, ! QMessageBox.Cancel,QMessageBox.Ok): self.pushButtonImport_clicked() ! elif self.parent.nameshash:# do we have already a local copy? ! pass # XXX fill the widget with the vals from nameshash self.show() --- 366,387 ---- class AddressBookEditorDialog(FormAddressEditor): def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): ! if GQ_DEBUG: logging.debug("AddressBookEditorDialog start") FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent self.parent_observer = observer + self.loaded_local_file = None + self.ga = None# we want to test if we already have a Gmail account text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ "before making changes to this copy you should (re)import your\n"+\ "contacts list.\n\n"+\ "Shall I import your Gmail contacts list now?" ! ans = QMessageBox.information(self,"Question", text, ! QMessageBox.Cancel,QMessageBox.Ok) ! if ans == 1: self.pushButtonImport_clicked() ! else: ! conlist = Gmail.load_addressfile(addrfile) ! self._load(conlist) ! self.loaded_local_file = 1 # XXX fill the widget with the vals from nameshash self.show() *************** *** 386,389 **** --- 391,403 ---- # The observer is passed to Login, after succes Login will call the observers # _login_success method + if self.loaded_local_file: + text = "You have an local contacts file loaded, when you import one\n"+\ + "from Gmail it will be merged with the local file.\n\n"+\ + "Do you want to import Gmail contacts and merge them with\n"+\ + "your local copy?" + ans = QMessageBox.information(self,"Question", text, + QMessageBox.Cancel,QMessageBox.Ok) + if ans != 1: + return obs = Observer(self._login_success) # this looks like a hack but Login is used by other objects also. *************** *** 397,400 **** --- 411,415 ---- # The new local copy will be saved on disk and returnt to the caller. conlist = Gmail.import_contacts(addrfile,self.ga) + self.loaded_local_file = None self._load(conlist) *************** *** 413,429 **** def pushButtonOk_clicked(self): ! print "FormAddressEditor.pushButtonOk_clicked(): Not implemented yet" def pushButtonCancel_clicked(self): - print "FormAddressEditor.pushButtonCancel_clicked()" # XXX we should also update the parent with the new contacts. self.done(1) def pushButtonEdit_clicked(self): ! print "FormAddressEditor.pushButtonEdit_clicked(): Not implemented yet" def listView3_clicked(self,a0): print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" ! def lineEditSearch_textChanged(self,a0): print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" --- 428,488 ---- def pushButtonOk_clicked(self): ! print "FormAddressEditor.pushButtonOk_clicked()" ! text = "Your contacts are kept in a local file on this system and you\n"+\ ! "should summit it to your Gmail contacts list to keep everything\n"+\ ! "in sync.\n\n"+\ ! "WARNING,\n"+\ ! "when summiting these contacts to your Gmail account the online Gmail\n"+\ ! "contacts list will be cleared and you will loose any changes you made online.\n\n"+\ ! "Should I upload these contacts to your Gmail accounts contacts list?" ! ans = QMessageBox.information(self,"Question", text, ! QMessageBox.Cancel,QMessageBox.Ok) ! if ans == 1: ! if not self.ga: ! obs = Observer(self._export_contacts) ! Login(parent=self.parent,observer=obs) ! else: ! self._export_contacts(self.ga) ! self.pushButtonCancel_clicked() ! ! def _export_contacts(self,ga): ! Gmail.export_contacts(addrfile,ga) def pushButtonCancel_clicked(self): # XXX we should also update the parent with the new contacts. self.done(1) def pushButtonEdit_clicked(self): ! print "FormAddressEditor.pushButtonEdit_clicked()" ! entry = self.listViewContacts.selectedItem() ! AddressBookEditDialog(entry,parent=self) def listView3_clicked(self,a0): print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" ! def lineEditSearch_textChanged(self,a0): print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" + + class AddressBookEditDialog(FormAddressEdit): + def __init__(self,entry,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): + if GQ_DEBUG: logging.debug("AddressBookEditDialog start") + FormAddressEdit.__init__(self,parent,name,modal,fl) + self.parent = parent + self.parent_observer = observer + self.entry = entry + self.name, self.email, self.notes = entry.text(0),entry.text(1),entry.text(2) + if GQ_DEBUG: logging.debug("receiced entry: %s %s %s" % (self.name,self.email,self.notes)) + self.lineEditName.setText(self.name) + self.lineEditEmail.setText(self.email) + self.textEditNotes.setText(self.notes) + self.show() + + def pushButtonOk_clicked(self): + print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" + self.entry.repaint()#update the entry in the view + Gmail.store_address(addrfile,self.name,self.email,self.notes) + + def pushButtonCancel_clicked(self): + self.done(1) + + Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** MainWin_forms.py 2 Jun 2005 19:07:16 -0000 1.22 --- MainWin_forms.py 3 Jun 2005 15:27:56 -0000 1.23 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** HelpDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.8 --- HelpDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.9 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddressEditDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.3 --- AddressEditDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.4 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** LoginDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.22 --- LoginDialog_forms.py 3 Jun 2005 15:27:56 -0000 1.23 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Fri Jun 3 14:33:54 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditorDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog.ui,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AddressEditorDialog.ui 2 Jun 2005 19:07:16 -0000 1.2 --- AddressEditorDialog.ui 3 Jun 2005 15:27:56 -0000 1.3 *************** *** 207,210 **** --- 207,216 ---- </rect> </property> + <property name="selectionMode"> + <enum>Single</enum> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> <property name="showSortIndicator"> <bool>true</bool> Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TODO 2 Jun 2005 19:07:16 -0000 1.8 --- TODO 3 Jun 2005 15:27:56 -0000 1.9 *************** *** 5,12 **** Perhaps copy the first message and add 'part #' to the subject line ? ! remove the addressbook and replace it for one based on gmail contacts. ! Perhaps import a new contacts list -> edit it -> sync with gmail contacts. ! See the contacts stuff from Waseem. ! ! See above, Make sure we remove old addressbook files when installing new vesrions. --- 5,12 ---- Perhaps copy the first message and add 'part #' to the subject line ? ! Make sure we remove old addressbook files when installing new vesrions. + + New addressbook + add a new entry (refactor addressbook editor dialog) + Check if the logic is sound and we don't loose contacts |
From: Stas Z. <sta...@us...> - 2005-06-02 19:07:53
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20936 Modified Files: AboutDialog_forms.py AddressDialog_forms.py AddressEditDialog_forms.py AddressEditorDialog.ui AddressEditorDialog_forms.py Gmail.py GmailAgent.e3p GuiQT.py HelpDialog_forms.py LoginDialog.ui LoginDialog_forms.py MainWin_forms.py TODO Log Message: Start implementing the new contacts support in libgmail2 Removed the old addressbook and start to replace it with one based on Gmail contacts. It works for most parts but it's still work in progress. Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Gmail.py 1 Jun 2005 18:07:28 -0000 1.12 --- Gmail.py 2 Jun 2005 19:07:16 -0000 1.13 *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - ## Used most parts from the libgmail2 examples ;-) GM_DEBUG = 0 import libgmail2,urllib2,logging,ConfigParser,os --- 19,22 ---- *************** *** 75,79 **** return (0,(name,pas)) ! def store_address(addrfile,name,addr): try: f = open(addrfile,'r') --- 74,83 ---- return (0,(name,pas)) ! def store_address(addrfile,name,addr,notes='',id=''): ! # stuff is stored in a file like this: ! # name&&addr&¬es&&id ! # Contacts that are not (yet) in the Gmail contacts list have an empty ! # string as id. ! # After syncronizing the file with the contacts the id fields will be asigned. try: f = open(addrfile,'r') *************** *** 86,92 **** else: for line in lines: ! if name in line and addr in line: return ! line = "%s&&&&&&%s\n" % (name,addr) try: f = open(addrfile,'a') --- 90,97 ---- else: for line in lines: ! if id in line and name in line and addr in line: return ! # It's a new entry ! line = "%s&&%s&&%s&&%s\n" % (name,addr,notes,id) try: f = open(addrfile,'a') *************** *** 108,117 **** return if GM_DEBUG: logging.debug(str(lines)) ! return (lines) def import_contacts(addrfile,ga): ! """This adds the gmail contacts to the address file.""" ! contacts = ga.getContacts().getRawList() ! print "contacts",contacts ! --- 113,133 ---- return if GM_DEBUG: logging.debug(str(lines)) ! newlines = [] ! for line in lines: ! newlines.append(tuple(line[:-1].split("&&"))) ! return (newlines) def import_contacts(addrfile,ga): ! """This adds the gmail contacts to the address file and saves it to disk""" ! contacts = ga.getContacts().getAllContacts() ! copy = load_addressfile(addrfile) ! #print "contacts",contacts ! #print "copy",copy ! for obj in contacts: ! store_address(addrfile,\ ! obj.getName(),\ ! obj.getEmail(),\ ! obj.getNotes(),\ ! obj.getId()) ! return load_addressfile(addrfile) Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AddressDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.8 --- AddressDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.9 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GmailAgent.e3p =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.e3p,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GmailAgent.e3p 1 Jun 2005 18:01:55 -0000 1.11 --- GmailAgent.e3p 2 Jun 2005 19:07:16 -0000 1.12 *************** *** 2,6 **** <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-01, 18:15:45 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> --- 2,6 ---- <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-02, 17:15:36 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> *************** *** 49,52 **** --- 49,58 ---- <Name>setup.py</Name> </Source> + <Source> + <Name>AddressEditDialog_forms.py</Name> + </Source> + <Source> + <Name>AddressEditorDialog_forms.py</Name> + </Source> </Sources> <Forms> *************** *** 81,84 **** --- 87,102 ---- <Name>HelpDialog.ui.h</Name> </Form> + <Form> + <Name>AddressEditorDialog.ui</Name> + </Form> + <Form> + <Name>AddressEditorDialog.ui.h</Name> + </Form> + <Form> + <Name>AddressEditDialog.ui</Name> + </Form> + <Form> + <Name>AddressEditDialog.ui.h</Name> + </Form> </Forms> <Translations> Index: AddressEditorDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog_forms.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddressEditorDialog_forms.py 2 Jun 2005 13:44:45 -0000 1.1 --- AddressEditorDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.2 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # ! # Created: Thu Jun 2 21:05:08 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 39,49 **** self.pushButtonEdit.setGeometry(QRect(170,380,106,26)) - self.listView3 = QListView(self,"listView3") - self.listView3.addColumn(self.__tr("Name")) - self.listView3.addColumn(self.__tr("Email address")) - self.listView3.addColumn(self.__tr("Notes")) - self.listView3.setGeometry(QRect(10,40,560,290)) - self.listView3.setShowSortIndicator(1) - self.textLabel1_2 = QLabel(self,"textLabel1_2") self.textLabel1_2.setGeometry(QRect(20,350,100,20)) --- 39,42 ---- *************** *** 52,55 **** --- 45,55 ---- self.lineEditSearch.setGeometry(QRect(124,350,160,20)) + self.listViewContacts = QListView(self,"listViewContacts") + self.listViewContacts.addColumn(self.__tr("Name")) + self.listViewContacts.addColumn(self.__tr("Email address")) + self.listViewContacts.addColumn(self.__tr("Notes")) + self.listViewContacts.setGeometry(QRect(10,40,560,290)) + self.listViewContacts.setShowSortIndicator(1) + self.languageChange() *************** *** 61,65 **** self.connect(self.pushButtonCancel,SIGNAL("clicked()"),self.pushButtonCancel_clicked) self.connect(self.pushButtonEdit,SIGNAL("clicked()"),self.pushButtonEdit_clicked) ! self.connect(self.listView3,SIGNAL("clicked(QListViewItem*)"),self.listView3_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) --- 61,65 ---- self.connect(self.pushButtonCancel,SIGNAL("clicked()"),self.pushButtonCancel_clicked) self.connect(self.pushButtonEdit,SIGNAL("clicked()"),self.pushButtonEdit_clicked) ! self.connect(self.listViewContacts,SIGNAL("clicked(QListViewItem*)"),self.listView3_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) *************** *** 72,82 **** self.textLabel1.setText(self.__tr("<h3>Select the address you want to edit and hit the 'Edit' button</h3>")) self.pushButtonEdit.setText(self.__tr("Edit")) - self.listView3.header().setLabel(0,self.__tr("Name")) - self.listView3.header().setLabel(1,self.__tr("Email address")) - self.listView3.header().setLabel(2,self.__tr("Notes")) - self.listView3.clear() - item = QListViewItem(self.listView3,None) - self.textLabel1_2.setText(self.__tr("Search for a name:")) --- 72,82 ---- self.textLabel1.setText(self.__tr("<h3>Select the address you want to edit and hit the 'Edit' button</h3>")) self.pushButtonEdit.setText(self.__tr("Edit")) self.textLabel1_2.setText(self.__tr("Search for a name:")) + self.listViewContacts.header().setLabel(0,self.__tr("Name")) + self.listViewContacts.header().setLabel(1,self.__tr("Email address")) + self.listViewContacts.header().setLabel(2,self.__tr("Notes")) + self.listViewContacts.clear() + item = QListViewItem(self.listViewContacts,None) + Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** AboutDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.18 --- AboutDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.19 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog.ui,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LoginDialog.ui 20 Apr 2005 14:22:58 -0000 1.1.1.1 --- LoginDialog.ui 2 Jun 2005 19:07:16 -0000 1.2 *************** *** 14,18 **** </property> <property name="caption"> ! <string>Lpicassa - Gmail login</string> </property> <property name="modal"> --- 14,18 ---- </property> <property name="caption"> ! <string>GmailAgent - Gmail login</string> </property> <property name="modal"> Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** GuiQT.py 2 Jun 2005 13:33:17 -0000 1.27 --- GuiQT.py 2 Jun 2005 19:07:16 -0000 1.28 *************** *** 35,39 **** try: ! import paths except: helppath = '' --- 35,39 ---- try: ! import paths# generated by the installer except: helppath = '' *************** *** 83,103 **** if self.attachments: self.textEditAttach.setText('\n'.join(self.attachments)) - self._setup_lookuphash()# not used yet? - - def _setup_lookuphash(self,file=addrfile): - # Not used yet? - lines = Gmail.load_addressfile(file) - # used by lineEditTo_textChanged to lookup the name - # keys are the names, vals are the email addresses - nameshash = {} - for line in lines: - try: - parts = line[:-1].split('&&') - nameshash[parts[0]] = parts[3] - except Exception,info: - if GQ_DEBUG: logging.warning("_setup_lookuphash. Reading addressbook failed, %s" % str(info)) - return - if GQ_DEBUG: logging.debug("nameshash, %s" % nameshash) - self.nameshash = nameshash def closeEvent(self,ev): --- 83,86 ---- *************** *** 146,150 **** obj.attachments = self.attachments obj.mailbody = self.mailbody ! obj.login = self.login# not used, yet? obj.ga = ga#gmail account object --- 129,133 ---- obj.attachments = self.attachments obj.mailbody = self.mailbody ! #obj.login = self.login# not used, yet? obj.ga = ga#gmail account object *************** *** 218,223 **** if not log or not pas: return ! self.parent.login['login'] = log ! self.parent.login['passwrd'] = pas self._do_login(log,pas) --- 201,206 ---- if not log or not pas: return ! #self.parent.login['login'] = log ! #self.parent.login['passwrd'] = pas self._do_login(log,pas) *************** *** 254,258 **** class About(FormAbout): def __init__(self, parent=None, name=None, modal=0, fl=0): - print "About called" import version FormAbout.__init__(self,parent,name,modal,fl) --- 237,240 ---- *************** *** 262,266 **** def pushButton5_clicked(self): - print "FormAbout.pushButton5_clicked()" self.done(1) --- 244,247 ---- *************** *** 287,291 **** self.selecteditem = None self.obs = observer ! self.ga = None# we want to test if we already have a Gmail account if os.path.exists(file): self._load(file) --- 268,272 ---- self.selecteditem = None self.obs = observer ! #self.ga = None# we want to test if we already have a Gmail account if os.path.exists(file): self._load(file) *************** *** 330,347 **** self.listViewSend.takeItem(selecteditem) - def pushButtonImport_clicked(self): - print "FormAddress.pushButtonImport_clicked()" - # The observer is passed to Login, after succes Login will call the observers - # update method - obs = Observer(self._set_account) - # this looks like a hack but Login is used by other objects also. - Login(parent=self.parent,observer=obs) - ### XXXX Login doesn't block - print "ga",self.ga - if not self.ga: - return# Login has it's own error messages - Gmail.import_contacts(addrfile,self.ga) - self._load(addrfile) - def listViewBook_clicked(self,a0): #print "FormAddress.listViewBook_clicked(QListViewItem*): Not implemented yet" --- 311,314 ---- *************** *** 365,369 **** def _load( self, filename): ! """Loads a address file into the widget.""" # this is also called from the observer self.listViewBook.clear() --- 332,336 ---- def _load( self, filename): ! """Loads a local address file into the widget.""" # this is also called from the observer self.listViewBook.clear() *************** *** 371,382 **** # used by lineEditSearch_textChanged to lookup the name # keys are the names, vals are the listviewitems objects ! nameshash = {} for line in lines: item = QListViewItem( self.listViewBook) try: ! parts = line[:-1].split('&&') ! nameshash[parts[0]] = item ! item.setText(0,parts[0]) ! item.setText(1,parts[3]) except Exception,info: if GQ_DEBUG: logging.warning("Reading addressbook failed, %s" % str(info)) --- 338,348 ---- # used by lineEditSearch_textChanged to lookup the name # keys are the names, vals are the listviewitems objects ! nameshash = {}# used also as a lookup hash for line in lines: item = QListViewItem( self.listViewBook) try: ! nameshash[line[0]] = item ! item.setText(0,line[0]) ! item.setText(1,line[1]) except Exception,info: if GQ_DEBUG: logging.warning("Reading addressbook failed, %s" % str(info)) *************** *** 385,393 **** self.nameshash = nameshash - def _set_account(self,ga): - """This is just a method which can be called by a observer.""" - # ga is the Gmail account after a succseful login - self.ga = ga - def getSelection(self,listview): """Get all the selected items in a listview""" --- 351,354 ---- *************** *** 408,416 **** FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent self.show() def pushButtonImport_clicked(self): ! print "FormAddressEditor.pushButtonImport_clicked(): Not implemented yet" ! def pushButtonOk_clicked(self): print "FormAddressEditor.pushButtonOk_clicked(): Not implemented yet" --- 369,415 ---- FormAddressEditor.__init__(self,parent,name,modal,fl) self.parent = parent + self.parent_observer = observer + text = "GmailAgent uses a local copy of your Gmail contacts list so\n"+\ + "before making changes to this copy you should (re)import your\n"+\ + "contacts list.\n\n"+\ + "Shall I import your Gmail contacts list now?" + if QMessageBox.information(self,"Question", text, + QMessageBox.Cancel,QMessageBox.Ok): + self.pushButtonImport_clicked() + elif self.parent.nameshash:# do we have already a local copy? + pass + # XXX fill the widget with the vals from nameshash self.show() def pushButtonImport_clicked(self): ! print "FormAddressEditor.pushButtonImport_clicked()" ! # The observer is passed to Login, after succes Login will call the observers ! # _login_success method ! obs = Observer(self._login_success) ! # this looks like a hack but Login is used by other objects also. ! Login(parent=self.parent,observer=obs) ! ! def _login_success(self,ga): ! """This is the method which is called through the observer by the Login.""" ! # ga is the Gmail account after a succseful login ! self.ga = ga ! # Get the contacts and merge them with the local copy ! # The new local copy will be saved on disk and returnt to the caller. ! conlist = Gmail.import_contacts(addrfile,self.ga) ! self._load(conlist) ! ! def _load( self, conlist): ! """Loads a contacts list into the widget.""" ! self.listViewContacts.clear() ! for line in conlist: ! item = QListViewItem(self.listViewContacts) ! try: ! item.setText(0,line[0]) ! item.setText(1,line[1]) ! item.setText(2,line[2][:60]) ! except Exception,info: ! if GQ_DEBUG: logging.warning("Reading addressbook failed, %s" % str(info)) ! return ! def pushButtonOk_clicked(self): print "FormAddressEditor.pushButtonOk_clicked(): Not implemented yet" *************** *** 418,421 **** --- 417,421 ---- def pushButtonCancel_clicked(self): print "FormAddressEditor.pushButtonCancel_clicked()" + # XXX we should also update the parent with the new contacts. self.done(1) Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MainWin_forms.py 2 Jun 2005 13:36:14 -0000 1.21 --- MainWin_forms.py 2 Jun 2005 19:07:16 -0000 1.22 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HelpDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.7 --- HelpDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.8 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AddressEditDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.2 --- AddressEditDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.3 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** LoginDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.21 --- LoginDialog_forms.py 2 Jun 2005 19:07:16 -0000 1.22 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 21:05:07 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 58,62 **** def languageChange(self): ! self.setCaption(self.__tr("Lpicassa - Gmail login")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.pushButtonLogin.setText(self.__tr("Login")) --- 58,62 ---- def languageChange(self): ! self.setCaption(self.__tr("GmailAgent - Gmail login")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.pushButtonLogin.setText(self.__tr("Login")) Index: AddressEditorDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditorDialog.ui,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddressEditorDialog.ui 2 Jun 2005 13:33:17 -0000 1.1 --- AddressEditorDialog.ui 2 Jun 2005 19:07:16 -0000 1.2 *************** *** 113,116 **** --- 113,145 ---- </property> </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>350</y> + <width>100</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Search for a name:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>lineEditSearch</cstring> + </property> + <property name="geometry"> + <rect> + <x>124</x> + <y>350</y> + <width>160</width> + <height>20</height> + </rect> + </property> + </widget> <widget class="QListView"> <column> *************** *** 168,172 **** </item> <property name="name"> ! <cstring>listView3</cstring> </property> <property name="geometry"> --- 197,201 ---- </item> <property name="name"> ! <cstring>listViewContacts</cstring> </property> <property name="geometry"> *************** *** 182,214 **** </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel1_2</cstring> - </property> - <property name="geometry"> - <rect> - <x>20</x> - <y>350</y> - <width>100</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Search for a name:</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>lineEditSearch</cstring> - </property> - <property name="geometry"> - <rect> - <x>124</x> - <y>350</y> - <width>160</width> - <height>20</height> - </rect> - </property> - </widget> </widget> <connections> --- 211,214 ---- *************** *** 238,242 **** </connection> <connection> ! <sender>listView3</sender> <signal>clicked(QListViewItem*)</signal> <receiver>FormAddressEditor</receiver> --- 238,242 ---- </connection> <connection> ! <sender>listViewContacts</sender> <signal>clicked(QListViewItem*)</signal> <receiver>FormAddressEditor</receiver> Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TODO 1 Jun 2005 18:22:20 -0000 1.7 --- TODO 2 Jun 2005 19:07:16 -0000 1.8 *************** *** 9,10 **** --- 9,12 ---- See the contacts stuff from Waseem. + See above, Make sure we remove old addressbook files when installing + new vesrions. |
From: Waseem D. <wd...@us...> - 2005-06-02 14:12:31
|
Update of /cvsroot/gmailagent/GA-libgmail2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20847 Modified Files: testlibgmail2.py Log Message: Incorporated 99.99% of Stas's changes into testlibgmail.py Index: testlibgmail2.py =================================================================== RCS file: /cvsroot/gmailagent/GA-libgmail2/testlibgmail2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testlibgmail2.py 1 Jun 2005 23:41:30 -0000 1.1 --- testlibgmail2.py 2 Jun 2005 14:12:20 -0000 1.2 *************** *** 5,19 **** Contacts """ - from libgmail2 import * import unittest import getpass class ContactsTests(unittest.TestCase): """ ! Set of tests that exercise libgmail2's contacts ! capabilities. ! These really all need to be run in order, for the ! most part, or we become unhappy. ! The function names should make it clear what they test """ def setUp(self): --- 5,15 ---- Contacts """ import unittest + from libgmail2 import * import getpass class ContactsTests(unittest.TestCase): """ ! Set of tests that exercise the contacts portion of libgmail2 """ def setUp(self): *************** *** 39,43 **** account.removeContact(contact) ! def testGmailContact(self): w = GmailContact('a','b','c','d') x = GmailContact('x','y','z') --- 35,40 ---- account.removeContact(contact) ! def test3_GmailContact(self): ! """Check that GmailContact equality and accessor methods work""" w = GmailContact('a','b','c','d') x = GmailContact('x','y','z') *************** *** 45,68 **** z = GmailContact('a','b','c','d') ! self.assertEqual(w,w) ! self.assertEqual(x,x) ! self.assertEqual(y,y) ! self.assertEqual(z,z) ! self.assertEqual(w,y) ! self.assertEqual(y,z) ! self.assertEqual(w,z) ! self.assertEqual(z,w) ! ! self.assertNotEqual(w,x) ! self.assertNotEqual(x,w) ! self.assertEqual(w.getId(), 'a') ! self.assertEqual(w.getName(), 'b') ! self.assertEqual(w.getEmail(), 'c') ! self.assertEqual(w.getNotes(), 'd') ! self.assertEqual(x.getNotes(), '') ! def testGetBy(self): account.addContact('Waseem', 'wd...@gm...', 'Is awesome') myContacts = account.getContacts() --- 42,67 ---- z = GmailContact('a','b','c','d') ! self.assertEqual(w,w, "%s doesn't equals %s" % (w,w)) ! self.assertEqual(x,x, "%s doesn't equals %s" % (x,x)) ! self.assertEqual(y,y, "%s doesn't equals %s" % (y,y)) ! self.assertEqual(z,z, "%s doesn't equals %s" % (z,z)) ! self.assertEqual(w,y, "%s doesn't equals %s" % (w,y)) ! self.assertEqual(y,z, "%s doesn't equals %s" % (y,z)) ! self.assertEqual(w,z, "%s doesn't equals %s" % (w,z)) ! self.assertEqual(z,w, "%s doesn't equals %s" % (z,w)) ! self.assertNotEqual(w,x, "%s shouldn't equals %s" % (w,x)) ! self.assertNotEqual(x,w, "%s shouldn't equals %s" % (x,w)) ! ! i,a,e,n = w.getId(),w.getName(),w.getEmail(),w.getNotes() ! self.assertEqual(i, 'a', "%s doesn't equals 'a'" % i) ! self.assertEqual(a, 'b', "%s doesn't equals 'b'" % a) ! self.assertEqual(e, 'c', "%s doesn't equals 'c'" % e) ! self.assertEqual(n, 'd', "%s doesn't equals 'd'" % n) ! self.assertEqual(x.getNotes(), '', "getNotes() should return ''") ! def test4_GetBy(self): ! """Get a contact by name, email, and id""" account.addContact('Waseem', 'wd...@gm...', 'Is awesome') myContacts = account.getContacts() *************** *** 71,85 **** self.assertEqual(waseem, myContacts.getContactById(waseem.getId())) ! def testGetByLists(self): account.addContact('Waseem', 'wd...@gm...', 'Is awesome') account.addContact('Daher', 'te...@fo...r') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') ! self.assertEqual([waseem], myContacts.getContactListByName('Waseem')) ! self.assertEqual([waseem], myContacts.getContactListByEmail('wd...@gm...')) ! self.assertEqual([waseem], myContacts.getContactListById(waseem.getId())) ! ! def testSmallGetAndRemove(self): count = 1 # Add some --- 70,90 ---- self.assertEqual(waseem, myContacts.getContactById(waseem.getId())) ! def test5_GetByLists(self): ! """Get a contact list by name, email, and id""" account.addContact('Waseem', 'wd...@gm...', 'Is awesome') account.addContact('Daher', 'te...@fo...r') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') + + result = [waseem] + obj = myContacts.getContactListByName('Waseem') + self.assertEqual(result, obj, "%s doesn't equals %s" % (result,obj)) + obj = myContacts.getContactListByEmail('wd...@gm...') + self.assertEqual([waseem], obj,"%s doesn't equals %s" % (result,obj)) + obj = myContacts.getContactListById(waseem.getId()) + self.assertEqual([waseem], obj,"%s doesn't equals %s" % (result,obj)) ! def test6_SmallGetAndRemove(self): ! """Add one address and remove it again""" count = 1 # Add some *************** *** 95,99 **** self.assertEqual(myContactList.getCount(), 0) ! def testMediumGetAndRemove(self): count = 14 for x in range(count): --- 100,105 ---- self.assertEqual(myContactList.getCount(), 0) ! def test7_MediumGetAndRemove(self): ! """Add 14 addresses and remove them again""" count = 14 for x in range(count): *************** *** 108,112 **** self.assertEqual(myContactList.getCount(), 0) ! def testLargeGetAndRemove(self): count = 25 for x in range(count): --- 114,119 ---- self.assertEqual(myContactList.getCount(), 0) ! def test8_LargeGetAndRemove(self): ! """Add 25 addresses and remove them again""" count = 25 for x in range(count): *************** *** 120,128 **** myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) ! if __name__ == '__main__': ! print "Starting libgmail2 test suite..." ! print "WARNING: THIS MAY DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" name = raw_input("Gmail account name:") pw = getpass.getpass("Password: ") --- 127,142 ---- myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) ! ! if __name__ == '__main__': ! #unittest.main() ! ## With this we get a better output ! print "\n==============================================" ! print "Start 'libgmail2 contacts' testsuite" ! print "------------------------------------------------\n" ! print "WARNING: THIS WILL DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" + print " BE SURE TO RUN THIS TEST ONLY ON A 'test' ACCOUNT" + name = raw_input("Gmail account name:") pw = getpass.getpass("Password: ") *************** *** 134,137 **** except GmailLoginFailure,e: print "\nLogin failed. (%s)" % e.message ! ! unittest.main() --- 148,153 ---- except GmailLoginFailure,e: print "\nLogin failed. (%s)" % e.message ! else: ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(ContactsTests)) ! unittest.TextTestRunner(verbosity=2).run(suite) |
From: Stas Z. <sta...@us...> - 2005-06-02 13:44:54
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7394 Added Files: AddressEditorDialog_forms.py Log Message: initial import --- NEW FILE: AddressEditorDialog_forms.py --- # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'AddressEditorDialog.ui' # # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # # WARNING! All changes made in this file will be lost! from qt import * class FormAddressEditor(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("FormAddressEditor") self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.sizePolicy().hasHeightForWidth())) self.setMinimumSize(QSize(580,420)) self.pushButtonImport = QPushButton(self,"pushButtonImport") self.pushButtonImport.setGeometry(QRect(20,380,106,26)) self.pushButtonCancel = QPushButton(self,"pushButtonCancel") self.pushButtonCancel.setGeometry(QRect(450,380,106,26)) self.pushButtonCancel.setDefault(1) self.pushButtonOk = QPushButton(self,"pushButtonOk") self.pushButtonOk.setGeometry(QRect(320,380,106,26)) self.textLabel1 = QLabel(self,"textLabel1") self.textLabel1.setGeometry(QRect(100,10,380,20)) self.pushButtonEdit = QPushButton(self,"pushButtonEdit") self.pushButtonEdit.setGeometry(QRect(170,380,106,26)) self.listView3 = QListView(self,"listView3") self.listView3.addColumn(self.__tr("Name")) self.listView3.addColumn(self.__tr("Email address")) self.listView3.addColumn(self.__tr("Notes")) self.listView3.setGeometry(QRect(10,40,560,290)) self.listView3.setShowSortIndicator(1) self.textLabel1_2 = QLabel(self,"textLabel1_2") self.textLabel1_2.setGeometry(QRect(20,350,100,20)) self.lineEditSearch = QLineEdit(self,"lineEditSearch") self.lineEditSearch.setGeometry(QRect(124,350,160,20)) self.languageChange() self.resize(QSize(580,420).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.pushButtonImport,SIGNAL("clicked()"),self.pushButtonImport_clicked) self.connect(self.pushButtonOk,SIGNAL("clicked()"),self.pushButtonOk_clicked) self.connect(self.pushButtonCancel,SIGNAL("clicked()"),self.pushButtonCancel_clicked) self.connect(self.pushButtonEdit,SIGNAL("clicked()"),self.pushButtonEdit_clicked) self.connect(self.listView3,SIGNAL("clicked(QListViewItem*)"),self.listView3_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) def languageChange(self): self.setCaption(self.__tr("GmailAgent - Addressbook editor")) self.pushButtonImport.setText(self.__tr("Import contacts")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.pushButtonOk.setText(self.__tr("Ok")) self.textLabel1.setText(self.__tr("<h3>Select the address you want to edit and hit the 'Edit' button</h3>")) self.pushButtonEdit.setText(self.__tr("Edit")) self.listView3.header().setLabel(0,self.__tr("Name")) self.listView3.header().setLabel(1,self.__tr("Email address")) self.listView3.header().setLabel(2,self.__tr("Notes")) self.listView3.clear() item = QListViewItem(self.listView3,None) self.textLabel1_2.setText(self.__tr("Search for a name:")) def pushButtonImport_clicked(self): print "FormAddressEditor.pushButtonImport_clicked(): Not implemented yet" def pushButtonOk_clicked(self): print "FormAddressEditor.pushButtonOk_clicked(): Not implemented yet" def pushButtonCancel_clicked(self): print "FormAddressEditor.pushButtonCancel_clicked(): Not implemented yet" def pushButtonEdit_clicked(self): print "FormAddressEditor.pushButtonEdit_clicked(): Not implemented yet" def listView3_clicked(self,a0): print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" def lineEditSearch_textChanged(self,a0): print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" def __tr(self,s,c = None): return qApp.translate("FormAddressEditor",s,c) |
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2627 Modified Files: AboutDialog_forms.py AddressDialog_forms.py AddressEditDialog_forms.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py Log Message: minor updates Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MainWin_forms.py 2 Jun 2005 13:33:17 -0000 1.20 --- MainWin_forms.py 2 Jun 2005 13:36:14 -0000 1.21 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HelpDialog_forms.py 2 Jun 2005 13:33:17 -0000 1.6 --- HelpDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.7 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressEditDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressEditDialog_forms.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddressEditDialog_forms.py 2 Jun 2005 13:33:17 -0000 1.1 --- AddressEditDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.2 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Thu Jun 2 15:32:36 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** LoginDialog_forms.py 2 Jun 2005 13:33:17 -0000 1.20 --- LoginDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.21 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AboutDialog_forms.py 2 Jun 2005 13:33:16 -0000 1.17 --- AboutDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.18 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AddressDialog_forms.py 2 Jun 2005 13:33:16 -0000 1.7 --- AddressDialog_forms.py 2 Jun 2005 13:36:14 -0000 1.8 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 15:35:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # |
From: Stas Z. <sta...@us...> - 2005-06-02 13:33:31
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv797 Modified Files: AboutDialog_forms.py AddressDialog.ui AddressDialog_forms.py GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py Makefile Added Files: AddressEditDialog.ui AddressEditDialog.ui.h AddressEditDialog_forms.py AddressEditorDialog.ui AddressEditorDialog.ui.h Log Message: Added qt forms to create a new gmail contacts addressbook Index: AddressDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog.ui,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AddressDialog.ui 1 Jun 2005 18:01:55 -0000 1.3 --- AddressDialog.ui 2 Jun 2005 13:33:16 -0000 1.4 *************** *** 121,124 **** --- 121,153 ---- </property> </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>lineEditSearch</cstring> + </property> + <property name="geometry"> + <rect> + <x>130</x> + <y>320</y> + <width>160</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>320</y> + <width>120</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Search for a name:</string> + </property> + </widget> <widget class="QPushButton"> <property name="name"> *************** *** 139,173 **** <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> ! <x>350</x> <y>360</y> ! <width>70</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Ok</string> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> ! <x>450</x> <y>360</y> ! <width>106</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Cancel</string> ! </property> ! <property name="default"> ! <bool>true</bool> </property> </widget> --- 168,202 ---- <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> ! <x>460</x> <y>360</y> ! <width>106</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Cancel</string> ! </property> ! <property name="default"> ! <bool>true</bool> </property> </widget> <widget class="QPushButton"> <property name="name"> ! <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> ! <x>320</x> <y>360</y> ! <width>110</width> <height>26</height> </rect> </property> <property name="text"> ! <string>Ok</string> </property> </widget> *************** *** 260,292 **** </property> </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>lineEditSearch</cstring> - </property> - <property name="geometry"> - <rect> - <x>130</x> - <y>320</y> - <width>160</width> - <height>20</height> - </rect> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel3</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>320</y> - <width>120</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Search for a name:</string> - </property> - </widget> </widget> <images> --- 289,292 ---- *************** *** 360,363 **** --- 360,364 ---- <slot>listViewSend_clicked( QListViewItem * )</slot> <slot>lineEditSearch_textChanged( const QString & )</slot> + <slot>pushButtonImport_clicked()</slot> </slots> <layoutdefaults spacing="6" margin="11"/> Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AddressDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.6 --- AddressDialog_forms.py 2 Jun 2005 13:33:16 -0000 1.7 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 134,147 **** self.pushButton_remove.setPixmap(self.image1) self.pushButtonEdit = QPushButton(self,"pushButtonEdit") self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) - self.pushButtonOk = QPushButton(self,"pushButtonOk") - self.pushButtonOk.setGeometry(QRect(350,360,70,26)) - self.pushButtonCancel = QPushButton(self,"pushButtonCancel") ! self.pushButtonCancel.setGeometry(QRect(450,360,106,26)) self.pushButtonCancel.setDefault(1) self.listViewSend = QListView(self,"listViewSend") self.listViewSend.addColumn(self.__tr("Name")) --- 134,153 ---- self.pushButton_remove.setPixmap(self.image1) + self.lineEditSearch = QLineEdit(self,"lineEditSearch") + self.lineEditSearch.setGeometry(QRect(130,320,160,20)) + + self.textLabel3 = QLabel(self,"textLabel3") + self.textLabel3.setGeometry(QRect(10,320,120,20)) + self.pushButtonEdit = QPushButton(self,"pushButtonEdit") self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) self.pushButtonCancel = QPushButton(self,"pushButtonCancel") ! self.pushButtonCancel.setGeometry(QRect(460,360,106,26)) self.pushButtonCancel.setDefault(1) + self.pushButtonOk = QPushButton(self,"pushButtonOk") + self.pushButtonOk.setGeometry(QRect(320,360,110,26)) + self.listViewSend = QListView(self,"listViewSend") self.listViewSend.addColumn(self.__tr("Name")) *************** *** 160,169 **** self.listViewBook.setShowSortIndicator(1) - self.lineEditSearch = QLineEdit(self,"lineEditSearch") - self.lineEditSearch.setGeometry(QRect(130,320,160,20)) - - self.textLabel3 = QLabel(self,"textLabel3") - self.textLabel3.setGeometry(QRect(10,320,120,20)) - self.languageChange() --- 166,169 ---- *************** *** 189,200 **** self.pushButton_remove.setText(QString.null) QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) self.pushButtonEdit.setText(self.__tr("Edit addressbook")) - self.pushButtonOk.setText(self.__tr("Ok")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.listViewSend.header().setLabel(0,self.__tr("Name")) self.listViewSend.header().setLabel(1,self.__tr("Email Address")) self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) - self.textLabel3.setText(self.__tr("Search for a name:")) --- 189,200 ---- self.pushButton_remove.setText(QString.null) QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) + self.textLabel3.setText(self.__tr("Search for a name:")) self.pushButtonEdit.setText(self.__tr("Edit addressbook")) self.pushButtonCancel.setText(self.__tr("Cancel")) + self.pushButtonOk.setText(self.__tr("Ok")) self.listViewSend.header().setLabel(0,self.__tr("Name")) self.listViewSend.header().setLabel(1,self.__tr("Email Address")) self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) *************** *** 223,226 **** --- 223,229 ---- print "FormAddress.lineEditSearch_textChanged(const QString&): Not implemented yet" + def pushButtonImport_clicked(self): + print "FormAddress.pushButtonImport_clicked(): Not implemented yet" + def __tr(self,s,c = None): return qApp.translate("FormAddress",s,c) --- NEW FILE: AddressEditDialog.ui.h --- /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you want to add, delete, or rename functions or slots, use ** Qt Designer to update this file, preserving your code. ** ** You should not define a constructor or destructor in this file. ** Instead, write your code in functions called init() and destroy(). ** These will automatically be called by the form's constructor and ** destructor. *****************************************************************************/ void FormAddressEdit::pushButtonOk_clicked() { } void FormAddressEdit::pushButtonCancel_clicked() { } --- NEW FILE: AddressEditorDialog.ui.h --- /**************************************************************************** ** ui.h extension file, included from the uic-generated form implementation. ** ** If you want to add, delete, or rename functions or slots, use ** Qt Designer to update this file, preserving your code. ** ** You should not define a constructor or destructor in this file. ** Instead, write your code in functions called init() and destroy(). ** These will automatically be called by the form's constructor and ** destructor. *****************************************************************************/ void Form1::pushButtonImport_clicked() { } void Form1::pushButtonOk_clicked() { } void Form1::pushButtonCancel_clicked() { } void FormAddressEditor::pushButtonEdit_clicked() { } void FormAddressEditor::listView3_clicked( QListViewItem * ) { } void FormAddressEditor::lineEditSearch_textChanged( const QString & ) { } Index: Makefile =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 15 May 2005 14:04:32 -0000 1.7 --- Makefile 2 Jun 2005 13:33:17 -0000 1.8 *************** *** 6,7 **** --- 6,10 ---- pyuic HelpDialog.ui -o HelpDialog_forms.py pyuic AddressDialog.ui -o AddressDialog_forms.py + pyuic AddressEditDialog.ui -o AddressEditDialog_forms.py + pyuic AddressEditorDialog.ui -o AddressEditorDialog_forms.py + \ No newline at end of file Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AboutDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.16 --- AboutDialog_forms.py 2 Jun 2005 13:33:16 -0000 1.17 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** GuiQT.py 1 Jun 2005 18:07:28 -0000 1.26 --- GuiQT.py 2 Jun 2005 13:33:17 -0000 1.27 *************** *** 20,32 **** GQ_DEBUG = 0 from qt import * from MainWin_forms import Form1 from LoginDialog_forms import FormLogin from AboutDialog_forms import FormAbout from HelpDialog_forms import FormHelp ! from AddressDialog_forms import FormAddress import Gmail,AddressBook import sys,os,logging try: import paths --- 20,37 ---- GQ_DEBUG = 0 + from qt import * + from MainWin_forms import Form1 from LoginDialog_forms import FormLogin from AboutDialog_forms import FormAbout from HelpDialog_forms import FormHelp ! from AddressEditorDialog_forms import FormAddressEditor ! from AddressEditDialog_forms import FormAddressEdit from AddressDialog_forms import FormAddress + import Gmail,AddressBook import sys,os,logging + try: import paths *************** *** 40,43 **** --- 45,49 ---- # TODO Add a addrfile path to the rcfile? # By doing so we can startup with the user selected addressfile? + # REMINDER the addressfile is a local copy of the Gmail contacts. addrfile = os.path.expanduser('~/.gmailaddressbook') if not os.path.exists(addrfile): *************** *** 291,296 **** # object so we make it a class attribute. self.Myobs = Observer(self._load) ! ad = AddressBook.ABMainWindow(parent=self,observer=self.Myobs,file=addrfile) ! def pushButtonOk_clicked(self): nameslist,names = [],'' --- 297,303 ---- # object so we make it a class attribute. self.Myobs = Observer(self._load) ! #ad = AddressBook.ABMainWindow(parent=self,observer=self.Myobs,file=addrfile) ! AddressBookEditorDialog(parent=self) ! def pushButtonOk_clicked(self): nameslist,names = [],'' *************** *** 395,396 **** --- 402,429 ---- if GQ_DEBUG: logging.debug("getSelection returns, %s" % objlist) return objlist + + class AddressBookEditorDialog(FormAddressEditor): + def __init__(self,parent=None,name=None,modal=0,fl=0,file=addrfile,observer=None): + if GQ_DEBUG: logging.debug("AddressBookDialog start") + FormAddressEditor.__init__(self,parent,name,modal,fl) + self.parent = parent + self.show() + + def pushButtonImport_clicked(self): + print "FormAddressEditor.pushButtonImport_clicked(): Not implemented yet" + + def pushButtonOk_clicked(self): + print "FormAddressEditor.pushButtonOk_clicked(): Not implemented yet" + + def pushButtonCancel_clicked(self): + print "FormAddressEditor.pushButtonCancel_clicked()" + self.done(1) + + def pushButtonEdit_clicked(self): + print "FormAddressEditor.pushButtonEdit_clicked(): Not implemented yet" + + def listView3_clicked(self,a0): + print "FormAddressEditor.listView3_clicked(QListViewItem*): Not implemented yet" + + def lineEditSearch_textChanged(self,a0): + print "FormAddressEditor.lineEditSearch_textChanged(const QString&): Not implemented yet" Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MainWin_forms.py 1 Jun 2005 18:35:23 -0000 1.19 --- MainWin_forms.py 2 Jun 2005 13:33:17 -0000 1.20 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HelpDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.5 --- HelpDialog_forms.py 2 Jun 2005 13:33:17 -0000 1.6 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- NEW FILE: AddressEditDialog_forms.py --- # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'AddressEditDialog.ui' # # Created: Thu Jun 2 15:32:36 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # # WARNING! All changes made in this file will be lost! from qt import * class FormAddressEdit(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) if not name: self.setName("FormAddressEdit") self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.sizePolicy().hasHeightForWidth())) self.setMinimumSize(QSize(360,250)) self.textLabel2 = QLabel(self,"textLabel2") self.textLabel2.setGeometry(QRect(50,20,40,20)) self.textLabel3 = QLabel(self,"textLabel3") self.textLabel3.setGeometry(QRect(10,50,80,20)) self.textLabel4 = QLabel(self,"textLabel4") self.textLabel4.setGeometry(QRect(50,80,40,20)) self.textEditNotes = QTextEdit(self,"textEditNotes") self.textEditNotes.setGeometry(QRect(90,80,240,104)) self.lineEditEmail = QLineEdit(self,"lineEditEmail") self.lineEditEmail.setGeometry(QRect(90,50,240,20)) self.lineEditName = QLineEdit(self,"lineEditName") self.lineEditName.setGeometry(QRect(90,20,240,20)) self.pushButtonCancel = QPushButton(self,"pushButtonCancel") self.pushButtonCancel.setGeometry(QRect(230,210,106,26)) self.pushButtonCancel.setDefault(1) self.pushButtonOk = QPushButton(self,"pushButtonOk") self.pushButtonOk.setGeometry(QRect(30,210,106,26)) self.languageChange() self.resize(QSize(360,250).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.connect(self.pushButtonOk,SIGNAL("clicked()"),self.pushButtonOk_clicked) self.connect(self.pushButtonCancel,SIGNAL("clicked()"),self.pushButtonCancel_clicked) def languageChange(self): self.setCaption(self.__tr("GmailAgent - Edit an contact")) self.textLabel2.setText(self.__tr("Name:")) self.textLabel3.setText(self.__tr("Email Address:")) self.textLabel4.setText(self.__tr("Notes:")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.pushButtonOk.setText(self.__tr("OK")) def pushButtonOk_clicked(self): print "FormAddressEdit.pushButtonOk_clicked(): Not implemented yet" def pushButtonCancel_clicked(self): print "FormAddressEdit.pushButtonCancel_clicked(): Not implemented yet" def __tr(self,s,c = None): return qApp.translate("FormAddressEdit",s,c) Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** LoginDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.19 --- LoginDialog_forms.py 2 Jun 2005 13:33:17 -0000 1.20 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Thu Jun 2 15:32:35 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- NEW FILE: AddressEditorDialog.ui --- <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>FormAddressEditor</class> <widget class="QDialog"> <property name="name"> <cstring>FormAddressEditor</cstring> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>580</width> <height>420</height> </rect> </property> <property name="sizePolicy"> <sizepolicy> <hsizetype>0</hsizetype> <vsizetype>0</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>580</width> <height>420</height> </size> </property> <property name="caption"> <string>GmailAgent - Addressbook editor</string> </property> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonImport</cstring> </property> <property name="geometry"> <rect> <x>20</x> <y>380</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>Import contacts</string> </property> </widget> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> <x>450</x> <y>380</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>Cancel</string> </property> <property name="default"> <bool>true</bool> </property> </widget> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> <x>320</x> <y>380</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>Ok</string> </property> </widget> <widget class="QLabel"> <property name="name"> <cstring>textLabel1</cstring> </property> <property name="geometry"> <rect> <x>100</x> <y>10</y> <width>380</width> <height>20</height> </rect> </property> <property name="text"> <string><h3>Select the address you want to edit and hit the 'Edit' button</h3></string> </property> </widget> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonEdit</cstring> </property> <property name="geometry"> <rect> <x>170</x> <y>380</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>Edit</string> </property> </widget> <widget class="QListView"> <column> <property name="text"> <string>Name</string> </property> <property name="clickable"> <bool>true</bool> </property> <property name="resizable"> <bool>true</bool> </property> </column> <column> <property name="text"> <string>Email address</string> </property> <property name="clickable"> <bool>true</bool> </property> <property name="resizable"> <bool>true</bool> </property> </column> <column> <property name="text"> <string>Notes</string> </property> <property name="clickable"> <bool>true</bool> </property> <property name="resizable"> <bool>true</bool> </property> </column> <item> <property name="text"> <string></string> </property> <property name="text"> <string></string> </property> <property name="text"> <string></string> </property> <property name="pixmap"> <pixmap></pixmap> </property> <property name="pixmap"> <pixmap></pixmap> </property> <property name="pixmap"> <pixmap></pixmap> </property> </item> <property name="name"> <cstring>listView3</cstring> </property> <property name="geometry"> <rect> <x>10</x> <y>40</y> <width>560</width> <height>290</height> </rect> </property> <property name="showSortIndicator"> <bool>true</bool> </property> </widget> <widget class="QLabel"> <property name="name"> <cstring>textLabel1_2</cstring> </property> <property name="geometry"> <rect> <x>20</x> <y>350</y> <width>100</width> <height>20</height> </rect> </property> <property name="text"> <string>Search for a name:</string> </property> </widget> <widget class="QLineEdit"> <property name="name"> <cstring>lineEditSearch</cstring> </property> <property name="geometry"> <rect> <x>124</x> <y>350</y> <width>160</width> <height>20</height> </rect> </property> </widget> </widget> <connections> <connection> <sender>pushButtonImport</sender> <signal>clicked()</signal> <receiver>FormAddressEditor</receiver> <slot>pushButtonImport_clicked()</slot> </connection> <connection> <sender>pushButtonOk</sender> <signal>clicked()</signal> <receiver>FormAddressEditor</receiver> <slot>pushButtonOk_clicked()</slot> </connection> <connection> <sender>pushButtonCancel</sender> <signal>clicked()</signal> <receiver>FormAddressEditor</receiver> <slot>pushButtonCancel_clicked()</slot> </connection> <connection> <sender>pushButtonEdit</sender> <signal>clicked()</signal> <receiver>FormAddressEditor</receiver> <slot>pushButtonEdit_clicked()</slot> </connection> <connection> <sender>listView3</sender> <signal>clicked(QListViewItem*)</signal> <receiver>FormAddressEditor</receiver> <slot>listView3_clicked(QListViewItem*)</slot> </connection> <connection> <sender>lineEditSearch</sender> <signal>textChanged(const QString&)</signal> <receiver>FormAddressEditor</receiver> <slot>lineEditSearch_textChanged(const QString&)</slot> </connection> </connections> <includes> <include location="local" impldecl="in implementation">AddressEditorDialog.ui.h</include> </includes> <slots> <slot>pushButtonImport_clicked()</slot> <slot>pushButtonOk_clicked()</slot> <slot>pushButtonCancel_clicked()</slot> <slot>pushButtonEdit_clicked()</slot> <slot>listView3_clicked( QListViewItem * )</slot> <slot>lineEditSearch_textChanged( const QString & )</slot> </slots> <layoutdefaults spacing="6" margin="11"/> </UI> --- NEW FILE: AddressEditDialog.ui --- <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>FormAddressEdit</class> <widget class="QDialog"> <property name="name"> <cstring>FormAddressEdit</cstring> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>360</width> <height>250</height> </rect> </property> <property name="sizePolicy"> <sizepolicy> <hsizetype>0</hsizetype> <vsizetype>0</vsizetype> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> <width>360</width> <height>250</height> </size> </property> <property name="caption"> <string>GmailAgent - Edit an contact</string> </property> <widget class="QLabel"> <property name="name"> <cstring>textLabel2</cstring> </property> <property name="geometry"> <rect> <x>50</x> <y>20</y> <width>40</width> <height>20</height> </rect> </property> <property name="text"> <string>Name:</string> </property> </widget> <widget class="QLabel"> <property name="name"> <cstring>textLabel3</cstring> </property> <property name="geometry"> <rect> <x>10</x> <y>50</y> <width>80</width> <height>20</height> </rect> </property> <property name="text"> <string>Email Address:</string> </property> </widget> <widget class="QLabel"> <property name="name"> <cstring>textLabel4</cstring> </property> <property name="geometry"> <rect> <x>50</x> <y>80</y> <width>40</width> <height>20</height> </rect> </property> <property name="text"> <string>Notes:</string> </property> </widget> <widget class="QTextEdit"> <property name="name"> <cstring>textEditNotes</cstring> </property> <property name="geometry"> <rect> <x>90</x> <y>80</y> <width>240</width> <height>104</height> </rect> </property> </widget> <widget class="QLineEdit"> <property name="name"> <cstring>lineEditEmail</cstring> </property> <property name="geometry"> <rect> <x>90</x> <y>50</y> <width>240</width> <height>20</height> </rect> </property> </widget> <widget class="QLineEdit"> <property name="name"> <cstring>lineEditName</cstring> </property> <property name="geometry"> <rect> <x>90</x> <y>20</y> <width>240</width> <height>20</height> </rect> </property> </widget> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonCancel</cstring> </property> <property name="geometry"> <rect> <x>230</x> <y>210</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>Cancel</string> </property> <property name="default"> <bool>true</bool> </property> </widget> <widget class="QPushButton"> <property name="name"> <cstring>pushButtonOk</cstring> </property> <property name="geometry"> <rect> <x>30</x> <y>210</y> <width>106</width> <height>26</height> </rect> </property> <property name="text"> <string>OK</string> </property> </widget> </widget> <connections> <connection> <sender>pushButtonOk</sender> <signal>clicked()</signal> <receiver>FormAddressEdit</receiver> <slot>pushButtonOk_clicked()</slot> </connection> <connection> <sender>pushButtonCancel</sender> <signal>clicked()</signal> <receiver>FormAddressEdit</receiver> <slot>pushButtonCancel_clicked()</slot> </connection> </connections> <includes> <include location="local" impldecl="in implementation">AddressEditDialog.ui.h</include> </includes> <slots> <slot>pushButtonOk_clicked()</slot> <slot>pushButtonCancel_clicked()</slot> </slots> <layoutdefaults spacing="6" margin="11"/> </UI> |
From: Stas Z. <sta...@us...> - 2005-06-02 13:15:07
|
Update of /cvsroot/gmailagent/GA-libgmail2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23659 Modified Files: libgmail2.py Log Message: Added a comment Index: libgmail2.py =================================================================== RCS file: /cvsroot/gmailagent/GA-libgmail2/libgmail2.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libgmail2.py 1 Jun 2005 23:41:30 -0000 1.2 --- libgmail2.py 2 Jun 2005 13:14:48 -0000 1.3 *************** *** 757,760 **** --- 757,762 ---- else: # We have no idea what this is + # Wouldn't it be better to replace the 'print' with a call to 'logging' + # like the rest of this lib does? (stas) print "\n\n" print "** We shouldn't be here! **" |
From: Stas Z. <sta...@us...> - 2005-06-02 10:01:12
|
Update of /cvsroot/gmailagent/GA-libgmail2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20516 Modified Files: testlibgmail2_stas.py Log Message: minor updates Index: testlibgmail2_stas.py =================================================================== RCS file: /cvsroot/gmailagent/GA-libgmail2/testlibgmail2_stas.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testlibgmail2_stas.py 2 Jun 2005 09:44:51 -0000 1.1 --- testlibgmail2_stas.py 2 Jun 2005 10:00:35 -0000 1.2 *************** *** 141,146 **** print "Start 'libgmail2 contacts' testsuite" print "------------------------------------------------\n" ! print "WARNING: THIS MAY DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" name = raw_input("Gmail account name:") --- 141,147 ---- print "Start 'libgmail2 contacts' testsuite" print "------------------------------------------------\n" ! print "WARNING: THIS WILL DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" + print " BE SURE TO RUN THIS TEST ONLY ON A 'test' ACCOUNT" name = raw_input("Gmail account name:") |
From: Stas Z. <sta...@us...> - 2005-06-02 09:45:00
|
Update of /cvsroot/gmailagent/GA-libgmail2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12322 Added Files: testlibgmail2_stas.py Log Message: My personal views on a test suite. --- NEW FILE: testlibgmail2_stas.py --- """ libgmail2_stas test suite Added my ideas about a testing suite :-) (stas) Tests: Contacts """ import unittest from libgmail2 import * import getpass class LevelsCheck(unittest.TestCase): """ Set of tests that exercise libgmail2's contacts capabilities. These really all need to be run in order, for the most part, or we become unhappy. The function names should make it clear what they test """ def setUp(self): """ Delete all entries in the addressbook so we start fresh """ #print "Setting up!" contacts = account.getContacts().getAllContacts() for contact in contacts: # print "Removing", contact account.removeContact(contact) def tearDown(self): """ Delete all entries in the addressbook so we start fresh """ #print "Tearing down!" contacts = account.getContacts().getAllContacts() for contact in contacts: # print "Removing", contact account.removeContact(contact) def test3_GmailContact(self): """Get GmailContact class instances.""" w = GmailContact('a','b','c','d') x = GmailContact('x','y','z') y = GmailContact('a','b','c','d') z = GmailContact('a','b','c','d') self.assertEqual(w,w, "%s doesn't equals %s" % (w,w)) self.assertEqual(x,x, "%s doesn't equals %s" % (x,x)) self.assertEqual(y,y, "%s doesn't equals %s" % (y,y)) self.assertEqual(z,z, "%s doesn't equals %s" % (z,z)) self.assertEqual(w,y, "%s doesn't equals %s" % (w,y)) self.assertEqual(y,z, "%s doesn't equals %s" % (y,z)) self.assertEqual(w,z, "%s doesn't equals %s" % (w,z)) self.assertEqual(z,w, "%s doesn't equals %s" % (z,w)) self.assertNotEqual(w,x, "%s shouldn't equals %s" % (w,x)) self.assertNotEqual(x,w, "%s shouldn't equals %s" % (x,w)) i,a,e,n = w.getId(),w.getName(),w.getEmail(),w.getNotes() self.assertEqual(i, 'a', "%s doesn't equals 'a'" % i) self.assertEqual(a, 'b', "%s doesn't equals 'b'" % a) self.assertEqual(e, 'c', "%s doesn't equals 'c'" % e) self.assertEqual(n, 'd', "%s doesn't equals 'd'" % n) self.assertEqual(x.getNotes(), '', "getNotes() should return ''") def test4_GetBy(self): """Get address by name""" account.addContact('Waseem', 'wd...@gm...', 'Is awesome') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') self.assertEqual(waseem, myContacts.getContactByEmail('wd...@gm...')) self.assertEqual(waseem, myContacts.getContactById(waseem.getId())) def test5_GetByLists(self): """Get address by name,email and id""" account.addContact('Waseem', 'wd...@gm...', 'Is awesome') account.addContact('Daher', 'te...@fo...r') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') result = [waseem] obj = myContacts.getContactListByName('Waseem') self.assertEqual(result, obj, "%s doesn't equals %s" % (result,obj)) obj = myContacts.getContactListByEmail('wd...@gm...') self.assertEqual([waseem], obj,"%s doesn't equals %s" % (result,obj)) obj = myContacts.getContactListById(waseem.getId()) self.assertEqual([waseem], obj,"%s doesn't equals %s" % (result,obj)) def test6_SmallGetAndRemove(self): """Add one address and remove it again""" count = 1 # Add some for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) def test7_MediumGetAndRemove(self): """Add 14 adresses and remove them again""" count = 14 for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) def test8_LargeGetAndRemove(self): """Add 25 adresses and remove them again""" count = 25 for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) if __name__ == '__main__': #unittest.main() ## With this we get a better output print "\n==============================================" print "Start 'libgmail2 contacts' testsuite" print "------------------------------------------------\n" print "WARNING: THIS MAY DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" name = raw_input("Gmail account name:") pw = getpass.getpass("Password: ") account = GmailAccount(name, pw) try: account.login() print "Login successful.\n" except GmailLoginFailure,e: print "\nLogin failed. (%s)" % e.message else: suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(LevelsCheck)) unittest.TextTestRunner(verbosity=2).run(suite) |
From: Waseem D. <wd...@us...> - 2005-06-01 23:41:41
|
Update of /cvsroot/gmailagent/GA-libgmail2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3581 Modified Files: libgmail2.py Added Files: testlibgmail2.py Log Message: Fixed getContacts() in libgmail2 (there were severe issues with the way it was done before) Added some nicer methods to GmailContactList Defined equality on GmailContacts Added awesome test suite for contacts in testlibgmail2.py (needs Python 2.4, I think, because assertTrue doesn't exist in unit tests in python 2.3?) Index: libgmail2.py =================================================================== RCS file: /cvsroot/gmailagent/GA-libgmail2/libgmail2.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** libgmail2.py 1 Jun 2005 14:55:31 -0000 1.1.1.1 --- libgmail2.py 1 Jun 2005 23:41:30 -0000 1.2 *************** *** 1,5 **** #!/usr/bin/python2.3 # ! # libgmail -- Gmail access via Python # # Version: 0.0.9 (XX October 2004) --- 1,5 ---- #!/usr/bin/python2.3 # ! # libgmail2 -- Gmail access via Python # # Version: 0.0.9 (XX October 2004) *************** *** 41,44 **** --- 41,45 ---- import logging import mimetypes + import types from email.MIMEBase import MIMEBase *************** *** 711,729 **** GmailContacts """ # pnl = a is necessary to get *all* contacts? myUrl = _buildURL(view='cl',search='contacts', pnl='a') myData = self._parsePage(myUrl) # This comes back with a dictionary ! # with entry 'a' which is a list of ! # tuples of 15 entries each-ish? ! contactList = [] addresses = myData['a'] ! for myTuple in addresses: ! # Each tuple has ~15 address entries ! for entry in myTuple: ! # Consider checking the length of entry before this? ! newGmailContact = GmailContact(entry[1], entry[2], entry[4], entry[5]) ! contactList.append(newGmailContact) ! #print "rawPage", self._retrievePage(myUrl) --- 712,777 ---- GmailContacts """ + contactList = [] + def addEntry(entry): + """ + Add an entry to our contact list + """ + # First, make sure the entry has at least an acceptable length + # (otherwise it doesn't have all the data we expect/need) + # + # We could probably be smarter about this... like if elements + # 1,2,and 4 are present, then just run with that. Though, we probably + # shouldn't rely on partially-well-formed data structures -- because + # if they change, chances are that something *bigger* in gmail changed + # that we're not ready to deal with + if len(entry) >= 6: + newGmailContact = GmailContact(entry[1], entry[2], entry[4], entry[5]) + contactList.append(newGmailContact) + + def extractEntries(possibleData): + """ + Strip out entries from this potential entry chunk + (in an awesome recursive fashion) + """ + # possibleData is either going to be an entry (which is a list), + # a tuple with up to 15 entries in it, + # or a list of tuples, each of which has up to 15 entries. + # So deal accordingly. + if type(possibleData) == types.ListType: + # Ok, either this is just one entry, or a list of tuples + # If this is just one entry, the first element + # will be 'ce' + if len(possibleData) >= 1 and possibleData[0]=='ce': + addEntry(possibleData) + else: + # Ok, this is the list of tuples + for mytuple in possibleData: + extractEntries(mytuple) + elif type(possibleData) == types.TupleType: + # Ok, this is a tuple of entries, probably + for entry in possibleData: + extractEntries(entry) + elif type(possibleData) == types.StringType and possibleData == '': + # This is fine, empty addressbook + pass + else: + # We have no idea what this is + print "\n\n" + print "** We shouldn't be here! **" + print "DEBUG INFO:" + print "type of myData[a]:", type(possibleData) + print "myData[a]", myData['a'] + print "ContactList:", contactList + for x in contactList: + print "Entry:",x + raise RuntimeError("Gmail must have changed something. Please notify the libgmail developers.") + # pnl = a is necessary to get *all* contacts? myUrl = _buildURL(view='cl',search='contacts', pnl='a') myData = self._parsePage(myUrl) # This comes back with a dictionary ! # with entry 'a' addresses = myData['a'] ! extractEntries(addresses) #print "rawPage", self._retrievePage(myUrl) *************** *** 731,734 **** --- 779,785 ---- #print "myData", myData #print "mydata[a]", myData['a'] + #print "cl", contactList + #for x in contactList: + # print "x:",x return GmailContactList(contactList) *************** *** 778,785 **** person we just killed. You should be using removeContact instead. """ - # TODO: Maybe make sure that this ID exists or something - # smart like that? myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up') pageData = self._retrievePage(myURL) --- 829,835 ---- person we just killed. + Don't call this method. You should be using removeContact instead. """ myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up') pageData = self._retrievePage(myURL) *************** *** 797,812 **** Returns True if successful, False otherwise. """ ! # TODO: Ensure that this is really a GmailContact? ! # Also, maybe this could lead to weird bad cache coherence? ! # Imaigne user A gets the contact list ! # Then user B, using gmail, deletes contact X and adds contact Y ! # which then gets contact X's id ! # Then, A tries to delete X using this, but deletes Y ! # by accident! ! # So it's a concern to do things strictly by ID like this ! # If we were smarter, we could fetch the contact list again ! # and compare fields, I suppose ! contactId = gmailContact.getId() ! return self._removeContactById(contactId) --- 847,870 ---- Returns True if successful, False otherwise. """ ! # Let's re-fetch the contact list to make ! # sure we're really deleting the guy ! # we think we're deleting ! newContactList = self.getContacts() ! newVersionOfPersonToDelete = newContactList.getContactById(gmailContact.getId()) ! # Ok, now we need to ensure that gmailContact ! # is the same as newVersionOfPersonToDelete ! # and then we can go ahead and delete him/her ! if (gmailContact == newVersionOfPersonToDelete): ! return self._removeContactById(gmailContact.getId()) ! else: ! # We have a cache coherency problem -- someone ! # else now occupies this ID slot. ! # TODO: Perhaps signal this in some nice way ! # to the end user? ! ! print "Unable to delete." ! print "Old version of person:",gmailContact ! print "New version of person:",newVersionOfPersonToDelete ! return False *************** *** 822,825 **** --- 880,890 ---- def __str__(self): return "%s %s %s %s" % (self.id, self.name, self.email, self.notes) + def __eq__(self, other): + if not isinstance(other, GmailContact): + return False + return (self.getId() == other.getId()) and \ + (self.getName() == other.getName()) and \ + (self.getEmail() == other.getEmail()) and \ + (self.getNotes() == other.getNotes()) def getId(self): return self.id *************** *** 840,880 **** def __str__(self): return '\n'.join([str(item) for item in self.contactList]) ! def getContactById(self, id): """ ! Returns the first contact in the ! address book with the specified id. ! Contact list *should* be unique by id ! (unless gmail stops enforcing this) ! ! ID IS A STRING ! Returns False if no entry found """ ! # This is going to be O(n), which sort of sucks ! for entry in self.contactList: ! if entry.getId() == id: ! return entry ! return False def getContactByEmail(self, email): """ ! Returns the first contact in the ! address book with the specified email. ! Contact list *should* be unique by email ! (unless gmail stops enforcing this) ! Returns False if no entry found """ ! for entry in self.contactList: ! if entry.getEmail() == email: ! return entry ! return False def getContactListByName(self, name): """ This function returns a LIST of GmailContacts whose name is ! 'name'. The problem is that there ! may very well be more than one entry ! with the same name, whereas we have ! guarantees of uniqueness with Id and Email Returns an empty list if no contacts --- 905,966 ---- def __str__(self): return '\n'.join([str(item) for item in self.contactList]) ! def getCount(self): """ ! Returns number of contacts ! """ ! return len(self.contactList) ! def getAllContacts(self): ! """ ! Returns an array of all the ! GmailContacts ! """ ! return self.contactList ! def getContactByName(self, name): ! """ ! Gets the first contact in the ! address book whose name is 'name'. ! Returns False if no contact ! could be found """ ! nameList = self.getContactListByName(name) ! if len(nameList) > 0: ! return nameList[0] ! else: ! return False def getContactByEmail(self, email): """ ! Gets the first contact in the ! address book whose name is 'email'. ! Returns False if no contact ! could be found """ ! emailList = self.getContactListByEmail(email) ! if len(emailList) > 0: ! return emailList[0] ! else: ! return False ! def getContactById(self, myId): ! """ ! Gets the first contact in the ! address book whose id is 'myId'. ! ! REMEMBER: ID IS A STRING ! ! Returns False if no contact ! could be found ! """ ! idList = self.getContactListById(myId) ! if len(idList) > 0: ! return idList[0] ! else: ! return False def getContactListByName(self, name): """ This function returns a LIST of GmailContacts whose name is ! 'name'. We expect there only to ! be one, but just in case! Returns an empty list if no contacts *************** *** 886,889 **** --- 972,1007 ---- nameList.append(entry) return nameList + def getContactListByEmail(self, email): + """ + This function returns a LIST + of GmailContacts whose email is + 'email'. We expect there only to + be one, but just in case! + + Returns an empty list if no contacts + were found + """ + emailList = [] + for entry in self.contactList: + if entry.getEmail() == email: + emailList.append(entry) + return emailList + def getContactListById(self, myId): + """ + This function returns a LIST + of GmailContacts whose id is + 'myId'. We expect there only to + be one, but just in case! + + Remember: ID IS A STRING + + Returns an empty list if no contacts + were found + """ + idList = [] + for entry in self.contactList: + if entry.getId() == myId: + idList.append(entry) + return idList def _splitBunches(infoItems): --- NEW FILE: testlibgmail2.py --- """ libgmail2 test suite Tests: Contacts """ from libgmail2 import * import unittest import getpass class ContactsTests(unittest.TestCase): """ Set of tests that exercise libgmail2's contacts capabilities. These really all need to be run in order, for the most part, or we become unhappy. The function names should make it clear what they test """ def setUp(self): """ Delete all entries in the addressbook so we start fresh """ #print "Setting up!" contacts = account.getContacts().getAllContacts() for contact in contacts: # print "Removing", contact account.removeContact(contact) def tearDown(self): """ Delete all entries in the addressbook so we start fresh """ #print "Tearing down!" contacts = account.getContacts().getAllContacts() for contact in contacts: # print "Removing", contact account.removeContact(contact) def testGmailContact(self): w = GmailContact('a','b','c','d') x = GmailContact('x','y','z') y = GmailContact('a','b','c','d') z = GmailContact('a','b','c','d') self.assertEqual(w,w) self.assertEqual(x,x) self.assertEqual(y,y) self.assertEqual(z,z) self.assertEqual(w,y) self.assertEqual(y,z) self.assertEqual(w,z) self.assertEqual(z,w) self.assertNotEqual(w,x) self.assertNotEqual(x,w) self.assertEqual(w.getId(), 'a') self.assertEqual(w.getName(), 'b') self.assertEqual(w.getEmail(), 'c') self.assertEqual(w.getNotes(), 'd') self.assertEqual(x.getNotes(), '') def testGetBy(self): account.addContact('Waseem', 'wd...@gm...', 'Is awesome') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') self.assertEqual(waseem, myContacts.getContactByEmail('wd...@gm...')) self.assertEqual(waseem, myContacts.getContactById(waseem.getId())) def testGetByLists(self): account.addContact('Waseem', 'wd...@gm...', 'Is awesome') account.addContact('Daher', 'te...@fo...r') myContacts = account.getContacts() waseem = myContacts.getContactByName('Waseem') self.assertEqual([waseem], myContacts.getContactListByName('Waseem')) self.assertEqual([waseem], myContacts.getContactListByEmail('wd...@gm...')) self.assertEqual([waseem], myContacts.getContactListById(waseem.getId())) def testSmallGetAndRemove(self): count = 1 # Add some for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) def testMediumGetAndRemove(self): count = 14 for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) def testLargeGetAndRemove(self): count = 25 for x in range(count): account.addContact(str(x), str(x)) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), count) # Now remove them all for x in range(count): self.assertTrue(account.removeContact(myContactList.getContactByName(str(x)))) myContactList = account.getContacts() self.assertEqual(myContactList.getCount(), 0) if __name__ == '__main__': print "Starting libgmail2 test suite..." print "WARNING: THIS MAY DELETE/REARRANGE" print " YOUR ADDRESSBOOK/EMAILS" name = raw_input("Gmail account name:") pw = getpass.getpass("Password: ") account = GmailAccount(name, pw) try: account.login() print "Login successful.\n" except GmailLoginFailure,e: print "\nLogin failed. (%s)" % e.message unittest.main() |
From: Stas Z. <sta...@us...> - 2005-06-01 18:35:32
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3744 Modified Files: AboutDialog_forms.py AddressDialog_forms.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py filelist Log Message: Updated the qt forms The maketarball script now copies the libgmail2 stuff from the libgmail2 cvs module. Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** MainWin_forms.py 1 Jun 2005 18:07:28 -0000 1.18 --- MainWin_forms.py 1 Jun 2005 18:35:23 -0000 1.19 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HelpDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.4 --- HelpDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.5 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Mon May 30 16:05:18 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: filelist =================================================================== RCS file: /cvsroot/gmailagent/GA-main/filelist,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** filelist 1 Jun 2005 18:01:55 -0000 1.7 --- filelist 1 Jun 2005 18:35:23 -0000 1.8 *************** *** 1,5 **** INSTALL README ! constants.py GmailAgent.py Gmail.py --- 1,5 ---- INSTALL README ! ../GA-libgmail2/constants.py GmailAgent.py Gmail.py Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** LoginDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.18 --- LoginDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.19 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AboutDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.15 --- AboutDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.16 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AddressDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.5 --- AddressDialog_forms.py 1 Jun 2005 18:35:23 -0000 1.6 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Mon May 30 16:05:18 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Wed Jun 1 20:29:02 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 134,137 **** --- 134,140 ---- self.pushButton_remove.setPixmap(self.image1) + self.pushButtonEdit = QPushButton(self,"pushButtonEdit") + self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) + self.pushButtonOk = QPushButton(self,"pushButtonOk") self.pushButtonOk.setGeometry(QRect(350,360,70,26)) *************** *** 141,150 **** self.pushButtonCancel.setDefault(1) - self.textLabel3 = QLabel(self,"textLabel3") - self.textLabel3.setGeometry(QRect(10,320,85,20)) - - self.lineEditSearch = QLineEdit(self,"lineEditSearch") - self.lineEditSearch.setGeometry(QRect(100,320,160,20)) - self.listViewSend = QListView(self,"listViewSend") self.listViewSend.addColumn(self.__tr("Name")) --- 144,147 ---- *************** *** 163,171 **** self.listViewBook.setShowSortIndicator(1) ! self.pushButtonEdit = QPushButton(self,"pushButtonEdit") ! self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) ! self.pushButtonImport = QPushButton(self,"pushButtonImport") ! self.pushButtonImport.setGeometry(QRect(150,360,110,26)) self.languageChange() --- 160,168 ---- self.listViewBook.setShowSortIndicator(1) ! self.lineEditSearch = QLineEdit(self,"lineEditSearch") ! self.lineEditSearch.setGeometry(QRect(130,320,160,20)) ! self.textLabel3 = QLabel(self,"textLabel3") ! self.textLabel3.setGeometry(QRect(10,320,120,20)) self.languageChange() *************** *** 182,186 **** self.connect(self.listViewSend,SIGNAL("clicked(QListViewItem*)"),self.listViewSend_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) - self.connect(self.pushButtonImport,SIGNAL("clicked()"),self.pushButtonImport_clicked) --- 179,182 ---- *************** *** 193,205 **** self.pushButton_remove.setText(QString.null) QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) self.pushButtonOk.setText(self.__tr("Ok")) self.pushButtonCancel.setText(self.__tr("Cancel")) - self.textLabel3.setText(self.__tr("Search for name:")) self.listViewSend.header().setLabel(0,self.__tr("Name")) self.listViewSend.header().setLabel(1,self.__tr("Email Address")) self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) ! self.pushButtonEdit.setText(self.__tr("Edit addressbook")) ! self.pushButtonImport.setText(self.__tr("Import contacts")) --- 189,200 ---- self.pushButton_remove.setText(QString.null) QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) + self.pushButtonEdit.setText(self.__tr("Edit addressbook")) self.pushButtonOk.setText(self.__tr("Ok")) self.pushButtonCancel.setText(self.__tr("Cancel")) self.listViewSend.header().setLabel(0,self.__tr("Name")) self.listViewSend.header().setLabel(1,self.__tr("Email Address")) self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) ! self.textLabel3.setText(self.__tr("Search for a name:")) *************** *** 228,234 **** print "FormAddress.lineEditSearch_textChanged(const QString&): Not implemented yet" - def pushButtonImport_clicked(self): - print "FormAddress.pushButtonImport_clicked(): Not implemented yet" - def __tr(self,s,c = None): return qApp.translate("FormAddress",s,c) --- 223,226 ---- |
From: Stas Z. <sta...@us...> - 2005-06-01 18:22:31
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28964 Modified Files: TODO Log Message: updated todo things Index: TODO =================================================================== RCS file: /cvsroot/gmailagent/GA-main/TODO,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TODO 16 May 2005 08:05:35 -0000 1.6 --- TODO 1 Jun 2005 18:22:20 -0000 1.7 *************** *** 5,10 **** Perhaps copy the first message and add 'part #' to the subject line ? ! Add support for Gmail 'contacts' to libgmail. ! ! See if we can improof the address book. --- 5,10 ---- Perhaps copy the first message and add 'part #' to the subject line ? ! remove the addressbook and replace it for one based on gmail contacts. ! Perhaps import a new contacts list -> edit it -> sync with gmail contacts. ! See the contacts stuff from Waseem. |
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18768 Modified Files: AboutDialog_forms.py AddressDialog.ui.h AddressDialog_forms.py Gmail.py GuiQT.py HelpDialog_forms.py LoginDialog_forms.py MainWin_forms.py Log Message: Update qt forms Added OO observers Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GuiQT.py 26 May 2005 06:23:29 -0000 1.25 --- GuiQT.py 1 Jun 2005 18:07:28 -0000 1.26 *************** *** 127,136 **** self.attachments = filter(os.path.exists,txt.split('\n')) self.mailbody = str(self.textEditMesg.text()) ! login = Login(self)# this will login and call send_message def send_message(self,ga): """This will send the message to Gmail and stores the address(es) in the addressbook.""" self.app.processEvents()# needed to update progress_dlg obj = Message() obj.mailheader = self.mailheader --- 127,139 ---- self.attachments = filter(os.path.exists,txt.split('\n')) self.mailbody = str(self.textEditMesg.text()) ! obs = Observer(self.send_message) ! login = Login(parent=self,observer=obs)# this will login and call send_message def send_message(self,ga): """This will send the message to Gmail and stores the address(es) in the addressbook.""" + self.progress_dlg.setProgress(1) self.app.processEvents()# needed to update progress_dlg + obj = Message() obj.mailheader = self.mailheader *************** *** 174,177 **** --- 177,181 ---- def pushButtonAdress_clicked(self): # lineEditTo.setCurrentText will called when the model calls the update method of the obs + """The 'To:' field is filled by the AddressBookDialog through the observer""" self.obs = Observer(self.lineEditTo.setText) ad = AddressBookDialog(self,observer=self.obs) *************** *** 184,190 **** class Login(FormLogin): ! def __init__(self, parent=None, name=None, modal=1, fl=0): FormLogin.__init__(self,parent,name,modal,fl) self.parent = parent self.keepsettings = 0 self.logindata = None --- 188,195 ---- class Login(FormLogin): ! def __init__(self, parent=None, name=None, modal=1, fl=0,observer=None): FormLogin.__init__(self,parent,name,modal,fl) self.parent = parent + self.obs = observer# the update method is called after a succesfull login self.keepsettings = 0 self.logindata = None *************** *** 213,216 **** --- 218,224 ---- def _do_login(self,log,pas): #print self.parent.login + # result is a tuple int,ga + # int is 0 or 1; 0 is succes, 1 is faillure + # ga is the Gmail account object result = Gmail.login(log,pas) self.pushButtonCancel_clicked() *************** *** 220,225 **** QMessageBox.Ok) else: ! self.parent.progress_dlg.setProgress(1) ! self.parent.send_message(result[2]) if self.keepsettings: result = Gmail.store_login(log,pas) --- 228,234 ---- QMessageBox.Ok) else: ! #self.parent.progress_dlg.setProgress(1) ! if self.obs: ! self.obs.update(result[2]) if self.keepsettings: result = Gmail.store_login(log,pas) *************** *** 269,274 **** --- 278,285 ---- if GQ_DEBUG: logging.debug("AddressBookDialog start") FormAddress.__init__(self,parent,name,modal,fl) + self.parent = parent self.selecteditem = None self.obs = observer + self.ga = None# we want to test if we already have a Gmail account if os.path.exists(file): self._load(file) *************** *** 277,280 **** --- 288,293 ---- def pushButtonEdit_clicked(self): + # seems we must prevent the garbage collector from removing the observer + # object so we make it a class attribute. self.Myobs = Observer(self._load) ad = AddressBook.ABMainWindow(parent=self,observer=self.Myobs,file=addrfile) *************** *** 310,313 **** --- 323,340 ---- self.listViewSend.takeItem(selecteditem) + def pushButtonImport_clicked(self): + print "FormAddress.pushButtonImport_clicked()" + # The observer is passed to Login, after succes Login will call the observers + # update method + obs = Observer(self._set_account) + # this looks like a hack but Login is used by other objects also. + Login(parent=self.parent,observer=obs) + ### XXXX Login doesn't block + print "ga",self.ga + if not self.ga: + return# Login has it's own error messages + Gmail.import_contacts(addrfile,self.ga) + self._load(addrfile) + def listViewBook_clicked(self,a0): #print "FormAddress.listViewBook_clicked(QListViewItem*): Not implemented yet" *************** *** 331,334 **** --- 358,362 ---- def _load( self, filename): + """Loads a address file into the widget.""" # this is also called from the observer self.listViewBook.clear() *************** *** 350,353 **** --- 378,386 ---- self.nameshash = nameshash + def _set_account(self,ga): + """This is just a method which can be called by a observer.""" + # ga is the Gmail account after a succseful login + self.ga = ga + def getSelection(self,listview): """Get all the selected items in a listview""" Index: MainWin_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/MainWin_forms.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MainWin_forms.py 16 May 2005 08:05:35 -0000 1.17 --- MainWin_forms.py 1 Jun 2005 18:07:28 -0000 1.18 *************** *** 3,7 **** # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Sun May 15 16:32:10 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'MainWin.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: HelpDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/HelpDialog_forms.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HelpDialog_forms.py 16 May 2005 08:05:35 -0000 1.3 --- HelpDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.4 *************** *** 3,7 **** # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Sun May 15 16:32:10 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'HelpDialog.ui' # ! # Created: Mon May 30 16:05:18 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: AddressDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog_forms.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AddressDialog_forms.py 16 May 2005 08:05:35 -0000 1.4 --- AddressDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.5 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Sun May 15 16:32:10 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AddressDialog.ui' # ! # Created: Mon May 30 16:05:18 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # *************** *** 134,140 **** self.pushButton_remove.setPixmap(self.image1) - self.pushButtonEdit = QPushButton(self,"pushButtonEdit") - self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) - self.pushButtonOk = QPushButton(self,"pushButtonOk") self.pushButtonOk.setGeometry(QRect(350,360,70,26)) --- 134,137 ---- *************** *** 166,169 **** --- 163,172 ---- self.listViewBook.setShowSortIndicator(1) + self.pushButtonEdit = QPushButton(self,"pushButtonEdit") + self.pushButtonEdit.setGeometry(QRect(20,360,106,26)) + + self.pushButtonImport = QPushButton(self,"pushButtonImport") + self.pushButtonImport.setGeometry(QRect(150,360,110,26)) + self.languageChange() *************** *** 179,182 **** --- 182,186 ---- self.connect(self.listViewSend,SIGNAL("clicked(QListViewItem*)"),self.listViewSend_clicked) self.connect(self.lineEditSearch,SIGNAL("textChanged(const QString&)"),self.lineEditSearch_textChanged) + self.connect(self.pushButtonImport,SIGNAL("clicked()"),self.pushButtonImport_clicked) *************** *** 189,193 **** self.pushButton_remove.setText(QString.null) QToolTip.add(self.pushButton_remove,self.__tr("Remove selected address from the 'Send to' list")) - self.pushButtonEdit.setText(self.__tr("Edit addressbook")) self.pushButtonOk.setText(self.__tr("Ok")) self.pushButtonCancel.setText(self.__tr("Cancel")) --- 193,196 ---- *************** *** 197,200 **** --- 200,205 ---- self.listViewBook.header().setLabel(0,self.__tr("Name")) self.listViewBook.header().setLabel(1,self.__tr("Email Address")) + self.pushButtonEdit.setText(self.__tr("Edit addressbook")) + self.pushButtonImport.setText(self.__tr("Import contacts")) *************** *** 223,226 **** --- 228,234 ---- print "FormAddress.lineEditSearch_textChanged(const QString&): Not implemented yet" + def pushButtonImport_clicked(self): + print "FormAddress.pushButtonImport_clicked(): Not implemented yet" + def __tr(self,s,c = None): return qApp.translate("FormAddress",s,c) Index: LoginDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/LoginDialog_forms.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** LoginDialog_forms.py 16 May 2005 08:05:35 -0000 1.17 --- LoginDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.18 *************** *** 3,7 **** # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Sun May 15 16:32:10 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'LoginDialog.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Gmail.py 1 Jun 2005 18:01:55 -0000 1.11 --- Gmail.py 1 Jun 2005 18:07:28 -0000 1.12 *************** *** 34,38 **** def send_message(obj): ! """obj is a class with all the info, see lpicassa.send_message""" header = obj.mailheader --- 34,38 ---- def send_message(obj): ! """obj is a class with all the info, see GuiQt.py.win.send_message""" header = obj.mailheader *************** *** 109,111 **** --- 109,117 ---- if GM_DEBUG: logging.debug(str(lines)) return (lines) + + def import_contacts(addrfile,ga): + """This adds the gmail contacts to the address file.""" + contacts = ga.getContacts().getRawList() + print "contacts",contacts + Index: AddressDialog.ui.h =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog.ui.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddressDialog.ui.h 1 May 2005 09:23:15 -0000 1.1 --- AddressDialog.ui.h 1 Jun 2005 18:07:28 -0000 1.2 *************** *** 58,59 **** --- 58,65 ---- } + + + void FormAddress::pushButtonImport_clicked() + { + + } Index: AboutDialog_forms.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AboutDialog_forms.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AboutDialog_forms.py 16 May 2005 08:05:35 -0000 1.14 --- AboutDialog_forms.py 1 Jun 2005 18:07:28 -0000 1.15 *************** *** 3,7 **** # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Sun May 15 16:32:10 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # --- 3,7 ---- # Form implementation generated from reading ui file 'AboutDialog.ui' # ! # Created: Mon May 30 16:05:17 2005 # by: The PyQt User Interface Compiler (pyuic) 3.14.1 # |
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15404 Modified Files: AddressDialog.ui Gmail.py GmailAgent.e3p filelist version.py Removed Files: Mylibgmail.py constants.py mkconstants.py Log Message: Moved libgmail stuff to it's own module Index: version.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/version.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** version.py 15 May 2005 10:31:10 -0000 1.9 --- version.py 1 Jun 2005 18:01:55 -0000 1.10 *************** *** 3,7 **** # it to get a version number ! VERSION = "0.6" #last changed on May 15 --sz-- --- 3,7 ---- # it to get a version number ! VERSION = "0.7" #last changed on May 15 --sz-- Index: AddressDialog.ui =================================================================== RCS file: /cvsroot/gmailagent/GA-main/AddressDialog.ui,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AddressDialog.ui 1 May 2005 11:02:42 -0000 1.2 --- AddressDialog.ui 1 Jun 2005 18:01:55 -0000 1.3 *************** *** 172,204 **** </property> </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>textLabel3</cstring> - </property> - <property name="geometry"> - <rect> - <x>10</x> - <y>320</y> - <width>85</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Search for name:</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>lineEditSearch</cstring> - </property> - <property name="geometry"> - <rect> - <x>100</x> - <y>320</y> - <width>160</width> - <height>20</height> - </rect> - </property> - </widget> <widget class="QListView"> <column> --- 172,175 ---- *************** *** 289,292 **** --- 260,292 ---- </property> </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>lineEditSearch</cstring> + </property> + <property name="geometry"> + <rect> + <x>130</x> + <y>320</y> + <width>160</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>320</y> + <width>120</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Search for a name:</string> + </property> + </widget> </widget> <images> --- constants.py DELETED --- Index: Gmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Gmail.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Gmail.py 2 May 2005 13:21:18 -0000 1.10 --- Gmail.py 1 Jun 2005 18:01:55 -0000 1.11 *************** *** 19,31 **** # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! ## Used most parts from the Mylibgmail examples ;-) GM_DEBUG = 0 ! import Mylibgmail,urllib2,logging,ConfigParser,os def login(name,pas): ! ga = Mylibgmail.GmailAccount(name,pas) try: ga.login() ! except (Mylibgmail.GmailLoginFailure,urllib2.HTTPError),info: if GM_DEBUG: logging.warning("%s" % info) return (1,"%s" % info) --- 19,31 ---- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! ## Used most parts from the libgmail2 examples ;-) GM_DEBUG = 0 ! import libgmail2,urllib2,logging,ConfigParser,os def login(name,pas): ! ga = libgmail2.GmailAccount(name,pas) try: ga.login() ! except (libgmail2.GmailLoginFailure,urllib2.HTTPError),info: if GM_DEBUG: logging.warning("%s" % info) return (1,"%s" % info) *************** *** 37,41 **** header = obj.mailheader ! gmsg = Mylibgmail.GmailComposedMessage(to = header['to'], subject = header['subject'], body = obj.mailbody, --- 37,41 ---- header = obj.mailheader ! gmsg = libgmail2.GmailComposedMessage(to = header['to'], subject = header['subject'], body = obj.mailbody, --- mkconstants.py DELETED --- Index: GmailAgent.e3p =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.e3p,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GmailAgent.e3p 26 May 2005 06:23:29 -0000 1.10 --- GmailAgent.e3p 1 Jun 2005 18:01:55 -0000 1.11 *************** *** 2,6 **** <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-05-16, 13:53:01 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> --- 2,6 ---- <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-06-01, 18:15:45 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> *************** *** 17,23 **** </Source> <Source> - <Name>mkconstants.py</Name> - </Source> - <Source> <Name>MainWin_forms.py</Name> </Source> --- 17,20 ---- *************** *** 29,41 **** </Source> <Source> - <Name>constants.py</Name> - </Source> - <Source> <Name>out.py</Name> </Source> <Source> - <Name>Mylibgmail.py</Name> - </Source> - <Source> <Name>version.py</Name> </Source> --- 26,32 ---- --- Mylibgmail.py DELETED --- Index: filelist =================================================================== RCS file: /cvsroot/gmailagent/GA-main/filelist,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** filelist 16 May 2005 09:07:39 -0000 1.6 --- filelist 1 Jun 2005 18:01:55 -0000 1.7 *************** *** 5,9 **** Gmail.py GuiQT.py ! Mylibgmail.py AboutDialog_forms.py LoginDialog_forms.py --- 5,9 ---- Gmail.py GuiQT.py ! ../GA-libgmail2/libgmail2.py AboutDialog_forms.py LoginDialog_forms.py |
From: Waseem D. <wd...@us...> - 2005-05-27 19:45:58
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5969 Modified Files: Mylibgmail.py Log Message: getContacts() needed to be redone so that we could access the ids of contacts before deleting them At this point: -> Get Contact List -> Add Contact -> Delete contact should all be fully functional Index: Mylibgmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Mylibgmail.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mylibgmail.py 27 May 2005 04:26:23 -0000 1.5 --- Mylibgmail.py 27 May 2005 19:45:39 -0000 1.6 *************** *** 707,728 **** def getContacts(self): """ ! Returns a list of [email-address, name] entries ! Other contact information is not returned ! ! Contains HUGE security hole that is the result ! of eval()ing gmail's response """ ! # (basic idea borrowed from gmail.py ! # http://www.holovaty.com/code/gmail.py) ! myUrl = _buildURL(view='page',name='contacts') ! # The gmail.py has a zx=JAVASCIRPT VERISON+int? ! # but leaving it off seems to work just fine ! pageData = self._retrievePage(myUrl) ! print ''' ! WARNING: WE BLINDLY eval() THE RESULT ! THAT COMES BACK FROM THE GMAIL PAGE QUERY. ! THIS IS TERRIBLY INSECURE. ! ''' ! return eval(pageData) def addContact(self, name, email, notes=''): --- 707,735 ---- def getContacts(self): """ ! Returns a GmailContactList object ! that has all the contacts in it as ! GmailContacts """ ! # pnl = a is necessary to get *all* contacts? ! myUrl = _buildURL(view='cl',search='contacts', pnl='a') ! myData = self._parsePage(myUrl) ! # This comes back with a dictionary ! # with entry 'a' which is a list of ! # tuples of 15 entries each-ish? ! contactList = [] ! addresses = myData['a'] ! for myTuple in addresses: ! # Each tuple has ~15 address entries ! for entry in myTuple: ! # Consider checking the length of entry before this? ! newGmailContact = GmailContact(entry[1], entry[2], entry[4], entry[5]) ! contactList.append(newGmailContact) ! ! ! #print "rawPage", self._retrievePage(myUrl) ! #print "\n\n" ! #print "myData", myData ! #print "mydata[a]", myData['a'] ! return GmailContactList(contactList) def addContact(self, name, email, notes=''): *************** *** 740,746 **** # print 'gmailat cookie', self._cookieJar._cookies['GMAIL_AT'] - # Johnvey specifies ct_id = -1 here and later people refer to contacts by their ids - # which is a strategy to consider if we ever want an atomic rename (which gmail - # seems to support) myData = urllib.urlencode({ 'act':'ec', --- 747,750 ---- *************** *** 749,752 **** --- 753,757 ---- 'ct_em':email, 'ctf_n':notes, + 'ct_id':-1, }) #print 'my data:', myData *************** *** 756,812 **** if pageData.find("The contact was successfully added") == -1: ! #print pageData return False else: return True ! def removeContactById(self, id): """ Attempts to remove the contact that occupies id "id" from the gmail address book. ! Returns true if successful, ! false otherwise. This is a little dangerous since you don't really know who you're deleting. Really, this should return the name or something of the ! person we just killed """ ! # This doesn't work - you have to do it by id? myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up') pageData = self._retrievePage(myURL) if pageData.find("The contact has been deleted") == -1: ! #print pageData return False else: return True ! def removeContact(self, email): """ ! Attempts to remove contact by email address ! Returns True if successful, false otherwise. """ ! # TODO: The fact that this makes a call ! # to get_contacts makes me a little unhappy, ! # but that's the way it is. ! # Generate an ID list of people to remove """ ! myContacts = self.getContacts() ! myEmails = [person[0] for person in myContacts] ! id = -1 ! for i in range(len(myEmails)): ! if myEmails[i] == email: ! id = i ! if id > -1: ! return self.removeContactById(id) ! else: ! return False """ ! # ID isn't just numerical order return False ! def _splitBunches(infoItems): """ --- 761,890 ---- if pageData.find("The contact was successfully added") == -1: ! print pageData return False else: return True ! def _removeContactById(self, id): """ Attempts to remove the contact that occupies id "id" from the gmail address book. ! Returns True if successful, ! False otherwise. This is a little dangerous since you don't really know who you're deleting. Really, this should return the name or something of the ! person we just killed. ! ! You should be using removeContact instead. """ ! # TODO: Maybe make sure that this ID exists or something ! # smart like that? myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up') pageData = self._retrievePage(myURL) if pageData.find("The contact has been deleted") == -1: ! # print pageData return False else: + # print pageData return True ! def removeContact(self, gmailContact): """ ! Attempts to remove the GmailContact passed in ! Returns True if successful, False otherwise. """ ! # TODO: Ensure that this is really a GmailContact? ! # Also, maybe this could lead to weird bad cache coherence? ! # Imaigne user A gets the contact list ! # Then user B, using gmail, deletes contact X and adds contact Y ! # which then gets contact X's id ! # Then, A tries to delete X using this, but deletes Y ! # by accident! ! # So it's a concern to do things strictly by ID like this ! # If we were smarter, we could fetch the contact list again ! # and compare fields, I suppose ! contactId = gmailContact.getId() ! return self._removeContactById(contactId) ! ! class GmailContact: ! """ ! Class for storing a Gmail Contacts list entry ! """ ! def __init__(self, id, name, email, notes=''): ! self.id = id ! self.name = name ! self.email = email ! self.notes = notes ! def __str__(self): ! return "%s %s %s %s" % (self.id, self.name, self.email, self.notes) ! def getId(self): ! return self.id ! def getName(self): ! return self.name ! def getEmail(self): ! return self.email ! def getNotes(self): ! return self.notes ! ! class GmailContactList: ! """ ! Class for storing an entire Gmail contacts list ! and retrieving contacts by Id, Email address, and name ! """ ! def __init__(self, contactList): ! self.contactList = contactList ! def __str__(self): ! return '\n'.join([str(item) for item in self.contactList]) ! def getContactById(self, id): """ ! Returns the first contact in the ! address book with the specified id. ! Contact list *should* be unique by id ! (unless gmail stops enforcing this) ! ID IS A STRING ! ! Returns False if no entry found """ ! # This is going to be O(n), which sort of sucks ! for entry in self.contactList: ! if entry.getId() == id: ! return entry return False ! def getContactByEmail(self, email): ! """ ! Returns the first contact in the ! address book with the specified email. ! Contact list *should* be unique by email ! (unless gmail stops enforcing this) ! ! Returns False if no entry found ! """ ! for entry in self.contactList: ! if entry.getEmail() == email: ! return entry ! return False ! def getContactListByName(self, name): ! """ ! This function returns a LIST ! of GmailContacts whose name is ! 'name'. The problem is that there ! may very well be more than one entry ! with the same name, whereas we have ! guarantees of uniqueness with Id and Email ! ! Returns an empty list if no contacts ! were found ! """ ! nameList = [] ! for entry in self.contactList: ! if entry.getName() == name: ! nameList.append(entry) ! return nameList ! def _splitBunches(infoItems): """ |
From: Waseem D. <wd...@us...> - 2005-05-27 04:26:33
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11520 Modified Files: Mylibgmail.py Log Message: Working on making deleting contacts work... seems like it might require a complete revamping of getting contacts Index: Mylibgmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Mylibgmail.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Mylibgmail.py 27 May 2005 01:46:38 -0000 1.4 --- Mylibgmail.py 27 May 2005 04:26:23 -0000 1.5 *************** *** 737,741 **** # This mostly comes from the Johnvey Gmail API, # but also from the gmail.py cited earlier ! myURL = _buildURL(view='address', act='a') # print 'gmailat cookie', self._cookieJar._cookies['GMAIL_AT'] --- 737,741 ---- # This mostly comes from the Johnvey Gmail API, # but also from the gmail.py cited earlier ! myURL = _buildURL(view='up') # print 'gmailat cookie', self._cookieJar._cookies['GMAIL_AT'] *************** *** 751,755 **** }) #print 'my data:', myData ! request = urllib2.Request("http://gmail.google.com/gmail?&ik=&view=up", data = myData) pageData = self._retrievePage(request) --- 751,755 ---- }) #print 'my data:', myData ! request = urllib2.Request(myURL, data = myData) pageData = self._retrievePage(request) *************** *** 761,766 **** return True ! def _splitBunches(infoItems): """ --- 761,812 ---- return True ! def removeContactById(self, id): ! """ ! Attempts to remove the contact that occupies ! id "id" from the gmail address book. ! Returns true if successful, ! false otherwise. ! ! This is a little dangerous since you don't really ! know who you're deleting. Really, ! this should return the name or something of the ! person we just killed ! """ ! # This doesn't work - you have to do it by id? ! myURL = _buildURL(search='contacts', ct_id = id, c=id, act='dc', at=self._cookieJar._cookies['GMAIL_AT'], view='up') ! pageData = self._retrievePage(myURL) ! ! if pageData.find("The contact has been deleted") == -1: ! #print pageData ! return False ! else: ! return True + def removeContact(self, email): + """ + Attempts to remove contact by email address + Returns True if successful, false otherwise. + """ + # TODO: The fact that this makes a call + # to get_contacts makes me a little unhappy, + # but that's the way it is. + + # Generate an ID list of people to remove + """ + myContacts = self.getContacts() + myEmails = [person[0] for person in myContacts] + id = -1 + for i in range(len(myEmails)): + if myEmails[i] == email: + id = i + + if id > -1: + return self.removeContactById(id) + else: + return False + """ + # ID isn't just numerical order + return False + def _splitBunches(infoItems): """ |
From: Waseem D. <wd...@us...> - 2005-05-27 01:46:49
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19115 Modified Files: Mylibgmail.py Log Message: Added rudimentary 'add contacts' support Index: Mylibgmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Mylibgmail.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mylibgmail.py 26 May 2005 21:37:23 -0000 1.3 --- Mylibgmail.py 27 May 2005 01:46:38 -0000 1.4 *************** *** 6,10 **** # # Author: fol...@my... ! # Contacts support added by Waseem Daher <wd...@mi...> # # License: GPL 2.0 --- 6,12 ---- # # Author: fol...@my... ! # ! # Contacts support added by wd...@mi... ! # (with massive help from 'gmail.py' and the Johnvey Gmail API) # # License: GPL 2.0 *************** *** 703,715 **** ## CONTACTS SUPPORT - # (basic idea borrowed from gmail.py - # http://www.holovaty.com/code/gmail.py) def getContacts(self): """ Returns a list of [email-address, name] entries Contains HUGE security hole that is the result of eval()ing gmail's response """ myUrl = _buildURL(view='page',name='contacts') # The gmail.py has a zx=JAVASCIRPT VERISON+int? --- 705,718 ---- ## CONTACTS SUPPORT def getContacts(self): """ Returns a list of [email-address, name] entries + Other contact information is not returned Contains HUGE security hole that is the result of eval()ing gmail's response """ + # (basic idea borrowed from gmail.py + # http://www.holovaty.com/code/gmail.py) myUrl = _buildURL(view='page',name='contacts') # The gmail.py has a zx=JAVASCIRPT VERISON+int? *************** *** 723,726 **** --- 726,766 ---- return eval(pageData) + def addContact(self, name, email, notes=''): + """ + Attempts to add a contact to the gmail + address book. Returns true if successful, + false otherwise + """ + # TODO: In the ideal world, we'd extract these specific + # constants into a nice constants file + + # This mostly comes from the Johnvey Gmail API, + # but also from the gmail.py cited earlier + myURL = _buildURL(view='address', act='a') + # print 'gmailat cookie', self._cookieJar._cookies['GMAIL_AT'] + + # Johnvey specifies ct_id = -1 here and later people refer to contacts by their ids + # which is a strategy to consider if we ever want an atomic rename (which gmail + # seems to support) + myData = urllib.urlencode({ + 'act':'ec', + 'at': self._cookieJar._cookies['GMAIL_AT'], # Cookie data? + 'ct_nm': name, + 'ct_em':email, + 'ctf_n':notes, + }) + #print 'my data:', myData + request = urllib2.Request("http://gmail.google.com/gmail?&ik=&view=up", + data = myData) + pageData = self._retrievePage(request) + + if pageData.find("The contact was successfully added") == -1: + #print pageData + return False + else: + return True + + + def _splitBunches(infoItems): """ |
From: Waseem D. <wd...@us...> - 2005-05-26 21:37:35
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32766 Modified Files: Mylibgmail.py Log Message: Added support for retrieving contacts from gmail (though, introduces a pretty bad security hole) Index: Mylibgmail.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/Mylibgmail.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mylibgmail.py 15 May 2005 14:04:32 -0000 1.2 --- Mylibgmail.py 26 May 2005 21:37:23 -0000 1.3 *************** *** 6,9 **** --- 6,10 ---- # # Author: fol...@my... + # Contacts support added by Waseem Daher <wd...@mi...> # # License: GPL 2.0 *************** *** 701,706 **** return draftMsg ! ! def _splitBunches(infoItems): """ --- 702,726 ---- return draftMsg ! ## CONTACTS SUPPORT ! # (basic idea borrowed from gmail.py ! # http://www.holovaty.com/code/gmail.py) ! def getContacts(self): ! """ ! Returns a list of [email-address, name] entries ! ! Contains HUGE security hole that is the result ! of eval()ing gmail's response ! """ ! myUrl = _buildURL(view='page',name='contacts') ! # The gmail.py has a zx=JAVASCIRPT VERISON+int? ! # but leaving it off seems to work just fine ! pageData = self._retrievePage(myUrl) ! print ''' ! WARNING: WE BLINDLY eval() THE RESULT ! THAT COMES BACK FROM THE GMAIL PAGE QUERY. ! THIS IS TERRIBLY INSECURE. ! ''' ! return eval(pageData) ! def _splitBunches(infoItems): """ |
From: Stas Z. <sta...@us...> - 2005-05-26 06:23:37
|
Update of /cvsroot/gmailagent/GA-main In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1862 Modified Files: GmailAgent.e3p GuiQT.py setup.py Log Message: minor updates Index: GuiQT.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GuiQT.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GuiQT.py 16 May 2005 10:25:04 -0000 1.24 --- GuiQT.py 26 May 2005 06:23:29 -0000 1.25 *************** *** 254,258 **** try: text = open(os.path.join(helppath,'index.html'),'r').read() ! except IOError,info: QMessageBox.critical(self, "Error", str(info), --- 254,258 ---- try: text = open(os.path.join(helppath,'index.html'),'r').read() ! except (IOError,Exception),info: QMessageBox.critical(self, "Error", str(info), Index: setup.py =================================================================== RCS file: /cvsroot/gmailagent/GA-main/setup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.py 16 May 2005 09:07:39 -0000 1.4 --- setup.py 26 May 2005 06:23:29 -0000 1.5 *************** *** 116,119 **** --- 116,121 ---- print "copying the manpage to %s" % manpath os.system('mv %s %s' % (os.path.join(docpath,'gmailagent.1.gz'),manpath)) + os.system('mv %s %s' % (os.path.join(destdir,'README'),docpath)) + os.system('mv %s %s' % (os.path.join(destdir,'INSTALL'),docpath)) except Exception,info: print info Index: GmailAgent.e3p =================================================================== RCS file: /cvsroot/gmailagent/GA-main/GmailAgent.e3p,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GmailAgent.e3p 11 May 2005 14:29:59 -0000 1.9 --- GmailAgent.e3p 26 May 2005 06:23:29 -0000 1.10 *************** *** 2,6 **** <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-05-11, 16:29:27 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> --- 2,6 ---- <!DOCTYPE Project SYSTEM "Project-3.5.dtd"> <!-- Project file for project GmailAgent --> ! <!-- Saved: 2005-05-16, 13:53:01 --> <!-- Copyright (C) 2005 Stas Zytkiewicz, st...@li... --> <Project version="3.5"> *************** *** 55,58 **** --- 55,61 ---- <Name>HelpDialog_forms.py</Name> </Source> + <Source> + <Name>setup.py</Name> + </Source> </Sources> <Forms> |