def setIp(self,index): name = index.data(Qt.DisplayRole) ip = None for contact in Config.openContacts(): if contact[1] == name: ip = contact[0] if ip is not None: self.ui.lineEdit.setText(ip) else: print('Couldn\'t get ip')
def initModel(self): words = [] for contact in Config.openContacts(): words.append(contact[1]) self.model = QStringListModel(words)
def makeContacts(self): text = '' for pair in Config.openContacts(): text = text+pair[0]+' - '+pair[1]+'\n' self.ui.plainTextEdit.setPlainText(text)