mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2025-07-26 03:22:51 +00:00
#616 fixes to coordinator pellet color option
This commit is contained in:
@ -250,6 +250,7 @@ function hmi.create(tool_ctl, main_pane, cfg_sys, divs, style)
|
||||
|
||||
local function submit_ui_opts()
|
||||
tmp_cfg.Time24Hour = tool_ctl.clock_fmt.get_value() == 1
|
||||
tmp_cfg.GreenPuPellet = tool_ctl.pellet_color.get_value() == 1
|
||||
tmp_cfg.TempScale = tool_ctl.temp_scale.get_value()
|
||||
tmp_cfg.EnergyScale = tool_ctl.energy_scale.get_value()
|
||||
main_pane.set_value(7)
|
||||
|
@ -380,6 +380,7 @@ function system.create(tool_ctl, main_pane, cfg_sys, divs, ext, style)
|
||||
try_set(tool_ctl.num_units, ini_cfg.UnitCount)
|
||||
try_set(tool_ctl.dis_flow_view, ini_cfg.DisableFlowView)
|
||||
try_set(tool_ctl.s_vol, ini_cfg.SpeakerVolume)
|
||||
try_set(tool_ctl.pellet_color, ini_cfg.GreenPuPellet)
|
||||
try_set(tool_ctl.clock_fmt, tri(ini_cfg.Time24Hour, 1, 2))
|
||||
try_set(tool_ctl.temp_scale, ini_cfg.TempScale)
|
||||
try_set(tool_ctl.energy_scale, ini_cfg.EnergyScale)
|
||||
|
@ -78,6 +78,7 @@ local tool_ctl = {
|
||||
-- settings elements from hmi
|
||||
dis_flow_view = nil, ---@type Checkbox
|
||||
s_vol = nil, ---@type NumberField
|
||||
pellet_color = nil, ---@type RadioButton
|
||||
clock_fmt = nil, ---@type RadioButton
|
||||
temp_scale = nil, ---@type RadioButton
|
||||
energy_scale = nil, ---@type RadioButton
|
||||
|
@ -19,7 +19,7 @@ local renderer = require("coordinator.renderer")
|
||||
local sounder = require("coordinator.sounder")
|
||||
local threads = require("coordinator.threads")
|
||||
|
||||
local COORDINATOR_VERSION = "v1.6.13"
|
||||
local COORDINATOR_VERSION = "v1.6.14"
|
||||
|
||||
local CHUNK_LOAD_DELAY_S = 30.0
|
||||
|
||||
|
@ -325,7 +325,7 @@ local function new_view(root, x, y)
|
||||
|
||||
TextBox{parent=waste_status,y=i,text="U"..i.." Waste",width=8}
|
||||
local a_waste = IndicatorLight{parent=waste_status,x=10,y=i,label="Auto",colors=ind_wht}
|
||||
local waste_m = StateIndicator{parent=waste_status,x=17,y=i,states=style.waste.states_abbrv,value=1,min_width=6}
|
||||
local waste_m = StateIndicator{parent=waste_status,x=17,y=i,states=style.get_waste().states_abbrv,value=1,min_width=6}
|
||||
|
||||
a_waste.register(unit.unit_ps, "U_AutoWaste", a_waste.update)
|
||||
waste_m.register(unit.unit_ps, "U_WasteProduct", waste_m.update)
|
||||
@ -339,11 +339,11 @@ local function new_view(root, x, y)
|
||||
TextBox{parent=waste_sel,text="WASTE PRODUCTION",alignment=ALIGN.CENTER,width=21,x=1,y=2,fg_bg=cutout_fg_bg}
|
||||
|
||||
local rect = Rectangle{parent=waste_sel,border=border(1,colors.brown,true),width=21,height=22,x=1,y=3}
|
||||
local status = StateIndicator{parent=rect,x=2,y=1,states=style.waste.states,value=1,min_width=17}
|
||||
local status = StateIndicator{parent=rect,x=2,y=1,states=style.get_waste().states,value=1,min_width=17}
|
||||
|
||||
status.register(facility.ps, "current_waste_product", status.update)
|
||||
|
||||
local waste_prod = RadioButton{parent=rect,x=2,y=3,options=style.waste.options,callback=process.set_process_waste,radio_colors=cpair(style.theme.accent_dark,style.theme.accent_light),select_color=colors.brown}
|
||||
local waste_prod = RadioButton{parent=rect,x=2,y=3,options=style.get_waste().options,callback=process.set_process_waste,radio_colors=cpair(style.theme.accent_dark,style.theme.accent_light),select_color=colors.brown}
|
||||
|
||||
waste_prod.register(facility.ps, "process_waste_product", waste_prod.set_value)
|
||||
|
||||
|
@ -398,7 +398,7 @@ local function init(parent, id)
|
||||
local waste_proc = Rectangle{parent=main,border=border(1,colors.brown,true),thin=true,width=33,height=3,x=46,y=49}
|
||||
local waste_div = Div{parent=waste_proc,x=2,y=1,width=31,height=1}
|
||||
|
||||
local waste_mode = MultiButton{parent=waste_div,x=1,y=1,options=style.waste.unit_opts,callback=unit.set_waste,min_width=6}
|
||||
local waste_mode = MultiButton{parent=waste_div,x=1,y=1,options=style.get_waste().unit_opts,callback=unit.set_waste,min_width=6}
|
||||
|
||||
waste_mode.register(u_ps, "U_WasteMode", waste_mode.set_value)
|
||||
|
||||
|
@ -227,30 +227,34 @@ style.sps = {
|
||||
}
|
||||
}
|
||||
|
||||
local pu_color = util.trinary(config.GreenPuPellet, colors.green, colors.cyan)
|
||||
local po_color = util.trinary(config.GreenPuPellet, colors.cyan, colors.green)
|
||||
-- get waste styling, which depends on the configuration
|
||||
---@return { states: { color: color, text: string }, states_abbrv: { color: color, text: string }, options: string[], unit_opts: { text: string, fg_bg: cpair, active_fg_bg:cpair } }
|
||||
function style.get_waste()
|
||||
local pu_color = util.trinary(config.GreenPuPellet, colors.green, colors.cyan)
|
||||
local po_color = util.trinary(config.GreenPuPellet, colors.cyan, colors.green)
|
||||
|
||||
style.waste = {
|
||||
-- auto waste processing states
|
||||
states = {
|
||||
{ color = cpair(colors.black, pu_color), text = "PLUTONIUM" },
|
||||
{ color = cpair(colors.black, po_color), text = "POLONIUM" },
|
||||
{ color = cpair(colors.black, colors.purple), text = "ANTI MATTER" }
|
||||
},
|
||||
states_abbrv = {
|
||||
{ color = cpair(colors.black, pu_color), text = "Pu" },
|
||||
{ color = cpair(colors.black, po_color), text = "Po" },
|
||||
{ color = cpair(colors.black, colors.purple), text = "AM" }
|
||||
},
|
||||
-- process radio button options
|
||||
options = { "Plutonium", "Polonium", "Antimatter" },
|
||||
-- unit waste selection
|
||||
unit_opts = {
|
||||
{ text = "Auto", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.white, colors.gray) },
|
||||
{ text = "Pu", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, pu_color) },
|
||||
{ text = "Po", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, po_color) },
|
||||
{ text = "AM", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, colors.purple) }
|
||||
return {
|
||||
-- auto waste processing states
|
||||
states = {
|
||||
{ color = cpair(colors.black, pu_color), text = "PLUTONIUM" },
|
||||
{ color = cpair(colors.black, po_color), text = "POLONIUM" },
|
||||
{ color = cpair(colors.black, colors.purple), text = "ANTI MATTER" }
|
||||
},
|
||||
states_abbrv = {
|
||||
{ color = cpair(colors.black, pu_color), text = "Pu" },
|
||||
{ color = cpair(colors.black, po_color), text = "Po" },
|
||||
{ color = cpair(colors.black, colors.purple), text = "AM" }
|
||||
},
|
||||
-- process radio button options
|
||||
options = { "Plutonium", "Polonium", "Antimatter" },
|
||||
-- unit waste selection
|
||||
unit_opts = {
|
||||
{ text = "Auto", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.white, colors.gray) },
|
||||
{ text = "Pu", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, pu_color) },
|
||||
{ text = "Po", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, po_color) },
|
||||
{ text = "AM", fg_bg = cpair(colors.black, colors.lightGray), active_fg_bg = cpair(colors.black, colors.purple) }
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return style
|
||||
|
Reference in New Issue
Block a user