Пример #1
0
    def register_email(self):
        self.password_info = self.password.get()
        self.password_entry.delete(0, END)
        self.email_info = self.email_address.get()
        self.email_address_entry.delete(0, END)

        if (isBlank(self.email_info) or isBlank(self.password_info)):
            self.empty_filler()
            self.info_regis.configure(text="Failed",
                                      justify="center",
                                      bg="white",
                                      fg="green",
                                      font=("calibri", 11))
        else:
            db = DBInterface.DBInterface()
            log = db.login(self.username_info2, self.password_info)
            data2 = json.loads(log)
            if (data2["status"] == True):
                db.update_email(self.ID_info2, self.email_info2,
                                self.email_info, self.password_info)
                pub_cmd.publish(client, "update email")
                self.info_regis.configure(text="Success Changing Email",
                                          justify="center",
                                          bg="white",
                                          fg="green",
                                          font=("calibri", 11))
            else:
                self.info_regis.configure(text="Wrong Current Password",
                                          justify="center",
                                          bg="white",
                                          fg="green",
                                          font=("calibri", 11))
Пример #2
0
 def handle_click_notification(self):
     
     db = DBInterface.DBInterface()
     if(self.notification == "On"):
         self.notification = "Off"
         self.button_f.config(text="Current Notification" + "\n\n" + self.notification)
         pub_cmd.publish(client, "update email")
         db.switch_notification(self.ID_info2, False)
     elif (self.notification == "Off"):
         self.notification = "On"
         self.button_f.config(text="Current Notification" + "\n\n" + self.notification)
         pub_cmd.publish(client, "update email")
         db.switch_notification(self.ID_info2, True)
Пример #3
0
 def play_sound(self):
     scrollbar_command = self.option.get('active')
     if scrollbar_command == 'First Lullaby':
         pub_cmd.publish(client, "lullaby1.mp3")
     elif scrollbar_command == 'Second Lullaby':
         pub_cmd.publish(client, "lullaby2.mp3")
     elif scrollbar_command == 'Third Lullaby':
         pub_cmd.publish(client, "lullaby3.mp3")
     elif scrollbar_command == 'Fourth Lullaby':
         pub_cmd.publish(client, "lullaby4.mp3")
Пример #4
0
def register_user():

    username_info = username.get()
    password_info = password.get()
    email_info = email_address.get()

    username_entry.delete(0, END)
    password_entry.delete(0, END)
    email_address_entry.delete(0, END)

    db = DBInterface.DBInterface()

    if (isBlank(username_info) or isBlank(password_info)
            or isBlank(email_info)):
        empty_filler()
        info_regis.configure(text="Registration Failed",
                             justify="center",
                             bg="white",
                             fg="green",
                             font=("calibri", 11))
    else:
        reg = db.register(username_info, email_info, password_info)
        data = json.loads(reg)

        if (data["status"] == True):
            pub_cmd.publish(client, "update email")
            info_regis.configure(text="Registration Success",
                                 justify="center",
                                 bg="white",
                                 fg="green",
                                 font=("calibri", 11))
        else:
            user_info_exist(data["err"])
            info_regis.configure(text="Registration Failed",
                                 justify="center",
                                 bg="white",
                                 fg="green",
                                 font=("calibri", 11))
Пример #5
0
 def stop_sound(self):
     pub_cmd.publish(client, "pause")
Пример #6
0
 def resume_sound(self):
     pub_cmd.publish(client, "resume")
Пример #7
0
 def do_action(self, type_num):
     if (type_num == 1):
         pub_cmd.publish(client, "lullaby1.mp3")
     elif (type_num == 2):
         pub_cmd.publish(client, "lullaby2.mp3")
     elif (type_num == 3):
         pub_cmd.publish(client, "lullaby3.mp3")
     elif (type_num == 4):
         pub_cmd.publish(client, "lullaby4.mp3")
     elif (type_num == 5):
         pub_cmd.publish(client, "pause")
     elif (type_num == 6):
         pub_cmd.publish(client, "resume")
     elif (type_num == 7):
         self.command2 = 'close'