1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-15 21:24:49 +00:00
opus/sys/apps/system/kiosk.lua

58 lines
1.4 KiB
Lua
Raw Normal View History

local UI = require('opus.ui')
2019-02-19 13:55:11 +00:00
local colors = _G.colors
2019-02-19 13:55:11 +00:00
local peripheral = _G.peripheral
local settings = _G.settings
return peripheral.find('monitor') and UI.Tab {
2020-04-27 01:39:58 +00:00
title = 'Kiosk',
2019-02-19 13:55:11 +00:00
description = 'Kiosk options',
form = UI.Form {
x = 2, y = 2, ex = -2, ey = 5,
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
},
},
labelText = UI.TextArea {
x = 2, ex = -2, y = 7, ey = -2,
textColor = colors.yellow,
backgroundColor = colors.black,
value = 'Settings apply to kiosk mode selected during startup'
},
enable = function(self)
local choices = { }
peripheral.find('monitor', function(side)
table.insert(choices, { name = side, value = side })
end)
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,
eventHandler = function(self, event)
if event.type == 'choice_change' then
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
settings.save('.settings')
2019-02-20 06:24:37 +00:00
end
2019-02-19 13:55:11 +00:00
end
}