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

View File

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

View File

@ -11,6 +11,9 @@
[ "90ef98d4b6fd15466f0a1f212ec1db8d9ebe018c" ] = {
title = "Turtles",
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",
},
[ "81c0d915fa6d82fd30661c5e66e204cea52bb2b5" ] = {
@ -214,4 +217,4 @@
\0304 \030f \030 ",
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