From 89ab742f8ea984fcb563a27a53182db2338cf301 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 12 Oct 2024 00:30:58 -0400 Subject: [PATCH] #528 configurator fixes, restoring textbox whitespace handling and adding specific trim whitespace option --- coordinator/config/facility.lua | 10 +++++----- coordinator/startup.lua | 2 +- graphics/core.lua | 2 +- graphics/elements/TextBox.lua | 3 ++- pocket/startup.lua | 2 +- pocket/ui/components/conn_waiting.lua | 6 +++--- supervisor/configure.lua | 2 +- supervisor/startup.lua | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/coordinator/config/facility.lua b/coordinator/config/facility.lua index 41620b7..00f8c99 100644 --- a/coordinator/config/facility.lua +++ b/coordinator/config/facility.lua @@ -206,10 +206,10 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) TextBox{parent=fac_c_1,x=1,y=1,height=4,text="This tool can attempt to connect to your supervisor computer. This would load facility information in order to get the unit count and aid monitor setup."} TextBox{parent=fac_c_1,x=1,y=6,height=2,text="The supervisor startup app must be running and fully configured on your supervisor computer."} - tool_ctl.sv_conn_status = TextBox{parent=fac_c_1,x=11,y=9,text=""} - tool_ctl.sv_conn_detail = TextBox{parent=fac_c_1,x=1,y=11,height=2,text=""} + self.sv_conn_status = TextBox{parent=fac_c_1,x=11,y=9,text=""} + self.sv_conn_detail = TextBox{parent=fac_c_1,x=1,y=11,height=2,text=""} - tool_ctl.sv_conn_button = PushButton{parent=fac_c_1,x=1,y=9,text="Connect",min_width=9,callback=function()sv_connect()end,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg} + self.sv_conn_button = PushButton{parent=fac_c_1,x=1,y=9,text="Connect",min_width=9,callback=function()sv_connect()end,fg_bg=cpair(colors.black,colors.green),active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg} local function sv_skip() tcd.abort(handle_timeout) @@ -225,8 +225,8 @@ function facility.create(tool_ctl, main_pane, cfg_sys, fac_cfg, style) end PushButton{parent=fac_c_1,x=1,y=14,text="\x1b Back",callback=function()main_pane.set_value(2)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} - tool_ctl.sv_skip = PushButton{parent=fac_c_1,x=44,y=14,text="Skip \x1a",callback=sv_skip,fg_bg=cpair(colors.black,colors.red),active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg} - tool_ctl.sv_next = PushButton{parent=fac_c_1,x=44,y=14,text="Next \x1a",callback=sv_next,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,hidden=true} + self.sv_skip = PushButton{parent=fac_c_1,x=44,y=14,text="Skip \x1a",callback=sv_skip,fg_bg=cpair(colors.black,colors.red),active_fg_bg=btn_act_fg_bg,dis_fg_bg=btn_dis_fg_bg} + self.sv_next = PushButton{parent=fac_c_1,x=44,y=14,text="Next \x1a",callback=sv_next,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg,hidden=true} TextBox{parent=fac_c_2,x=1,y=1,height=3,text="Please enter the number of reactors you have, also referred to as reactor units or 'units' for short. A maximum of 4 is currently supported."} tool_ctl.num_units = NumberField{parent=fac_c_2,x=1,y=5,width=5,max_chars=2,default=ini_cfg.UnitCount,min=1,max=4,fg_bg=bw_fg_bg} diff --git a/coordinator/startup.lua b/coordinator/startup.lua index d712fa9..9cd8e61 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer") local sounder = require("coordinator.sounder") local threads = require("coordinator.threads") -local COORDINATOR_VERSION = "v1.5.11" +local COORDINATOR_VERSION = "v1.5.12" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/graphics/core.lua b/graphics/core.lua index e71a702..cbedccf 100644 --- a/graphics/core.lua +++ b/graphics/core.lua @@ -7,7 +7,7 @@ local flasher = require("graphics.flasher") local core = {} -core.version = "2.4.2" +core.version = "2.4.3" core.flasher = flasher core.events = events diff --git a/graphics/elements/TextBox.lua b/graphics/elements/TextBox.lua index 4c4b5ea..c91746d 100644 --- a/graphics/elements/TextBox.lua +++ b/graphics/elements/TextBox.lua @@ -10,6 +10,7 @@ local ALIGN = core.ALIGN ---@class textbox_args ---@field text string text to show ---@field alignment? ALIGN text alignment, left by default +---@field trim_whitespace? boolean true to trim whitespace before/after lines of text ---@field anchor? boolean true to use this as an anchor, making it focusable ---@field parent graphics_element ---@field id? string element id @@ -59,7 +60,7 @@ return function (args) -- trim leading/trailing whitespace, except on the first line -- leading whitespace on the first line is usually intentional - if i > 1 then + if args.trim_whitespace == true then lines[i] = util.trim(lines[i]) end diff --git a/pocket/startup.lua b/pocket/startup.lua index 0bdfed5..074da8b 100644 --- a/pocket/startup.lua +++ b/pocket/startup.lua @@ -20,7 +20,7 @@ local pocket = require("pocket.pocket") local renderer = require("pocket.renderer") local threads = require("pocket.threads") -local POCKET_VERSION = "v0.12.4-alpha" +local POCKET_VERSION = "v0.12.5-alpha" local println = util.println local println_ts = util.println_ts diff --git a/pocket/ui/components/conn_waiting.lua b/pocket/ui/components/conn_waiting.lua index 6050241..fd2fb80 100644 --- a/pocket/ui/components/conn_waiting.lua +++ b/pocket/ui/components/conn_waiting.lua @@ -29,15 +29,15 @@ local function init(parent, y, is_api) local waiting_x = math.floor(parent.get_width() / 2) - 1 - local msg = TextBox{parent=box,x=3,y=11,width=box.get_width()-4,height=2,text="",alignment=ALIGN.CENTER,fg_bg=cpair(colors.red,style.root.bkg)} + local msg = TextBox{parent=box,x=3,y=11,width=box.get_width()-4,height=2,text="",alignment=ALIGN.CENTER,fg_bg=cpair(colors.red,style.root.bkg),trim_whitespace=true} if is_api then WaitingAnim{parent=box,x=waiting_x,y=1,fg_bg=cpair(colors.blue,style.root.bkg)} - TextBox{parent=box,y=5,text="Connecting to API",alignment=ALIGN.CENTER,fg_bg=cpair(colors.white,style.root.bkg)} + TextBox{parent=box,y=5,text="Connecting to API",alignment=ALIGN.CENTER,fg_bg=cpair(colors.white,style.root.bkg),trim_whitespace=true} msg.register(iocontrol.get_db().ps, "api_link_msg", msg.set_value) else WaitingAnim{parent=box,x=waiting_x,y=1,fg_bg=cpair(colors.green,style.root.bkg)} - TextBox{parent=box,y=5,text="Connecting to Supervisor",alignment=ALIGN.CENTER,fg_bg=cpair(colors.white,style.root.bkg)} + TextBox{parent=box,y=5,text="Connecting to Supervisor",alignment=ALIGN.CENTER,fg_bg=cpair(colors.white,style.root.bkg),trim_whitespace=true} msg.register(iocontrol.get_db().ps, "svr_link_msg", msg.set_value) end diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 14c7396..aaab65e 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -222,7 +222,7 @@ local function config_view(display) --#region System Configuration - local divs = { fac_cfg, net_cfg, log_cfg, clr_cfg, summary, import_err } + local divs = { net_cfg, log_cfg, clr_cfg, summary, import_err } system.create(tool_ctl, main_pane, settings, divs, fac_pane, style, exit) diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 797a759..388ab51 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -22,7 +22,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.5.7" +local SUPERVISOR_VERSION = "v1.5.8" local println = util.println local println_ts = util.println_ts