Update homeplus.spk

This commit is contained in:
Ale32bit 2016-11-20 17:09:16 +01:00 committed by GitHub
parent c55608d64c
commit 089596eff1

View file

@ -404,15 +404,15 @@ term.setCursorPos(1,1)\\\
\",\ \",\
[ \"homeplus.lua\" ] = \"\\\ [ \"homeplus.lua\" ] = \"\\\
--setup\\\ --setup\\\
if not fs.exists(spk.getDataPath()..\\\"/icons/shellIcon\\\") then\\\ if not fs.exists(spk.getDataPath()..\\\"/icons/sphone.shell\\\") then\\\
local f = spk.open(\\\"icons/shellIcon\\\",\\\"w\\\")\\\ local f = spk.open(\\\"icons/sphone.shell\\\",\\\"w\\\")\\\
f.write(\\\"4fff\\\\nf4ff\\\\n4f44\\\")\\\ f.write(\\\"4fff\\\\nf4ff\\\\n4f44\\\")\\\
f.close()\\\ f.close()\\\
end\\\ end\\\
\\\ \\\
if not fs.exists(spk.getDataPath()..\\\"/config\\\") then\\\ if not fs.exists(spk.getDataPath()..\\\"/config\\\") then\\\
local f = spk.open(\\\"config\\\",\\\"w\\\")\\\ local f = spk.open(\\\"config\\\",\\\"w\\\")\\\
f.write(\\\"{[1] = {\\\\\\\"Shell\\\\\\\", \\\\\\\"/rom/programs/shell\\\\\\\"},}\\\")\\\ f.write(\\\"{[1] = {\\\\\\\"Shell\\\\\\\", \\\\\\\"sphone.launch\\\\\\\"},}\\\")\\\
f.close()\\\ f.close()\\\
end\\\ end\\\
\\\ \\\
@ -495,35 +495,29 @@ local function homeSettings()\\\
for k, v in pairs(iconPos) do\\\ for k, v in pairs(iconPos) do\\\
if (x >= v[1] and y >= v[2]) and (x <= v[3] and y <= v[4]) then\\\ if (x >= v[1] and y >= v[2]) and (x <= v[3] and y <= v[4]) then\\\
local iconPoss = k\\\ local iconPoss = k\\\
term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\ local ll = config.list(\\\"/.sPhone/config/spklist\\\")\\\
term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ -- for k,v in pairs(ll) do\\\
term.clear()\\\ -- if config.read\\\
sPhone.header(\\\"Home+: Add\\\")\\\ -- end\\\
term.setCursorPos(1,3)\\\ local spkID,name = sPhone.list(nil,{\\\
visum.align(\\\"center\\\",\\\" Path\\\",false,3)\\\ list = ll,\\\
visum.align(\\\"center\\\",\\\" (Blank to cancel)\\\",false,4)\\\ pairs = true,\\\
term.setCursorPos(2,6)\\\ title = \\\" Add App\\\"\\\
write(\\\"/\\\")\\\ })\\\
local path = read()\\\ if not spkID then\\\
if path ~= \\\"\\\" then\\\
if not fs.exists(\\\"/\\\"..path) then\\\
sPhone.winOk(\\\"App not found\\\")\\\
return\\\ return\\\
else\\\ else\\\
visum.align(\\\"center\\\",\\\" Name\\\",false,8)\\\
term.setCursorPos(2,10)\\\
local name = read()\\\
local f = spk.open(\\\"config\\\",\\\"r\\\")\\\ local f = spk.open(\\\"config\\\",\\\"r\\\")\\\
local ics = textutils.unserialise(f.readAll())\\\ local ics = textutils.unserialise(f.readAll())\\\
f.close()\\\ f.close()\\\
ics[iconPoss] = {name,path}\\\ ics[iconPoss] = {name,spkID}\\\
objectsDesktop[iconPoss] = {name,path}\\\ objectsDesktop[iconPoss] = {name,spkID}\\\
local f = spk.open(\\\"config\\\",\\\"w\\\")\\\ local f = spk.open(\\\"config\\\",\\\"w\\\")\\\
f.write(textutils.serialize(ics))\\\ f.write(textutils.serialize(ics))\\\
f.close()\\\ f.close()\\\
shell.run(spk.getPath()..\\\"/files/paint.lua\\\",spk.getDataPath()..\\\"/icons/\\\"..spkID)\\\
sPhone.winOk(\\\"Done!\\\")\\\ sPhone.winOk(\\\"Done!\\\")\\\
end\\\ end\\\
end\\\
break\\\ break\\\
end\\\ end\\\
end\\\ end\\\
@ -591,11 +585,11 @@ local function footer()\\\
}\\\ }\\\
\\\ \\\
while true do\\\ while true do\\\
local name, id = sPhone.menu(menu,\\\"Home\\\",\\\"V\\\")\\\ local name, id = sPhone.menu(menu,\\\"Home+\\\",\\\"V\\\")\\\
if id == 0 then\\\ if id == 0 then\\\
break\\\ break\\\
elseif id == 1 then\\\ elseif id == 1 then\\\
shell.run(\\\"/.sPhone/apps/system/settings\\\")\\\ sPhone.launch(\\\"sphone.settings\\\")\\\
break\\\ break\\\
elseif id == 2 then\\\ elseif id == 2 then\\\
homeSettings()\\\ homeSettings()\\\
@ -603,7 +597,7 @@ local function footer()\\\
sPhone.login()\\\ sPhone.login()\\\
break\\\ break\\\
elseif id == 4 then\\\ elseif id == 4 then\\\
shell.run(\\\"/.sPhone/apps/system/info\\\")\\\ sPhone.launch(\\\"sphone.info\\\")\\\
break\\\ break\\\
elseif id == 5 then\\\ elseif id == 5 then\\\
os.shutdown()\\\ os.shutdown()\\\
@ -621,7 +615,13 @@ local function redraw()\\\
for k, v in pairs(objectsDesktop) do\\\ for k, v in pairs(objectsDesktop) do\\\
local x, y,endx,endy = getCoords(k)\\\ local x, y,endx,endy = getCoords(k)\\\
objCoords[k] = {x,y,endx,endy}\\\ objCoords[k] = {x,y,endx,endy}\\\
local icon = paintutils.loadImage(spk.getDataPath()..\\\"/icons/shellIcon\\\")\\\ local loI\\\
if not fs.exists(spk.getDataPath()..\\\"/icons/\\\"..v[2]) then\\\
loI = spk.getDataPath()..\\\"/icons/sphone.shell\\\"\\\
else\\\
loI = spk.getDataPath()..\\\"/icons/\\\"..v[2]\\\
end\\\
local icon = paintutils.loadImage(loI)\\\
paintutils.drawImage(icon,x,y)\\\ paintutils.drawImage(icon,x,y)\\\
local name, sndName\\\ local name, sndName\\\
if #v[1] > 5 then\\\ if #v[1] > 5 then\\\
@ -661,7 +661,7 @@ local function main()\\\
term.clear()\\\ term.clear()\\\
term.setCursorPos(1,1)\\\ term.setCursorPos(1,1)\\\
sleep(0.1)\\\ sleep(0.1)\\\
shell.run(\\\"/rom/programs/shell\\\")\\\ sPhone.launch(\\\"sphone.shell\\\")\\\
sPhone.inHome = true\\\ sPhone.inHome = true\\\
elseif ev[1] == \\\"mouse_click\\\" then\\\ elseif ev[1] == \\\"mouse_click\\\" then\\\
local x, y = ev[3], ev[4]\\\ local x, y = ev[3], ev[4]\\\
@ -670,7 +670,7 @@ local function main()\\\
if x >= 12 and x <= 15 then\\\ if x >= 12 and x <= 15 then\\\
sPhone.inHome = false\\\ sPhone.inHome = false\\\
sleep(0.1)\\\ sleep(0.1)\\\
shell.run(\\\"/.sPhone/apps/appList\\\")\\\ sPhone.launch(\\\"sphone.appList\\\")\\\
sPhone.inHome = true\\\ sPhone.inHome = true\\\
elseif x == w-6 then\\\ elseif x == w-6 then\\\
sPhone.inHome = false\\\ sPhone.inHome = false\\\
@ -679,7 +679,7 @@ local function main()\\\
term.clear()\\\ term.clear()\\\
term.setCursorPos(1,1)\\\ term.setCursorPos(1,1)\\\
sleep(0.1)\\\ sleep(0.1)\\\
shell.run(\\\"/.sPhone/apps/store\\\")\\\ sPhone.launch(\\\"sphone.store\\\")\\\
sPhone.inHome = true\\\ sPhone.inHome = true\\\
elseif x <= w-1 and x >= w-3 then\\\ elseif x <= w-1 and x >= w-3 then\\\
sPhone.inHome = false\\\ sPhone.inHome = false\\\
@ -689,20 +689,13 @@ local function main()\\\
else\\\ else\\\
local appName, appPath = getProgram(x,y)\\\ local appName, appPath = getProgram(x,y)\\\
if appName then\\\ if appName then\\\
if fs.exists(appPath) then\\\
sPhone.inHome = false\\\ sPhone.inHome = false\\\
term.setBackgroundColor(colors.black)\\\ sPhone.launch(appPath)\\\
term.setTextColor(colors.white)\\\
term.clear()\\\
term.setCursorPos(1,1)\\\
sleep(0.1)\\\
shell.run(appPath)\\\
sPhone.inHome = true\\\ sPhone.inHome = true\\\
end\\\ end\\\
end\\\ end\\\
end\\\ end\\\
end\\\ end\\\
end\\\
end\\\ end\\\
\\\ \\\
local function clockUpdate()\\\ local function clockUpdate()\\\
@ -727,7 +720,7 @@ parallel.waitForAll(main,clockUpdate)\\\
config = "{\ config = "{\
type = \"home\",\ type = \"home\",\
name = \"Home+\",\ name = \"Home+\",\
version = 1,\ version = 2,\
main = \"homeplus.lua\",\ main = \"homeplus.lua\",\
id = \"ale32bit.homeplus\",\ id = \"ale32bit.homeplus\",\
author = \"Ale32bit\",\ author = \"Ale32bit\",\