示例#1
0
    def __init__(self, frame_pai, controller):
        super().__init__(frame_pai)

        self.controller = controller
        self.controller.requestRetrieveFriends()

        # LEMBRAR DE CRIAR METODOS QUE CARREGAMOS OS CONTATOS!
        self.currentChat = Models.LstMessages

        self.currentContactChat = Models.user()
        self.idUserSelected = self.currentContactChat.idd
        self.userFriendsList = Models.LstUsers()

        self.config_opcoes1(command=lambda: self.controller.loginActivity())
        self.config_ajuda1(command=lambda: self.__raise_ajuda__())
        self.config_ajuda2(command=lambda: self.__raise_sobre__())
        self.botao_envia.config(command=lambda: self.__envia_msg__())
        self.entr_msg.bind('<KeyRelease-Return>',
                           lambda event: self.__envia_msg__())
        self.contatos_treeview.bind('<<TreeviewSelect>>',
                                    lambda event: self.__retrieve_chat__())

        #TODO MUDAR ESSA CHAMADA ABAIXO
        self.frame_chat.config(text='Seja bem vindo(a) ' +
                               self.controller.session.currentUser.userName)

        self.add_contato_button.config(command=lambda: self.__add_contato__())
        self.solicitations_button.config(
            command=lambda: self.FriendshipSolicitations())

        self.entr_contatos.bind('<KeyRelease>',
                                lambda event: self.__search_contacts__())
示例#2
0
    def __init__(self, controller):
        super().__init__()
        self.controller = controller
        self.lstRequests = Models.LstUsers()
        self.controller.requestFriendshipRequests()

        self.blockButton.config(command=lambda: self.blockUser())
        self.aceptButton.config(command=lambda: self.aceptUser())
        self.contatos_treeview.bind('<<TreeviewSelect>>',
                                    lambda event: self.bindTreeview())
示例#3
0
    def namesLike(self, user: Models.user, nameLike: str):
        tableName = 'friends_' + str(user.idd)
        nameLike = nameLike + '%'
        sql = 'SELECT ' \
              'id_friend,  ' \
              'userName, u' \
              'serEmail ' \
              'FROM ' + tableName + \
              ' INNER JOIN users ON (' + tableName + '.id_friend = users.id)' \
              ' WHERE userName LIKE "' + nameLike + '" ;'

        lst_tupl = self.__execute_fetchall__(sql)

        lstUser = Models.LstUsers()
        if lst_tupl != []:
            for tupl in lst_tupl:
                user = Models.user()
                user.idd = int(tupl[0])
                user.userName = tupl[1]
                user.userEmail = tupl[2]
                lstUser.append(user)
        return lstUser
示例#4
0
    def retrieveFriends(self, user: Models.user):
        id_user = user.idd
        tableName = 'friends_' + str(id_user)
        sql = 'SELECT id_friend,  userName, userEmail, showNotification, dateAdd FROM ' + tableName + ' INNER JOIN users ON (' + tableName + '.id_friend = users.id)  WHERE confirmation = 1;'
        lst_tupl = self.__execute_fetchall__(sql)

        if isinstance(lst_tupl, Exception):
            return lst_tupl
        elif lst_tupl is None:
            return Exception('Friends list not found')

        else:
            lstUser = Models.LstUsers()
            for elem in lst_tupl:
                friendUser = Models.user()
                friendUser.idd = int(elem[0])
                friendUser.userName = elem[1]
                friendUser.userEmail = elem[2]
                friendUser.showNotification = elem[3]
                friendUser.dateAdd = elem[4]
                lstUser.append(friendUser)
            return lstUser
示例#5
0
 def fromJson(self, dictObj: dict):
     super().fromJson(dictObj)
     self.lstUsers = Models.LstUsers().fromJson(dictObj['lstUsers'])
     return self
示例#6
0
 def __init__(self, lstUsers: Models.LstUsers = Models.LstUsers()):
     super().__init__()
     self.lstUsers = lstUsers
示例#7
0
 def fromJson(self, dictObj: dict or list):
     super().fromJson(dictObj)
     self.namesLike = Models.LstUsers().fromJson(dictObj['namesLike'])
     return self
示例#8
0
 def __init__(self, namesLike: Models.LstUsers = Models.LstUsers()):
     super().__init__()
     self.namesLike = namesLike