示例#1
0
 def showContacts(self, contacts):
     if contacts is not None:
         for c in contacts:
             contact_model = ContactModel()
             contact_model.setAllFields(c[0], c[1], c[2], c[3], c[4], c[5],
                                        c[6])
             c_button = ContactButton(contact_model, self)
             self.view.buttonListLayout.setAlignment(Qt.AlignTop)
             self.view.buttonListLayout.addWidget(c_button)
    def deleteContact(self):
        v = self.view
        first_name = v.first_name.text()
        last_name = v.last_name.text()
        telephone = v.telephone.text()
        email = v.email.text()
        url = v.url.text()
        notes = v.notes.toPlainText()

        # delete this contact from Contacts table
        contact_to_delete = ContactModel()
        c_id = self.contact.getId()
        contact_to_delete.setAllFields(c_id, first_name, last_name, telephone,
                                       email, url, notes)
        contact_to_delete.deleteContact()

        # delete tuples (c_id, t_id) from ContactsTags table
        contact_tag = ContactTagModel()
        contact_tag.setContactId(c_id)
        contact_tag.deleteContactTagsFromId()

        self.showContactList()