From bb9924ad5a657de6cca123dfc2f68d4e8ecd12e9 Mon Sep 17 00:00:00 2001 From: Alessandro <4512372+Ale32bit@users.noreply.github.com> Date: Mon, 28 Oct 2019 19:29:25 +0100 Subject: [PATCH] Final update Bug fixes --- src/apps/spks/appList.spk | 160 +++++++++++----------- src/apps/spks/chat.spk | 9 +- src/apps/spks/explorer.spk | 192 +++++++++++++------------- src/apps/spks/gps.spk | 9 +- src/apps/spks/home.spk | 266 +++++++++++++++++++++---------------- src/apps/spks/info.spk | 11 +- src/apps/spks/settings.spk | 20 +-- src/apps/spks/shell.spk | 9 +- src/apps/spks/store.spk | 11 +- src/apps/spks/themes.spk | 73 +++++----- 10 files changed, 402 insertions(+), 358 deletions(-) diff --git a/src/apps/spks/appList.spk b/src/apps/spks/appList.spk index 95666e5..4452b9e 100644 --- a/src/apps/spks/appList.spk +++ b/src/apps/spks/appList.spk @@ -1,93 +1,95 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { files = "{\ - [ \"appList.lua\" ] = \"local apps = {}\\r\\\ -local function update()\\r\\\ - apps = config.list(\\\"/.sPhone/config/spklist\\\")\\r\\\ - for k,v in pairs(apps) do\\r\\\ - local h = config.read(\\\"/.sPhone/apps/spk/\\\"..k..\\\"/.spk\\\",\\\"hidden\\\")\\r\\\ - if h then\\r\\\ - apps[k] = nil\\r\\\ - end\\r\\\ - end\\r\\\ -end\\r\\\ -local function menu(id)\\r\\\ - local data = config.list(\\\"/.sPhone/apps/spk/\\\"..id..\\\"/.spk\\\")\\r\\\ - if data then\\r\\\ - term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\r\\\ - term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\ - term.clear()\\r\\\ - sPhone.header(\\\" Apps\\\",\\\"X\\\")\\r\\\ - term.setCursorPos(2,3)\\r\\\ - print(data.name)\\r\\\ - term.setCursorPos(2,6)\\r\\\ - term.setTextColor(colors.black)\\r\\\ - print(\\\"Author:\\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - term.setCursorPos(2,7)\\r\\\ - print(data.author)\\r\\\ - term.setCursorPos(2,9)\\r\\\ - term.setTextColor(colors.black)\\r\\\ - print(\\\"Type:\\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - term.setCursorPos(2,10)\\r\\\ - print((data.type or \\\"Normal\\\"))\\r\\\ - term.setCursorPos(2,12)\\r\\\ - term.setTextColor(colors.black)\\r\\\ - print(\\\"Version:\\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - term.setCursorPos(2,13)\\r\\\ - print(data.version)\\r\\\ - paintutils.drawLine(19,4,25,4,colors.red)\\r\\\ - term.setTextColor(colors.white)\\r\\\ - term.setCursorPos(19,4)\\r\\\ - write(\\\"Delete\\\")\\r\\\ - local w,h = term.getSize()\\r\\\ - while true do\\r\\\ - local _,_,mx,my = os.pullEvent(\\\"mouse_click\\\")\\r\\\ - if my == 1 and mx == w then\\r\\\ - break\\r\\\ - elseif (mx >= 19 and mx <= 25) and my == 4 then\\r\\\ - if fs.exists(\\\"/.sPhone/apps/spk/\\\"..data.id) then\\r\\\ - fs.delete(\\\"/.sPhone/apps/spk/\\\"..data.id)\\r\\\ - end\\r\\\ - config.write(\\\"/.sPhone/config/spklist\\\",data.id,nil)\\r\\\ - break\\r\\\ - end\\r\\\ - end\\r\\\ - end\\r\\\ -end\\r\\\ -\\r\\\ -update()\\r\\\ -\\r\\\ -while true do\\r\\\ - local id, _, mouse = sPhone.list(nil,{\\r\\\ - list = apps,\\r\\\ - pairs = true,\\r\\\ - title = \\\" Apps\\\"\\r\\\ - })\\r\\\ - if not id then\\r\\\ - break\\r\\\ - end\\r\\\ - if mouse == 1 then\\r\\\ - sPhone.launch(id)\\r\\\ - break\\r\\\ - elseif mouse == 2 then\\r\\\ - menu(id)\\r\\\ - update()\\r\\\ - end\\r\\\ -end\",\ + [ \"appList.lua\" ] = \"local apps = {}\\\ +local function update()\\\ + apps = config.list(\\\"/.sPhone/config/spklist\\\")\\\ + for k,v in pairs(apps) do\\\ + local h = config.read(\\\"/.sPhone/apps/spk/\\\"..k..\\\"/.spk\\\",\\\"hidden\\\")\\\ + if h then\\\ + apps[k] = nil\\\ + end\\\ + end\\\ +end\\\ +local function menu(id)\\\ + local data = config.list(\\\"/.sPhone/apps/spk/\\\"..id..\\\"/.spk\\\")\\\ + if data then\\\ + term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\ + term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ + term.clear()\\\ + sPhone.header(\\\" Apps\\\",\\\"X\\\")\\\ + term.setCursorPos(2,3)\\\ + print(data.name)\\\ + term.setCursorPos(2,6)\\\ + term.setTextColor(colors.black)\\\ + print(\\\"Author:\\\")\\\ + term.setTextColor(colors.gray)\\\ + term.setCursorPos(2,7)\\\ + print(data.author)\\\ + term.setCursorPos(2,9)\\\ + term.setTextColor(colors.black)\\\ + print(\\\"Type:\\\")\\\ + term.setTextColor(colors.gray)\\\ + term.setCursorPos(2,10)\\\ + print((data.type or \\\"Normal\\\"))\\\ + term.setCursorPos(2,12)\\\ + term.setTextColor(colors.black)\\\ + print(\\\"Version:\\\")\\\ + term.setTextColor(colors.gray)\\\ + term.setCursorPos(2,13)\\\ + print(data.version)\\\ + paintutils.drawLine(19,4,25,4,colors.red)\\\ + term.setTextColor(colors.white)\\\ + term.setCursorPos(19,4)\\\ + write(\\\"Delete\\\")\\\ + local w,h = term.getSize()\\\ + while true do\\\ + local _,_,mx,my = os.pullEvent(\\\"mouse_click\\\")\\\ + if my == 1 and mx == w then\\\ + break\\\ + elseif (mx >= 19 and mx <= 25) and my == 4 then\\\ + if fs.exists(\\\"/.sPhone/apps/spk/\\\"..data.id) then\\\ + fs.delete(\\\"/.sPhone/apps/spk/\\\"..data.id)\\\ + end\\\ + config.write(\\\"/.sPhone/config/spklist\\\",data.id,nil)\\\ + break\\\ + end\\\ + end\\\ + end\\\ +end\\\ +\\\ +update()\\\ +\\\ +while true do\\\ + local id, _, mouse = sPhone.list(nil,{\\\ + list = apps,\\\ + pairs = true,\\\ + title = \\\" Apps\\\"\\\ + })\\\ + if not id then\\\ + break\\\ + end\\\ + if mouse == 1 then\\\ + sPhone.launch(id)\\\ + break\\\ + elseif mouse == 2 then\\\ + menu(id)\\\ + update()\\\ + end\\\ +end\\\ +\\\ +return true\",\ }", config = "{\ type = \"app\",\ name = \"Apps\",\ version = 1,\ - main = \"appList.lua\",\ id = \"sphone.appList\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + main = \"appList.lua\",\ }", } \ No newline at end of file diff --git a/src/apps/spks/chat.spk b/src/apps/spks/chat.spk index ba54253..73284b1 100644 --- a/src/apps/spks/chat.spk +++ b/src/apps/spks/chat.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -20,16 +20,15 @@ if not peripheral.isPresent(\\\"back\\\") or not peripheral.getType(\\\"back\\\" end\\\ write(\\\"Host: \\\")\\\ local h = read() term.setCursorPos(2,6)\\\ -shell.run(\\\"/rom/programs/rednet/chat\\\", \\\"join\\\", h, sPhone.user)\\\ -\",\ +shell.run(\\\"/rom/programs/rednet/chat\\\", \\\"join\\\", h, sPhone.user)\",\ }", config = "{\ type = \"app\",\ name = \"RedNet Chat\",\ version = 1,\ - main = \"chat.lua\",\ id = \"sphone.chat\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + main = \"chat.lua\",\ }", } \ No newline at end of file diff --git a/src/apps/spks/explorer.spk b/src/apps/spks/explorer.spk index 0039eaa..fcaf7f3 100644 --- a/src/apps/spks/explorer.spk +++ b/src/apps/spks/explorer.spk @@ -1,109 +1,111 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { files = "{\ - [ \"explorer.lua\" ] = \"local dir = nil\\r\\\ -\\r\\\ -local function split(inputstr, sep)\\r\\\ - if sep == nil then\\r\\\ - sep = \\\"%s\\\"\\r\\\ - end\\r\\\ - local t={} ; i=1\\r\\\ - for str in string.gmatch(inputstr, \\\"([^\\\"..sep..\\\"]+)\\\") do\\r\\\ - t[i] = str\\r\\\ - i = i + 1\\r\\\ - end\\r\\\ - return t\\r\\\ -end\\r\\\ -\\r\\\ -local function run(path, args)\\r\\\ - return pcall(function()\\r\\\ - os.run(setmetatable({\\r\\\ - shell = shell,\\r\\\ - multishell = multishell,\\r\\\ - }, {__index = getfenv()}), path, args)\\r\\\ - end)\\r\\\ -end\\r\\\ -while true do\\r\\\ - local path, mouse = sPhone.list(dir,{\\r\\\ - fg1b = colors.green,\\r\\\ - })\\r\\\ - if not path then\\r\\\ - break\\r\\\ - end\\r\\\ - if mouse == 1 then\\r\\\ - run(path)\\r\\\ - elseif mouse == 2 then\\r\\\ - while true do\\r\\\ - local w,h = term.getSize()\\r\\\ - term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\r\\\ - term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\ - term.clear()\\r\\\ - sPhone.header(fs.getName(path),\\\"X\\\")\\r\\\ - term.setCursorPos(2,3)\\r\\\ - write(\\\"Size: \\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - local siz = fs.getSize(path)\\r\\\ - local text\\r\\\ - if siz == 1 then\\r\\\ - text = siz..\\\" byte\\\"\\r\\\ - else\\r\\\ - text = siz..\\\" bytes\\\"\\r\\\ - end\\r\\\ - print(text)\\r\\\ - term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\ - term.setCursorPos(2,5)\\r\\\ - write(\\\"Type: \\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - print(string.getExtension(fs.getName(path)) or \\\"none\\\")\\r\\\ - term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\ - term.setCursorPos(2,8)\\r\\\ - print(\\\"Actions\\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - term.setCursorPos(2,10)\\r\\\ - print(\\\"Run with arguments\\\")\\r\\\ - term.setCursorPos(2,11)\\r\\\ - print(\\\"Edit\\\")\\r\\\ - term.setCursorPos(2,12)\\r\\\ - print(\\\"Rename\\\")\\r\\\ - term.setCursorPos(2,13)\\r\\\ - print(\\\"Delete\\\")\\r\\\ - term.setTextColor(sPhone.theme[\\\"text\\\"])\\r\\\ - local _,_,x,y = os.pullEvent(\\\"mouse_click\\\")\\r\\\ - if y == 1 and x == w then\\r\\\ - break\\r\\\ - elseif y == 10 then\\r\\\ - term.setCursorPos(2,h-1)\\r\\\ - write(\\\"Args: \\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - shell.run(path..\\\" \\\"..read())\\r\\\ - elseif y == 11 then\\r\\\ - shell.run(\\\"edit\\\",path)\\r\\\ - elseif y == 12 then\\r\\\ - term.setCursorPos(2,h-1)\\r\\\ - write(\\\"Rename: \\\")\\r\\\ - term.setTextColor(colors.gray)\\r\\\ - local oldPath = path\\r\\\ - path = fs.getDir(path)..\\\"/\\\"..read()\\r\\\ - fs.move(oldPath,path)\\r\\\ - elseif y == 13 then\\r\\\ - fs.delete(path)\\r\\\ - break\\r\\\ - end\\r\\\ - end\\r\\\ - end\\r\\\ - dir = fs.getDir(path)\\r\\\ -end\",\ + [ \"explorer.lua\" ] = \"local dir = nil\\\ +\\\ +local function split(inputstr, sep)\\\ + if sep == nil then\\\ + sep = \\\"%s\\\"\\\ + end\\\ + local t={} ; i=1\\\ + for str in string.gmatch(inputstr, \\\"([^\\\"..sep..\\\"]+)\\\") do\\\ + t[i] = str\\\ + i = i + 1\\\ + end\\\ + return t\\\ +end\\\ +\\\ +local function run(path, args)\\\ + return pcall(function()\\\ + os.run(setmetatable({\\\ + shell = shell,\\\ + multishell = multishell,\\\ + }, {__index = getfenv()}), path, args)\\\ + end)\\\ +end\\\ +while true do\\\ + local path, mouse = sPhone.list(dir,{\\\ + fg1b = colors.green,\\\ + })\\\ + if not path then\\\ + break\\\ + end\\\ + if mouse == 1 then\\\ + run(path)\\\ + elseif mouse == 2 then\\\ + while true do\\\ + local w,h = term.getSize()\\\ + term.setBackgroundColor(sPhone.theme[\\\"backgroundColor\\\"])\\\ + term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ + term.clear()\\\ + sPhone.header(fs.getName(path),\\\"X\\\")\\\ + term.setCursorPos(2,3)\\\ + write(\\\"Size: \\\")\\\ + term.setTextColor(colors.gray)\\\ + local siz = fs.getSize(path)\\\ + local text\\\ + if siz == 1 then\\\ + text = siz..\\\" byte\\\"\\\ + else\\\ + text = siz..\\\" bytes\\\"\\\ + end\\\ + print(text)\\\ + term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ + term.setCursorPos(2,5)\\\ + write(\\\"Type: \\\")\\\ + term.setTextColor(colors.gray)\\\ + print(string.getExtension(fs.getName(path)) or \\\"none\\\")\\\ + term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ + term.setCursorPos(2,8)\\\ + print(\\\"Actions\\\")\\\ + term.setTextColor(colors.gray)\\\ + term.setCursorPos(2,10)\\\ + print(\\\"Run with arguments\\\")\\\ + term.setCursorPos(2,11)\\\ + print(\\\"Edit\\\")\\\ + term.setCursorPos(2,12)\\\ + print(\\\"Rename\\\")\\\ + term.setCursorPos(2,13)\\\ + print(\\\"Delete\\\")\\\ + term.setTextColor(sPhone.theme[\\\"text\\\"])\\\ + local _,_,x,y = os.pullEvent(\\\"mouse_click\\\")\\\ + if y == 1 and x == w then\\\ + break\\\ + elseif y == 10 then\\\ + term.setCursorPos(2,h-1)\\\ + write(\\\"Args: \\\")\\\ + term.setTextColor(colors.gray)\\\ + shell.run(path..\\\" \\\"..read())\\\ + elseif y == 11 then\\\ + shell.run(\\\"edit\\\",path)\\\ + elseif y == 12 then\\\ + term.setCursorPos(2,h-1)\\\ + write(\\\"Rename: \\\")\\\ + term.setTextColor(colors.gray)\\\ + local oldPath = path\\\ + path = fs.getDir(path)..\\\"/\\\"..read()\\\ + fs.move(oldPath,path)\\\ + elseif y == 13 then\\\ + fs.delete(path)\\\ + break\\\ + end\\\ + end\\\ + end\\\ + dir = fs.getDir(path)\\\ +end\\\ +\\\ +return true\",\ }", config = "{\ type = \"app\",\ main = \"explorer.lua\",\ name = \"File Explorer\",\ - version = 1,\ id = \"sphone.explorer\",\ author = \"Sertex\",\ hidden = true,\ + version = 1,\ }", -} +} \ No newline at end of file diff --git a/src/apps/spks/gps.spk b/src/apps/spks/gps.spk index 56a6a1e..b53e6dc 100644 --- a/src/apps/spks/gps.spk +++ b/src/apps/spks/gps.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -13,15 +13,16 @@ if tonumber(x) then\\\ else\\\ sPhone.winOk(\\\"X Y Z\\\",\\\"? ? ?\\\")\\\ end\\\ -\",\ +\\\ +return true\",\ }", config = "{\ type = \"app\",\ name = \"GPS\",\ version = 1,\ - main = \"gps.lua\",\ id = \"sphone.gps\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + main = \"gps.lua\",\ }", } \ No newline at end of file diff --git a/src/apps/spks/home.spk b/src/apps/spks/home.spk index 85bd2e2..0d13330 100644 --- a/src/apps/spks/home.spk +++ b/src/apps/spks/home.spk @@ -1,128 +1,168 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { files = "{\ - [ \"home.lua\" ] = \"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\\\ + [ \"home.lua\" ] = \"local currentTime\\\ \\\ - 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)\\\ - end\\\ - local function footerMenu()\\\ - sPhone.isFooterMenuOpen = true\\\ - function redraw()\\\ - drawHome()\\\ - 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\\\ - while true do\\\ - term.redirect(sPhone.mainTerm)\\\ - drawHome()\\\ - redraw()\\\ - 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\\\ - sPhone.launch(\\\"sphone.settings\\\")\\\ - sPhone.inHome = true\\\ - drawHome()\\\ - end\\\ - elseif y == 1 then\\\ - if x < 26 and x > 22 then\\\ - sPhone.isFooterMenuOpen = false\\\ - return\\\ - end\\\ - end\\\ - end\\\ - end\\\ - local function buttonHomeLoop()\\\ - while true do\\\ - drawHome()\\\ - term.setCursorBlink(false)\\\ - local autoLockTimer = os.startTimer(10)\\\ - local id = visum.buttons(buttonsInHome)\\\ +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\\\ \\\ - if id == \\\"sphone.header\\\" then\\\ - footerMenu()\\\ - elseif id == \\\"sphone.lock\\\" then\\\ - sPhone.inHome = false\\\ - sPhone.login()\\\ - sPhone.inHome = true\\\ - else\\\ - sPhone.inHome = false\\\ - os.pullEvent = os.oldPullEvent\\\ - sPhone.launch(id)\\\ - os.pullEvent = os.pullEventRaw\\\ - sPhone.inHome = true\\\ - end\\\ - end\\\ - \\\ - sPhone.inHome = false\\\ - \\\ - end\\\ - \\\ - local function updateClock()\\\ - while true do\\\ - if sPhone.inHome then\\\ - term.setCursorPos(1,1)\\\ - term.setBackgroundColor(sPhone.theme[\\\"header\\\"])\\\ - term.setTextColor(sPhone.theme[\\\"headerText\\\"])\\\ - term.setCursorPos(1,1)\\\ - write(\\\" \\\")\\\ - term.setCursorPos(1,1)\\\ - write(\\\" \\\"..textutils.formatTime(os.time(), not config.read(\\\"/.sPhone/config/sPhone\\\",\\\"format12time\\\")))\\\ - end\\\ - sleep(0)\\\ - end\\\ - end\\\ - \\\ - parallel.waitForAll(buttonHomeLoop, updateClock)\\\ -\",\ + 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\",\ - version = 1,\ id = \"sphone.home\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + version = 1,\ }", -} +} \ No newline at end of file diff --git a/src/apps/spks/info.spk b/src/apps/spks/info.spk index f1ac0bb..5c6bea5 100644 --- a/src/apps/spks/info.spk +++ b/src/apps/spks/info.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -29,18 +29,17 @@ while true do\\\ local w, h = term.getSize()\\\ local _, _, x, y = os.pullEvent(\\\"mouse_click\\\")\\\ if y == 1 and x == w then\\\ - return\\\ + return true\\\ end\\\ -end\\\ -\",\ +end\",\ }", config = "{\ type = \"system\",\ name = \"Info\",\ main = \"info.lua\",\ - version = 1,\ id = \"sphone.info\",\ author = \"Sertex\",\ hidden = true,\ + version = 1,\ }", -} +} \ No newline at end of file diff --git a/src/apps/spks/settings.spk b/src/apps/spks/settings.spk index b8ca39f..2937b3c 100644 --- a/src/apps/spks/settings.spk +++ b/src/apps/spks/settings.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -239,6 +239,7 @@ local function editTheme()\\\ \\\"Background Color\\\",\\\ \\\"Window Options\\\",\\\ \\\"Login Options\\\",\\\ + \\\"\\\",\\\ \\\"Save\\\",\\\ \\\"Load\\\",\\\ \\\"Reset\\\",\\\ @@ -307,7 +308,7 @@ local function editTheme()\\\ sPhone.applyTheme(\\\"lock.error\\\", sPhone.colorPicker(\\\"Error\\\",sPhone.getTheme(\\\"lock.error\\\")))\\\ end\\\ end\\\ - elseif id == 9 then\\\ + elseif id == 10 then\\\ local saveTheme\\\ sPhone.header(sPhone.user)\\\ term.setCursorPos(w,1)\\\ @@ -334,7 +335,7 @@ local function editTheme()\\\ end\\\ fs.copy(\\\"/.sPhone/config/theme\\\", saveTheme)\\\ sPhone.winOk(\\\"Theme saved!\\\")\\\ - elseif id == 10 then\\\ + elseif id == 11 then\\\ local loadTheme = sPhone.list()\\\ if loadTheme then\\\ if fs.exists(loadTheme) and not fs.isDir(loadTheme) then\\\ @@ -349,7 +350,7 @@ local function editTheme()\\\ sPhone.winOk(\\\"Theme not found!\\\")\\\ end\\\ end\\\ - elseif id == 11 then\\\ + elseif id == 12 then\\\ fs.delete(\\\"/.sPhone/config/theme\\\")\\\ sPhone.theme = sPhone.defaultTheme\\\ sPhone.winOk(\\\"Removed Theme\\\")\\\ @@ -409,8 +410,8 @@ while true do\\\ end\\\ local name, id = sPhone.menu(menu, \\\"Settings\\\",\\\"X\\\")\\\ if id == 0 then\\\ - task.kill(temp.get(\\\"homePID\\\"))\\\ - return\\\ + --task.kill(temp.get(\\\"homePID\\\"))\\\ + return true\\\ elseif id == 1 then\\\ setfenv(loadstring(http.get(\\\"https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua\\\").readAll()),getfenv())()\\\ elseif id == 2 then\\\ @@ -428,16 +429,15 @@ while true do\\\ elseif id == 8 then\\\ config.write(\\\"/.sPhone/config/sPhone\\\",\\\"showUpdate\\\", not config.read(\\\"/.sPhone/config/sPhone\\\",\\\"showUpdate\\\"))\\\ end\\\ -end\\\ -\",\ +end\",\ }", config = "{\ type = \"system\",\ name = \"Settings\",\ main = \"settings.lua\",\ - version = 1,\ id = \"sphone.settings\",\ author = \"Sertex\",\ hidden = true,\ + version = 1,\ }", -} +} \ No newline at end of file diff --git a/src/apps/spks/shell.spk b/src/apps/spks/shell.spk index 5c66024..389f526 100644 --- a/src/apps/spks/shell.spk +++ b/src/apps/spks/shell.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -9,15 +9,16 @@ term.setTextColor(colors.white)\\\ term.clear()\\\ term.setCursorPos(1,1)\\\ shell.run(\\\"/rom/programs/shell\\\")\\\ -\",\ +\\\ +return true\",\ }", config = "{\ type = \"app\",\ name = \"Shell\",\ version = 1,\ - main = \"shell.lua\",\ id = \"sphone.shell\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + main = \"shell.lua\",\ }", } \ No newline at end of file diff --git a/src/apps/spks/store.spk b/src/apps/spks/store.spk index 0baaf23..c7c6b3f 100644 --- a/src/apps/spks/store.spk +++ b/src/apps/spks/store.spk @@ -1,5 +1,5 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { @@ -69,7 +69,7 @@ while true do\\\ })\\\ \\\ if not path then\\\ - return\\\ + return true\\\ end\\\ \\\ local data = http.get(\\\"https://raw.github.com/SertexTeam/sPhone-Store/master/apps/\\\"..path).readAll()\\\ @@ -132,16 +132,15 @@ while true do\\\ \\\ \\\ \\\ - end\\\ -\",\ + end\",\ }", config = "{\ type = \"app\",\ name = \"Store\",\ version = 1,\ - main = \"store.lua\",\ id = \"sphone.store\",\ author = \"Sertex\",\ hidden = true,\ + main = \"store.lua\",\ }", -} +} \ No newline at end of file diff --git a/src/apps/spks/themes.spk b/src/apps/spks/themes.spk index b9daf2a..98fbc07 100644 --- a/src/apps/spks/themes.spk +++ b/src/apps/spks/themes.spk @@ -1,50 +1,51 @@ -- --- sPhone Application Package +-- Sertex Application Package -- Built with SPK builder 1.2 -- { files = "{\ - [ \"themes.lua\" ] = \"if not sPhone then\\r\\\ - printError(\\\"sPhone must be installed and loaded before running this program\\\")\\r\\\ - return\\r\\\ -end\\r\\\ -\\r\\\ -\\r\\\ -print(\\\"Downloading theme list\\\")\\r\\\ -local url = \\\"https://raw.github.com/Ale32bit/sPhone-Mods/master/themes.lua\\\"\\r\\\ -\\r\\\ -local ht = http.get(url)\\r\\\ -local themesRaw = ht.readAll()\\r\\\ -local themes = textutils.unserialize(themesRaw)\\r\\\ -ht.close()\\r\\\ -\\r\\\ -local li = {}\\r\\\ -for k,v in pairs(themes) do\\r\\\ - table.insert(li,k)\\r\\\ -end\\r\\\ -while true do\\r\\\ - local g, c = sPhone.menu(li,\\\" Themes\\\",\\\"X\\\")\\r\\\ - if c == 0 then\\r\\\ - return\\r\\\ - elseif c > #li then\\r\\\ - \\r\\\ - else\\r\\\ - for k,v in pairs(themes[g]) do\\r\\\ - sPhone.applyTheme(k,v)\\r\\\ - end\\r\\\ - sPhone.winOk(\\\"Theme applied\\\")\\r\\\ - break\\r\\\ - end\\r\\\ -end\\r\\\ -\",\ + [ \"themes.lua\" ] = \"if not sPhone then\\\ + printError(\\\"sPhone must be installed and loaded before running this program\\\")\\\ + return\\\ +end\\\ +\\\ +\\\ +print(\\\"Downloading theme list\\\")\\\ +local url = \\\"https://raw.github.com/Ale32bit/sPhone-Mods/master/themes.lua\\\"\\\ +\\\ +local ht = http.get(url)\\\ +local themesRaw = ht.readAll()\\\ +local themes = textutils.unserialize(themesRaw)\\\ +ht.close()\\\ +\\\ +local li = {}\\\ +for k,v in pairs(themes) do\\\ + table.insert(li,k)\\\ +end\\\ +while true do\\\ + local g, c = sPhone.menu(li,\\\" Themes\\\",\\\"X\\\")\\\ + if c == 0 then\\\ + return\\\ + elseif c > #li then\\\ + \\\ + else\\\ + for k,v in pairs(themes[g]) do\\\ + sPhone.applyTheme(k,v)\\\ + end\\\ + sPhone.winOk(\\\"Theme applied\\\")\\\ + break\\\ + end\\\ +end\\\ +\\\ +return true\",\ }", config = "{\ type = \"app\",\ name = \"Theme List\",\ version = 1,\ - main = \"themes.lua\",\ id = \"sphone.themes\",\ - author = \"BeaconNet\",\ + author = \"Sertex\",\ hidden = true,\ + main = \"themes.lua\",\ }", } \ No newline at end of file