This commit is contained in:
kepler155c
2018-10-24 06:51:05 -04:00
parent 9664077f2e
commit e45aad7ed0
8 changed files with 122 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
local Config = require('config')
local Event = require('event')
local itemDB = require('itemDB')
local Milo = require('milo')
local UI = require('ui')
@@ -29,9 +30,35 @@ local machinesPage = UI.Page {
},
}
function machinesPage:getList()
-- TODO: remove dedupe naming in perf code ?
for _, v in pairs(device) do
if v.pullItems then
if not context.config.remoteDefaults[v.name] then
context.config.remoteDefaults[v.name] = {
name = v.name,
mtype = 'ignore',
}
end
end
end
end
function machinesPage:enable()
self:getList()
self.grid:update()
UI.Page.enable(self)
self.handler = Event.on({ 'device_attach', 'device_detach'}, function()
self:getList()
self.grid:update()
self.grid:draw()
self.grid:sync()
end)
end
function machinesPage:disable()
UI.Page.disable(self)
Event.off(self.handler)
end
function machinesPage.grid:getDisplayValues(row)
@@ -41,6 +68,9 @@ function machinesPage.grid:getDisplayValues(row)
end
function machinesPage.grid:getRowTextColor(row, selected)
if not device[row.name] then
return colors.red
end
if row.mtype == 'ignore' then
return colors.lightGray
end
@@ -205,9 +235,6 @@ function machineWizard:eventHandler(event)
UI:setPreviousPage()
elseif event.type == 'collapse' then
self.items:hide()
elseif event.type == 'enable_view' then
local current = event.next or event.prev
self.titleBar.title = current.title or 'Machine'