custom help files + redo System UI

This commit is contained in:
kepler155c@gmail.com
2018-12-22 22:11:16 -05:00
parent 3de03bef22
commit 26564cbcc1
15 changed files with 541 additions and 292 deletions

50
sys/apps/system/path.lua Normal file
View File

@@ -0,0 +1,50 @@
local Config = require('config')
local UI = require('ui')
local Util = require('util')
local shell = _ENV.shell
local pathTab = UI.Window {
tabTitle = 'Path',
description = 'Set the shell path',
tabClose = true,
entry = UI.TextEntry {
x = 2, y = 2, ex = -2,
limit = 256,
value = shell.path(),
shadowText = 'enter system path',
accelerators = {
enter = 'update_path',
},
},
grid = UI.Grid {
y = 4,
disableHeader = true,
columns = { { key = 'value' } },
autospace = true,
},
}
function pathTab.grid:draw()
self.values = { }
local env = Config.load('shell')
for _,v in ipairs(Util.split(env.path, '(.-):')) do
table.insert(self.values, { value = v })
end
self:update()
UI.Grid.draw(self)
end
function pathTab:eventHandler(event)
if event.type == 'update_path' then
local env = Config.load('shell')
env.path = self.entry.value
self.grid:setIndex(self.grid:getIndex())
self.grid:draw()
Config.update('shell', env)
self:emit({ type = 'success_message', message = 'reboot to take effect' })
return true
end
end
return pathTab