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

View File

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

View File

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

View File

@@ -14,7 +14,7 @@ local template =
[[%sDisplays the amount of items entering or leaving storage.%s
Right-clicking on the activity monitor will reset the totals.]]
local wizardPage = UI.Window {
local wizardPage = UI.WizardPage {
title = 'Activity Monitor',
index = 2,
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.]]
local brewingStandView = UI.Window {
local wizardPage = UI.WizardPage {
title = 'Brewing Stand',
index = 2,
backgroundColor = colors.cyan,
@@ -25,7 +25,7 @@ local brewingStandView = UI.Window {
},
}
function brewingStandView:isValidType(node)
function wizardPage:isValidType(node)
local m = device[node.name]
return m and m.type == 'minecraft:brewing_stand'and {
name = 'Brewing Stand',
@@ -35,8 +35,8 @@ function brewingStandView:isValidType(node)
}
end
function brewingStandView:isValidFor(node)
function wizardPage:isValidFor(node)
return node.mtype == 'brewingStand'
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 {
y = 2, ey = -2,
pages = {
quantity = UI.Window {
quantity = UI.WizardPage {
index = 1,
text = UI.Text {
x = 6, y = 3,
@@ -36,7 +36,7 @@ local craftPage = UI.Page {
},
},
},
resources = UI.Window {
resources = UI.WizardPage {
index = 2,
grid = UI.ScrollingGrid {
y = 2, ey = -2,
@@ -105,7 +105,7 @@ function craftPage.wizard.pages.resources:enable()
else
self.grid:setValues({ })
end
return UI.Window.enable(self)
return UI.WizardPage.enable(self)
end
function craftPage:eventHandler(event)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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