Пример #1
0
 def Tema(self):
     assunto= self.fut.get()
     
     user = Rocket_Chat(Logins[0],Logins[1])
     chat = Chat(Logins,assunto)
     self.acaba()
     chat.inicia()
Пример #2
0
 def Enter(self, event):
     assunto= self.fut.get()
     
     user = Rocket_Chat(Logins[0],Logins[1])
     
     chat = Chat(Logins,assunto)
     self.acaba()
     chat.inicia()
Пример #3
0
    def Enter(self,event):
        login = self.Nome.get()
        secret = self.Senha.get()
        saves = fb.get("https://rocket-messenger.firebaseio.com/","data")
        answer= False
        for lg in saves:
            name=saves[lg]["name"]
            senha=saves[lg]["password"]
            if login==name or secret==senha:
                answer=True

        if answer==True:
            self.lbl["fg"]="red"
            self.lbl["text"]="Login ou Senha já existente!"
        if answer==False:
            user=Rocket_Chat(login,secret)
            user.salva_data()
            log.lb["fg"]="green"
            log.lb["text"]="Login e senha salvos!"
            self.acaba()
Пример #4
0
 def __init__(self, Logins,assunto):
     self.assunto=assunto
     self.Chat = Tk()
     self.Chat.title("Rocket Chat")
     self.Chat.geometry("500x600+40+40")
     self.Chat['bg'] = 'gray'
     user = Rocket_Chat(Logins[0], Logins[1])
     user.post(assunto)
             ## Widgets ##
     self.opcoes = Frame(self.Chat, bg= "light blue")
     self.opcoes.pack(fill=BOTH)
     
     self.input_user = StringVar()
     self.input_field = Entry(self.Chat, text=self.input_user)
     self.input_field.focus()
     reading=receive(assunto)
     self.TextoInicio = Label(self.opcoes, text = "Bem vindo ao Rocket Chat", bg = "light blue")
     self.scroll=Scrollbar(self.Chat)
     self.label = Text(self.Chat,height=200,width=200, bg= "gray")
     self.exit = Button(self.opcoes, text = "Menu", command = self.sair, bg= "grey")
     self.cor = Button(self.opcoes, text='Editar texto e fundo', command=self.Edita)
     
     
     
     
     ## Coloca na tela ##
     
     self.exit.pack(side = RIGHT)
     self.TextoInicio.pack(side= LEFT)
     self.input_field.pack(side=BOTTOM, fill=X)
     self.label.pack()
     self.input_field.bind("<Return>", self.Envia)
     self.cor.pack()
     
     
     self.Chat.after(2000, lambda:self.atualiza(assunto))
Пример #5
0
    def checa_login_senha(self):
        uname = self.username.get()
        secret = self.password.get()
        saves = fb.get("https://rocket-messenger.firebaseio.com/","data")

        login=False
        for lg in saves:
            name=saves[lg]["name"]
            senha=saves[lg]["password"]
            if uname==name and secret==senha:
                login=True
        if login==True:
            Logins.append(uname) 
            Logins.append(secret)
            user = Rocket_Chat(Logins[0],Logins[1])
            menu = Menu()
            menu.inicia()
            
        elif login==False:
            self.lb["fg"]="red"
            self.lb["text"]="Login ou Senha não existe!"
Пример #6
0
    def Envia(self,event):
        user= Rocket_Chat(Logins[0], Logins[1])
        self.label.delete('1.0', END) 
        reading=receive(self.assunto)
   
        self.label.see("end")
        self.input_get = self.input_field.get()

        #inteligencia artificial
        chatbot=ia(self.input_get)
        #checa se existem palavrões
        chatbot_h="Neutro"
        if chatbot[2]>0:
            alerta="CUIDADO, a mensagem abaixo possui palavras de baixo calão"
            user.send(alerta,self.assunto,chatbot_h)  
        '''
        humores=["Animado!!","Pra baixo...","Normal"]
        if chatbot[3]=="Positive":
            user.send(self.input_get,self.assunto,humores[0])

        elif chatbot[3]=="Negative":
            user.send(self.input_get,self.assunto,humores[1])
    
        elif chatbot[3]=="Neutral":
            user.send(self.input_get,self.assunto,humores[2])
        '''

        #chatbot[3] indica o sentimento da mensagem
        user.send(self.input_get,self.assunto,chatbot[3])
        self.texto = "{0}: {1} - humor: {2} \n".format(user.nome, self.input_get,user.humor)
        self.scroll.config(command=self.label.yview)
        self.label.configure(yscrollcommand=self.scroll.set)
        self.scroll.pack(side=RIGHT, fill=Y)        
        self.input_user.set('')
        self.label.insert(END,self.texto, 'bold_italics') 
        self.label.pack(side=BOTTOM)
        self.input_field.delete('0', END)
    

        return "break"