Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version = "3.0 - Openperipheral relesase"
- local function os_start()
- if fs.exists("openperipheral.conf") then
- glassc = fs.open("openperipheral.conf", "r")
- gls = glassc.readLine()
- glass = peripheral.wrap(gls)
- glassc.close()
- glass.clear()
- else
- asd = "iii"
- end
- --GUI
- slc = 0
- --tde-paint:
- local function painter()
- term.setBackgroundColor(colors.blue)
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,1)
- write(" Painter ")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.blue)
- --program
- print("Choise slot for paint")
- print("1")
- print("2")
- print("3")
- print("4")
- print("5 - desktop image")
- write(">")
- var = read()
- if var == "1" then
- shell.run("paint /tde/paint/1")
- elseif var == "2" then
- shell.run("paint /tde/paint/2")
- elseif var == "3" then
- shell.run("paint /tde/paint/3")
- elseif var == "4" then
- shell.run("paint /tde/paint/4")
- elseif var == "5" then
- shell.run("paint /wallpaper")
- os_start()
- else
- painter()
- end
- end
- --tde-redstone:
- tBarC = 8
- tBartC = 1
- local function redsbskg()
- backColor = colors.pink
- term.setBackgroundColor(backColor)
- term.clear()
- end
- function RedGui()
- redsbskg()
- redstonegui = paintutils.loadImage("/tde/redstone.png")
- paintutils.drawImage(redstonegui, 0, 0)
- term.setCursorPos(1, 19)
- write("(C) tima_gt 2013-2014 GNU GPL project ")
- term.setCursorPos(1, 2)
- write("Active redstone")
- term.setCursorPos(1, 15)
- write("DeActive redstone")
- term.setCursorPos(50, 1)
- write("X")
- asd = true
- while asd == true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- if event == "mouse_click" then
- if X >=1 and X <=17 and Y >=3 and Y <=5 and button ==1 then slc = 0
- redstone.setOutput("back", true)
- elseif X >=1 and X <=17 and Y >=14 and Y <=18 and button ==1 then slc = 0
- redstone.setOutput("back", false)
- elseif X ==50 and Y ==1 and button ==1 then slc = 0
- asd = false
- shell.run("tde-desktop")
- else
- RedGui()
- end
- end
- end
- end
- end
- --tde-terminal:
- local function restoretext()
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- local function tde_terminal()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- write("For exit write exit")
- trues = true
- local xter yter = term.getCursorPos()
- term.setCursorPos(1,3)
- while trues == true do
- if xter == 1 and yter == 1 then
- term.setCursorPos(1, 2)
- end
- write(">")
- command = read()
- if command == "exit" then
- print("Exitting...")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- trues = false
- elseif command == "ls" then
- term.setBackgroundColor(colors.black)
- shell.run(command)
- elseif command == "luaide" then
- shell.run("pastebin run vyAZc6tJ")
- else
- shell.run(command)
- end
- end
- end
- --applications app:
- local function app_color()
- backColor = colors.white
- term.setBackgroundColor(backColor)
- term.clear()
- end
- --functions|
- -- V
- local function applicationslist()
- if fs.exists("openperipheral.conf") then
- glass.clear()
- apps = glass.addBox(3, 3, 100, 10, 0x0, 0.7)
- appstext = glass.addText(30, 3, "applications", 0xFFFFFF)
- end
- applist = paintutils.loadImage("/tde/program")
- paintutils.drawImage(applist, 2, 2)
- term.setCursorPos(4, 18)
- write(" Back ")
- term.setCursorPos(3, 5)
- write(">_")
- end
- --button-home-touch= [Y1=16 X1=1] [Y1=18 X2=14]
- --terminal-touch= [Y1=1 X1=1] [Y2=5 X2=9]
- --redstone-touch= [Y1=1 X1=11] [Y2=5 X2=20]
- --pictures-touch= [Y1=1 X1=23] [Y2=5 X2=31]
- applicationslist()
- local function whiletruedoapp()
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- if event == "mouse_click" then
- if X >=1 and X <=14 and Y >=16 and Y <=19 and button ==1 then slc = 0
- shell.run("tde-desktop")
- elseif X >=2 and X <=10 and button == 1 and Y >=2 and Y <=5 then slc = 0
- tde_terminal()
- term.setTextColor(colors.white)
- elseif X >=12 and X <=21 and button == 1 and Y >=2 and Y <=6 then slc = 0
- RedGui()
- elseif X >=24 and X <=32 and button == 1 and Y >=2 and Y <=6 then slc = 0
- painter() --painter
- --elseif X >=27 and X<=46 and button == 1 and Y >=2 and Y <=7 then slc = 0
- --shell.run("/ccYoutube") not working yet
- shell.run("pastebin run nCN4nL7A")
- elseif X >=2 and X <=14 and Y >=8 and Y <=14 and button == 1 then slc = 0
- shell.run("pastebin run vyAZc6tJ")
- vaa = read()
- if vaa == "1" then
- os.sleep(1)
- end
- else
- applicationslist()
- end
- end
- end
- end
- end
- --tde-desktop
- local function fixtext()
- term.setTextColor(colors.white)
- end
- local function desktop()
- --glass support
- if fs.exists("openperipheral.conf") then
- glass.clear()
- menu = glass.addBox(2, 2, 40, 13, 0x000, 0.7)
- menutext = glass.addText(12, 5, "[Menu]", 0xFFFFFF)
- end
- --image fixer
- term.setBackgroundColor(colors.white)
- term.clear()
- --indicators
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1, 1)
- write("[ Menu ] ")
- write(" ")
- --Desktop image
- image = paintutils.loadImage("wallpaper")
- paintutils.drawImage(image, 1, 2)
- term.setCursorPos(1, 1)
- end
- function tmenu()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,2)
- print("Applications")
- term.setCursorPos(1,3)
- print(" Shutdown ")
- term.setCursorPos(1,4)
- print(" Restart ")
- term.setCursorPos(1,5)
- print(" Settings ")
- term.setCursorPos(1,6)
- print(" LogOut ")
- end
- fixtext()
- desktop()
- while true do
- local event, button, X, Y = os.pullEventRaw()
- if slc == 0 then
- if event == "mouse_click" then
- if X >=2 and X <=12 and Y==1 and button ==1 then
- slc = 1
- tmenu()
- elseif X>=2 and X <=12 and Y==1 and button ==1 then
- slc = 2
- else
- desktop()
- end
- end
- elseif slc == 1 then
- if X>=1 and X<=12 and Y==2 and button ==1 then slc = 0
- app_color()
- applicationslist()
- whiletruedoapp()
- elseif X>=1 and X<=12 and Y==5 and button ==1 then slc = 0
- shell.run("setup")
- term.setTextColor(colors.white)
- elseif X >=1 and X <=12 and button == 1 and Y== 3 then slc = 0
- if fs.exists("openperipheral.conf") then
- glass.clear()
- end
- os.shutdown()
- elseif X>=1 and X<=12 and Y==4 and button ==1 then slc = 0
- if fs.exists("openperipheral.conf") then
- glass.clear()
- end
- os.reboot()
- elseif X>=1 and X<=12 and Y==6 and button ==1 then slc = 0
- if fs.exists("openperipheral.conf") then
- glass.clear()
- local time = os.time()
- time = textutils.formatTime(time, false)
- glass.addBox(3, 3, 200, 100, 0xfff, 0.5)
- glass.addText(4, 3, "computer is locked!", 0xFFFFFF)
- end
- term.setBackgroundColor(colors.blue)
- while true do
- local time = os.time()
- time = textutils.formatTime(time, false)
- term.clear()
- term.setCursorPos(1, 2)
- print("locked at ",time, ", press any key to unlock")
- local sEvent, param= os.pullEvent("key")
- if sEvent == "key" then
- break
- end
- end
- elseif X>=1 and X<=12 and Y==6 and button ==1 and fs.exists(".user") then slc = 0
- if fs.exists("openperipheral.conf") then
- glass.clear()
- local time = os.time()
- time = textutils.formatTime(time, false)
- glass.addBox(3, 3, 200, 100, 0xfff, 0.5)
- glass.addText(4, 3, "computer is locked!", 0xFFFFFF)
- end
- shell.run("tde-register")
- else
- slc = 0
- desktop()
- end
- shell.run("tde-register")
- end
- end
- end
- if fs.exists("/.tde-root") then
- openconf = fs.open("/.tde-root", "r")
- configtext = openconf.readLine()
- openconf.close()
- if configtext == "nouser" then
- os_start()
- elseif configtext == "user" then
- shell.run("tde-register")
- os_start()
- else
- shell.run("rm /.tde-root")
- term.setTextColor(colors.red)
- print("Error: Out of free ram, reboot the PC!")
- end
- else
- print("Hello, user, this is TDE ", version, "!")
- print("do you want to register user?")
- print("Y/n?")
- write(">")
- rootconf = read()
- if (rootconf == "") or (rootconf == "y") or (rootconf == "Y") then
- writeconfa = fs.open("/.tde-root", "w")
- writeconfa.writeLine("user")
- writeconfa.close()
- shell.run("tde-register")
- os_start()
- elseif rootconf == "n" then
- writeconf = fs.open("/.tde-root", "w")
- writeconf.writeLine("nouser")
- os_start()
- else
- os.sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement