1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-18 14:18:06 +00:00

shell cleanup

This commit is contained in:
kepler155c@gmail.com
2020-06-13 12:18:04 -06:00
parent 947f502c6d
commit b69dcdeffa
5 changed files with 164 additions and 217 deletions

View File

@@ -1,4 +1,5 @@
local Ansi = require('opus.ansi')
local Config = require('opus.config')
local Packages = require('opus.packages')
local UI = require('opus.ui')
local Util = require('opus.util')
@@ -8,9 +9,11 @@ local term = _G.term
UI:configure('PackageManager', ...)
local config = Config.load('package')
local page = UI.Page {
grid = UI.ScrollingGrid {
x = 2, ex = 14, y = 2, ey = -5,
x = 2, ex = 14, y = 2, ey = -6,
values = { },
columns = {
{ heading = 'Package', key = 'name' },
@@ -21,13 +24,13 @@ local page = UI.Page {
},
add = UI.Button {
x = 2, y = -3,
text = 'Install',
text = ' + ',
event = 'action',
help = 'Install or update',
},
remove = UI.Button {
x = 12, y = -3,
text = 'Remove ',
x = 8, y = -3,
text = ' - ',
event = 'action',
operation = 'uninstall',
operationText = 'Remove',
@@ -43,6 +46,14 @@ local page = UI.Page {
x = 16, y = 3, ey = -5,
marginRight = 2, marginLeft = 0,
},
UI.Checkbox {
x = 3, y = -5,
label = 'Compress',
textColor = 'yellow',
backgroundColor = 'primary',
value = config.compression,
help = 'Compress packages (experimental)',
},
action = UI.SlideOut {
titleBar = UI.TitleBar {
event = 'hide-action',
@@ -102,8 +113,6 @@ end
function page.action:show()
self.output.win:clear()
UI.SlideOut.show(self)
--self.output:draw()
--self.output.win.redraw()
end
function page:run(operation, name)
@@ -127,7 +136,6 @@ end
function page:updateSelection(selected)
self.add.operation = selected.installed and 'update' or 'install'
self.add.operationText = selected.installed and 'Update' or 'Install'
self.add.text = selected.installed and 'Update' or 'Install'
self.remove.inactive = not selected.installed
self.add:draw()
self.remove:draw()
@@ -146,6 +154,10 @@ function page:eventHandler(event)
self.description:draw()
self:updateSelection(event.selected)
elseif event.type == 'checkbox_change' then
config.compression = not config.compression
Config.update('package', config)
elseif event.type == 'updateall' then
self.operation = 'updateall'
self.action.button.text = ' Begin '