mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#243 graphics core updates for content windows, redrawing, and handling of addition/removal of children
This commit is contained in:
parent
270726e276
commit
de9cb3bd3a
@ -20,7 +20,7 @@ local sounder = require("coordinator.sounder")
|
|||||||
|
|
||||||
local apisessions = require("coordinator.session.apisessions")
|
local apisessions = require("coordinator.session.apisessions")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "v0.15.3"
|
local COORDINATOR_VERSION = "v0.15.4"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -33,7 +33,7 @@ local period = core.flasher.PERIOD
|
|||||||
---@param x integer top left x
|
---@param x integer top left x
|
||||||
---@param y integer top left y
|
---@param y integer top left y
|
||||||
local function new_view(root, x, y)
|
local function new_view(root, x, y)
|
||||||
assert(root.height() >= (y + 24), "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
assert(root.get_height() >= (y + 24), "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
||||||
|
|
||||||
local facility = iocontrol.get_db().facility
|
local facility = iocontrol.get_db().facility
|
||||||
local units = iocontrol.get_db().units
|
local units = iocontrol.get_db().units
|
||||||
|
@ -38,7 +38,7 @@ local function make(parent, x, y, unit)
|
|||||||
height = 17
|
height = 17
|
||||||
end
|
end
|
||||||
|
|
||||||
assert(parent.height() >= (y + height), "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
assert(parent.get_height() >= (y + height), "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
||||||
|
|
||||||
-- bounding box div
|
-- bounding box div
|
||||||
local root = Div{parent=parent,x=x,y=y,width=80,height=height}
|
local root = Div{parent=parent,x=x,y=y,width=80,height=height}
|
||||||
|
@ -32,7 +32,7 @@ local function init(main)
|
|||||||
local header = TextBox{parent=main,y=1,text="Nuclear Generation Facility SCADA Coordinator",alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
local header = TextBox{parent=main,y=1,text="Nuclear Generation Facility SCADA Coordinator",alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
||||||
local ping = DataIndicator{parent=main,x=1,y=1,label="SVTT",format="%d",value=0,unit="ms",lu_colors=cpair(colors.lightGray, colors.white),width=12,fg_bg=style.header}
|
local ping = DataIndicator{parent=main,x=1,y=1,label="SVTT",format="%d",value=0,unit="ms",lu_colors=cpair(colors.lightGray, colors.white),width=12,fg_bg=style.header}
|
||||||
-- max length example: "01:23:45 AM - Wednesday, September 28 2022"
|
-- max length example: "01:23:45 AM - Wednesday, September 28 2022"
|
||||||
local datetime = TextBox{parent=main,x=(header.width()-42),y=1,text="",alignment=TEXT_ALIGN.RIGHT,width=42,height=1,fg_bg=style.header}
|
local datetime = TextBox{parent=main,x=(header.get_width()-42),y=1,text="",alignment=TEXT_ALIGN.RIGHT,width=42,height=1,fg_bg=style.header}
|
||||||
|
|
||||||
ping.register(facility.ps, "sv_ping", ping.update)
|
ping.register(facility.ps, "sv_ping", ping.update)
|
||||||
datetime.register(facility.ps, "date_time", datetime.set_value)
|
datetime.register(facility.ps, "date_time", datetime.set_value)
|
||||||
@ -45,12 +45,12 @@ local function init(main)
|
|||||||
-- unit overviews
|
-- unit overviews
|
||||||
if facility.num_units >= 1 then
|
if facility.num_units >= 1 then
|
||||||
uo_1 = unit_overview(main, 2, 3, units[1])
|
uo_1 = unit_overview(main, 2, 3, units[1])
|
||||||
row_1_height = uo_1.height()
|
row_1_height = uo_1.get_height()
|
||||||
end
|
end
|
||||||
|
|
||||||
if facility.num_units >= 2 then
|
if facility.num_units >= 2 then
|
||||||
uo_2 = unit_overview(main, 84, 3, units[2])
|
uo_2 = unit_overview(main, 84, 3, units[2])
|
||||||
row_1_height = math.max(row_1_height, uo_2.height())
|
row_1_height = math.max(row_1_height, uo_2.get_height())
|
||||||
end
|
end
|
||||||
|
|
||||||
cnc_y_start = cnc_y_start + row_1_height + 1
|
cnc_y_start = cnc_y_start + row_1_height + 1
|
||||||
@ -60,11 +60,11 @@ local function init(main)
|
|||||||
local row_2_offset = cnc_y_start
|
local row_2_offset = cnc_y_start
|
||||||
|
|
||||||
uo_3 = unit_overview(main, 2, row_2_offset, units[3])
|
uo_3 = unit_overview(main, 2, row_2_offset, units[3])
|
||||||
cnc_y_start = row_2_offset + uo_3.height() + 1
|
cnc_y_start = row_2_offset + uo_3.get_height() + 1
|
||||||
|
|
||||||
if facility.num_units == 4 then
|
if facility.num_units == 4 then
|
||||||
uo_4 = unit_overview(main, 84, row_2_offset, units[4])
|
uo_4 = unit_overview(main, 84, row_2_offset, units[4])
|
||||||
cnc_y_start = math.max(cnc_y_start, row_2_offset + uo_4.height() + 1)
|
cnc_y_start = math.max(cnc_y_start, row_2_offset + uo_4.get_height() + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -73,11 +73,11 @@ local function init(main)
|
|||||||
cnc_y_start = cnc_y_start
|
cnc_y_start = cnc_y_start
|
||||||
|
|
||||||
-- induction matrix and process control interfaces are 24 tall + space needed for divider
|
-- induction matrix and process control interfaces are 24 tall + space needed for divider
|
||||||
local cnc_bottom_align_start = main.height() - 26
|
local cnc_bottom_align_start = main.get_height() - 26
|
||||||
|
|
||||||
assert(cnc_bottom_align_start >= cnc_y_start, "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
assert(cnc_bottom_align_start >= cnc_y_start, "main display not of sufficient vertical resolution (add an additional row of monitors)")
|
||||||
|
|
||||||
TextBox{parent=main,y=cnc_bottom_align_start,text=util.strrep("\x8c", header.width()),alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=cpair(colors.lightGray,colors.gray)}
|
TextBox{parent=main,y=cnc_bottom_align_start,text=util.strrep("\x8c", header.get_width()),alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=cpair(colors.lightGray,colors.gray)}
|
||||||
|
|
||||||
cnc_bottom_align_start = cnc_bottom_align_start + 2
|
cnc_bottom_align_start = cnc_bottom_align_start + 2
|
||||||
|
|
||||||
|
@ -68,21 +68,22 @@ function element.new(args)
|
|||||||
define_completed = false,
|
define_completed = false,
|
||||||
p_window = nil, ---@type table
|
p_window = nil, ---@type table
|
||||||
position = { x = 1, y = 1 }, ---@type coordinate_2d
|
position = { x = 1, y = 1 }, ---@type coordinate_2d
|
||||||
child_offset = { x = 0, y = 0 },
|
child_offset = { x = 0, y = 0 }, ---@type coordinate_2d
|
||||||
bounds = { x1 = 1, y1 = 1, x2 = 1, y2 = 1 }, ---@class element_bounds
|
bounds = { x1 = 1, y1 = 1, x2 = 1, y2 = 1 }, ---@class element_bounds
|
||||||
next_y = 1,
|
next_y = 1,
|
||||||
children = {},
|
|
||||||
subscriptions = {},
|
subscriptions = {},
|
||||||
mt = {}
|
mt = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
---@class graphics_template
|
---@class graphics_base
|
||||||
local protected = {
|
local protected = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
value = nil, ---@type any
|
value = nil, ---@type any
|
||||||
window = nil, ---@type table
|
window = nil, ---@type table
|
||||||
|
content_window = nil, ---@type table|nil
|
||||||
fg_bg = core.cpair(colors.white, colors.black),
|
fg_bg = core.cpair(colors.white, colors.black),
|
||||||
frame = core.gframe(1, 1, 1, 1)
|
frame = core.gframe(1, 1, 1, 1),
|
||||||
|
children = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local name_brief = "graphics.element{" .. self.elem_type .. "}: "
|
local name_brief = "graphics.element{" .. self.elem_type .. "}: "
|
||||||
@ -199,15 +200,15 @@ function element.new(args)
|
|||||||
-- luacheck: push ignore
|
-- luacheck: push ignore
|
||||||
---@diagnostic disable: unused-local, unused-vararg
|
---@diagnostic disable: unused-local, unused-vararg
|
||||||
|
|
||||||
-- dynamically insert a child element
|
-- handle a child element having been added
|
||||||
---@param id string|integer element identifier
|
---@param id string|integer element identifier
|
||||||
---@param elem graphics_element element
|
---@param child graphics_element child element
|
||||||
function protected.insert(id, elem)
|
function protected.on_added(id, child)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dynamically remove a child element
|
-- handle a child element having been removed
|
||||||
---@param id string|integer element identifier
|
---@param id string|integer element identifier
|
||||||
function protected.remove(id)
|
function protected.on_removed(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- handle a mouse event
|
-- handle a mouse event
|
||||||
@ -280,6 +281,14 @@ function element.new(args)
|
|||||||
---@return graphics_element element, element_id id
|
---@return graphics_element element, element_id id
|
||||||
function protected.get() return public, self.id end
|
function protected.get() return public, self.id end
|
||||||
|
|
||||||
|
-- report completion of element instantiation and get the public interface
|
||||||
|
---@nodiscard
|
||||||
|
---@return graphics_element element, element_id id
|
||||||
|
function protected.complete()
|
||||||
|
if args.parent ~= nil then args.parent.__child_ready(self.id, public) end
|
||||||
|
return public, self.id
|
||||||
|
end
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
-- SETUP --
|
-- SETUP --
|
||||||
-----------
|
-----------
|
||||||
@ -306,11 +315,19 @@ function element.new(args)
|
|||||||
|
|
||||||
-- get the window object
|
-- get the window object
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
function public.window() return protected.window end
|
function public.window() return protected.content_window or protected.window end
|
||||||
|
|
||||||
-- delete this element (hide and unsubscribe from PSIL)
|
-- delete this element (hide and unsubscribe from PSIL)
|
||||||
function public.delete()
|
function public.delete()
|
||||||
-- hide + stop animations
|
-- grab parent fg/bg so we can clear cleanly
|
||||||
|
if args.parent ~= nil then
|
||||||
|
local fg_bg = args.parent.get_fg_bg()
|
||||||
|
protected.window.setBackgroundColor(fg_bg.bkg)
|
||||||
|
protected.window.setTextColor(fg_bg.fgd)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- clear, hide, and stop animations
|
||||||
|
protected.window.clear()
|
||||||
public.hide()
|
public.hide()
|
||||||
|
|
||||||
-- unsubscribe from PSIL
|
-- unsubscribe from PSIL
|
||||||
@ -320,9 +337,9 @@ function element.new(args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- delete all children
|
-- delete all children
|
||||||
for k, v in pairs(self.children) do
|
for k, v in pairs(protected.children) do
|
||||||
v.delete()
|
v.delete()
|
||||||
self.children[k] = nil
|
protected.children[k] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -331,7 +348,7 @@ function element.new(args)
|
|||||||
-- add a child element
|
-- add a child element
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@param key string|nil id
|
---@param key string|nil id
|
||||||
---@param child graphics_template
|
---@param child graphics_base
|
||||||
---@return integer|string key
|
---@return integer|string key
|
||||||
function public.__add_child(key, child)
|
function public.__add_child(key, child)
|
||||||
-- offset first automatic placement
|
-- offset first automatic placement
|
||||||
@ -346,26 +363,34 @@ function element.new(args)
|
|||||||
local child_element = child.get()
|
local child_element = child.get()
|
||||||
|
|
||||||
if key == nil then
|
if key == nil then
|
||||||
table.insert(self.children, child_element)
|
table.insert(protected.children, child_element)
|
||||||
return #self.children
|
return #protected.children
|
||||||
else
|
else
|
||||||
self.children[key] = child_element
|
protected.children[key] = child_element
|
||||||
return key
|
return key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- actions to take upon a child element becoming ready (initial draw/construction completed)
|
||||||
|
---@param key string|integer id
|
||||||
|
---@param child graphics_element
|
||||||
|
function public.__child_ready(key, child)
|
||||||
|
protected.on_added(key, child)
|
||||||
|
end
|
||||||
|
|
||||||
-- get a child element
|
-- get a child element
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@param id element_id
|
---@param id element_id
|
||||||
---@return graphics_element
|
---@return graphics_element
|
||||||
function public.get_child(id) return self.children[id] end
|
function public.get_child(id) return protected.children[id] end
|
||||||
|
|
||||||
-- remove a child element
|
-- remove a child element
|
||||||
---@param id element_id
|
---@param id element_id
|
||||||
function public.remove(id)
|
function public.remove(id)
|
||||||
if self.children[id] ~= nil then
|
if protected.children[id] ~= nil then
|
||||||
self.children[id].delete()
|
protected.children[id].delete()
|
||||||
self.children[id] = nil
|
protected.children[id] = nil
|
||||||
|
protected.on_removed(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -374,13 +399,13 @@ function element.new(args)
|
|||||||
---@param id element_id
|
---@param id element_id
|
||||||
---@return graphics_element|nil element
|
---@return graphics_element|nil element
|
||||||
function public.get_element_by_id(id)
|
function public.get_element_by_id(id)
|
||||||
if self.children[id] == nil then
|
if protected.children[id] == nil then
|
||||||
for _, child in pairs(self.children) do
|
for _, child in pairs(protected.children) do
|
||||||
local elem = child.get_element_by_id(id)
|
local elem = child.get_element_by_id(id)
|
||||||
if elem ~= nil then return elem end
|
if elem ~= nil then return elem end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return self.children[id]
|
return protected.children[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -419,14 +444,14 @@ function element.new(args)
|
|||||||
-- get element width
|
-- get element width
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@return integer width
|
---@return integer width
|
||||||
function public.width()
|
function public.get_width()
|
||||||
return protected.frame.w
|
return protected.frame.w
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get element height
|
-- get element height
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@return integer height
|
---@return integer height
|
||||||
function public.height()
|
function public.get_height()
|
||||||
return protected.frame.h
|
return protected.frame.h
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -501,7 +526,7 @@ function element.new(args)
|
|||||||
|
|
||||||
-- handle the mouse event then pass to children
|
-- handle the mouse event then pass to children
|
||||||
protected.handle_mouse(event_T)
|
protected.handle_mouse(event_T)
|
||||||
for _, child in pairs(self.children) do child.handle_mouse(event_T) end
|
for _, child in pairs(protected.children) do child.handle_mouse(event_T) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -536,7 +561,9 @@ function element.new(args)
|
|||||||
if animate ~= false then public.animate_all() end
|
if animate ~= false then public.animate_all() end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide the element and disables animations
|
-- hide the element and disables animations<br>
|
||||||
|
-- this alone does not cause an element to be fully hidden, it only prevents updates from being shown<br>
|
||||||
|
---@see graphics_element.content_redraw
|
||||||
function public.hide()
|
function public.hide()
|
||||||
public.freeze_all() -- stop animations for efficiency/performance
|
public.freeze_all() -- stop animations for efficiency/performance
|
||||||
protected.window.setVisible(false)
|
protected.window.setVisible(false)
|
||||||
@ -552,7 +579,7 @@ function element.new(args)
|
|||||||
function public.animate_all()
|
function public.animate_all()
|
||||||
if protected.window.isVisible() then
|
if protected.window.isVisible() then
|
||||||
public.animate()
|
public.animate()
|
||||||
for _, child in pairs(self.children) do child.animate_all() end
|
for _, child in pairs(protected.children) do child.animate_all() end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -564,7 +591,7 @@ function element.new(args)
|
|||||||
-- freeze animation(s) for this element and all its children
|
-- freeze animation(s) for this element and all its children
|
||||||
function public.freeze_all()
|
function public.freeze_all()
|
||||||
public.freeze()
|
public.freeze()
|
||||||
for _, child in pairs(self.children) do child.freeze_all() end
|
for _, child in pairs(protected.children) do child.freeze_all() end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- re-draw the element
|
-- re-draw the element
|
||||||
@ -572,6 +599,14 @@ function element.new(args)
|
|||||||
protected.window.redraw()
|
protected.window.redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- if a content window is set, clears it then re-draws all children
|
||||||
|
function public.content_redraw()
|
||||||
|
if protected.content_window ~= nil then
|
||||||
|
protected.content_window.clear()
|
||||||
|
for _, child in pairs(protected.children) do child.redraw() end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return protected
|
return protected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ local function waiting(args)
|
|||||||
|
|
||||||
e.start_anim()
|
e.start_anim()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return waiting
|
return waiting
|
||||||
|
@ -28,7 +28,7 @@ local function colormap(args)
|
|||||||
e.window.setCursorPos(1, 1)
|
e.window.setCursorPos(1, 1)
|
||||||
e.window.blit(spaces, bkg, bkg)
|
e.window.blit(spaces, bkg, bkg)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return colormap
|
return colormap
|
||||||
|
@ -199,7 +199,7 @@ local function hazard_button(args)
|
|||||||
-- initial draw of border
|
-- initial draw of border
|
||||||
draw_border(args.accent)
|
draw_border(args.accent)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return hazard_button
|
return hazard_button
|
||||||
|
@ -131,7 +131,7 @@ local function multi_button(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return multi_button
|
return multi_button
|
||||||
|
@ -121,7 +121,7 @@ local function push_button(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return push_button
|
return push_button
|
||||||
|
@ -104,7 +104,7 @@ local function radio_button(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return radio_button
|
return radio_button
|
||||||
|
@ -116,7 +116,7 @@ local function sidebar(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
draw(false)
|
draw(false)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return sidebar
|
return sidebar
|
||||||
|
@ -189,7 +189,7 @@ local function spinbox(args)
|
|||||||
e.value = 0
|
e.value = 0
|
||||||
set_digits()
|
set_digits()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return spinbox
|
return spinbox
|
||||||
|
@ -87,7 +87,7 @@ local function switch_button(args)
|
|||||||
draw_state()
|
draw_state()
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return switch_button
|
return switch_button
|
||||||
|
@ -125,7 +125,7 @@ local function tabbar(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return tabbar
|
return tabbar
|
||||||
|
@ -17,7 +17,7 @@ local element = require("graphics.element")
|
|||||||
---@param args displaybox_args
|
---@param args displaybox_args
|
||||||
local function displaybox(args)
|
local function displaybox(args)
|
||||||
-- create new graphics element base object
|
-- create new graphics element base object
|
||||||
return element.new(args).get()
|
return element.new(args).complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return displaybox
|
return displaybox
|
||||||
|
@ -19,7 +19,7 @@ local element = require("graphics.element")
|
|||||||
---@return graphics_element element, element_id id
|
---@return graphics_element element, element_id id
|
||||||
local function div(args)
|
local function div(args)
|
||||||
-- create new graphics element base object
|
-- create new graphics element base object
|
||||||
return element.new(args).get()
|
return element.new(args).complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return div
|
return div
|
||||||
|
@ -109,7 +109,7 @@ local function alarm_indicator_light(args)
|
|||||||
e.on_update(1)
|
e.on_update(1)
|
||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return alarm_indicator_light
|
return alarm_indicator_light
|
||||||
|
@ -163,7 +163,7 @@ local function core_map(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
e.on_update(0)
|
e.on_update(0)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return core_map
|
return core_map
|
||||||
|
@ -97,7 +97,7 @@ local function data(args)
|
|||||||
-- initial value draw
|
-- initial value draw
|
||||||
e.on_update(args.value)
|
e.on_update(args.value)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
@ -120,7 +120,7 @@ local function hbar(args)
|
|||||||
-- initialize to 0
|
-- initialize to 0
|
||||||
e.on_update(0)
|
e.on_update(0)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return hbar
|
return hbar
|
||||||
|
@ -69,7 +69,7 @@ local function icon(args)
|
|||||||
-- initial icon draw
|
-- initial icon draw
|
||||||
e.on_update(args.value or 1)
|
e.on_update(args.value or 1)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return icon
|
return icon
|
||||||
|
@ -95,7 +95,7 @@ local function indicator_led(args)
|
|||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return indicator_led
|
return indicator_led
|
||||||
|
@ -109,7 +109,7 @@ local function indicator_led_pair(args)
|
|||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return indicator_led_pair
|
return indicator_led_pair
|
||||||
|
@ -54,7 +54,7 @@ local function indicator_led_rgb(args)
|
|||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return indicator_led_rgb
|
return indicator_led_rgb
|
||||||
|
@ -93,7 +93,7 @@ local function indicator_light(args)
|
|||||||
e.window.setCursorPos(3, 1)
|
e.window.setCursorPos(3, 1)
|
||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return indicator_light
|
return indicator_light
|
||||||
|
@ -80,7 +80,7 @@ local function power(args)
|
|||||||
-- initial value draw
|
-- initial value draw
|
||||||
e.on_update(args.value)
|
e.on_update(args.value)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return power
|
return power
|
||||||
|
@ -85,7 +85,7 @@ local function rad(args)
|
|||||||
-- initial value draw
|
-- initial value draw
|
||||||
e.on_update(types.new_zero_radiation_reading())
|
e.on_update(types.new_zero_radiation_reading())
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return rad
|
return rad
|
||||||
|
@ -75,7 +75,7 @@ local function state_indicator(args)
|
|||||||
-- initial draw
|
-- initial draw
|
||||||
e.on_update(args.value or 1)
|
e.on_update(args.value or 1)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return state_indicator
|
return state_indicator
|
||||||
|
@ -106,7 +106,7 @@ local function tristate_indicator_light(args)
|
|||||||
e.on_update(1)
|
e.on_update(1)
|
||||||
e.window.write(args.label)
|
e.window.write(args.label)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return tristate_indicator_light
|
return tristate_indicator_light
|
||||||
|
@ -100,7 +100,7 @@ local function vbar(args)
|
|||||||
---@param val number 0.0 to 1.0
|
---@param val number 0.0 to 1.0
|
||||||
function e.set_value(val) e.on_update(val) end
|
function e.set_value(val) e.on_update(val) end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return vbar
|
return vbar
|
||||||
|
@ -37,7 +37,7 @@ local function multipane(args)
|
|||||||
|
|
||||||
e.set_value(1)
|
e.set_value(1)
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return multipane
|
return multipane
|
||||||
|
@ -142,7 +142,7 @@ local function pipenet(args)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return pipenet
|
return pipenet
|
||||||
|
@ -178,7 +178,7 @@ local function rectangle(args)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return rectangle
|
return rectangle
|
||||||
|
@ -65,7 +65,7 @@ local function textbox(args)
|
|||||||
display_text(val)
|
display_text(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return textbox
|
return textbox
|
||||||
|
@ -82,7 +82,7 @@ local function tiling(args)
|
|||||||
if inner_width % 2 == 0 then alternator = not alternator end
|
if inner_width % 2 == 0 then alternator = not alternator end
|
||||||
end
|
end
|
||||||
|
|
||||||
return e.get()
|
return e.complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
return tiling
|
return tiling
|
||||||
|
@ -17,7 +17,7 @@ local coreio = require("pocket.coreio")
|
|||||||
local pocket = require("pocket.pocket")
|
local pocket = require("pocket.pocket")
|
||||||
local renderer = require("pocket.renderer")
|
local renderer = require("pocket.renderer")
|
||||||
|
|
||||||
local POCKET_VERSION = "alpha-v0.3.3"
|
local POCKET_VERSION = "alpha-v0.3.4"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -25,7 +25,7 @@ local function init(parent, y, is_api)
|
|||||||
-- bounding box div
|
-- bounding box div
|
||||||
local box = Div{parent=root,x=1,y=y,height=5}
|
local box = Div{parent=root,x=1,y=y,height=5}
|
||||||
|
|
||||||
local waiting_x = math.floor(parent.width() / 2) - 1
|
local waiting_x = math.floor(parent.get_width() / 2) - 1
|
||||||
|
|
||||||
if is_api then
|
if is_api then
|
||||||
WaitingAnim{parent=box,x=waiting_x,y=1,fg_bg=cpair(colors.blue,style.root.bkg)}
|
WaitingAnim{parent=box,x=waiting_x,y=1,fg_bg=cpair(colors.blue,style.root.bkg)}
|
||||||
|
@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc")
|
|||||||
local renderer = require("reactor-plc.renderer")
|
local renderer = require("reactor-plc.renderer")
|
||||||
local threads = require("reactor-plc.threads")
|
local threads = require("reactor-plc.threads")
|
||||||
|
|
||||||
local R_PLC_VERSION = "v1.3.3"
|
local R_PLC_VERSION = "v1.3.4"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -28,7 +28,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
|||||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||||
|
|
||||||
local RTU_VERSION = "v1.2.3"
|
local RTU_VERSION = "v1.2.4"
|
||||||
|
|
||||||
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE
|
||||||
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE
|
||||||
|
@ -19,7 +19,7 @@ local supervisor = require("supervisor.supervisor")
|
|||||||
|
|
||||||
local svsessions = require("supervisor.session.svsessions")
|
local svsessions = require("supervisor.session.svsessions")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "v0.16.3"
|
local SUPERVISOR_VERSION = "v0.16.4"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
Loading…
Reference in New Issue
Block a user