1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-14 09:26:54 +00:00

url apps, cleanup

This commit is contained in:
kepler155c@gmail.com 2017-05-31 07:06:30 -04:00
parent 10cd1509fb
commit 16ac873ace
4 changed files with 23 additions and 22 deletions

View File

@ -34,17 +34,6 @@ for n = 0, 15 do
mapGrayToPaint[2 ^ n] = mapColorToPaint[gs] mapGrayToPaint[2 ^ n] = mapColorToPaint[gs]
end end
local function colorToGrayScale(c)
return mapColorToGray[c]
end
local function colorToPaintColor(c, isColor)
if isColor then
return mapColorToPaint[c]
end
return mapGrayToPaint[c]
end
local function safeValue(v) local function safeValue(v)
local t = type(v) local t = type(v)
if t == 'string' or t == 'number' then if t == 'string' or t == 'number' then
@ -900,6 +889,13 @@ function Canvas:init(args)
end end
end end
function Canvas:colorToPaintColor(c)
if self.isColor then
return mapColorToPaint[c]
end
return mapGrayToPaint[c]
end
function Canvas:copy() function Canvas:copy()
local b = Canvas({ x = self.x, y = self.y, ex = self.ex, ey = self.ey }) local b = Canvas({ x = self.x, y = self.y, ex = self.ex, ey = self.ey })
for i = 1, self.ey - self.y + 1 do for i = 1, self.ey - self.y + 1 do
@ -918,8 +914,7 @@ function Canvas:addLayer(layer, bg, fg)
ey = layer.y + layer.height - 1, ey = layer.y + layer.height - 1,
isColor = self.isColor, isColor = self.isColor,
}) })
canvas:clear(colorToPaintColor(bg, self.isColor), canvas:clear(bg, fg)
colorToPaintColor(fg, self.isColor))
canvas.parent = self canvas.parent = self
if not self.layers then if not self.layers then
@ -978,10 +973,10 @@ function Canvas:write(x, y, text, bg, tc)
line.dirty = true line.dirty = true
line.text = replace(line.text, x, text, width) line.text = replace(line.text, x, text, width)
if bg then if bg then
line.bg = fill(line.bg, x, colorToPaintColor(bg, self.isColor), width) line.bg = fill(line.bg, x, self:colorToPaintColor(bg), width)
end end
if tc then if tc then
line.fg = fill(line.fg, x, colorToPaintColor(tc, self.isColor), width) line.fg = fill(line.fg, x, self:colorToPaintColor(tc), width)
end end
end end
end end
@ -1001,8 +996,8 @@ end
function Canvas:clear(bg, fg) function Canvas:clear(bg, fg)
local width = self.ex - self.x + 1 local width = self.ex - self.x + 1
local text = string.rep(' ', width) local text = string.rep(' ', width)
fg = string.rep(fg, width) fg = string.rep(self:colorToPaintColor(fg), width)
bg = string.rep(bg, width) bg = string.rep(self:colorToPaintColor(bg), width)
for i = 1, self.ey - self.y + 1 do for i = 1, self.ey - self.y + 1 do
self:writeLine(i, text, fg, bg) self:writeLine(i, text, fg, bg)
end end
@ -1209,8 +1204,7 @@ function UI.Device:init(args)
x = 1, y = 1, ex = self.width, ey = self.height, x = 1, y = 1, ex = self.width, ey = self.height,
isColor = self.isColor, isColor = self.isColor,
}) })
self.canvas:clear(colorToPaintColor(self.backgroundColor, self.isColor), self.canvas:clear(self.backgroundColor, self.textColor)
colorToPaintColor(self.textColor, self.isColor))
end end
function UI.Device:resize() function UI.Device:resize()
@ -2339,7 +2333,7 @@ function UI.Tabs:init(args)
for k,child in pairs(defaults) do for k,child in pairs(defaults) do
if type(child) == 'table' and child.UIElement then if type(child) == 'table' and child.UIElement then
table.insert(buttons, { table.insert(buttons, {
text = child.tabTitle, event = 'tab_select', text = child.tabTitle or '', event = 'tab_select',
}) })
end end
end end

View File

@ -15,7 +15,7 @@ if not s then
end end
-- process fstab -- process fstab
local mounts = Util.readFile('usr/config/fstab') local mounts = Util.readFile('sys/etc/fstab')
if mounts then if mounts then
for _,l in ipairs(Util.split(mounts)) do for _,l in ipairs(Util.split(mounts)) do
if l:sub(1, 1) ~= '#' then if l:sub(1, 1) ~= '#' then

View File

@ -11,6 +11,9 @@
[ "90ef98d4b6fd15466f0a1f212ec1db8d9ebe018c" ] = { [ "90ef98d4b6fd15466f0a1f212ec1db8d9ebe018c" ] = {
title = "Turtles", title = "Turtles",
category = "Apps", category = "Apps",
icon = " \0305 \030c \0305 \030 \
\030d \030c \0305 \030c \0308 \030d\031f\"\
\0308\031f.\030 \031 \0308\031f.\030 \031 ",
run = "Turtles.lua", run = "Turtles.lua",
}, },
[ "81c0d915fa6d82fd30661c5e66e204cea52bb2b5" ] = { [ "81c0d915fa6d82fd30661c5e66e204cea52bb2b5" ] = {
@ -214,4 +217,4 @@
\0304 \030f \030 ", \0304 \030f \030 ",
run = "shell", run = "shell",
}, },
} }

4
sys/etc/fstab Normal file
View File

@ -0,0 +1,4 @@
sys/apps/gpsdeploy urlfs http://pastebin.com/raw/qLthLak5
sys/apps/Minesweeper urlfs http://pastebin.com/raw/nsKrHTbN
sys/apps/Micropaint urlfs http://pastebin.com/raw/tMRzJXx2
sys/apps/sketch urlfs http://pastebin.com/raw/Mm5hd97E