def groupAdded(self, group): print group.name.toString() pi = self._model.invisibleRootItem(); # Adding Group Item groupItem = GroupItemself() groupItem.setText(QString.fromUtf8(group.name.toString())) groupItem.setUid(group.uid) pi.appendRow(groupItem) for contact in group.contacts: print " * " + contact.name.toString() contactItem = ContactItem(self) contactItem.setContactName(QString.fromUtf8(contact.name.toString())) contactItem.setUid(contact.uid) groupItem.appendRow(contactItem) self._contactDict[contact.uid] = contact
def groupUpdated(self, group): print "GroupUpdated" l = self._model.findItems("*", Qt.MatchWildcard) for itm in l: if itm.uid() == group.uid: itm.setText(QString.fromUtf8(group.name.toString())) for contact in group.contact_ids: for ent in l: if ent.uid() == contact: itm.setText(QString.fromUtf8(contact)) continue #print " * " + contact.name.toString() contactItem = ContactItem() contactItem.setContactName(contact) contactItem.setUid(contact) itm.appendRow(contactItem) break