Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w,h = term.getSize()
- slc = 0
- isBuild = false
- lastSelection = 1
- function titleBar()
- term.setCursorPos(1,h)
- term.setBackgroundColor(colors.lightBlue)
- term.setTextColor(colors.white)
- term.clearLine()
- term.setTextColor(colors.white)
- term.setCursorPos(1, h)
- write(" Menu ")
- end
- function leftNavMenu1()
- term.setCursorPos(1,2)
- term.setBackgroundColor(colors.gray)
- print(" Storage ")
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print("Customize")
- print(" M-OS ")
- print(" Startup ")
- paintutils.drawLine(10,2,10,h-1,colors.lightGray)
- end
- function leftNavMenu2()
- term.setCursorPos(1,2)
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print(" Storage ")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- print("Customize")
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print(" M-OS ")
- print(" Startup ")
- paintutils.drawLine(10,2,10,h-1,colors.lightGray)
- end
- function leftNavMenu3()
- term.setCursorPos(1,2)
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print(" Storage ")
- print("Customize")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- print(" M-OS ")
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print(" Startup ")
- paintutils.drawLine(10,2,10,h-1,colors.lightGray)
- end
- function leftNavMenu4()
- term.setCursorPos(1,2)
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- print(" Storage ")
- print("Customize")
- print(" M-OS ")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.gray)
- print(" Startup ")
- paintutils.drawLine(10,2,10,h-1,colors.lightGray)
- end
- function selection1()
- slc = 1
- lastSelection = 1
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(12,2)
- print("Manage Storage")
- term.setCursorPos(12,4)
- local size = fs.getSize("m-os/desktop") + fs.getSize("m-os/programs/installed_programs") + fs.getSize("m-os/monitior_detected") + fs.getSize("m-os/boot") + fs.getSize("m-os/settings") + fs.getSize("m-os/logon") + fs.getSize("m-os/restore")
- print("OS: " .. size .. " bytes.")
- term.setCursorPos(12,5)
- local picturesSize = fs.getSize("m-os/images/bground") + fs.getSize("m-os/images/logo") + fs.getSize("m-os/images/icons/file") + fs.getSize("m-os/images/icons/paint") + fs.getSize("m-os/images/icons/shell") + fs.getSize("m-os/images/icons/unknown")
- print("Images: " .. picturesSize .. " bytes.")
- term.setCursorPos(12,6)
- local totalSpaceUsed = size + picturesSize
- print("Total space used: " .. totalSpaceUsed .. " bytes.")
- term.setCursorPos(12,7)
- local freeSpace = fs.getFreeSpace("/")
- print("Free space: " .. freeSpace .. " bytes.")
- end
- function selection2()
- slc = 2
- lastSelection = 2
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(12,2)
- print("Customize your Computer")
- term.setCursorPos(12,4)
- term.setTextColor(colors.lightGray)
- term.setBackgroundColor(colors.gray)
- print(" Edit Desktop Background ")
- end
- function selection3()
- slc = 3
- lastSelection = 3
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(12,2)
- print("M-OS")
- term.setCursorPos(12,3)
- print("Created by MarcoPolo0306")
- if isBuild == true then
- term.setCursorPos(12,5)
- print("Build date: 5/29/17")
- term.setCursorPos(12,6)
- print("Build version: 6")
- else
- term.setCursorPos(12,5)
- print("Version realease date: 29/4/17")
- term.setCursorPos(12,6)
- print("Version: 1.1.2")
- term.setCursorPos(25,6)
- end
- term.setCursorPos(12,8)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lightGray)
- print(" Reinstall ")
- term.setCursorPos(12,10)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lightGray)
- print(" Uninstall ")
- end
- function selection4()
- slc = 4
- lastSelection = 4
- term.setTextColor(colors.gray)
- term.setBackgroundColor(colors.white)
- term.setCursorPos(12,2)
- print("Startup Options")
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(12,4)
- print(" Change Password ")
- end
- function drawWindow()
- local tbarC = colors.lightBlue
- local tBartC = colors.white
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(tbarC)
- term.setTextColor(tBartC)
- term.clearLine()
- term.setCursorPos(2,1)
- write("Settings")
- term.setCursorPos(w,1)
- term.setBackgroundColor(colors.red)
- print("X")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.gray)
- leftNavMenu1()
- end
- function areYouSure()
- slc = 1
- local y1 = h/2-3
- local y2 = h/2+6
- paintutils.drawBox(w/2-10,h/2-3,w/2+10,h/2+4,colors.lightGray)
- paintutils.drawFilledBox(w/2-9,h/2-2,w/2+9,h/2+3,colors.white)
- paintutils.drawLine(w/2-10,h/2-3,w/2+10,h/2-3,colors.lightBlue)
- term.setTextColor(colors.white)
- term.setCursorPos(w/2-10, h/2-3)
- print("Are you sure?")
- term.setTextColor(colors.gray)
- term.setCursorPos(w/2-9, h/2-2)
- term.setBackgroundColor(colors.white)
- print(" Are you sure you")
- term.setCursorPos(w/2-9, h/2-1)
- print(" want to delete ")
- term.setCursorPos(w/2-9, h/2)
- print(" M-OS?")
- term.setCursorPos(w/2-6, h/2+2)
- term.setTextColor(colors.lightGray)
- term.setBackgroundColor(colors.gray)
- print(" Yes ")
- term.setCursorPos(w/2+3, h/2+2)
- print(" No ")
- end
- function createWindow()
- term.setBackgroundColor(1)
- term.clear()
- term.setCursorPos(1,1)
- leftNavMenu1()
- drawWindow()
- titleBar()
- end
- createWindow()
- selection1()
- while true do
- createWindow()
- if lastSelection == 1 then
- leftNavMenu1()
- selection1()
- elseif lastSelection == 2 then
- leftNavMenu2()
- selection2()
- elseif lastSelection == 3 then
- leftNavMenu3()
- selection3()
- elseif lastSelection == 4 then
- leftNavMenu4()
- selection4()
- end
- local event, button, X, Y = os.pullEvent()
- if event == "mouse_click" then
- if X==w and Y==1 and button ==1 then
- shell.run("m-os/desktop")
- elseif X>=1 and X<=9 and Y==2 and button == 1 then
- createWindow()
- leftNavMenu1()
- selection1()
- elseif X>=1 and X<=9 and Y==3 and button == 1 then
- createWindow()
- leftNavMenu2()
- selection2()
- elseif X>=1 and X<=9 and Y==4 and button == 1 then
- createWindow()
- leftNavMenu3()
- selection3()
- elseif X>=1 and X<=9 and Y==5 and button == 1 then
- createWindow()
- leftNavMenu4()
- selection4()
- elseif X>=12 and X<=37 and Y==4 and slc == 2 and button == 1 then
- shell.run("paint","m-os/images/bground")
- elseif X>=12 and X<=23 and Y==8 and slc == 3 and button == 1 then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- print("Thank you for using M-OS. Your computer will reboot in 5 seconds.")
- fs.delete("startup")
- shell.run("pastebin get JuDHtxJt startup")
- sleep(5)
- os.reboot()
- elseif X>=12 and X<=23 and Y==10 and slc == 3 and button == 1 then
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- print("Thank you for using M-OS. Your computer will reboot in 5 seconds.")
- fs.delete("startup")
- fs.delete("m-os")
- sleep(5)
- os.reboot()
- elseif X>=12 and X<=37 and Y==4 and slc == 4 and button == 1 then
- shell.run("edit","m-os/logon")
- end
- end
- end
- local ok, err = pcall(main)
- if not ok then
- term.setBackgroundColor(colors.red)
- term.clear()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,1)
- term.clearLine()
- term.setTextColor(colors.white)
- print("Internal System Error")
- term.setBackgroundColor(colors.red)
- print("The following error has occured: " .. err)
- print("Please report this error to MarcoPolo0306. (=")
- print("(Your computer will restart in 15 seconds.)")
- sleep(15)
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement