mirror of
https://github.com/kepler155c/opus
synced 2025-01-11 16:20:26 +00:00
web running os
This commit is contained in:
parent
76a3313654
commit
9e25c4ca0c
@ -55,15 +55,14 @@ local function unserialize( s )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sure(N,n)
|
|
||||||
if (l2-n)<1 then N="0" end
|
|
||||||
return N
|
|
||||||
end
|
|
||||||
|
|
||||||
local function splitnum(S)
|
local function splitnum(S)
|
||||||
local Out=""
|
local Out=""
|
||||||
for l1=1,#S,2 do
|
for l1=1,#S,2 do
|
||||||
local l2=(#S-l1)+1
|
local l2=(#S-l1)+1
|
||||||
|
local function sure(N,n)
|
||||||
|
if (l2-n)<1 then N="0" end
|
||||||
|
return N
|
||||||
|
end
|
||||||
local CNum=tonumber("0x"..sure(string.sub(S,l2-1,l2-1),1) .. sure(string.sub(S,l2,l2),0))
|
local CNum=tonumber("0x"..sure(string.sub(S,l2-1,l2-1),1) .. sure(string.sub(S,l2,l2),0))
|
||||||
Out=string.char(CNum)..Out
|
Out=string.char(CNum)..Out
|
||||||
end
|
end
|
||||||
|
@ -50,6 +50,9 @@ function page:eventHandler(event)
|
|||||||
end
|
end
|
||||||
self.menuBar:draw()
|
self.menuBar:draw()
|
||||||
|
|
||||||
|
elseif event.type == 'grid_select' then
|
||||||
|
multishell.openTab({ path = 'sys/apps/Lua.lua', args = { event.selected }, focused = true })
|
||||||
|
|
||||||
elseif event.type == 'reset' then
|
elseif event.type == 'reset' then
|
||||||
self.filtered = { }
|
self.filtered = { }
|
||||||
self.grid:setValues({ })
|
self.grid:setValues({ })
|
||||||
@ -78,12 +81,8 @@ function page:eventHandler(event)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function page.grid:draw()
|
function page.grid:getDisplayValues(row)
|
||||||
self:adjustWidth()
|
row = Util.shallowCopy(row)
|
||||||
UI.Grid.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function eventLoop()
|
|
||||||
|
|
||||||
local function tovalue(s)
|
local function tovalue(s)
|
||||||
if type(s) == 'table' then
|
if type(s) == 'table' then
|
||||||
@ -92,16 +91,30 @@ function eventLoop()
|
|||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for k,v in pairs(row) do
|
||||||
|
row[k] = tovalue(v)
|
||||||
|
end
|
||||||
|
|
||||||
|
return row
|
||||||
|
end
|
||||||
|
|
||||||
|
function page.grid:draw()
|
||||||
|
self:adjustWidth()
|
||||||
|
UI.Grid.draw(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
function eventLoop()
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
local e = { os.pullEvent() }
|
local e = { os.pullEvent() }
|
||||||
if not page.paused and not page.filtered[e[1]] then
|
if not page.paused and not page.filtered[e[1]] then
|
||||||
table.insert(page.grid.values, 1, {
|
table.insert(page.grid.values, 1, {
|
||||||
event = e[1],
|
event = e[1],
|
||||||
p1 = tovalue(e[2]),
|
p1 = e[2],
|
||||||
p2 = tovalue(e[3]),
|
p2 = e[3],
|
||||||
p3 = tovalue(e[4]),
|
p3 = e[4],
|
||||||
p4 = tovalue(e[5]),
|
p4 = e[5],
|
||||||
p5 = tovalue(e[6]),
|
p5 = e[6],
|
||||||
})
|
})
|
||||||
if #page.grid.values > page.grid.height - 1 then
|
if #page.grid.values > page.grid.height - 1 then
|
||||||
table.remove(page.grid.values, #page.grid.values)
|
table.remove(page.grid.values, #page.grid.values)
|
||||||
|
@ -35,6 +35,9 @@ local function loadApplications()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Util.each(applications, function(v, k) v.key = k end)
|
||||||
|
applications = Util.filter(applications, function(_, a) return not a.disabled end)
|
||||||
end
|
end
|
||||||
|
|
||||||
loadApplications()
|
loadApplications()
|
||||||
@ -318,8 +321,11 @@ function page:eventHandler(event)
|
|||||||
|
|
||||||
elseif event.type == 'delete' then
|
elseif event.type == 'delete' then
|
||||||
local focused = page:getFocused()
|
local focused = page:getFocused()
|
||||||
|
debug(focused.app)
|
||||||
if focused.app then
|
if focused.app then
|
||||||
fs.delete(focused.app.filename)
|
focused.app.disabled = true
|
||||||
|
local filename = focused.app.filename or fs.combine(REGISTRY_DIR, focused.app.key)
|
||||||
|
Util.writeTable(filename, focused.app)
|
||||||
loadApplications()
|
loadApplications()
|
||||||
page:refresh()
|
page:refresh()
|
||||||
page:draw()
|
page:draw()
|
||||||
@ -401,10 +407,11 @@ function editor.form.image:draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function editor:updateApplications(app)
|
function editor:updateApplications(app)
|
||||||
if not app.filename then
|
if not app.key then
|
||||||
app.filename = 'sys/apps/.overview/' .. app.title
|
app.key = SHA1.sha1(app.title)
|
||||||
end
|
end
|
||||||
Util.writeTable(app.filename, app)
|
local filename = app.filename or fs.combine(REGISTRY_DIR, app.key)
|
||||||
|
Util.writeTable(filename, app)
|
||||||
loadApplications()
|
loadApplications()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user