Update sPhone.lua

This commit is contained in:
Ale32bit 2016-07-30 19:23:54 +02:00 committed by GitHub
parent adaa45a7db
commit d9d192c59c

View file

@ -1,6 +1,6 @@
local function kernel() local function kernel()
_G.sPhone = { _G.sPhone = {
version = "Alpha 2.13.8", version = "Alpha 2.14",
user = "Guest", user = "Guest",
devMode = false, devMode = false,
mainTerm = term.current() mainTerm = term.current()
@ -555,66 +555,6 @@ end
sleep(1) sleep(1)
end end
local function installedApps()
sPhone.winOk("Work In","Progress")
local dir = "/.sPhone/apps/storeApps/"
if not fs.exists(dir) then
fs.makeDir(dir)
end
local apps = {}
local appsName = {}
for k, v in pairs(fs.list(dir)) do
if fs.isDir(dir..v) then
if fs.exists(dir..v.."/sPhone-Main.lua") then
local nDir = dir..v.."/sPhone-Main.lua"
pDir = dir..v
local run = config.read(nDir, "run")
local name = config.read(nDir, "name")
local author = config.read(nDir, "author")
local version = config.read(nDir, "version")
appsName[name] = run
end
end
end
for k, v in pairs(appsName) do
table.insert(apps, v)
end
local function drawHome()
term.setBackgroundColor(sPhone.theme["backgroundColor"])
term.clear()
term.setTextColor(sPhone.theme["text"])
sPhone.header("Apps","X")
term.setTextColor(sPhone.theme["backgroundColor"])
term.setBackgroundColor(sPhone.theme["text"])
term.setCursorPos(1,3)
for k, v in pairs(appsName) do
print(k)
end
end
drawHome()
local w, h = term.getSize()
while true do
drawHome()
local _,_,x,y = os.pullEvent("mouse_click")
if x == w and y == 1 then
break
elseif y >= 2 then
if apps[y-2] then
sPhone.run("/.sPhone/apps/storeApps/"..pDir.."/"..apps[y-2])
end
end
end
end
local function home() local function home()
sPhone.inHome = true sPhone.inHome = true
@ -641,6 +581,7 @@ end
["sPhone.kst"] = "/.sPhone/apps/kstwallet", ["sPhone.kst"] = "/.sPhone/apps/kstwallet",
["sPhone.info"] = "/.sPhone/apps/system/info", ["sPhone.info"] = "/.sPhone/apps/system/info",
["sPhone.store"] = "/.sPhone/apps/store", ["sPhone.store"] = "/.sPhone/apps/store",
["sPhone.appsButton"] = "/.sPhone/apps/appList",
} }
if not sPhone.locked then if not sPhone.locked then
@ -719,10 +660,6 @@ end
if id == "sPhone.header" then if id == "sPhone.header" then
footerMenu() footerMenu()
elseif id == "sPhone.appsButton" then
sPhone.inHome = false
installedApps()
sPhone.inHome = true
elseif id == "sPhone.lock" then elseif id == "sPhone.lock" then
sPhone.inHome = false sPhone.inHome = false
login() login()