pcall driver init

This commit is contained in:
kepler155c@gmail.com 2018-12-05 21:21:30 -05:00
parent 72142e12cc
commit 6674c715e0
2 changed files with 9 additions and 5 deletions

View File

@ -43,14 +43,14 @@ local page = UI.Page {
{ text = 'Establish', event = 'trust' },
{ text = 'Remove', event = 'untrust' },
} },
{ text = 'Help', event = 'help' },
{ text = 'Help', event = 'help', noCheck = true },
{
text = '\206',
x = -3,
dropdown = {
{ text = 'Show all', event = 'show_all' },
{ text = 'Show all', event = 'show_all', noCheck = true },
UI.MenuBar.spacer,
{ text = 'Show trusted', event = 'show_trusted' },
{ text = 'Show trusted', event = 'show_trusted', noCheck = true },
},
},
},
@ -159,6 +159,7 @@ This only needs to be done once.
elseif event.type == 'show_all' then
config.showTrusted = false
self.grid:setValues(network)
Config.update('network', config)
elseif event.type == 'show_trusted' then
@ -177,7 +178,7 @@ function page.menuBar:getActive(menuItem)
local trustList = Util.readTable('usr/.known_hosts') or { }
return t and trustList[t.id]
end
return not not t
return menuItem.noCheck or not not t
end
function page.grid:getRowTextColor(row, selected)

View File

@ -173,6 +173,9 @@ end
-- initialize drivers
for _,v in pairs(device) do
if drivers[v.type] then
drivers[v.type](v)
local s, m = pcall(drivers[v.type], v)
if not s and m then
_G.printError(m)
end
end
end