Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'Brad'
- import time
- import os
- def new():
- name = raw_input("Insert name of new file (use .txt if you want a text file): ")
- file1 = open(name, "w").close
- file1 = open(name, "r+")
- os.system("cls")
- print("PyEdit v0.1.1")
- print("Enter text to be written to file then press 'Enter'")
- print(" ")
- print(" ")
- data = raw_input()
- file1.write(data)
- file1.close
- osScreen2()
- def calc():
- os.system("cls")
- function = raw_input("add, subtract, multiply, or divide?: ")
- if function == "add":
- os.system("cls")
- x = raw_input("Insert first number: ")
- os.system("cls")
- y = raw_input("Insert second number: ")
- os.system("cls")
- add = int(x) + int(y)
- print(str(x) + " + " + str(y) + " = " + str(add))
- osScreen2()
- elif function == "subtract":
- os.system("cls")
- x = raw_input("Insert first number: ")
- os.system("cls")
- y = raw_input("Insert second number: ")
- os.system("cls")
- add = int(x) - int(y)
- print(str(x) + " - " + str(y) + " = " + str(add))
- osScreen2()
- elif function == "multiply":
- os.system("cls")
- x = raw_input("Insert first factor: ")
- os.system("cls")
- y = raw_input("Insert second factor: ")
- os.system("cls")
- add = int(x) * int(y)
- print(str(x) + " x " + str(y) + " = " + str(add))
- osScreen2()
- elif function == "divide":
- os.system("cls")
- x = raw_input("Insert numerator: ")
- os.system("cls")
- y = raw_input("Insert denominator: ")
- os.system("cls")
- add = int(x) / int(y)
- print(str(x) + " / " + str(y) + " = " + str(add))
- osScreen2()
- else:
- print("Invalid operation")
- osScreen2()
- # the say command-------------------------
- def say():
- sent = raw_input("Say what?: ")
- print(sent)
- osScreen2()
- #--------------------------the resetpw command--------------------------
- def pwreset():
- os.system("cls")
- ps = raw_input("Enter your old password: ")
- if ps == password:
- os.system("cls")
- dp = raw_input("Enter your new password: ")
- open("pass.txt", 'w').close
- f2 = open("pass.txt", "r+")
- f2.write(dp)
- os.system("cls")
- print("Password Reset")
- time.sleep(1)
- os.system("cls")
- osScreen2()
- else:
- os.system("cls")
- print("Passcode Incorrect")
- time.sleep(1)
- osScreen()
- #--------------------------------------------------------------------------
- #---------------the coms command-------------------------------------------
- def commands():
- print("commands: exit, resetpw, coms, clearsc, say, calc, new")
- # -------------------the loading account screen ----------------------------
- def loadOS():
- os.system("cls")
- print("loading your POS account.")
- time.sleep(1)
- os.system("cls")
- print("loading your POS account..")
- time.sleep(1)
- os.system("cls")
- print("loading your POS account...")
- time.sleep(1)
- osScreen()
- #------------------------------------------------------------------------------
- #---------------the command interpreter----------------------------------------
- def osScreen():
- os.system("cls")
- print("POS V 0.0.1")
- print("for a list of commands type 'coms'")
- osScreen2()
- def osScreen2():
- command = raw_input("> ")
- if command == "exit":
- exit()
- elif command == "resetpw":
- pwreset()
- osScreen2()
- elif command == "coms":
- commands()
- osScreen2()
- elif command == "clearsc":
- os.system("cls")
- osScreen2()
- elif command == "say":
- say()
- elif command == "calc":
- calc()
- elif command == "new":
- new()
- else:
- print("Unknown command")
- osScreen2()
- print("Welcome to POS")
- print("--------------")
- password = raw_input("Code: ")
- f1 = open("pass.txt")
- setpass = f1.read()
- f1.close()
- if password == setpass:
- loadOS()
- else:
- print("Incorrect Passcode")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement