mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2025-07-26 03:22:51 +00:00
updated type hints for remaining graphics_element generic types
This commit is contained in:
@ -302,7 +302,7 @@ local function load_settings(target, raw)
|
||||
end
|
||||
|
||||
-- create the config view
|
||||
---@param display graphics_element
|
||||
---@param display DisplayBox
|
||||
local function config_view(display)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local function exit() os.queueEvent("terminate") end
|
||||
|
@ -15,7 +15,7 @@ local cpair = core.cpair
|
||||
local border = core.border
|
||||
|
||||
-- new boiler view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param ps psil ps interface
|
||||
|
@ -22,7 +22,7 @@ local border = core.border
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- new induction matrix view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param data imatrix_session_db matrix data
|
||||
|
@ -33,7 +33,7 @@ local bw_fg_bg = style.bw_fg_bg
|
||||
local period = core.flasher.PERIOD
|
||||
|
||||
-- new process control view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
local function new_view(root, x, y)
|
||||
|
@ -17,7 +17,7 @@ local cpair = core.cpair
|
||||
local border = core.border
|
||||
|
||||
-- create new reactor view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param ps psil ps interface
|
||||
|
@ -16,7 +16,7 @@ local cpair = core.cpair
|
||||
local border = core.border
|
||||
|
||||
-- new turbine view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param ps psil ps interface
|
||||
|
@ -42,7 +42,7 @@ local gry_wht = style.gray_white
|
||||
local period = core.flasher.PERIOD
|
||||
|
||||
-- create a unit view
|
||||
---@param parent graphics_element parent
|
||||
---@param parent DisplayBox parent
|
||||
---@param id integer
|
||||
local function init(parent, id)
|
||||
local s_hi_box = style.theme.highlight_box
|
||||
|
@ -31,7 +31,7 @@ local wh_gray = style.wh_gray
|
||||
local lg_gray = style.lg_gray
|
||||
|
||||
-- make a new unit flow window
|
||||
---@param parent graphics_element parent
|
||||
---@param parent DisplayBox parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param wide boolean whether to render wide version
|
||||
|
@ -19,7 +19,7 @@ local ALIGN = core.ALIGN
|
||||
local pipe = core.pipe
|
||||
|
||||
-- make a new unit overview window
|
||||
---@param parent graphics_element parent
|
||||
---@param parent Container parent
|
||||
---@param x integer top left x
|
||||
---@param y integer top left y
|
||||
---@param unit ioctl_unit unit database entry
|
||||
|
@ -34,7 +34,7 @@ local pipe = core.pipe
|
||||
local wh_gray = style.wh_gray
|
||||
|
||||
-- create new flow view
|
||||
---@param main graphics_element main displaybox
|
||||
---@param main DisplayBox main displaybox
|
||||
local function init(main)
|
||||
local s_hi_bright = style.theme.highlight_box_bright
|
||||
local s_field = style.theme.field_box
|
||||
|
@ -34,7 +34,7 @@ local cpair = core.cpair
|
||||
local led_grn = style.led_grn
|
||||
|
||||
-- create new front panel view
|
||||
---@param panel graphics_element main displaybox
|
||||
---@param panel DisplayBox main displaybox
|
||||
---@param num_units integer number of units (number of unit monitors)
|
||||
local function init(panel, num_units)
|
||||
local ps = iocontrol.get_db().fp.ps
|
||||
|
@ -21,7 +21,7 @@ local DataIndicator = require("graphics.elements.indicators.DataIndicator")
|
||||
local ALIGN = core.ALIGN
|
||||
|
||||
-- create new main view
|
||||
---@param main graphics_element main displaybox
|
||||
---@param main DisplayBox main displaybox
|
||||
local function init(main)
|
||||
local s_header = style.theme.header
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
local unit_detail = require("coordinator.ui.components.unit_detail")
|
||||
|
||||
-- create a unit view
|
||||
---@param main graphics_element main displaybox
|
||||
---@param main DisplayBox main displaybox
|
||||
---@param id integer
|
||||
local function init(main, id)
|
||||
unit_detail(main, id)
|
||||
|
@ -17,6 +17,8 @@ core.events = events
|
||||
---@enum ALIGN
|
||||
core.ALIGN = { LEFT = 1, CENTER = 2, RIGHT = 3 }
|
||||
|
||||
---@alias Container DisplayBox|Div|ListBox|MultiPane|AppMultiPane|Rectangle
|
||||
|
||||
---@class graphics_border
|
||||
---@field width integer
|
||||
---@field color color
|
||||
|
@ -122,7 +122,7 @@ local function load_settings(target, raw)
|
||||
end
|
||||
|
||||
-- create the config view
|
||||
---@param display graphics_element
|
||||
---@param display DisplayBox
|
||||
local function config_view(display)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local function exit() os.queueEvent("terminate") end
|
||||
|
@ -109,10 +109,10 @@ pocket.APP_ID = APP_ID
|
||||
---@param smem pkt_shared_memory
|
||||
function pocket.init_nav(smem)
|
||||
local self = {
|
||||
pane = nil, ---@type MultiPane|nil
|
||||
pane = nil, ---@type AppMultiPane|MultiPane|nil
|
||||
sidebar = nil, ---@type Sidebar|nil
|
||||
apps = {}, ---@type pocket_app[]
|
||||
containers = {}, ---@type graphics_element[]
|
||||
containers = {}, ---@type Container[]
|
||||
help_map = {}, ---@type { [string]: function }
|
||||
help_return = nil, ---@type POCKET_APP_ID|nil
|
||||
loader_return = nil, ---@type POCKET_APP_ID|nil
|
||||
@ -134,8 +134,8 @@ function pocket.init_nav(smem)
|
||||
|
||||
-- register an app
|
||||
---@param app_id POCKET_APP_ID app ID
|
||||
---@param container graphics_element element that contains this app (usually a Div)
|
||||
---@param pane? graphics_element multipane if this is a simple paned app, then nav_to must be a number
|
||||
---@param container Container element that contains this app (usually a Div)
|
||||
---@param pane? AppMultiPane|MultiPane multipane if this is a simple paned app, then nav_to must be a number
|
||||
---@param require_sv? boolean true to specifiy if this app should be unloaded when the supervisor connection is lost
|
||||
---@param require_api? boolean true to specifiy if this app should be unloaded when the api connection is lost
|
||||
function nav.register_app(app_id, container, pane, require_sv, require_api)
|
||||
@ -159,7 +159,7 @@ function pocket.init_nav(smem)
|
||||
function app.requires_conn() return require_sv or require_api or false end
|
||||
|
||||
-- delayed set of the pane if it wasn't ready at the start
|
||||
---@param root_pane graphics_element multipane
|
||||
---@param root_pane AppMultiPane|MultiPane multipane
|
||||
function app.set_root_pane(root_pane)
|
||||
app.pane = root_pane
|
||||
end
|
||||
|
@ -42,7 +42,7 @@ local hzd_fg_bg = cpair(colors.white, colors.gray)
|
||||
local dis_colors = cpair(colors.white, colors.lightGray)
|
||||
|
||||
-- new unit control page view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
@ -63,7 +63,7 @@ local function new_view(root)
|
||||
local btn_fg_bg = cpair(colors.green, colors.black)
|
||||
local btn_active = cpair(colors.white, colors.black)
|
||||
|
||||
local page_div = nil ---@type nil|graphics_element
|
||||
local page_div = nil ---@type Div|nil
|
||||
|
||||
-- set sidebar to display unit-specific fields based on a specified unit
|
||||
local function set_sidebar()
|
||||
@ -83,7 +83,7 @@ local function new_view(root)
|
||||
local function load()
|
||||
page_div = Div{parent=main,y=2,width=main.get_width()}
|
||||
|
||||
local panes = {}
|
||||
local panes = {} ---@type Div[]
|
||||
|
||||
local active_unit = 1
|
||||
|
||||
|
@ -22,7 +22,7 @@ local cpair = core.cpair
|
||||
local APP_ID = pocket.APP_ID
|
||||
|
||||
-- create diagnostic app pages
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function create_pages(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -13,7 +13,7 @@ local TextBox = require("graphics.elements.TextBox")
|
||||
local APP_ID = pocket.APP_ID
|
||||
|
||||
-- create placeholder app page
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function create_pages(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -36,7 +36,7 @@ local APP_ID = pocket.APP_ID
|
||||
-- local text_fg = style.text_fg
|
||||
|
||||
-- new system guide view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
@ -58,7 +58,7 @@ local function new_view(root)
|
||||
|
||||
app.set_sidebar({{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(APP_ID.ROOT) end }})
|
||||
|
||||
local page_div = nil ---@type nil|graphics_element
|
||||
local page_div = nil ---@type Div|nil
|
||||
|
||||
-- load the app (create the elements)
|
||||
local function load()
|
||||
@ -88,7 +88,7 @@ local function new_view(root)
|
||||
local fps = Div{parent=page_div,x=2,width=p_width}
|
||||
local gls = Div{parent=page_div,x=2,width=p_width}
|
||||
local lnk = Div{parent=page_div,x=2,width=p_width}
|
||||
local panes = { home, search, use, uis, fps, gls, lnk }
|
||||
local panes = { home, search, use, uis, fps, gls, lnk } ---@type Div[]
|
||||
|
||||
local doc_map = {} ---@type { [string]: function }
|
||||
local search_db = {} ---@type [ string, string, string, function ][]
|
||||
|
@ -18,7 +18,7 @@ local APP_ID = pocket.APP_ID
|
||||
local LINK_STATE = iocontrol.LINK_STATE
|
||||
|
||||
-- create the connecting to SV & API page
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function create_pages(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -25,7 +25,7 @@ local cpair = core.cpair
|
||||
local APP_ID = pocket.APP_ID
|
||||
|
||||
-- create system app pages
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function create_pages(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -47,7 +47,7 @@ local emc_ind_s = {
|
||||
}
|
||||
|
||||
-- new unit page view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
@ -69,7 +69,7 @@ local function new_view(root)
|
||||
local btn_active = cpair(colors.white, colors.black)
|
||||
|
||||
local nav_links = {}
|
||||
local page_div = nil ---@type nil|graphics_element
|
||||
local page_div = nil ---@type Div|nil
|
||||
|
||||
-- set sidebar to display unit-specific fields based on a specified unit
|
||||
local function set_sidebar(id)
|
||||
@ -99,7 +99,7 @@ local function new_view(root)
|
||||
local function load()
|
||||
page_div = Div{parent=main,y=2,width=main.get_width()}
|
||||
|
||||
local panes = {}
|
||||
local panes = {} ---@type Div[]
|
||||
|
||||
local active_unit = 1
|
||||
|
||||
|
@ -18,7 +18,7 @@ local ALIGN = core.ALIGN
|
||||
local cpair = core.cpair
|
||||
|
||||
-- create a waiting view
|
||||
---@param parent graphics_element parent
|
||||
---@param parent Container parent
|
||||
---@param y integer y offset
|
||||
local function init(parent, y, is_api)
|
||||
-- root div
|
||||
|
@ -38,7 +38,7 @@ local cpair = core.cpair
|
||||
local APP_ID = pocket.APP_ID
|
||||
|
||||
-- create new main view
|
||||
---@param main graphics_element main displaybox
|
||||
---@param main DisplayBox main displaybox
|
||||
local function init(main)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -21,7 +21,7 @@ local DOC_TYPE = docs.DOC_ITEM_TYPE
|
||||
local LIST_TYPE = docs.DOC_LIST_TYPE
|
||||
|
||||
-- new guide documentation section
|
||||
---@param data { [1]: pocket_app, [2]: graphics_element, [3]: graphics_element[], [4]: { [string]: function }, [5]: [ string, string, string, function ][], [6]: cpair, [7]: cpair }
|
||||
---@param data { [1]: pocket_app, [2]: Div, [3]: Div[], [4]: { [string]: function }, [5]: [ string, string, string, function ][], [6]: cpair, [7]: cpair }
|
||||
---@param base_page nav_tree_page
|
||||
---@param title string
|
||||
---@param items table
|
||||
|
@ -19,7 +19,7 @@ local cpair = core.cpair
|
||||
local APP_ID = pocket.APP_ID
|
||||
|
||||
-- new home page view
|
||||
---@param root graphics_element parent
|
||||
---@param root Container parent
|
||||
local function new_view(root)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
|
@ -29,8 +29,8 @@ local yel_ind_s = style.icon_states.yel_ind_s
|
||||
-- create a boiler view in the unit app
|
||||
---@param app pocket_app
|
||||
---@param u_page nav_tree_page
|
||||
---@param panes graphics_element[]
|
||||
---@param blr_pane graphics_element
|
||||
---@param panes Div[]
|
||||
---@param blr_pane Div
|
||||
---@param b_id integer boiler ID
|
||||
---@param ps psil
|
||||
---@param update function
|
||||
|
@ -29,8 +29,8 @@ local yel_ind_s = style.icon_states.yel_ind_s
|
||||
-- create a reactor view in the unit app
|
||||
---@param app pocket_app
|
||||
---@param u_page nav_tree_page
|
||||
---@param panes graphics_element[]
|
||||
---@param page_div graphics_element
|
||||
---@param panes Div[]
|
||||
---@param page_div Div
|
||||
---@param u_ps psil
|
||||
---@param update function
|
||||
return function (app, u_page, panes, page_div, u_ps, update)
|
||||
|
@ -30,8 +30,8 @@ local yel_ind_s = style.icon_states.yel_ind_s
|
||||
-- create a turbine view in the unit app
|
||||
---@param app pocket_app
|
||||
---@param u_page nav_tree_page
|
||||
---@param panes graphics_element[]
|
||||
---@param tbn_pane graphics_element
|
||||
---@param panes Div[]
|
||||
---@param tbn_pane Div
|
||||
---@param u_id integer unit ID
|
||||
---@param t_id integer turbine ID
|
||||
---@param ps psil
|
||||
|
@ -160,7 +160,7 @@ local function self_check()
|
||||
end
|
||||
|
||||
-- exit self check back home
|
||||
---@param main_pane graphics_element
|
||||
---@param main_pane MultiPane
|
||||
local function exit_self_check(main_pane)
|
||||
tcd.abort(handle_timeout)
|
||||
self.net_listen = false
|
||||
@ -172,9 +172,9 @@ end
|
||||
local check = {}
|
||||
|
||||
-- create the self-check view
|
||||
---@param main_pane graphics_element
|
||||
---@param main_pane MultiPane
|
||||
---@param settings_cfg plc_config
|
||||
---@param check_sys graphics_element
|
||||
---@param check_sys Div
|
||||
---@param style { [string]: cpair }
|
||||
function check.create(main_pane, settings_cfg, check_sys, style)
|
||||
local bw_fg_bg = style.bw_fg_bg
|
||||
|
@ -61,7 +61,7 @@ local system = {}
|
||||
|
||||
-- create the system configuration view
|
||||
---@param tool_ctl _plc_cfg_tool_ctl
|
||||
---@param main_pane graphics_element
|
||||
---@param main_pane MultiPane
|
||||
---@param cfg_sys [ plc_config, plc_config, plc_config, table, function ]
|
||||
---@param divs Div[]
|
||||
---@param style { [string]: cpair }
|
||||
|
@ -125,7 +125,7 @@ local function load_settings(target, raw)
|
||||
end
|
||||
|
||||
-- create the config view
|
||||
---@param display graphics_element
|
||||
---@param display DisplayBox
|
||||
local function config_view(display)
|
||||
local bw_fg_bg = style.bw_fg_bg
|
||||
local g_lg_fg_bg = style.g_lg_fg_bg
|
||||
|
@ -34,7 +34,7 @@ local ind_grn = style.ind_grn
|
||||
local ind_red = style.ind_red
|
||||
|
||||
-- create new front panel view
|
||||
---@param panel graphics_element main displaybox
|
||||
---@param panel DisplayBox main displaybox
|
||||
local function init(panel)
|
||||
local s_hi_box = style.theme.highlight_box
|
||||
|
||||
|
@ -259,7 +259,7 @@ local function load_settings(target, raw)
|
||||
end
|
||||
|
||||
-- create the config view
|
||||
---@param display graphics_element
|
||||
---@param display DisplayBox
|
||||
local function config_view(display)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local function exit() os.queueEvent("terminate") end
|
||||
|
@ -30,7 +30,7 @@ local ind_grn = style.ind_grn
|
||||
local UNIT_TYPE_LABELS = { "UNKNOWN", "REDSTONE", "BOILER", "TURBINE", "DYNAMIC TANK", "IND MATRIX", "SPS", "SNA", "ENV DETECTOR" }
|
||||
|
||||
-- create new front panel view
|
||||
---@param panel graphics_element main displaybox
|
||||
---@param panel DisplayBox main displaybox
|
||||
---@param units rtu_registry_entry[] unit list
|
||||
local function init(panel, units)
|
||||
local disabled_fg = style.fp.disabled_fg
|
||||
|
@ -153,7 +153,7 @@ local function load_settings(target, raw)
|
||||
end
|
||||
|
||||
-- create the config view
|
||||
---@param display graphics_element
|
||||
---@param display DisplayBox
|
||||
local function config_view(display)
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local function exit() os.queueEvent("terminate") end
|
||||
|
@ -33,7 +33,7 @@ local cpair = core.cpair
|
||||
local ind_grn = style.ind_grn
|
||||
|
||||
-- create new front panel view
|
||||
---@param panel graphics_element main displaybox
|
||||
---@param panel DisplayBox main displaybox
|
||||
local function init(panel)
|
||||
local s_hi_box = style.theme.highlight_box
|
||||
local s_hi_bright = style.theme.highlight_box_bright
|
||||
|
Reference in New Issue
Block a user