#395 pocket navigation system
This commit is contained in:
@@ -24,7 +24,6 @@ local TextBox = require("graphics.elements.textbox")
|
||||
local Sidebar = require("graphics.elements.controls.sidebar")
|
||||
|
||||
local LINK_STATE = iocontrol.LINK_STATE
|
||||
local NAV_PAGE = iocontrol.NAV_PAGE
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
@@ -33,24 +32,20 @@ local cpair = core.cpair
|
||||
-- create new main view
|
||||
---@param main graphics_element main displaybox
|
||||
local function init(main)
|
||||
local nav = iocontrol.get_db().nav
|
||||
local ps = iocontrol.get_db().ps
|
||||
local ps = iocontrol.get_db().ps
|
||||
|
||||
-- window header message
|
||||
TextBox{parent=main,y=1,text="",alignment=ALIGN.LEFT,height=1,fg_bg=style.header}
|
||||
|
||||
--
|
||||
-- root panel panes (connection screens + main screen)
|
||||
--
|
||||
--#region root panel panes (connection screens + main screen)
|
||||
|
||||
local root_pane_div = Div{parent=main,x=1,y=2}
|
||||
|
||||
local conn_sv_wait = conn_waiting(root_pane_div, 6, false)
|
||||
local conn_api_wait = conn_waiting(root_pane_div, 6, true)
|
||||
local main_pane = Div{parent=main,x=1,y=2}
|
||||
local root_panes = { conn_sv_wait, conn_api_wait, main_pane }
|
||||
|
||||
local root_pane = MultiPane{parent=root_pane_div,x=1,y=1,panes=root_panes}
|
||||
local root_pane = MultiPane{parent=root_pane_div,x=1,y=1,panes={conn_sv_wait,conn_api_wait,main_pane}}
|
||||
|
||||
root_pane.register(ps, "link_state", function (state)
|
||||
if state == LINK_STATE.UNLINKED or state == LINK_STATE.API_LINK_ONLY then
|
||||
@@ -62,62 +57,28 @@ local function init(main)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- main page panel panes & sidebar
|
||||
--
|
||||
--#endregion
|
||||
|
||||
--#region main page panel panes & sidebar
|
||||
|
||||
local page_div = Div{parent=main_pane,x=4,y=1}
|
||||
|
||||
local sidebar_tabs = {
|
||||
{
|
||||
char = "#",
|
||||
color = cpair(colors.black,colors.green)
|
||||
},
|
||||
{
|
||||
char = "U",
|
||||
color = cpair(colors.black,colors.yellow)
|
||||
},
|
||||
{
|
||||
char = "R",
|
||||
color = cpair(colors.black,colors.cyan)
|
||||
},
|
||||
{
|
||||
char = "B",
|
||||
color = cpair(colors.black,colors.lightGray)
|
||||
},
|
||||
{
|
||||
char = "T",
|
||||
color = cpair(colors.black,colors.white)
|
||||
},
|
||||
{
|
||||
char = "D",
|
||||
color = cpair(colors.black,colors.orange)
|
||||
}
|
||||
{ char = "#", color = cpair(colors.black,colors.green) },
|
||||
{ char = "U", color = cpair(colors.black,colors.yellow) },
|
||||
{ char = "R", color = cpair(colors.black,colors.cyan) },
|
||||
{ char = "B", color = cpair(colors.black,colors.lightGray) },
|
||||
{ char = "T", color = cpair(colors.black,colors.white) },
|
||||
{ char = "D", color = cpair(colors.black,colors.orange) }
|
||||
}
|
||||
|
||||
local panes = { home_page(page_div), unit_page(page_div), reactor_page(page_div), boiler_page(page_div), turbine_page(page_div), diag_page(page_div) }
|
||||
local page_pane = MultiPane{parent=page_div,x=1,y=1,panes={home_page(page_div),unit_page(page_div),reactor_page(page_div),boiler_page(page_div),turbine_page(page_div),diag_page(page_div)}}
|
||||
|
||||
local page_pane = MultiPane{parent=page_div,x=1,y=1,panes=panes}
|
||||
local base = iocontrol.init_nav(page_pane)
|
||||
|
||||
local function navigate_sidebar(page)
|
||||
if page == 1 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.HOME]
|
||||
elseif page == 2 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.UNITS]
|
||||
elseif page == 3 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.REACTORS]
|
||||
elseif page == 4 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.BOILERS]
|
||||
elseif page == 5 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.TURBINES]
|
||||
elseif page == 6 then
|
||||
nav.page = nav.sub_pages[NAV_PAGE.DIAG]
|
||||
end
|
||||
Sidebar{parent=main_pane,x=1,y=1,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=base.switcher}
|
||||
|
||||
page_pane.set_value(page)
|
||||
end
|
||||
|
||||
Sidebar{parent=main_pane,x=1,y=1,tabs=sidebar_tabs,fg_bg=cpair(colors.white,colors.gray),callback=navigate_sidebar}
|
||||
--#endregion
|
||||
end
|
||||
|
||||
return init
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
-- local style = require("pocket.ui.style")
|
||||
--
|
||||
-- Boiler Detail Page
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
local core = require("graphics.core")
|
||||
|
||||
-- local cpair = core.cpair
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new boiler page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
db.nav.new_page(nil, 4)
|
||||
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="BOILERS",x=1,y=1,height=1,alignment=ALIGN.CENTER}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
--
|
||||
-- Diagnostic Tools
|
||||
--
|
||||
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local core = require("graphics.core")
|
||||
@@ -15,8 +19,6 @@ local SwitchButton = require("graphics.elements.controls.switch_button")
|
||||
|
||||
local cpair = core.cpair
|
||||
|
||||
local NAV_PAGE = iocontrol.NAV_PAGE
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new diagnostics page view
|
||||
@@ -36,23 +38,15 @@ local function new_view(root)
|
||||
|
||||
local page_pane = MultiPane{parent=main,x=1,y=1,panes=panes}
|
||||
|
||||
local function navigate_diag()
|
||||
page_pane.set_value(1)
|
||||
db.nav.page = NAV_PAGE.DIAG
|
||||
db.nav.sub_pages[NAV_PAGE.DIAG] = NAV_PAGE.DIAG
|
||||
end
|
||||
|
||||
local function navigate_alarm()
|
||||
page_pane.set_value(2)
|
||||
db.nav.page = NAV_PAGE.D_ALARMS
|
||||
db.nav.sub_pages[NAV_PAGE.DIAG] = NAV_PAGE.D_ALARMS
|
||||
end
|
||||
local npage_diag = db.nav.new_page(nil, 6, page_pane)
|
||||
local npage_home = db.nav.new_page(npage_diag, 1)
|
||||
local npage_alarm = db.nav.new_page(npage_diag, 2)
|
||||
|
||||
------------------------
|
||||
-- Alarm Testing Page --
|
||||
------------------------
|
||||
|
||||
db.nav.register_task(NAV_PAGE.D_ALARMS, db.diag.tone_test.get_tone_states)
|
||||
table.insert(npage_alarm.tasks, db.diag.tone_test.get_tone_states)
|
||||
|
||||
local ttest = db.diag.tone_test
|
||||
|
||||
@@ -67,7 +61,7 @@ local function new_view(root)
|
||||
|
||||
ttest.ready_warn = TextBox{parent=audio,y=2,text="",height=1,alignment=ALIGN.CENTER,fg_bg=cpair(colors.yellow,colors.black)}
|
||||
|
||||
PushButton{parent=audio,x=13,y=18,text="\x11 BACK",min_width=8,fg_bg=cpair(colors.black,colors.lightGray),active_fg_bg=c_wht_gray,callback=navigate_diag}
|
||||
PushButton{parent=audio,x=13,y=18,text="\x11 BACK",min_width=8,fg_bg=cpair(colors.black,colors.lightGray),active_fg_bg=c_wht_gray,callback=npage_home.nav_to}
|
||||
|
||||
local tones = Div{parent=audio,x=2,y=3,height=10,width=8,fg_bg=cpair(colors.black,colors.yellow)}
|
||||
|
||||
@@ -137,7 +131,7 @@ local function new_view(root)
|
||||
-- App List --
|
||||
--------------
|
||||
|
||||
App{parent=diag_home,x=3,y=4,text="\x0f",title="Alarm",callback=navigate_alarm,app_fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.white,colors.gray)}
|
||||
App{parent=diag_home,x=3,y=4,text="\x0f",title="Alarm",callback=npage_alarm.nav_to,app_fg_bg=cpair(colors.black,colors.red),active_fg_bg=cpair(colors.white,colors.gray)}
|
||||
App{parent=diag_home,x=10,y=4,text="\x1e",title="LoopT",callback=function()end,app_fg_bg=cpair(colors.black,colors.cyan)}
|
||||
App{parent=diag_home,x=17,y=4,text="@",title="Comps",callback=function()end,app_fg_bg=cpair(colors.black,colors.orange)}
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
local core = require("graphics.core")
|
||||
--
|
||||
-- Main Home Page
|
||||
--
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local App = require("graphics.elements.controls.app")
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
|
||||
local App = require("graphics.elements.controls.app")
|
||||
|
||||
local cpair = core.cpair
|
||||
|
||||
-- new home page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
db.nav.new_page(nil, 1)
|
||||
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
App{parent=main,x=3,y=2,text="\x17",title="PRC",callback=function()end,app_fg_bg=cpair(colors.black,colors.purple)}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
-- local style = require("pocket.ui.style")
|
||||
--
|
||||
-- Reactor Detail Page
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
local core = require("graphics.core")
|
||||
|
||||
-- local cpair = core.cpair
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new reactor page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
db.nav.new_page(nil, 3)
|
||||
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="REACTOR",x=1,y=1,height=1,alignment=ALIGN.CENTER}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
-- local style = require("pocket.ui.style")
|
||||
--
|
||||
-- Turbine Detail Page
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
local core = require("graphics.core")
|
||||
|
||||
-- local cpair = core.cpair
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new turbine page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
db.nav.new_page(nil, 5)
|
||||
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="TURBINES",x=1,y=1,height=1,alignment=ALIGN.CENTER}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
-- local style = require("pocket.ui.style")
|
||||
--
|
||||
-- Unit Overview Page
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
local core = require("graphics.core")
|
||||
|
||||
-- local cpair = core.cpair
|
||||
local Div = require("graphics.elements.div")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new unit page view
|
||||
---@param root graphics_element parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
db.nav.new_page(nil, 2)
|
||||
|
||||
local main = Div{parent=root,x=1,y=1}
|
||||
|
||||
TextBox{parent=main,text="UNITS",x=1,y=1,height=1,alignment=ALIGN.CENTER}
|
||||
|
||||
Reference in New Issue
Block a user