wizard and tab rework

This commit is contained in:
kepler155c@gmail.com
2020-04-26 19:39:28 -06:00
parent 8d014c0098
commit ef0886ec85
20 changed files with 398 additions and 426 deletions

View File

@@ -2,7 +2,7 @@ local Ansi = require('opus.ansi')
local UI = require('opus.ui')
local infoTab = UI.Tab {
tabTitle = 'Info',
title = 'Info',
index = 4,
textArea = UI.TextArea {
x = 2, ex = -2, y = 2, ey = -2,

View File

@@ -7,7 +7,7 @@ local colors = _G.colors
local context = Milo:getContext()
local machinesTab = UI.Tab {
tabTitle = 'Machine',
title = 'Machine',
index = 3,
grid = UI.ScrollingGrid {
x = 2, ex = -2, y = 2, ey = -2,

View File

@@ -7,7 +7,7 @@ local Util = require('opus.util')
local context = Milo:getContext()
local manageTab = UI.Tab {
tabTitle = 'Manage',
title = 'Manage',
index = 1,
form = UI.Form {
x = 1, ex = -1, ey = -1,

View File

@@ -4,7 +4,7 @@ local Milo = require('milo')
local UI = require('opus.ui')
local recipeTab = UI.Tab {
tabTitle = 'Recipe',
title = 'Recipe',
index = 2,
grid = UI.ScrollingGrid {
x = 2, ex = -2, y = 2, ey = -4,

View File

@@ -7,7 +7,7 @@ local colors = _G.colors
local context = Milo:getContext()
local resetTab = UI.Tab {
tabTitle = 'Reset',
title = 'Reset',
index = 5,
noFill = true,
textArea = UI.TextArea {

View File

@@ -23,7 +23,7 @@ local page = UI.Page {
tabs = UI.Tabs {
y = 2, ey = -2,
inventory = UI.Tab {
tabTitle = 'Inventory',
title = 'Inventory',
grid = UI.ScrollingGrid {
y = 2, ey = -2,
columns = {
@@ -33,7 +33,7 @@ local page = UI.Page {
},
},
autostore = UI.Tab {
tabTitle = 'Deposit',
title = 'Deposit',
grid = UI.ScrollingGrid {
y = 2, ey = -2,
columns = {

View File

@@ -83,7 +83,7 @@ local function createPage(node)
parent = monitor,
tabs = UI.Tabs {
[1] = UI.Tab {
tabTitle = 'Overview',
title = 'Overview',
backgroundColor = colors.black,
noFill = true,
onlineLabel = UI.Text {
@@ -135,14 +135,14 @@ local function createPage(node)
},
},
[2] = UI.Tab {
tabTitle = 'Stats',
title = 'Stats',
noFill = true,
textArea = UI.TextArea {
y = 3,
},
},
[3] = UI.Tab {
tabTitle = 'Storage',
title = 'Storage',
noFill = true,
grid = UI.ScrollingGrid {
y = 2,
@@ -157,7 +157,7 @@ local function createPage(node)
},
},
[4] = UI.Tab {
tabTitle = 'Offline',
title = 'Offline',
noFill = true,
grid = UI.ScrollingGrid {
y = 2,
@@ -168,14 +168,14 @@ local function createPage(node)
},
},
[5] = UI.Tab {
tabTitle = 'Activity',
title = 'Activity',
noFill = true,
term = UI.Embedded {
--visible = true,
},
},
[6] = UI.Tab {
tabTitle = 'Tasks',
title = 'Tasks',
noFill = true,
grid = UI.ScrollingGrid {
y = 2,
@@ -449,7 +449,7 @@ Unlocked Slots : %d of %d (%d%%)
function page:eventHandler(event)
if event.type == 'tab_activate' then
local state = Milo:getState('statusState') or { }
state[node.name] = event.activated.tabTitle
state[node.name] = event.activated.title
Milo:setState('statusState', state)
end
return UI.Page.eventHandler(self, event)
@@ -472,7 +472,7 @@ Unlocked Slots : %d of %d (%d%%)
-- restore active tab
local tabState = Milo:getState('statusState') or { }
if tabState[node.name] then
page.tabs:selectTab(Util.find(page.tabs, 'tabTitle', tabState[node.name]))
page.tabs:selectTab(Util.find(page.tabs, 'title', tabState[node.name]))
end
return page