can now use named colors

This commit is contained in:
kepler155c@gmail.com
2020-04-21 22:32:53 -06:00
parent 949c485539
commit d17162b49d
14 changed files with 190 additions and 253 deletions

View File

@@ -63,8 +63,8 @@ local page = UI.Page {
x = 1, ex = -13,
limit = 50,
shadowText = 'filter',
backgroundColor = UI.colors.primary,
backgroundFocusColor = UI.colors.primary,
backgroundColor = 'primary',
backgroundFocusColor = 'primary',
accelerators = {
[ 'enter' ] = 'eject',
[ 'up' ] = 'grid_up',

View File

@@ -1,53 +0,0 @@
local class = require('opus.class')
local itemDB = require('core.itemDB')
local Mini = require('milo.miniAdapter')
local os = _G.os
local Adapter = class(Mini)
function Adapter:init(args)
Mini.init(self, args)
self._rawList = self.list
function self.list()
-- wait for up to 1 sec until any items that have been inserted
-- into interface are added to the system
for _ = 0, 20 do
if #self._rawList() == 0 then
break
end
os.sleep(0)
end
local list = { }
for _, v in pairs(self.listAvailableItems()) do
list[itemDB:makeKey(v)] = v
end
return list
end
function self.getItemMeta(key)
local item = self.findItem(itemDB:splitKey(key))
if item and item.getMetadata then
return item.getMetadata()
end
end
function self.pushItems(target, key, amount, slot)
local item = self.findItem(itemDB:splitKey(key))
if item and item.export then
return item.export(target, amount, slot)
end
return 0
end
function self.pullItems(target, key, amount, slot)
_G._syslog({target, key, amount, slot })
return 0
end
end
return Adapter

View File

@@ -54,8 +54,8 @@ local page = UI.Page {
limit = 50,
shadowText = 'filter',
shadowTextColor = colors.gray,
backgroundColor = UI.colors.primary,
backgroundFocusColor = UI.colors.primary,
backgroundColor = 'primary',
backgroundFocusColor = 'primary',
accelerators = {
[ 'enter' ] = 'eject',
[ 'up' ] = 'grid_up',
@@ -66,7 +66,7 @@ local page = UI.Page {
storageStatus = UI.Text {
x = -17, ex = -10,
textColor = colors.lime,
backgroundColor = UI.colors.primary,
backgroundColor = 'primary',
value = '',
},
amount = UI.TextEntry {

View File

@@ -21,8 +21,8 @@ local networkPage = UI.Page {
y = -2, x = 1, ex = -9,
limit = 50,
shadowText = 'filter',
backgroundColor = UI.colors.primary,
backgroundFocusColor = UI.colors.primary,
backgroundColor = 'primary',
backgroundFocusColor = 'primary',
},
grid = UI.ScrollingGrid {
y = 2, ey = -3,
@@ -234,7 +234,7 @@ The settings will take effect immediately!]],
},
},
statusBar = UI.StatusBar {
backgroundColor = UI.colors.primary,
backgroundColor = 'primary',
},
notification = UI.Notification { },
filter = UI.SlideOut {
@@ -289,7 +289,7 @@ The settings will take effect immediately!]],
},
},
statusBar = UI.StatusBar {
backgroundColor = UI.colors.primary,
backgroundColor = 'primary',
},
},
}

View File

@@ -41,7 +41,6 @@ function page:eventHandler(event)
elseif event.type == 'focus_change' then
self.statusBar:setStatus(event.focused.help)
self.statusBar:draw()
elseif event.type == 'success_message' then
self.notification:success(event.message)

View File

@@ -1,43 +0,0 @@
local Ansi = require('opus.ansi')
local UI = require('opus.ui')
local colors = _G.colors
local device = _G.device
--[[ Configuration Screen ]]
local template =
[[%sWarning%s
Must an interface for Refined Storage / Applied Energistics.
Add all speed upgrades possible.
]]
local wizardPage = UI.WizardPage {
title = 'Mass Storage',
index = 2,
backgroundColor = colors.cyan,
[1] = UI.TextArea {
x = 2, ex = -2, y = 2, ey = -2,
value = string.format(template, Ansi.red, Ansi.reset),
},
}
function wizardPage:isValidFor(node)
if node.mtype == 'storage' then
local m = device[node.name]
return m and m.listAvailableItems
end
end
function wizardPage:setNode(node)
self.node = node
end
function wizardPage:validate()
self.node.adapterType = 'massAdapter'
return true
end
-- disable until a way is found to transfer between 2 non-transferrable nodes
-- UI:getPage('nodeWizard').wizard:add({ inputChest = wizardPage })

View File

@@ -50,7 +50,7 @@ local setup = UI.SlideOut {
[[also have an introspection module.]],
},
statusBar = UI.StatusBar {
backgroundColor = UI.colors.primary,
backgroundColor = 'primary',
},
}