From a4a59d4a3d82067701ed47261aeea5470142bcbe Mon Sep 17 00:00:00 2001 From: Mikayla Date: Wed, 25 Sep 2024 21:21:12 +0000 Subject: [PATCH] specific graphics element types rather than graphics_element --- coordinator/configure.lua | 28 ++++++------- coordinator/renderer.lua | 8 ++-- coordinator/ui/components/pkt_entry.lua | 2 +- coordinator/ui/layout/main_view.lua | 2 +- coordinator/ui/pgi.lua | 8 ++-- graphics/element.lua | 2 +- pocket/configure.lua | 8 ++-- pocket/iocontrol.lua | 8 ++-- pocket/pocket.lua | 8 ++-- reactor-plc/config/check.lua | 4 +- reactor-plc/config/system.lua | 4 +- reactor-plc/configure.lua | 10 ++--- rtu/configure.lua | 50 +++++++++++------------ supervisor/configure.lua | 22 +++++----- supervisor/panel/components/chk_entry.lua | 2 +- supervisor/panel/components/pdg_entry.lua | 2 +- supervisor/panel/components/rtu_entry.lua | 2 +- supervisor/panel/pgi.lua | 30 +++++++------- 18 files changed, 100 insertions(+), 100 deletions(-) diff --git a/coordinator/configure.lua b/coordinator/configure.lua index ad0221d..d4339b8 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -81,29 +81,29 @@ local tool_ctl = { importing_legacy = false, jumped_to_color = false, - view_cfg = nil, ---@type graphics_element - color_cfg = nil, ---@type graphics_element - color_next = nil, ---@type graphics_element - color_apply = nil, ---@type graphics_element - settings_apply = nil, ---@type graphics_element + view_cfg = nil, ---@type PushButton + color_cfg = nil, ---@type PushButton + color_next = nil, ---@type PushButton + color_apply = nil, ---@type PushButton + settings_apply = nil, ---@type PushButton gen_summary = nil, ---@type function show_current_cfg = nil, ---@type function load_legacy = nil, ---@type function show_auth_key = nil, ---@type function - show_key_btn = nil, ---@type graphics_element - auth_key_textbox = nil, ---@type graphics_element + show_key_btn = nil, ---@type PushButton + auth_key_textbox = nil, ---@type TextBox auth_key_value = "", sv_connect = nil, ---@type function - sv_conn_button = nil, ---@type graphics_element - sv_conn_status = nil, ---@type graphics_element - sv_conn_detail = nil, ---@type graphics_element - sv_skip = nil, ---@type graphics_element - sv_next = nil, ---@type graphics_element + sv_conn_button = nil, ---@type PushButton + sv_conn_status = nil, ---@type TextBox + sv_conn_detail = nil, ---@type TextBox + sv_skip = nil, ---@type PushButton + sv_next = nil, ---@type PushButton - apply_mon = nil, ---@type graphics_element + apply_mon = nil, ---@type PushButton update_mon_reqs = nil, ---@type function gen_mon_list = function () end, @@ -622,7 +622,7 @@ local function config_view(display) local mon_desc = TextBox{parent=mon_c_3,x=1,y=1,height=4,text=""} - local mon_unit_l, mon_unit = nil, nil ---@type graphics_element, graphics_element + local mon_unit_l, mon_unit = nil, nil ---@type TextBox, NumberField local mon_warn = TextBox{parent=mon_c_3,x=1,y=11,height=2,text="",fg_bg=cpair(colors.red,colors.lightGray)} diff --git a/coordinator/renderer.lua b/coordinator/renderer.lua index ae2c1c3..cfa5013 100644 --- a/coordinator/renderer.lua +++ b/coordinator/renderer.lua @@ -34,10 +34,10 @@ local engine = { ui_ready = false, fp_ready = false, ui = { - front_panel = nil, ---@type graphics_element|nil - main_display = nil, ---@type graphics_element|nil - flow_display = nil, ---@type graphics_element|nil - unit_displays = {} ---@type (graphics_element|nil)[] + front_panel = nil, ---@type DisplayBox|nil + main_display = nil, ---@type DisplayBox|nil + flow_display = nil, ---@type DisplayBox|nil + unit_displays = {} ---@type (DisplayBox|nil)[] }, disable_flow_view = false } diff --git a/coordinator/ui/components/pkt_entry.lua b/coordinator/ui/components/pkt_entry.lua index 0a8a2f0..b7a8d1e 100644 --- a/coordinator/ui/components/pkt_entry.lua +++ b/coordinator/ui/components/pkt_entry.lua @@ -18,7 +18,7 @@ local ALIGN = core.ALIGN local cpair = core.cpair -- create a pocket list entry ----@param parent graphics_element parent +---@param parent ListBox parent ---@param id integer PKT session ID local function init(parent, id) local s_hi_box = style.fp_theme.highlight_box diff --git a/coordinator/ui/layout/main_view.lua b/coordinator/ui/layout/main_view.lua index 2d06db0..f730a75 100644 --- a/coordinator/ui/layout/main_view.lua +++ b/coordinator/ui/layout/main_view.lua @@ -37,7 +37,7 @@ local function init(main) ping.register(facility.ps, "sv_ping", ping.update) datetime.register(facility.ps, "date_time", datetime.set_value) - ---@type graphics_element, graphics_element, graphics_element, graphics_element + ---@type Div, Div, Div, Div local uo_1, uo_2, uo_3, uo_4 local cnc_y_start = 3 diff --git a/coordinator/ui/pgi.lua b/coordinator/ui/pgi.lua index c17b784..70ca0b8 100644 --- a/coordinator/ui/pgi.lua +++ b/coordinator/ui/pgi.lua @@ -8,17 +8,17 @@ local util = require("scada-common.util") local pgi = {} local data = { - pkt_list = nil, ---@type nil|graphics_element + pkt_list = nil, ---@type ListBox|nil pkt_entry = nil, ---@type function -- session entries s_entries = { - pkt = {} ---@type graphics_element[] + pkt = {} ---@type Div[] } } -- link list boxes ----@param pkt_list graphics_element pocket list element ----@param pkt_entry function pocket entry constructor +---@param pkt_list ListBox pocket list element +---@param pkt_entry fun(parent: ListBox, id: integer) : Div pocket entry constructor function pgi.link_elements(pkt_list, pkt_entry) data.pkt_list = pkt_list data.pkt_entry = pkt_entry diff --git a/graphics/element.lua b/graphics/element.lua index 2cfcc93..ff93414 100644 --- a/graphics/element.lua +++ b/graphics/element.lua @@ -566,7 +566,7 @@ function element.new(args, constraint, child_offset_x, child_offset_y) -- remove all child elements and reset next y function public.remove_all() for i = 1, #protected.children do - local child = protected.children[i].get() ---@type graphics_element + local child = protected.children[i].get() ---@type graphics_element child.delete() protected.on_removed(child.get_id()) end diff --git a/pocket/configure.lua b/pocket/configure.lua index fdf5c93..773610a 100644 --- a/pocket/configure.lua +++ b/pocket/configure.lua @@ -58,8 +58,8 @@ local tool_ctl = { viewing_config = false, importing_legacy = false, - view_cfg = nil, ---@type graphics_element - settings_apply = nil, ---@type graphics_element + view_cfg = nil, ---@type PushButton + settings_apply = nil, ---@type PushButton set_networked = nil, ---@type function bundled_emcool = nil, ---@type function @@ -68,8 +68,8 @@ local tool_ctl = { load_legacy = nil, ---@type function show_auth_key = nil, ---@type function - show_key_btn = nil, ---@type graphics_element - auth_key_textbox = nil, ---@type graphics_element + show_key_btn = nil, ---@type PushButton + auth_key_textbox = nil, ---@type TextBox auth_key_value = "" } diff --git a/pocket/iocontrol.lua b/pocket/iocontrol.lua index 9c3e75c..b11483d 100644 --- a/pocket/iocontrol.lua +++ b/pocket/iocontrol.lua @@ -83,10 +83,10 @@ function iocontrol.init_core(pkt_comms, nav, cfg) get_tone_states = function () comms.diag__get_alarm_tones() end, - ready_warn = nil, ---@type graphics_element - tone_buttons = {}, ---@type graphics_element[] - alarm_buttons = {}, ---@type graphics_element[] - tone_indicators = {} ---@type graphics_element[] indicators to update from supervisor tone states + ready_warn = nil, ---@type TextBox + tone_buttons = {}, ---@type SwitchButton[] + alarm_buttons = {}, ---@type CheckBox[] + tone_indicators = {} ---@type IndicatorLight[] indicators to update from supervisor tone states } -- API access diff --git a/pocket/pocket.lua b/pocket/pocket.lua index 19628fc..f69cc3b 100644 --- a/pocket/pocket.lua +++ b/pocket/pocket.lua @@ -109,8 +109,8 @@ pocket.APP_ID = APP_ID ---@param smem pkt_shared_memory function pocket.init_nav(smem) local self = { - pane = nil, ---@type graphics_element - sidebar = nil, ---@type graphics_element + pane = nil, ---@type MultiPane|nil + sidebar = nil, ---@type Sidebar|nil apps = {}, ---@type pocket_app[] containers = {}, ---@type graphics_element[] help_map = {}, ---@type { [string]: function } @@ -125,11 +125,11 @@ function pocket.init_nav(smem) local nav = {} -- set the root pane element to switch between apps with - ---@param root_pane graphics_element + ---@param root_pane MultiPane function nav.set_pane(root_pane) self.pane = root_pane end -- link sidebar element - ---@param sidebar graphics_element + ---@param sidebar Sidebar function nav.set_sidebar(sidebar) self.sidebar = sidebar end -- register an app diff --git a/reactor-plc/config/check.lua b/reactor-plc/config/check.lua index 98b100b..0f20155 100644 --- a/reactor-plc/config/check.lua +++ b/reactor-plc/config/check.lua @@ -33,8 +33,8 @@ local self = { settings = nil, ---@type plc_config - run_test_btn = nil, ---@type graphics_element - sc_log = nil, ---@type graphics_element + run_test_btn = nil, ---@type PushButton + sc_log = nil, ---@type ListBox self_check_msg = nil ---@type function } diff --git a/reactor-plc/config/system.lua b/reactor-plc/config/system.lua index 542e7a4..ab167ce 100644 --- a/reactor-plc/config/system.lua +++ b/reactor-plc/config/system.lua @@ -31,8 +31,8 @@ local self = { bundled_emcool = nil, ---@type function show_auth_key = nil, ---@type function - show_key_btn = nil, ---@type graphics_element - auth_key_textbox = nil, ---@type graphics_element + show_key_btn = nil, ---@type PushButton + auth_key_textbox = nil, ---@type TextBox auth_key_value = "" } diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index af56161..99c3a5a 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -58,11 +58,11 @@ local tool_ctl = { viewing_config = false, jumped_to_color = false, - view_cfg = nil, ---@type graphics_element - color_cfg = nil, ---@type graphics_element - color_next = nil, ---@type graphics_element - color_apply = nil, ---@type graphics_element - settings_apply = nil, ---@type graphics_element + view_cfg = nil, ---@type PushButton + color_cfg = nil, ---@type PushButton + color_next = nil, ---@type PushButton + color_apply = nil, ---@type PushButton + settings_apply = nil, ---@type PushButton gen_summary = nil, ---@type function load_legacy = nil, ---@type function diff --git a/rtu/configure.lua b/rtu/configure.lua index adc761a..2c199e8 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -130,14 +130,14 @@ local tool_ctl = { rs_cfg_port = IO.F_SCRAM, ---@type IO_PORT rs_cfg_editing = false, ---@type integer|false - view_gw_cfg = nil, ---@type graphics_element - dev_cfg = nil, ---@type graphics_element - rs_cfg = nil, ---@type graphics_element - color_cfg = nil, ---@type graphics_element - color_next = nil, ---@type graphics_element - color_apply = nil, ---@type graphics_element - settings_apply = nil, ---@type graphics_element - settings_confirm = nil, ---@type graphics_element + view_gw_cfg = nil, ---@type PushButton + dev_cfg = nil, ---@type PushButton + rs_cfg = nil, ---@type PushButton + color_cfg = nil, ---@type PushButton + color_next = nil, ---@type PushButton + color_apply = nil, ---@type PushButton + settings_apply = nil, ---@type PushButton + settings_confirm = nil, ---@type PushButton go_home = nil, ---@type function gen_summary = nil, ---@type function @@ -149,26 +149,26 @@ local tool_ctl = { gen_rs_summary = nil, ---@type function show_auth_key = nil, ---@type function - show_key_btn = nil, ---@type graphics_element - auth_key_textbox = nil, ---@type graphics_element + show_key_btn = nil, ---@type PushButton + auth_key_textbox = nil, ---@type TextBox auth_key_value = "", - ppm_devs = nil, ---@type graphics_element - p_name_msg = nil, ---@type graphics_element - p_prompt = nil, ---@type graphics_element - p_idx = nil, ---@type graphics_element - p_unit = nil, ---@type graphics_element - p_assign_btn = nil, ---@type graphics_element - p_desc = nil, ---@type graphics_element - p_desc_ext = nil, ---@type graphics_element - p_err = nil, ---@type graphics_element + ppm_devs = nil, ---@type ListBox + p_name_msg = nil, ---@type TextBox + p_prompt = nil, ---@type TextBox + p_idx = nil, ---@type NumberField + p_unit = nil, ---@type NumberField + p_assign_btn = nil, ---@type RadioButton + p_desc = nil, ---@type TextBox + p_desc_ext = nil, ---@type TextBox + p_err = nil, ---@type TextBox - rs_cfg_selection = nil, ---@type graphics_element - rs_cfg_unit_l = nil, ---@type graphics_element - rs_cfg_unit = nil, ---@type graphics_element - rs_cfg_side_l = nil, ---@type graphics_element - rs_cfg_color = nil, ---@type graphics_element - rs_cfg_shortcut = nil ---@type graphics_element + rs_cfg_selection = nil, ---@type TextBox + rs_cfg_unit_l = nil, ---@type TextBox + rs_cfg_unit = nil, ---@type NumberField + rs_cfg_side_l = nil, ---@type TextBox + rs_cfg_color = nil, ---@type Radio2D + rs_cfg_shortcut = nil ---@type TextBox } ---@class rtu_config diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 6352056..05891ec 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -62,26 +62,26 @@ local tool_ctl = { importing_legacy = false, jumped_to_color = false, - view_cfg = nil, ---@type graphics_element - color_cfg = nil, ---@type graphics_element - color_next = nil, ---@type graphics_element - color_apply = nil, ---@type graphics_element - settings_apply = nil, ---@type graphics_element + view_cfg = nil, ---@type PushButton + color_cfg = nil, ---@type PushButton + color_next = nil, ---@type PushButton + color_apply = nil, ---@type PushButton + settings_apply = nil, ---@type PushButton gen_summary = nil, ---@type function show_current_cfg = nil, ---@type function load_legacy = nil, ---@type function show_auth_key = nil, ---@type function - show_key_btn = nil, ---@type graphics_element - auth_key_textbox = nil, ---@type graphics_element + show_key_btn = nil, ---@type PushButton + auth_key_textbox = nil, ---@type TextBox auth_key_value = "", - cooling_elems = {}, ---@type { line: graphics_element, turbines: graphics_element, boilers: graphics_element, tank: graphics_element }[] - tank_elems = {}, ---@type { div: graphics_element, tank_opt: graphics_element, no_tank: graphics_element }[] + cooling_elems = {}, ---@type { line: Div, turbines: NumberField, boilers: NumberField, tank: CheckBox }[] + tank_elems = {}, ---@type { div: Div, tank_opt: Radio2D, no_tank: TextBox }[] - vis_ftanks = {}, ---@type { line: graphics_element, pipe_conn?: graphics_element, pipe_chain?: graphics_element, pipe_direct?: graphics_element, label?: graphics_element }[] - vis_utanks = {} ---@type { line: graphics_element, label: graphics_element }[] + vis_ftanks = {}, ---@type { line: Div, pipe_conn?: TextBox, pipe_chain?: TextBox, pipe_direct?: TextBox, label?: TextBox }[] + vis_utanks = {} ---@type { line: Div, label: TextBox }[] } ---@class svr_config diff --git a/supervisor/panel/components/chk_entry.lua b/supervisor/panel/components/chk_entry.lua index 8cce5db..eebba3b 100644 --- a/supervisor/panel/components/chk_entry.lua +++ b/supervisor/panel/components/chk_entry.lua @@ -16,7 +16,7 @@ local ALIGN = core.ALIGN local cpair = core.cpair -- create an ID check list entry ----@param parent graphics_element parent +---@param parent ListBox parent ---@param msg string message ---@param fail_code integer failure code local function init(parent, msg, fail_code) diff --git a/supervisor/panel/components/pdg_entry.lua b/supervisor/panel/components/pdg_entry.lua index a60dccd..d160ef3 100644 --- a/supervisor/panel/components/pdg_entry.lua +++ b/supervisor/panel/components/pdg_entry.lua @@ -18,7 +18,7 @@ local ALIGN = core.ALIGN local cpair = core.cpair -- create a pocket diagnostics list entry ----@param parent graphics_element parent +---@param parent ListBox parent ---@param id integer PDG session ID local function init(parent, id) local s_hi_box = style.theme.highlight_box diff --git a/supervisor/panel/components/rtu_entry.lua b/supervisor/panel/components/rtu_entry.lua index e7bcd14..4ca4058 100644 --- a/supervisor/panel/components/rtu_entry.lua +++ b/supervisor/panel/components/rtu_entry.lua @@ -18,7 +18,7 @@ local ALIGN = core.ALIGN local cpair = core.cpair -- create an RTU list entry ----@param parent graphics_element parent +---@param parent ListBox parent ---@param id integer RTU session ID local function init(parent, id) local s_hi_box = style.theme.highlight_box diff --git a/supervisor/panel/pgi.lua b/supervisor/panel/pgi.lua index aa57ef9..5eb35c6 100644 --- a/supervisor/panel/pgi.lua +++ b/supervisor/panel/pgi.lua @@ -8,28 +8,28 @@ local util = require("scada-common.util") local pgi = {} local data = { - rtu_list = nil, ---@type nil|graphics_element - pdg_list = nil, ---@type nil|graphics_element - chk_list = nil, ---@type nil|graphics_element + rtu_list = nil, ---@type ListBox|nil + pdg_list = nil, ---@type ListBox|nil + chk_list = nil, ---@type ListBox|nil rtu_entry = nil, ---@type function pdg_entry = nil, ---@type function chk_entry = nil, ---@type function -- list entries entries = { - rtu = {}, ---@type graphics_element[] - pdg = {}, ---@type graphics_element[] - chk = {}, ---@type graphics_element[][] - missing = {} ---@type graphics_element[] + rtu = {}, ---@type Div[] + pdg = {}, ---@type Div[] + chk = {}, ---@type Div[][] + missing = {} ---@type Div[] } } -- link list boxes ----@param rtu_list graphics_element RTU list element ----@param rtu_entry function RTU entry constructor ----@param pdg_list graphics_element pocket diagnostics list element ----@param pdg_entry function pocket diagnostics entry constructor ----@param chk_list graphics_element CHK list element ----@param chk_entry function CHK entry constructor +---@param rtu_list ListBox RTU list element +---@param rtu_entry fun(parent: ListBox, id: integer) : Div RTU entry constructor +---@param pdg_list ListBox pocket diagnostics list element +---@param pdg_entry fun(parent: ListBox, id: integer) : Div pocket diagnostics entry constructor +---@param chk_list ListBox CHK list element +---@param chk_entry fun(parent: ListBox, msg: string, fail_code: integer) : Div CHK entry constructor function pgi.link_elements(rtu_list, rtu_entry, pdg_list, pdg_entry, chk_list, chk_entry) data.rtu_list = rtu_list data.pdg_list = pdg_list @@ -135,8 +135,8 @@ function pgi.create_chk_entry(unit, fail_code, msg) end end --- delete a device ID check failure entry from the CHK list ----@note this assumes only one type of failure can occur per each RTU gateway session's RTU, which is the case +-- delete a device ID check failure entry from the CHK list
+-- this assumes only one type of failure can occur per each RTU gateway session's RTU, which is the case ---@param unit unit_session RTU session function pgi.delete_chk_entry(unit) local gw_session = unit.get_session_id()