ui overhaul

This commit is contained in:
kepler155c@gmail.com
2019-02-05 23:04:22 -05:00
parent ab22ae8224
commit b07343a530
19 changed files with 35 additions and 52 deletions

View File

@@ -14,7 +14,7 @@ local os = _G.os
local shell = _ENV.shell local shell = _ENV.shell
local term = _G.term local term = _G.term
UI.Button.defaults.focusIndicator = ' ' --UI.Button.defaults.focusIndicator = ' '
UI:configure('Turtles', ...) UI:configure('Turtles', ...)
local config = { } local config = { }
@@ -43,7 +43,7 @@ local page = UI.Page {
x = 1, y = 5, ey = -2, x = 1, y = 5, ey = -2,
scripts = UI.ScrollingGrid { scripts = UI.ScrollingGrid {
tabTitle = 'Run', tabTitle = 'Run',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = colors.cyan,
columns = { columns = {
{ heading = '', key = 'label' }, { heading = '', key = 'label' },
}, },
@@ -53,7 +53,7 @@ local page = UI.Page {
}, },
turtles = UI.ScrollingGrid { turtles = UI.ScrollingGrid {
tabTitle = 'Select', tabTitle = 'Select',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = colors.cyan,
columns = { columns = {
{ heading = 'label', key = 'label' }, { heading = 'label', key = 'label' },
{ heading = 'Dist', key = 'distance' }, { heading = 'Dist', key = 'distance' },
@@ -65,7 +65,7 @@ local page = UI.Page {
autospace = true, autospace = true,
}, },
inventory = UI.ScrollingGrid { inventory = UI.ScrollingGrid {
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = colors.cyan,
tabTitle = 'Inv', tabTitle = 'Inv',
columns = { columns = {
{ heading = '', key = 'index', width = 2 }, { heading = '', key = 'index', width = 2 },
@@ -90,7 +90,7 @@ local page = UI.Page {
]] ]]
action = UI.Window { action = UI.Window {
tabTitle = 'Action', tabTitle = 'Action',
backgroundColor = UI.TabBar.defaults.selectedBackgroundColor, backgroundColor = colors.cyan,
moveUp = UI.Button { moveUp = UI.Button {
x = 5, y = 2, x = 5, y = 2,
text = 'up', text = 'up',

View File

@@ -8,7 +8,7 @@ local learnPage = UI.Page {
wizard = UI.Wizard { wizard = UI.Wizard {
y = 2, ey = -2, y = 2, ey = -2,
pages = { pages = {
general = UI.Window { general = UI.WizardPage {
index = 1, index = 1,
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
x = 2, ex = -2, y = 2, ey = -2, x = 2, ex = -2, y = 2, ey = -2,

View File

@@ -192,7 +192,7 @@ nodeWizard = UI.Page {
wizard = UI.Wizard { wizard = UI.Wizard {
y = 2, ey = -2, y = 2, ey = -2,
pages = { pages = {
general = UI.Window { general = UI.WizardPage {
index = 1, index = 1,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,
form = UI.Form { form = UI.Form {
@@ -221,7 +221,7 @@ nodeWizard = UI.Page {
help = 'Contents of inventory', help = 'Contents of inventory',
}, },
}, },
confirmation = UI.Window { confirmation = UI.WizardPage {
title = 'Confirm changes', title = 'Confirm changes',
index = 2, index = 2,
notice = UI.TextArea { notice = UI.TextArea {
@@ -375,7 +375,7 @@ end
--[[ General Page ]] -- --[[ General Page ]] --
function nodeWizard.wizard.pages.general:enable() function nodeWizard.wizard.pages.general:enable()
UI.Window.enable(self) UI.WizardPage.enable(self)
self:focusFirst() self:focusFirst()
end end

View File

@@ -14,7 +14,7 @@ local template =
[[%sDisplays the amount of items entering or leaving storage.%s [[%sDisplays the amount of items entering or leaving storage.%s
Right-clicking on the activity monitor will reset the totals.]] Right-clicking on the activity monitor will reset the totals.]]
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Activity Monitor', title = 'Activity Monitor',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,

View File

@@ -15,7 +15,7 @@ When finished brewing, the recipe will be available upon refreshing.
Note that you do not need to import items from the brewing stand or export blaze powder, this will be done automatically.]] Note that you do not need to import items from the brewing stand or export blaze powder, this will be done automatically.]]
local brewingStandView = UI.Window { local wizardPage = UI.WizardPage {
title = 'Brewing Stand', title = 'Brewing Stand',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,
@@ -25,7 +25,7 @@ local brewingStandView = UI.Window {
}, },
} }
function brewingStandView:isValidType(node) function wizardPage:isValidType(node)
local m = device[node.name] local m = device[node.name]
return m and m.type == 'minecraft:brewing_stand'and { return m and m.type == 'minecraft:brewing_stand'and {
name = 'Brewing Stand', name = 'Brewing Stand',
@@ -35,8 +35,8 @@ function brewingStandView:isValidType(node)
} }
end end
function brewingStandView:isValidFor(node) function wizardPage:isValidFor(node)
return node.mtype == 'brewingStand' return node.mtype == 'brewingStand'
end end
UI:getPage('nodeWizard').wizard:add({ brewingStand = brewingStandView }) UI:getPage('nodeWizard').wizard:add({ brewingStand = wizardPage })

View File

@@ -11,7 +11,7 @@ local craftPage = UI.Page {
wizard = UI.Wizard { wizard = UI.Wizard {
y = 2, ey = -2, y = 2, ey = -2,
pages = { pages = {
quantity = UI.Window { quantity = UI.WizardPage {
index = 1, index = 1,
text = UI.Text { text = UI.Text {
x = 6, y = 3, x = 6, y = 3,
@@ -36,7 +36,7 @@ local craftPage = UI.Page {
}, },
}, },
}, },
resources = UI.Window { resources = UI.WizardPage {
index = 2, index = 2,
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
y = 2, ey = -2, y = 2, ey = -2,
@@ -105,7 +105,7 @@ function craftPage.wizard.pages.resources:enable()
else else
self.grid:setValues({ }) self.grid:setValues({ })
end end
return UI.Window.enable(self) return UI.WizardPage.enable(self)
end end
function craftPage:eventHandler(event) function craftPage:eventHandler(event)

View File

@@ -5,7 +5,7 @@ local Util = require('util')
local colors = _G.colors local colors = _G.colors
local device = _G.device local device = _G.device
local exportView = UI.Window { local exportView = UI.WizardPage {
title = 'Export item into inventory', title = 'Export item into inventory',
index = 3, index = 3,
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {

View File

@@ -5,7 +5,7 @@ local Util = require('util')
local colors = _G.colors local colors = _G.colors
local device = _G.device local device = _G.device
local importView = UI.Window { local importView = UI.WizardPage {
title = 'Import item from inventory', title = 'Import item from inventory',
index = 4, index = 4,
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {

View File

@@ -11,7 +11,7 @@ local template =
Any items placed in this chest will be imported into storage. Any items placed in this chest will be imported into storage.
]] ]]
local inputChestWizardPage = UI.Window { local inputChestWizardPage = UI.WizardPage {
title = 'Input Chest', title = 'Input Chest',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,

View File

@@ -12,7 +12,7 @@ local device = _G.device
local os = _G.os local os = _G.os
--[[ Configuration Screen ]] --[[ Configuration Screen ]]
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Crafting Monitor', title = 'Crafting Monitor',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,

View File

@@ -11,7 +11,7 @@ local context = Milo:getContext()
local machine local machine
local pages = { local pages = {
machines = UI.Window { machines = UI.WizardPage {
index = 2, index = 2,
validFor = 'Machine Processing', validFor = 'Machine Processing',
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
@@ -22,7 +22,7 @@ local pages = {
sortColumn = 'displayName', sortColumn = 'displayName',
}, },
}, },
confirmation = UI.Window { confirmation = UI.WizardPage {
index = 3, index = 3,
validFor = 'Machine Processing', validFor = 'Machine Processing',
notice = UI.TextArea { notice = UI.TextArea {
@@ -51,7 +51,7 @@ function pages.machines:enable()
end end
end) end)
self.grid:setValues(t) self.grid:setValues(t)
UI.Window.enable(self) UI.WizardPage.enable(self)
end end
function pages.machines:validate() function pages.machines:validate()

View File

@@ -13,7 +13,7 @@ Must an interface for Refined Storage / Applied Energistics.
Add all speed upgrades possible. Add all speed upgrades possible.
]] ]]
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Mass Storage', title = 'Mass Storage',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,

View File

@@ -5,8 +5,6 @@ local Socket = require('socket')
local device = _G.device local device = _G.device
local SHIELD_SLOT = 2
local context = Milo:getContext() local context = Milo:getContext()
local function getNameSafe(v) local function getNameSafe(v)

View File

@@ -23,7 +23,7 @@ local page = UI.Page {
}, },
tabs = UI.Tabs { tabs = UI.Tabs {
y = 2, ey = -2, y = 2, ey = -2,
inventory = UI.Window { inventory = UI.Tab {
tabTitle = 'Inventory', tabTitle = 'Inventory',
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
y = 2, ey = -2, y = 2, ey = -2,
@@ -33,7 +33,7 @@ local page = UI.Page {
sortColumn = 'displayName', sortColumn = 'displayName',
}, },
}, },
autostore = UI.Window { autostore = UI.Tab {
tabTitle = 'Deposit', tabTitle = 'Deposit',
grid = UI.ScrollingGrid { grid = UI.ScrollingGrid {
y = 2, ey = -2, y = 2, ey = -2,
@@ -71,7 +71,7 @@ function page.tabs.inventory:enable()
self.grid:setValues(list) self.grid:setValues(list)
itemDB:flush() itemDB:flush()
return UI.Window.enable(self) return UI.Tab.enable(self)
end end
function page.tabs.inventory.grid:getRowTextColor(row) function page.tabs.inventory.grid:getRowTextColor(row)
@@ -107,7 +107,7 @@ function page.tabs.autostore:enable()
end end
self.grid:setValues(list) self.grid:setValues(list)
return UI.Window.enable(self) return UI.Tab.enable(self)
end end
function page.tabs.autostore:eventHandler(event) function page.tabs.autostore:eventHandler(event)

View File

@@ -11,7 +11,7 @@ if speakerNode then
Sound.setVolume(speakerNode.volume) Sound.setVolume(speakerNode.volume)
end end
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Speaker', title = 'Speaker',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,

View File

@@ -4,7 +4,7 @@ local UI = require('ui')
local colors = _G.colors local colors = _G.colors
local device = _G.device local device = _G.device
local storageView = UI.Window { local storageView = UI.WizardPage {
title = 'Storage Options - General', title = 'Storage Options - General',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,
@@ -34,11 +34,6 @@ local storageView = UI.Window {
}, },
} }
function storageView:enable()
UI.Window.enable(self)
self:focusFirst()
end
function storageView:validate() function storageView:validate()
return self.form:save() return self.form:save()
end end
@@ -64,7 +59,7 @@ end
UI:getPage('nodeWizard').wizard:add({ storageGeneral = storageView }) UI:getPage('nodeWizard').wizard:add({ storageGeneral = storageView })
--[[ Locking Page ]]-- --[[ Locking Page ]]--
local lockView = UI.Window { local lockView = UI.WizardPage {
title = 'Storage Options - Locking', title = 'Storage Options - Locking',
index = 3, index = 3,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,
@@ -104,11 +99,6 @@ function lockView:showLockTypes()
self.grid:draw() self.grid:draw()
end end
function lockView:enable()
UI.Window.enable(self)
self:focusFirst()
end
function lockView:validate() function lockView:validate()
return self.form:save() return self.form:save()
end end

View File

@@ -5,7 +5,7 @@ local colors = _G.colors
local device = _G.device local device = _G.device
--[[ Configuration Screen ]] --[[ Configuration Screen ]]
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Trashcan', title = 'Trashcan',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,
@@ -40,11 +40,6 @@ local wizardPage = UI.Window {
}, },
} }
function wizardPage:enable()
UI.Window.enable(self)
self:focusFirst()
end
function wizardPage:validate() function wizardPage:validate()
return self.form:save() return self.form:save()
end end

View File

@@ -6,7 +6,7 @@ local colors = _G.colors
local turtle = _G.turtle local turtle = _G.turtle
local pages = { local pages = {
turtleCraft = UI.Window { turtleCraft = UI.WizardPage {
index = 2, index = 2,
validFor = 'Turtle Crafting', validFor = 'Turtle Crafting',
notice = UI.Text { notice = UI.Text {

View File

@@ -5,7 +5,7 @@ local device = _G.device
local os = _G.os local os = _G.os
--[[ Configuration Page ]]-- --[[ Configuration Page ]]--
local wizardPage = UI.Window { local wizardPage = UI.WizardPage {
title = 'Store Front', title = 'Store Front',
index = 2, index = 2,
backgroundColor = colors.cyan, backgroundColor = colors.cyan,