This commit is contained in:
43
coordinator/ui/components/unit_overview.lua
Normal file
43
coordinator/ui/components/unit_overview.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
local core = require("graphics.core")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local Div = require("graphics.elements.div")
|
||||
local HorizontalBar = require("graphics.elements.indicators.hbar")
|
||||
local DataIndicator = require("graphics.elements.indicators.data")
|
||||
local StateIndicator = require("graphics.elements.indicators.state")
|
||||
local Rectangle = require("graphics.elements.rectangle")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
local border = core.graphics.border
|
||||
|
||||
---@param parent graphics_element
|
||||
local function make(parent, x, y, unit_id)
|
||||
-- bounding box div
|
||||
local root = Div{parent=parent,x=x,y=y,width=75,height=50}
|
||||
|
||||
-- unit header message
|
||||
TextBox{parent=root,text="Unit #" .. unit_id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||
|
||||
-- reactor
|
||||
local reactor = Rectangle{parent=root,border=border(1, colors.gray, false),width=30,height=10,x=1,y=3}
|
||||
|
||||
local text_fg_bg = cpair(colors.black, colors.lightGray)
|
||||
local lu_col = cpair(colors.gray, colors.gray)
|
||||
|
||||
local status = StateIndicator{parent=reactor,x=9,y=2,states=style.reactor.states,value=1,min_width=14}
|
||||
local core_temp = DataIndicator{parent=reactor,x=3,y=4,lu_colors=lu_col,label="Core: ",unit="K",format="%7.0f",value=295,width=26,fg_bg=text_fg_bg}
|
||||
local heating_r = DataIndicator{parent=reactor,x=3,y=5,lu_colors=lu_col,label="Heating:",unit="mB/t",format="%7.0f",value=359999,width=26,fg_bg=text_fg_bg}
|
||||
local burn_r = DataIndicator{parent=reactor,x=3,y=6,lu_colors=lu_col,label="Burn: ",unit="mB/t",format="%7.1f",value=40.1,width=26,fg_bg=text_fg_bg}
|
||||
|
||||
local fuel = HorizontalBar{parent=root,x=34,y=4,show_percent=true,bar_fg_bg=cpair(colors.brown,colors.white),height=1,width=14}
|
||||
local coolant = HorizontalBar{parent=root,x=34,y=5,show_percent=true,bar_fg_bg=cpair(colors.lightBlue,colors.white),height=1,width=14}
|
||||
|
||||
fuel.update(0.85)
|
||||
coolant.update(0.75)
|
||||
end
|
||||
|
||||
return make
|
||||
29
coordinator/ui/layout/main_view.lua
Normal file
29
coordinator/ui/layout/main_view.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--
|
||||
-- Main SCADA Coordinator GUI
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local log = require("scada-common.log")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local DisplayBox = require("graphics.elements.displaybox")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local unit_overview = require("coordinator.ui.components.unit_overview")
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
local function init(monitor)
|
||||
local main = DisplayBox{window=monitor,fg_bg=style.root}
|
||||
|
||||
-- window header message
|
||||
TextBox{parent=main,text="Nuclear Generation Facility SCADA Coordinator",alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||
|
||||
-- unit overviews
|
||||
unit_overview(main, 5, 5, 1)
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return init
|
||||
22
coordinator/ui/layout/unit_view.lua
Normal file
22
coordinator/ui/layout/unit_view.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--
|
||||
-- Reactor Unit SCADA Coordinator GUI
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local DisplayBox = require("graphics.elements.displaybox")
|
||||
local TextBox = require("graphics.elements.textbox")
|
||||
|
||||
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
||||
|
||||
local function init(monitor, id)
|
||||
local main = DisplayBox{window=monitor,fg_bg=style.root}
|
||||
|
||||
TextBox{parent=main,text="Reactor Unit #" .. id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return init
|
||||
@@ -1,21 +0,0 @@
|
||||
--
|
||||
-- Main SCADA Coordinator GUI
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local layout = require("graphics.layout")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local displaybox = require("graphics.elements.displaybox")
|
||||
local textbox = require("graphics.elements.textbox")
|
||||
|
||||
local function init(monitor)
|
||||
local main = layout.create(monitor, displaybox{window=monitor,fg_bg=style.root})
|
||||
|
||||
textbox{parent=main,text="Nuclear Generation Facility SCADA Coordinator",alignment=core.graphics.TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return init
|
||||
@@ -3,9 +3,33 @@ local core = require("graphics.core")
|
||||
|
||||
local style = {}
|
||||
|
||||
local cpair = core.graphics.cpair
|
||||
|
||||
-- MAIN LAYOUT --
|
||||
|
||||
style.root = core.graphics.cpair(colors.black, colors.lightGray)
|
||||
style.header = core.graphics.cpair(colors.white,colors.gray)
|
||||
style.root = cpair(colors.black, colors.lightGray)
|
||||
style.header = cpair(colors.white, colors.gray)
|
||||
|
||||
style.reactor = {
|
||||
-- reactor states
|
||||
states = {
|
||||
{
|
||||
color = cpair(colors.black, colors.yellow),
|
||||
text = "DISCONNECTED"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.white, colors.gray),
|
||||
text = "DISABLED"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.green),
|
||||
text = "ACTIVE"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.red),
|
||||
text = "SCRAM!"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return style
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
--
|
||||
-- Reactor Unit SCADA Coordinator GUI
|
||||
--
|
||||
|
||||
local core = require("graphics.core")
|
||||
local layout = require("graphics.layout")
|
||||
|
||||
local style = require("coordinator.ui.style")
|
||||
|
||||
local displaybox = require("graphics.elements.displaybox")
|
||||
local textbox = require("graphics.elements.textbox")
|
||||
|
||||
local function init(monitor, id)
|
||||
local main = layout.create(monitor, displaybox{window=monitor,fg_bg=style.root})
|
||||
|
||||
textbox{parent=main,text="Reactor Unit #" .. id,alignment=core.graphics.TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
return init
|
||||
Reference in New Issue
Block a user