diff --git a/Whatsnew.txt b/Whatsnew.txt new file mode 100644 index 0000000..ead7c86 --- /dev/null +++ b/Whatsnew.txt @@ -0,0 +1,39 @@ +------------PyPromptOS------------ +Welcome to the Whats new thing! +This might be handy if you wanna know whats new +But who knows? + +Date of changes: M6 / D8 / Y2024 + +Changes / Whats new: + - Removed BHelp or BetterHelp because it's useless + - Removed the fakeload because again it's useless + - Removed echo for now (Might return soon?) + / Changed the \ to / (I don't know the name of it) + / reworked all the commands that are useful + + Added an launcher / starter! To check if all files are there + + Added an Setup to show how this program works + + Added an feature where setup will create an file for skipping setup + + + +What i should add in the future: + That all the commands work without having to keep the program in the same folder or keeping it the same name + +Dates of version: + 1.0 PBR // M4 / D18 / Y2023 + 1.0.1 PBR // M4 / D24 / Y2023 + 1.0.2 PBR // M5 / D9 / Y2024 + 1.3 PBR // M5 / D10 / Y2024 started working again on // M5 / D6 / Y2024 (got to lazy) (???) + 1.4 PBR // M6 / D8 / Y2024 started working again on // M8 / D3 / Y2024 (forgot about this) + +Credit: + Coding: @MaxBoiy + +Compiled via: + PyInstaller + +With barely any *big* updates and no linux support! isn't it exciting? + +MBD Product // Made By Dico // +------------PyPromptOS------------ \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..74db50e --- /dev/null +++ b/main.py @@ -0,0 +1,227 @@ +import time +import sys +import os +import webbrowser +import random + +pathtofile = "temp folder" +base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__))) +setuptemp = "_files/setup.json" +pathtown = "Whatsnew.txt" +pathtown1 = os.path.join(base_path, pathtown) +pathtosetup = os.path.join(base_path, setuptemp) +pathtonontemp = "C:/Users/Public/PyPrompt/setup.json" + +def delay_print(s): + for c in s: + sys.stdout.write(c) + sys.stdout.flush() + time.sleep(0.20) + +os.system("cls") +delay_print("PyPrompt") +print("") +print("Version 1.4 PBR") +print() +print("Type help to get a list for commands.") + +while True: + command = input("#/> ") + + if command == "help": + print("------------PyPrompt------------") + print("help // Shows this list of commands.") + print("dir // Shows the directory.") + print("clear // Will cls the screen") + print("exit // This will quit the Script") + print("cd // Will bring you to an other directory") + print("run (T)// Will allow you to run files") + print("show (T)// Will show you the text from a text file") + print("wn // Will show a list of What's new") + print("settings // Will open the settings") + print("------------PyPrompt------------") + + elif command == "cd": + cd = input("cd_dir/>") + os.chdir(cd) + + elif command == "clear": + os.system("cls") + + elif command == "exit": + break + + elif command == "dir": + os.system("dir") + + elif command == "run": + os.system("cls") + print("Welcome to run! use 'help' to see all active commands ") + print("If you wanna run python code put python before the name of file") + print("else it will open in text editor") + while True: + run = input("run/>") + if run == "help": + print("------------PyPrompt/run------------") + print("dir // Will show all files expect .uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343 sorry!") + print("cd // Allows you to go to different folders") + print("exit // Will bring you back to the main terminal") + print("cexit // Will clear the console and also exit back to the main terminal") + print("------------PyPrompt/run------------") + + elif run == "dir": + os.system("dir /B/A-D | findstr /EILV '.uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343'") + + elif run == "cd": + os.system("dir /a:d ") + print("Please enter which folder you want") + foldercd = input("run_folder/>") + if foldercd == "": + print("Prompt is empty!") + + elif foldercd == "..": + print("This currently doesn't work :( I blame os.chdir!") + + elif foldercd == ".": + print("This currently doesn't work :( I blame os.chdir!") + + else: + os.chdir(foldercd) + + elif run == "exit": + break + + elif run == "cexit": + os.system("cls") + break + + else: + os.system(run) + + elif command == "show": + os.system("cls") + print("Welcome to show! use 'help' to see all active commands ") + while True: + show = input("show/>") + if show == "help": + print("------------PyPrompt/show------------") + print("this is kinda the same as run but here you read the contents of the file and not run it") + print("------------PyPrompt/show------------") + print("dir // Will show all files expect .uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343 sorry!") + print("cd // Allows you to go to different folders") + print("exit // Will bring you back to the main terminal") + print("cexit // Will clear the console and also exit back to the main terminal") + print("------------PyPrompt/show------------") + + elif show == "dir": + os.system("dir /B/A-D | findstr /EILV '.uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343'") + + elif show == "cd": + os.system("dir /a:d ") + print("Please enter which folder you want") + foldercd = input("show_folder\>") + if foldercd == "": + print("Prompt is empty!") + else: + os.chdir(foldercd) + + elif show == "..": + print("This currently doesn't work :( I blame os.chdir!") + + elif show == ".": + print("This currently doesn't work :( I blame os.chdir!") + + elif show == "exit": + break + + elif show == "cexit": + os.system("cls") + break + + elif show == "": + print("Prompt is empty! Maybe type something?") + + else: + os.system('%s %s' % ("more", show)) + + elif command == "wn": + os.system('%s %s' % ("more", pathtown1)) + + elif command == "settings": + os.system("cls") + print("------------\033[0;30;47mPyPrompt/Settings\033[0m------------") + print("Welcome to the settings menu! What can we do for you?") + while True: + print("[1] = General") + print("[2] = Credits & Info") + print("[3] = Exit") + settingsmenu = input("#/Settings/>") + if settingsmenu == "1": + + os.system("cls") + print("------------\033[0;30;47mPyPrompt/Settings/General\033[0m------------") + print("Settings/General Basic settings for PyPrompt") + while True: + print("[1] = Delete setup file") + print("[2] = Go back") + genesettings = input("#/S/General>") + if genesettings == "1": + if os.path.exists(pathtonontemp): + pathtofile = "C:/Users/Public/PyPrompt/setup.json" + os.system("cls") + print("------------\033[0;30;47mConfirm\033[0m------------") + print("Are you sure you want to erase the setup file?") + print("By doing this you will have to do the setup again when you open this program\n") + print("Path to file:", pathtofile) + print("[y/n]") + while True: + eraseconfirm = input("Confirm> ") + if eraseconfirm == "y": + os.remove(pathtofile) + if os.path.exists(pathtofile): + print("The file is not deleted! Something happend") + input("------------\033[0;30;47mContinue\033[0m------------") + else: + print("The file is successfully deleted!") + input("------------\033[0;30;47mContinue\033[0m------------") + break + elif eraseconfirm == "n": + break + elif genesettings == "2": + break + elif settingsmenu == "2": + os.system("cls") + print("------------\033[0;30;47mCredits & Info\033[0m------------") + print("Version: 1.4 Public Beta Release | Change log >> [1]\n") + print("Created by Maxboiy/MBD\n") + print("Credits to:") + print("the internet | Without it you would not have this program right now\n") + print("Compiler:\n PyInstaller\n") + print("Compile date:\n 5-August-2024\n") + print("Open Github page \n [2]\n") + print("[3] = Go back") + while True: + candi = input("#/S/Info> ") + if candi == "1": + os.system('%s %s' % ("more", pathtown1)) + print("[3] = Go back") + elif candi == "2": + webbrowser.open("https://github.com/Maxboiy/PyPrompt") + elif candi == "3": + break + elif candi == "4": + webbrowser.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ") + print("Got you ;)") + elif settingsmenu == "3": + os.system("cls") + print("------------\033[0;30;47mClose\033[0m------------") + print("[1] = Go back to the program") + print("[2] = Close the program") + closeandquit = input("#/S/Quit> ") + if closeandquit == "1": + break + elif closeandquit == "2": + Programclosed + + else: + print(command, "Invalid command! Maybe check for typos?") \ No newline at end of file diff --git a/starter.py b/starter.py new file mode 100644 index 0000000..f5791c5 --- /dev/null +++ b/starter.py @@ -0,0 +1,173 @@ +import sys +import os +import json +import webbrowser + +dirfolder = "_files" +pyscript = "_files/main.py" +setupfileno = "setup.json" +userpath = "%USERPROFILE%" +setupfile = "C:/Users/Public/PyPrompt/setup.json" +pyprompt = "Checking PyPrompt... not Found!" +filescheck = "Checking files... not found!" +programfile = "Checking program files... not found!" +setupdia = "Setup file... not found!" +setup1 = "Entering setup..." + +print("------------PyPrompt------------") +print("PyPrompt will shortly begin after this!") + +# Checking for the files +base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__))) +# Found the files +if base_path == base_path: + filescheck = "Checking files... found!" + +print(filescheck) + +# Checking for the PyPrompt script +usedfiles = os.path.join(base_path, pyscript) +if os.path.exists(usedfiles): + pyprompt = "Checking PyPrompt... found!" + +else: + print("") + print("WARNING! starter.py didn't find PyPrompt!") + print("Without PyPrompt this program can't start! If you didn't know\n") + print("Troubleshot") + print("[1] = go to the Github page") + print("[2] = Give new location") + print("[3] = Ignore warning and contine") + print("[4] = Give up!") + cfpy = input("recovery> ") + if cfpy == "1": + print("We are going to open the Github page!") + print("https://github.com/Maxboiy/PyPrompt") + print("open? [y/n]") + agreepage = input("recovery/contine> ") + if agreepage == "y": + webbrowser.open("https://github.com/Maxboiy/PyPrompt") + if agreepage == "n": + print("Please restart this program!") + input("recovery/quit>") + ha_error + + elif cfpy == "2": + print("WARNING: This is temporary and will not happen very time on boot") + print("Where to look:", usedfiles) + newlocation = input("recovery/location> ") + pyscript = newlocation + + elif cfpy == "3": + print("Continuing...") + + elif cfpy == "4": + print("Are you giving up?") + print("Never should you give up!\n") + print("Do you want me to open some inspirational music? [y/n]") + inspirationalmusic = input("recovery/give_up> ") + if inspirationalmusic == "y": + webbrowser.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ") + print("GOT YOU!!! HAHAHHAHAHAHA") + input("recovery/give_up/troll> ") + youvebeenrickrolled + if inspirationalmusic == "n": + print("Its sad to see you go! :,(") + input("recovery/quit> ") + goodbye + +print(pyprompt) + +# Checking for the files used by PyPrompt +useddir = os.path.join(base_path, dirfolder) +if os.path.exists(useddir): + programfile = "Checking program files... found!" + +print(programfile) + +# Checking for setup file + +if os.path.exists(setupfile): + with open(setupfile, "r") as f: + data = json.load(f) + for setup in data["setup"]: + if setup["done"] == "True": + setupdia = "Setup file... found!" + setup1 = "Skipping setup..." + print(setupdia) + print(setup1) + +else: + os.system("cls") + print("------------PyPrompt/Setup------------") + print("Welcome to PyPrompt!\n") + print("PyPrompt is an terminal recreation but in Python") + print("It might not have all the features as an normal terminal") + print("but hey! atleast it works... for the most part\n") + print("Press enter to contine.") + input("------------\033[0;30;47mContinue\033[0m------------") + os.system("cls") + print("------------PyPrompt/Setup------------") + print("Hello there! this start program creates an file which auto skips the setup") + print("But we want permission from you to know if we can save setup.json in the Public user folder.") + print("If you decline, you will have to do the setup everytime you start PyPrompt") + print("DIR >>", setupfile) + print() + print("[yes/no]") + permissionneed = input("Permission>") + if permissionneed == "yes": + os.system("cls") + print("------------PyPrompt/Setup------------") + print("Thank you! The file will be created once setup is completed.\n") + input("------------\033[0;30;47mContinue\033[0m------------") + elif permissionneed == "no": + print("------------PyPrompt/Setup------------") + print("The setup.json file will be saved in the temp folder!\n") + input("------------\033[0;30;47mContinue\033[0m------------") + os.system("cls") + print("------------PyPrompt/Setup/help------------") + print("1. Terminal in terminal") + print("Some commands are there own terminals, meaning they will have there own commands and doesn't work like the main terminal") + print("the commands that are there own terminal will have an (T) at the end of there name\n") + print("Type skip to skip this part!\n") + print("Try it out!\n") + while True: + print("Type run") + sample1 = input("pyprompt/sample1> ") + if sample1 == "run": + print("Goodjob! Your now inside the other terminal. But how do you get out?\n") + print("Type exit") + sample1_run = input("run\>") + if sample1_run == "exit": + break + else: + print(sample1_run, "does not work! ") + elif sample1 == "skip": + break + else: + print(sample1, "does not work!") + print("And thats the basics of the terminal commands") + print("Press enter to contine.") + input("------------\033[0;30;47mContinue\033[0m------------") + setupw = {"setup": [{"done": "True"}] } + if permissionneed == "yes": + permsave = os.path.join(userpath, setupfile) + if os.path.exists("C:/Users/Public/PyPrompt"): + with open(permsave, "w") as f: + json.dump(setupw, f) + else: + os.mkdir('C:/Users/Public/PyPrompt') + with open(permsave, "w") as f: + json.dump(setupw, f) + + elif permissionneed == "no": + tempsave = os.path.join(useddir, setupfileno) + with open(tempsave, "w") as f: + json.dump(setupw, f) + + os.system('%s %s' % ("python", usedfiles)) + +os.system("%s %s" % ("python", usedfiles)) + + +