-- -- Sertex Application Package -- Built with SPK builder 1.2 -- { files = "{\ [ \"home.lua\" ] = \"local currentTime\\\ \\\ local function launch(id)\\\ \\\ local ok, par = sPhone.launch(id);\\\ \\\ if not ok then\\\ term.setBackgroundColor(colors.black)\\\ term.setTextColor(colors.white)\\\ term.clear()\\\ term.setCursorPos(1,1)\\\ print(id .. \\\" has errored:\\\")\\\ printError(par)\\\ print(\\\"Press any key to continue\\\")\\\ os.pullEvent(\\\"key\\\")\\\ \\\ else\\\ if #par == 0 or not par[1] and par[1] ~= nil then\\\ term.setBackgroundColor(colors.black)\\\ term.setTextColor(colors.white)\\\ print(\\\"Press any key to continue\\\")\\\ os.pullEvent(\\\"key\\\")\\\ end\\\ end\\\ end\\\ \\\ local buttonsInHome = {\\\ {\\\"sphone.header\\\",23,1,25,1,sPhone.theme[\\\"header\\\"],sPhone.theme[\\\"headerText\\\"],\\\"vvv\\\"},\\\ {\\\"sphone.appList\\\",12,20,14,20,sPhone.theme[\\\"backgroundColor\\\"],sPhone.theme[\\\"header\\\"],\\\"===\\\"},\\\ {\\\"sphone.shell\\\",2,3,8,5,colors.black,colors.yellow,\\\" Shell\\\",2},\\\ {\\\"sphone.explorer\\\",11,3,17,5,colors.blue,colors.white,\\\" Files\\\",2},\\\ {\\\"sphone.lock\\\",20,3,25,5,colors.lightGray,colors.black,\\\" Lock\\\",2},\\\ {\\\"sphone.gps\\\",11,7,15,9,colors.red,colors.black,\\\" GPS\\\",2},\\\ {\\\"sphone.info\\\",18,7,23,9,colors.lightGray,colors.black,\\\" Info\\\",2},\\\ {\\\"sphone.store\\\",2,7,8,9,colors.green,colors.white,\\\" Store\\\",2},\\\ }\\\ \\\ local function clear()\\\ term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\ term.clear()\\\ term.setCursorPos(1,1)\\\ term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ end\\\ \\\ local function drawClock(time)\\\ term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\ term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\ term.setCursorPos(1,1)\\\ write(\\\" \\\")\\\ term.setCursorPos(1,1)\\\ write(\\\" \\\"..time)\\\ end\\\ \\\ local function drawHome()\\\ clear()\\\ visum.buttons(buttonsInHome,true)\\\ \\\ local w, h = term.getSize()\\\ paintutils.drawLine(1,1,w,1, sPhone.theme[\\\"header\\\"])\\\ term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\ visum.align(\\\"right\\\",\\\"vvv \\\",false,1)\\\ drawClock(currentTime or \\\"\\\")\\\ end\\\ local function footerMenu()\\\ sPhone.isFooterMenuOpen = true\\\ function redraw()\\\ drawHome()\\\ drawClock(currentTime)\\\ local w, h = term.getSize()\\\ paintutils.drawFilledBox(1,2,w,4,sPhone.theme[\\\"header\\\"])\\\ term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\ term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\ visum.align(\\\"right\\\",\\\"^^^ \\\",false,1)\\\ visum.align(\\\"right\\\", \\\"Reboot \\\",false,3)\\\ term.setCursorPos(11,3)\\\ write(\\\"Settings\\\")\\\ term.setCursorPos(2,3)\\\ write(\\\"Shutdown\\\")\\\ end\\\ redraw()\\\ while true do\\\ term.redirect(sPhone.mainTerm)\\\ local _,_,x,y = os.pullEvent(\\\"mouse_click\\\")\\\ if y == 3 then\\\ if x > 1 and x < 10 then\\\ os.shutdown()\\\ sPhone.inHome = true\\\ elseif x > 19 and x < 26 then\\\ os.reboot()\\\ sPhone.inHome = true\\\ elseif x > 10 and x < 19 then\\\ sPhone.inHome = false\\\ launch(\\\"sphone.settings\\\")\\\ sPhone.inHome = true\\\ \\\ drawHome()\\\ break\\\ end\\\ elseif y == 1 then\\\ if x < 26 and x > 22 then\\\ sPhone.isFooterMenuOpen = false\\\ return\\\ end\\\ end\\\ end\\\ end\\\ local function buttonHomeLoop()\\\ drawHome()\\\ while true do\\\ term.setCursorBlink(false)\\\ local autoLockTimer = os.startTimer(10)\\\ local id = visum.buttons(buttonsInHome)\\\ \\\ if id == \\\"sphone.header\\\" then\\\ footerMenu()\\\ drawHome()\\\ elseif id == \\\"sphone.lock\\\" then\\\ sPhone.inHome = false\\\ sPhone.login()\\\ drawHome()\\\ sPhone.inHome = true\\\ else\\\ sPhone.inHome = false\\\ os.pullEvent = os.oldPullEvent\\\ launch(id)\\\ drawHome()\\\ os.pullEvent = os.pullEventRaw\\\ sPhone.inHome = true\\\ end\\\ end\\\ \\\ sPhone.inHome = false\\\ \\\ end\\\ \\\ local function updateClock()\\\ local old\\\ while true do\\\ if sPhone.inHome then\\\ local time = textutils.formatTime(os.time(), not config.read(\\\"/.sPhone/config/sPhone\\\",\\\"format12time\\\"))\\\ if time ~= old then\\\ old = time\\\ currentTime = time\\\ drawClock(time)\\\ end\\\ end\\\ sleep(0.3)\\\ end\\\ end\\\ \\\ parallel.waitForAll(buttonHomeLoop, updateClock)\",\ }", config = "{\ type = \"home\",\ main = \"home.lua\",\ name = \"sPhone Home\",\ id = \"sphone.home\",\ author = \"Sertex\",\ hidden = true,\ version = 1,\ }", }