2019-02-19 13:55:11 +00:00
|
|
|
local UI = require('ui')
|
|
|
|
|
2019-02-26 23:03:09 +00:00
|
|
|
local colors = _G.colors
|
2019-02-19 13:55:11 +00:00
|
|
|
local peripheral = _G.peripheral
|
|
|
|
local settings = _G.settings
|
|
|
|
|
|
|
|
local tab = UI.Tab {
|
|
|
|
tabTitle = 'Kiosk',
|
|
|
|
description = 'Kiosk options',
|
|
|
|
form = UI.Form {
|
2019-02-26 23:03:09 +00:00
|
|
|
x = 2, ex = -2,
|
2019-02-19 13:55:11 +00:00
|
|
|
manualControls = true,
|
|
|
|
monitor = UI.Chooser {
|
|
|
|
formLabel = 'Monitor', formKey = 'monitor',
|
|
|
|
},
|
|
|
|
textScale = UI.Chooser {
|
2019-06-18 19:19:24 +00:00
|
|
|
formLabel = 'Font Size', formKey = 'textScale',
|
|
|
|
nochoice = 'Small',
|
|
|
|
choices = {
|
|
|
|
{ name = 'Small', value = '.5' },
|
|
|
|
{ name = 'Large', value = '1' },
|
|
|
|
},
|
|
|
|
help = 'Adjust text scaling',
|
2019-02-19 13:55:11 +00:00
|
|
|
},
|
2019-02-26 23:03:09 +00:00
|
|
|
labelText = UI.TextArea {
|
|
|
|
x = 2, ex = -2, y = 5,
|
|
|
|
textColor = colors.yellow,
|
|
|
|
value = 'Settings apply to kiosk mode selected during startup'
|
|
|
|
},
|
2019-02-19 13:55:11 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
function tab:enable()
|
|
|
|
local choices = { }
|
|
|
|
|
2019-03-12 03:48:22 +00:00
|
|
|
peripheral.find('monitor', function(side)
|
|
|
|
table.insert(choices, { name = side, value = side })
|
|
|
|
end)
|
2019-02-19 13:55:11 +00:00
|
|
|
|
|
|
|
self.form.monitor.choices = choices
|
|
|
|
self.form.monitor.value = settings.get('kiosk.monitor')
|
|
|
|
|
|
|
|
self.form.textScale.value = settings.get('kiosk.textscale')
|
|
|
|
|
|
|
|
UI.Tab.enable(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
function tab:eventHandler(event)
|
|
|
|
if event.type == 'choice_change' then
|
2019-02-20 06:24:37 +00:00
|
|
|
if self.form.monitor.value then
|
|
|
|
settings.set('kiosk.monitor', self.form.monitor.value)
|
|
|
|
end
|
|
|
|
if self.form.textScale.value then
|
|
|
|
settings.set('kiosk.textscale', self.form.textScale.value)
|
|
|
|
end
|
2019-02-19 13:55:11 +00:00
|
|
|
settings.save('.settings')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if peripheral.find('monitor') then
|
|
|
|
return tab
|
|
|
|
end
|