diff --git a/alpha_main.py b/alpha_main.py index f0693b1..665d2d5 100644 --- a/alpha_main.py +++ b/alpha_main.py @@ -4,6 +4,7 @@ print("nuggetcatsoftware@gmail.com") #import modules for chatterbot +from threading import Thread from chatterbot import ChatBot from chatterbot.trainers import ListTrainer from chatterbot.trainers import ChatterBotCorpusTrainer @@ -69,3 +70,29 @@ def trainchatbot(trainer): #works in tandem with bootnoise.startupnoise1() trainer.train(conversation8) trainer.train(conversation9) + + + + + +#working path starts here (listed here for checklist) +# 1. check user data +# 2. train NLP data ++ play boot sound 1 +# 3. start frontend +# 4. time sleep 1 then start bootmessage +# 5. start the rest of the program + + +#general framework +# 1. check user data +checkuserdata() +# 2. train NLP data ++ play boot sound 1 +try: + Thread(target=trainchatbot(trainer)).start() + Thread(target=startnoise1()).start() +except Exception as e: + notify("OHNO", e ,90) + print(e) +# 3. start frontend +# 4. time sleep 1 then start bootmessage +# 5. start the ALPHAMAIN \ No newline at end of file diff --git a/data.json b/data.json new file mode 100644 index 0000000..9062a85 --- /dev/null +++ b/data.json @@ -0,0 +1,22 @@ +{ + "main_user_data": { + "dictpref": "british", + "userbloodtype": "null", + "usercity": "Newport", + "userdob": "1997-03-14", + "useremail": "test@gmail.com", + "useremailpass": "test123!!", + "userethnicity": "null", + "usergender": "Male", + "userheight": "null", + "userhobby": "null", + "userinterest": "null", + "username": "test", + "userpersonaldiscordbottoken": "null", + "userreligion": "null", + "userskincolor": "null", + "userspecies": "homo sapien", + "usersport": "null", + "userweight": "null" + } +} \ No newline at end of file diff --git a/modules/__pycache__/boot_checkuserdata.cpython-36.pyc b/modules/__pycache__/boot_checkuserdata.cpython-36.pyc new file mode 100644 index 0000000..b1610fd Binary files /dev/null and b/modules/__pycache__/boot_checkuserdata.cpython-36.pyc differ diff --git a/modules/__pycache__/boot_message.cpython-36.pyc b/modules/__pycache__/boot_message.cpython-36.pyc new file mode 100644 index 0000000..d4351bd Binary files /dev/null and b/modules/__pycache__/boot_message.cpython-36.pyc differ diff --git a/modules/__pycache__/boot_noise.cpython-36.pyc b/modules/__pycache__/boot_noise.cpython-36.pyc new file mode 100644 index 0000000..699923c Binary files /dev/null and b/modules/__pycache__/boot_noise.cpython-36.pyc differ diff --git a/modules/__pycache__/sense.cpython-36.pyc b/modules/__pycache__/sense.cpython-36.pyc new file mode 100644 index 0000000..71c2ee6 Binary files /dev/null and b/modules/__pycache__/sense.cpython-36.pyc differ diff --git a/modules/boot_checkuserdata.py b/modules/boot_checkuserdata.py index 93a523c..8c11a96 100644 --- a/modules/boot_checkuserdata.py +++ b/modules/boot_checkuserdata.py @@ -7,7 +7,7 @@ def checkuserdata(): #this file checks for user data if path.isfile('data.json') == False: - notify("OPPs!","Cant start without data.json, try again","60") + notify("OPPs!","Cant start without data.json, try again",60) time.sleep(30) exit() else: diff --git a/modules/boot_loader.py b/modules/boot_loader.py new file mode 100644 index 0000000..625ba09 --- /dev/null +++ b/modules/boot_loader.py @@ -0,0 +1,23 @@ +from sys import modules +from threading import Thread +from boot_noise import * +from boot_message import * +from boot_checkuserdata import checkuserdata +from sense import notify +import random +def startup(): + user_name=checkuserdata()[0] + user_gender=checkuserdata()[2] + random_functions = random.randint(1,2) + if int(random_functions) == 1: + wishMe(user_gender) + elif int(random_functions) == 2: + wishme2(user_name) +def bootloader(): #only this is meant to be called + try: + Thread(target=startupnoise).start() + Thread(target=startupnoise2).start() + Thread(target=startup()).start() + except Exception as e: + print(e) + notify("OHNO", e, 90) diff --git a/modules/boot_noise.py b/modules/boot_noise.py index 341e75d..d2f29bb 100644 --- a/modules/boot_noise.py +++ b/modules/boot_noise.py @@ -1,6 +1,7 @@ import playsound - +import time def startnoise1(): #this starts when training happens + time.sleep(2) try: playsound("audio/start2.mp3") except Exception as e: diff --git a/modules/sense.py b/modules/sense.py index 1a5db39..6a48ab5 100644 --- a/modules/sense.py +++ b/modules/sense.py @@ -31,7 +31,8 @@ def listen(): return query def notify(title, content, duration): - dataconfirm = ToastNotifier() - icon_path="app.ico" - dataconfirm.show_toast(title, content, duration, icon_path) + notify= ToastNotifier() + icon_path=None + notify.show_toast(title, content, icon_path, duration) + diff --git a/usersetting/usersettings.py b/usersetting/usersettings.py index ae0b2ef..1494671 100644 --- a/usersetting/usersettings.py +++ b/usersetting/usersettings.py @@ -14,6 +14,7 @@ from chatterbot import ChatBot from chatterbot.trainers import ListTrainer from chatterbot.trainers import ChatterBotCorpusTrainer +from modules.sense import speak #imports the notification system. from win10toast import ToastNotifier @@ -52,11 +53,10 @@ def usersettingwrite(username, usercity, user_gender, userdob, useremail, userem "dictpref":"british" } } + speak("Please wait while we load your data") json.dump(data, f, ensure_ascii=False, sort_keys=True, indent=4) #notifies the user that - dataconfirm = ToastNotifier() - dataconfirm.show_toast("Alpha", "User data confirmed.", duration = 20, icon_path ="app.ico") - time.sleep(5) + speak("Data loaded and confirmed") exit() except Exception as e: print(e)