Update home.spk

This commit is contained in:
Ale32bit 2016-11-23 19:45:46 +01:00 committed by GitHub
parent 1620d63658
commit e5a23bd9e9

View file

@ -1,120 +1,138 @@
--
-- sPhone Application Package
local buttonsInHome = { -- Built with SPK builder 1.2
{"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}, files = "{\
{"sphone.lock",19,3,24,5,colors.lightGray,colors.black," Lock",2}, [ \"home.lua\" ] = \"\\\
{"sphone.chat",11,3,16,5,colors.black,colors.white," Chat",2}, \\\
{"sphone.gps",11,7,15,9,colors.red,colors.black," GPS",2}, local buttonsInHome = {\\\
{"sphone.info",18,7,23,9,colors.lightGray,colors.black," Info",2}, {\\\"sphone.header\\\",23,1,25,1,sPhone.theme[\\\"header\\\"],sPhone.theme[\\\"headerText\\\"],\\\"vvv\\\"},\\\
{"sphone.store",2,7,8,9,colors.green,colors.white," Store",2}, {\\\"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.lock\\\",19,3,24,5,colors.lightGray,colors.black,\\\" Lock\\\",2},\\\
local function clear() {\\\"sphone.chat\\\",11,3,16,5,colors.black,colors.white,\\\" Chat\\\",2},\\\
term.setBackgroundColor(sPhone.theme["backgroundColor"]) {\\\"sphone.gps\\\",11,7,15,9,colors.red,colors.black,\\\" GPS\\\",2},\\\
term.clear() {\\\"sphone.info\\\",18,7,23,9,colors.lightGray,colors.black,\\\" Info\\\",2},\\\
term.setCursorPos(1,1) {\\\"sphone.store\\\",2,7,8,9,colors.green,colors.white,\\\" Store\\\",2},\\\
term.setTextColor(sPhone.theme["text"]) }\\\
end \\\
local function clear()\\\
local function drawHome() term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\
local function box(x,y,text,bg,colorText,page) term.clear()\\\
graphics.box(x,y,x+1+#text,y+2,bg) term.setCursorPos(1,1)\\\
term.setCursorPos(x+1,y+1) term.setTextColor(sPhone.theme[\\\"text\\\"])\\\
term.setTextColor(colorText) end\\\
write(text) \\\
end local function drawHome()\\\
clear() local function box(x,y,text,bg,colorText,page)\\\
graphics.box(x,y,x+1+#text,y+2,bg)\\\
term.setCursorPos(x+1,y+1)\\\
visum.buttons(buttonsInHome,true) term.setTextColor(colorText)\\\
write(text)\\\
local w, h = term.getSize() end\\\
paintutils.drawLine(1,1,w,1, sPhone.theme["header"]) clear()\\\
term.setTextColor(sPhone.theme["headerText"]) \\\
visum.align("right","vvv ",false,1) \\\
end visum.buttons(buttonsInHome,true)\\\
local function footerMenu() \\\
sPhone.isFooterMenuOpen = true local w, h = term.getSize()\\\
function redraw() paintutils.drawLine(1,1,w,1, sPhone.theme[\\\"header\\\"])\\\
drawHome() term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
local w, h = term.getSize() visum.align(\\\"right\\\",\\\"vvv \\\",false,1)\\\
graphics.box(1,2,w,4,sPhone.theme["header"]) end\\\
term.setTextColor(sPhone.theme["headerText"]) local function footerMenu()\\\
term.setBackgroundColor(sPhone.theme["header"]) sPhone.isFooterMenuOpen = true\\\
visum.align("right","^^^ ",false,1) function redraw()\\\
visum.align("right", "Reboot ",false,3) drawHome()\\\
term.setCursorPos(11,3) local w, h = term.getSize()\\\
write("Settings") graphics.box(1,2,w,4,sPhone.theme[\\\"header\\\"])\\\
term.setCursorPos(2,3) term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
write("Shutdown") term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
end visum.align(\\\"right\\\",\\\"^^^ \\\",false,1)\\\
while true do visum.align(\\\"right\\\", \\\"Reboot \\\",false,3)\\\
term.redirect(sPhone.mainTerm) term.setCursorPos(11,3)\\\
drawHome() write(\\\"Settings\\\")\\\
redraw() term.setCursorPos(2,3)\\\
local _,_,x,y = os.pullEvent("mouse_click") write(\\\"Shutdown\\\")\\\
if y == 3 then end\\\
if x > 1 and x < 10 then while true do\\\
os.shutdown() term.redirect(sPhone.mainTerm)\\\
sPhone.inHome = true drawHome()\\\
elseif x > 19 and x < 26 then redraw()\\\
os.reboot() local _,_,x,y = os.pullEvent(\\\"mouse_click\\\")\\\
sPhone.inHome = true if y == 3 then\\\
elseif x > 10 and x < 19 then if x > 1 and x < 10 then\\\
sPhone.inHome = false os.shutdown()\\\
sPhone.launch("sphone.settings") sPhone.inHome = true\\\
sPhone.inHome = true elseif x > 19 and x < 26 then\\\
drawHome() os.reboot()\\\
end sPhone.inHome = true\\\
elseif y == 1 then elseif x > 10 and x < 19 then\\\
if x < 26 and x > 22 then sPhone.inHome = false\\\
sPhone.isFooterMenuOpen = false sPhone.launch(\\\"sphone.settings\\\")\\\
return sPhone.inHome = true\\\
end drawHome()\\\
end end\\\
end elseif y == 1 then\\\
end if x < 26 and x > 22 then\\\
local function buttonHomeLoop() sPhone.isFooterMenuOpen = false\\\
while true do return\\\
drawHome() end\\\
term.setCursorBlink(false) end\\\
local autoLockTimer = os.startTimer(10) end\\\
local id = visum.buttons(buttonsInHome) end\\\
local function buttonHomeLoop()\\\
if id == "sphone.header" then while true do\\\
footerMenu() drawHome()\\\
elseif id == "sphone.lock" then term.setCursorBlink(false)\\\
sPhone.inHome = false local autoLockTimer = os.startTimer(10)\\\
sPhone.login() local id = visum.buttons(buttonsInHome)\\\
sPhone.inHome = true \\\
else if id == \\\"sphone.header\\\" then\\\
sPhone.inHome = false footerMenu()\\\
os.pullEvent = os.oldPullEvent elseif id == \\\"sphone.lock\\\" then\\\
sPhone.launch(id) sPhone.inHome = false\\\
os.pullEvent = os.pullEventRaw sPhone.login()\\\
sPhone.inHome = true sPhone.inHome = true\\\
end else\\\
end sPhone.inHome = false\\\
os.pullEvent = os.oldPullEvent\\\
sPhone.inHome = false sPhone.launch(id)\\\
os.pullEvent = os.pullEventRaw\\\
end sPhone.inHome = true\\\
end\\\
local function updateClock() end\\\
while true do \\\
if sPhone.inHome then sPhone.inHome = false\\\
term.setCursorPos(1,1) \\\
term.setBackgroundColor(sPhone.theme["header"]) end\\\
term.setTextColor(sPhone.theme["headerText"]) \\\
term.setCursorPos(1,1) local function updateClock()\\\
write(" ") while true do\\\
term.setCursorPos(1,1) if sPhone.inHome then\\\
write(" "..textutils.formatTime(os.time(), not config.read("/.sPhone/config/sPhone","format12time"))) term.setCursorPos(1,1)\\\
end term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\
sleep(0) term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\
end term.setCursorPos(1,1)\\\
end write(\\\" \\\")\\\
term.setCursorPos(1,1)\\\
parallel.waitForAll(buttonHomeLoop, updateClock) write(\\\" \\\"..textutils.formatTime(os.time(), not config.read(\\\"/.sPhone/config/sPhone\\\",\\\"format12time\\\")))\\\
end\\\
sleep(0)\\\
end\\\
end\\\
\\\
parallel.waitForAll(buttonHomeLoop, updateClock)\\\
\",\
}",
config = "{\
type = \"home\",\
main = \"home.lua\",\
name = \"sPhone Home\",\
version = 1,\
id = \"sphone.home\",\
author = \"BeaconNet\",\
hidden = true,\
}",
}