milo: text scaling + manipulator fixes
This commit is contained in:
@@ -21,6 +21,11 @@ function Storage:init(nodes)
|
|||||||
|
|
||||||
Event.on({ 'device_attach', 'device_detach' }, function(e, dev)
|
Event.on({ 'device_attach', 'device_detach' }, function(e, dev)
|
||||||
_G._debug('%s: %s', e, tostring(dev))
|
_G._debug('%s: %s', e, tostring(dev))
|
||||||
|
if e == 'device_detach' then
|
||||||
|
if self.nodes[dev] then
|
||||||
|
self.nodes[dev].adapter = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
self:initStorage()
|
self:initStorage()
|
||||||
end)
|
end)
|
||||||
Event.onInterval(15, function()
|
Event.onInterval(15, function()
|
||||||
|
|||||||
@@ -11,22 +11,42 @@ local device = _G.device
|
|||||||
--[[ Configuration Page ]]--
|
--[[ Configuration Page ]]--
|
||||||
local template =
|
local template =
|
||||||
[[%sDisplays the amount of items entering or leaving storage.%s
|
[[%sDisplays the amount of items entering or leaving storage.%s
|
||||||
|
|
||||||
Right-clicking on the activity monitor will reset the totals.]]
|
Right-clicking on the activity monitor will reset the totals.]]
|
||||||
|
|
||||||
local activityWizardPage = UI.Window {
|
local wizardPage = UI.Window {
|
||||||
title = 'Activity Monitor',
|
title = 'Activity Monitor',
|
||||||
index = 2,
|
index = 2,
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
[1] = UI.TextArea {
|
[1] = UI.TextArea {
|
||||||
x = 2, ex = -2, y = 2, ey = -2,
|
x = 2, ex = -2, y = 2, ey = 6,
|
||||||
marginRight = 0,
|
marginRight = 0,
|
||||||
value = string.format(template, Ansi.yellow, Ansi.reset),
|
value = string.format(template, Ansi.yellow, Ansi.reset),
|
||||||
},
|
},
|
||||||
timestamp = os.clock(),
|
form = UI.Form {
|
||||||
|
x = 2, ex = -2, y = 7, ey = -2,
|
||||||
|
manualControls = true,
|
||||||
|
[1] = UI.Chooser {
|
||||||
|
width = 9,
|
||||||
|
formLabel = 'Font Size', formKey = 'textScale',
|
||||||
|
nochoice = 'Small',
|
||||||
|
choices = {
|
||||||
|
{ name = 'Small', value = .5, help = '(requires restart)', },
|
||||||
|
{ name = 'Large', value = 1, help = '(requires restart)', },
|
||||||
|
},
|
||||||
|
help = 'Adjust text scaling (requires restart)',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function activityWizardPage:isValidType(node)
|
function wizardPage:setNode(node)
|
||||||
|
self.form:setValues(node)
|
||||||
|
end
|
||||||
|
|
||||||
|
function wizardPage:validate()
|
||||||
|
return self.form:save()
|
||||||
|
end
|
||||||
|
|
||||||
|
function wizardPage:isValidType(node)
|
||||||
local m = device[node.name]
|
local m = device[node.name]
|
||||||
return m and m.type == 'monitor' and {
|
return m and m.type == 'monitor' and {
|
||||||
name = 'Activity Monitor',
|
name = 'Activity Monitor',
|
||||||
@@ -36,18 +56,18 @@ function activityWizardPage:isValidType(node)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function activityWizardPage:isValidFor(node)
|
function wizardPage:isValidFor(node)
|
||||||
return node.mtype == 'activity'
|
return node.mtype == 'activity'
|
||||||
end
|
end
|
||||||
|
|
||||||
UI:getPage('nodeWizard').wizard:add({ activity = activityWizardPage })
|
UI:getPage('nodeWizard').wizard:add({ activity = wizardPage })
|
||||||
|
|
||||||
--[[ Display ]]--
|
--[[ Display ]]--
|
||||||
local function createPage(node)
|
local function createPage(node)
|
||||||
local page = UI.Window {
|
local page = UI.Window {
|
||||||
parent = UI.Device {
|
parent = UI.Device {
|
||||||
device = node.adapter,
|
device = node.adapter,
|
||||||
textScale = .5,
|
textScale = node.textScale or .5,
|
||||||
},
|
},
|
||||||
grid = UI.Grid {
|
grid = UI.Grid {
|
||||||
columns = {
|
columns = {
|
||||||
@@ -58,6 +78,7 @@ local function createPage(node)
|
|||||||
},
|
},
|
||||||
sortColumn = 'displayName',
|
sortColumn = 'displayName',
|
||||||
},
|
},
|
||||||
|
timestamp = os.clock(),
|
||||||
}
|
}
|
||||||
|
|
||||||
function page.grid:getRowTextColor(row, selected)
|
function page.grid:getRowTextColor(row, selected)
|
||||||
|
|||||||
@@ -15,13 +15,35 @@ local wizardPage = UI.Window {
|
|||||||
index = 2,
|
index = 2,
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
[1] = UI.TextArea {
|
[1] = UI.TextArea {
|
||||||
x = 2, ex = -2, y = 2, ey = -2,
|
x = 2, ex = -2, y = 2, ey = 3,
|
||||||
marginRight = 0,
|
marginRight = 0,
|
||||||
textColor = colors.yellow,
|
textColor = colors.yellow,
|
||||||
value = 'Displays the crafting progress.'
|
value = 'Displays the crafting progress.'
|
||||||
},
|
},
|
||||||
|
form = UI.Form {
|
||||||
|
x = 2, ex = -2, y = 4, ey = -2,
|
||||||
|
manualControls = true,
|
||||||
|
[1] = UI.Chooser {
|
||||||
|
width = 9,
|
||||||
|
formLabel = 'Font Size', formKey = 'textScale',
|
||||||
|
nochoice = 'Small',
|
||||||
|
choices = {
|
||||||
|
{ name = 'Small', value = .5, help = '(requires restart)', },
|
||||||
|
{ name = 'Large', value = 1, help = '(requires restart)', },
|
||||||
|
},
|
||||||
|
help = 'Adjust text scaling (requires restart)',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wizardPage:setNode(node)
|
||||||
|
self.form:setValues(node)
|
||||||
|
end
|
||||||
|
|
||||||
|
function wizardPage:validate()
|
||||||
|
return self.form:save()
|
||||||
|
end
|
||||||
|
|
||||||
function wizardPage:isValidType(node)
|
function wizardPage:isValidType(node)
|
||||||
local m = device[node.name]
|
local m = device[node.name]
|
||||||
return m and m.type == 'monitor' and {
|
return m and m.type == 'monitor' and {
|
||||||
@@ -44,7 +66,7 @@ local function createPage(node)
|
|||||||
local page = UI.Page {
|
local page = UI.Page {
|
||||||
parent = UI.Device {
|
parent = UI.Device {
|
||||||
device = node.adapter,
|
device = node.adapter,
|
||||||
textScale = .5,
|
textScale = node.textScale or .5,
|
||||||
},
|
},
|
||||||
grid = UI.Grid {
|
grid = UI.Grid {
|
||||||
sortColumn = 'index',
|
sortColumn = 'index',
|
||||||
|
|||||||
Reference in New Issue
Block a user