def randomContact(): contact = Contact() contact.fname=randomString(10) contact.mname=randomString(10) contact.lname=randomString(10) contact.phone=randomString(10) contact.bday=str(random.randint(1,29))+"/"+str(random.randint(1,12))+"/"+str(1950+random.randint(0,60)) return contact
def getContact(self): """get contacts from fields in gui""" contact = Contact() try: contact.cid = self.cidEdit.text() contact.fname = self.fnameEdit.text() contact.mname = self.mnameEdit.text() contact.lname = self.lnameEdit.text() contact.phone = self.phoneEdit.text() contact.bday = self.bdayEdit.text() except Exception as e: QMessageBox.question(self, 'Error', str(e), QMessageBox.Ok, QMessageBox.Ok) return contact
def getContact(self): """get contacts from fields in gui""" contact = Contact() try: contact.cid = self.cidEdit.text() contact.fname = self.fnameEdit.text() contact.mname = self.mnameEdit.text() contact.lname = self.lnameEdit.text() contact.phone = self.phoneEdit.text() contact.bday = self.bdayEdit.text() except Exception as e: QMessageBox.question(self, 'Error', str(e), QMessageBox.Ok, QMessageBox.Ok) return contact