Пример #1
0
    def addPartners(self):
        self.listBox3.delete(0, 'end')
        self.personList.sort(key=lambda x: self.get_time_of_last_message(x[1]),
                             reverse=True)

        for i in range(len(self.personList)):
            counter = self.check_for_new_messages(i)
            if self.partner[1] == self.personList[i][1]:
                counter = 0

            self.listBox3.insert(
                'end',
                TextWrapper.mergeNameCounter(self.personList[i][0], counter,
                                             25))

            if counter != 0:
                self.listBox3.itemconfig(i, bg='#dfd')
            else:
                #print("No new messages in chat",i)
                self.listBox3.itemconfig(i, bg="white")

            #self.listBox3.insert('end', '')   # TODO: hans usegnoh zum teste

        # Opening the first Chat by default
        if len(self.personList) != 0:
            #set the first person as partner:
            if self.partner[0] == "":
                self.loadChat(self.personList[0])

        else:  # personlist empty or variable partner isn't empty
            self.username_label.config(text="")
Пример #2
0
    def addPartners(self):
        self.listBox3.delete(0, 'end')
        self.person_list.sort(key=lambda x: self.chat_function.get_full_chat(
            'chat', self.feed_id, x[1])[-1][1],
                              reverse=True)

        for i in range(len(self.person_list)):
            counter = self.check_for_new_messages(i)
            if self.partner[1] == self.person_list[i][1]:
                counter = 0

            self.listBox3.insert(
                'end',
                TextWrapper.mergeNameCounter(self.person_list[i][0], counter))

            if counter != 0:
                self.listBox3.itemconfig(i, bg='#dfd')
            else:
                self.listBox3.itemconfig(i, bg="white")

        # Opening the first Chat by default
        if len(self.person_list) != 0:
            # Choose the partner as first person:
            if self.partner[0] == "":
                self.loadChat(self.person_list[0])

        else:  # person_list empty or variable partner isn't empty
            self.username_label.config(text="")
Пример #3
0
    def addPartners(self):
        if len(self.person_list) != 0:
            self.listBox3.delete(0, 'end')
            self.person_list.sort(
                key=lambda x: self.chat_function.get_full_chat(x[1])[-1][1],
                reverse=True)

            for i in range(len(self.person_list)):
                counter = self.check_for_new_messages(i)
                if self.partner[1] == self.person_list[i][1]:
                    counter = 0

                self.listBox3.insert(
                    'end',
                    TextWrapper.mergeNameCounter(self.person_list[i][0],
                                                 counter))

                if counter != 0:
                    self.listBox3.itemconfig(i, bg='#dfd')
                else:
                    self.listBox3.itemconfig(i, bg="white")