new gui
This commit is contained in:
parent
8ce6a8bd79
commit
aab808b9dd
1 changed files with 73 additions and 10 deletions
|
@ -7,16 +7,29 @@ local function redrawM()
|
||||||
term.setBackgroundColor(colors.white)
|
term.setBackgroundColor(colors.white)
|
||||||
term.setTextColor(colors.black)
|
term.setTextColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1,1)
|
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
paintutils.drawLine(1,1,w,1,colors.orange)
|
paintutils.drawLine(1,1,w,1,colors.green)
|
||||||
|
term.setCursorPos(1,1)
|
||||||
|
write(" Store")
|
||||||
visum.align("right","X",false,1)
|
visum.align("right","X",false,1)
|
||||||
visum.align("center"," Store",false,1)
|
|
||||||
term.setTextColor(colors.black)
|
term.setTextColor(colors.black)
|
||||||
term.setBackgroundColor(colors.white)
|
term.setBackgroundColor(colors.white)
|
||||||
term.setCursorPos(1,3)
|
term.setCursorPos(1,3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function install(ap)
|
||||||
|
local data = http.get("https://raw.github.com/Sertex-Team/sPhone-Store/master/apps/"..ap.path).readAll()
|
||||||
|
local f = fs.open("/tmp/sPhoneStore/"..ap.id..".spk","w")
|
||||||
|
f.write(data)
|
||||||
|
f.close()
|
||||||
|
local status = sPhone.install("/tmp/sPhoneStore/"..ap.id..".spk")
|
||||||
|
if status then
|
||||||
|
sPhone.winOk("Installed")
|
||||||
|
else
|
||||||
|
sPhone.winOk("Error while installing")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
redrawM()
|
redrawM()
|
||||||
|
|
||||||
term.setCursorPos(1,2)
|
term.setCursorPos(1,2)
|
||||||
|
@ -57,14 +70,64 @@ while true do
|
||||||
|
|
||||||
if appsL[y-2] then
|
if appsL[y-2] then
|
||||||
local data = http.get("https://raw.github.com/Sertex-Team/sPhone-Store/master/apps/"..appsL[y-2].path).readAll()
|
local data = http.get("https://raw.github.com/Sertex-Team/sPhone-Store/master/apps/"..appsL[y-2].path).readAll()
|
||||||
local f = fs.open("/tmp/sPhoneStore/"..appsL[y-2].id..".spk","w")
|
data = textutils.unserialise(data)
|
||||||
f.write(data)
|
if data then
|
||||||
f.close()
|
local _conf = textutils.unserialise(data.config)
|
||||||
local status = sPhone.install("/tmp/sPhoneStore/"..appsL[y-2].id..".spk")
|
redrawM()
|
||||||
if status then
|
term.setCursorPos(2,3)
|
||||||
sPhone.winOk("Installed")
|
print(_conf.name)
|
||||||
|
term.setCursorPos(2,6)
|
||||||
|
term.setTextColor(colors.black)
|
||||||
|
print("Author:")
|
||||||
|
term.setTextColor(colors.gray)
|
||||||
|
term.setCursorPos(2,7)
|
||||||
|
print(_conf.author)
|
||||||
|
term.setCursorPos(2,9)
|
||||||
|
term.setTextColor(colors.black)
|
||||||
|
print("Type:")
|
||||||
|
term.setTextColor(colors.gray)
|
||||||
|
term.setCursorPos(2,10)
|
||||||
|
print((_conf.type or "Normal"))
|
||||||
|
term.setCursorPos(2,12)
|
||||||
|
term.setTextColor(colors.black)
|
||||||
|
print("Version:")
|
||||||
|
term.setTextColor(colors.gray)
|
||||||
|
term.setCursorPos(2,13)
|
||||||
|
print(_conf.version)
|
||||||
|
|
||||||
|
if config.read("/.sPhone/config/spklist",_conf.id) then
|
||||||
|
paintutils.drawLine(19,4,25,4,colors.red)
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
term.setCursorPos(19,4)
|
||||||
|
write("Delete")
|
||||||
else
|
else
|
||||||
sPhone.winOk("Error while installing")
|
paintutils.drawLine(19,4,25,4,colors.green)
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
term.setCursorPos(19,4)
|
||||||
|
write("Install")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
while true do
|
||||||
|
local _,_,mx,my = os.pullEvent("mouse_click")
|
||||||
|
if my == 1 and x == mw then
|
||||||
|
break
|
||||||
|
elseif (mx >= 19 and mx <= 25) and my == 4 then
|
||||||
|
if config.read("/.sPhone/config/spklist",_conf.id) then
|
||||||
|
if fs.exists("/.sPhone/apps/spk/".._conf.id) then
|
||||||
|
fs.delete("/.sPhone/apps/spk/".._conf.id)
|
||||||
|
end
|
||||||
|
config.write("/.sPhone/config/spklist",_conf.id,nil)
|
||||||
|
else
|
||||||
|
install(appsL[y-2])
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sPhone.winOk("Cannot install","file corrupted")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue