package manager improvements

This commit is contained in:
kepler155c@gmail.com
2019-07-03 10:44:30 -04:00
parent 9456d31881
commit 0b222207ba
6 changed files with 53 additions and 18 deletions

View File

@@ -33,6 +33,12 @@ local page = UI.Page {
operationText = 'Remove',
help = 'Remove',
},
updateall = UI.Button {
ex = -2, y = -3, width = 12,
text = 'Update All',
event = 'updateall',
help = 'Update all installed packages',
},
description = UI.TextArea {
x = 16, y = 3, ey = -5,
marginRight = 0, marginLeft = 0,
@@ -138,6 +144,13 @@ function page:eventHandler(event)
self.description:draw()
self:updateSelection(event.selected)
elseif event.type == 'updateall' then
self.operation = 'updateall'
self.action.button.text = ' Begin '
self.action.button.event = 'begin'
self.action.titleBar.title = 'Update All'
self.action:show()
elseif event.type == 'action' then
local selected = self.grid:getSelected()
if selected then
@@ -153,11 +166,16 @@ function page:eventHandler(event)
self.action:hide()
elseif event.type == 'begin' then
local selected = self.grid:getSelected()
self:run(self.operation, selected.name)
selected.installed = Packages:isInstalled(selected.name)
if self.operation == 'updateall' then
self:run(self.operation, '')
else
local selected = self.grid:getSelected()
self:run(self.operation, selected.name)
selected.installed = Packages:isInstalled(selected.name)
self:updateSelection(selected)
end
self:updateSelection(selected)
self.action.button.text = ' Done '
self.action.button.event = 'hide-action'
self.action.button:draw()

View File

@@ -25,7 +25,10 @@ Anavrins: Encryption/security/custom apps
Community: Several selected applications
hugeblank: Startup screen improvements
LDDestroier: Art design + custom apps
Lemmmy: Application improvements]]
Lemmmy: Application improvements
%sContribute at:%s
https://github.com/kepler155c/opus]]
local page = UI.Page {
wizard = UI.Wizard {
@@ -108,7 +111,7 @@ local page = UI.Page {
textColor = colors.yellow,
inactive = true,
x = 3, ex = -3, y = 2, ey = -2,
value = string.format(contributorsIntro, Ansi.white),
value = string.format(contributorsIntro, Ansi.white, Ansi.yellow, Ansi.white),
},
},
},

View File

@@ -35,13 +35,15 @@ local function progress(max)
end
end
local function install(name, isUpdate)
local function install(name, isUpdate, ignoreDeps)
local manifest = Packages:downloadManifest(name) or error('Invalid package')
if manifest.required then
for _, v in pairs(manifest.required) do
if isUpdate or not Packages:isInstalled(v) then
install(v, isUpdate)
if not ignoreDeps then
if manifest.required then
for _, v in pairs(manifest.required) do
if isUpdate or not Packages:isInstalled(v) then
install(v, isUpdate)
end
end
end
end
@@ -89,6 +91,21 @@ if action == 'install' then
return
end
if action == 'refresh' then
print('Downloading...')
Packages:downloadList()
print('refresh complete')
return
end
if action == 'updateall' then
for name in pairs(Packages:installed()) do
install(name, true, true)
end
print('updateall complete')
return
end
if action == 'update' then
local name = args[1] or Syntax('Invalid package')
if not Packages:isInstalled(name) then