1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-27 09:00:41 +00:00

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 = 'Establish', event = 'trust' },
{ text = 'Remove', event = 'untrust' }, { text = 'Remove', event = 'untrust' },
} }, } },
{ text = 'Help', event = 'help' }, { text = 'Help', event = 'help', noCheck = true },
{ {
text = '\206', text = '\206',
x = -3, x = -3,
dropdown = { dropdown = {
{ text = 'Show all', event = 'show_all' }, { text = 'Show all', event = 'show_all', noCheck = true },
UI.MenuBar.spacer, 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 elseif event.type == 'show_all' then
config.showTrusted = false config.showTrusted = false
self.grid:setValues(network)
Config.update('network', config) Config.update('network', config)
elseif event.type == 'show_trusted' then elseif event.type == 'show_trusted' then
@ -177,7 +178,7 @@ function page.menuBar:getActive(menuItem)
local trustList = Util.readTable('usr/.known_hosts') or { } local trustList = Util.readTable('usr/.known_hosts') or { }
return t and trustList[t.id] return t and trustList[t.id]
end end
return not not t return menuItem.noCheck or not not t
end end
function page.grid:getRowTextColor(row, selected) function page.grid:getRowTextColor(row, selected)

View File

@ -173,6 +173,9 @@ end
-- initialize drivers -- initialize drivers
for _,v in pairs(device) do for _,v in pairs(device) do
if drivers[v.type] then 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
end end