mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#89 fixed up ui closing to be cleaner on restart
This commit is contained in:
parent
c14fc048a1
commit
d9be5ccb47
@ -92,18 +92,21 @@ function renderer.start_ui()
|
||||
end
|
||||
|
||||
-- close out the UI
|
||||
---@param recolor? boolean true to restore to color palette from style
|
||||
function renderer.close_ui(recolor)
|
||||
function renderer.close_ui()
|
||||
-- report ui as not ready
|
||||
engine.ui_ready = false
|
||||
|
||||
-- hide to stop animation callbacks
|
||||
ui.main_layout.hide()
|
||||
for i = 1, #ui.unit_layouts do
|
||||
ui.unit_layouts[i].hide()
|
||||
engine.monitors.unit_displays[i].clear()
|
||||
end
|
||||
|
||||
-- clear root UI elements
|
||||
ui.main_layout = nil
|
||||
ui.unit_layouts = {}
|
||||
|
||||
-- reset displays
|
||||
renderer.reset(recolor)
|
||||
|
||||
-- re-draw dmesg
|
||||
engine.dmesg_window.setVisible(true)
|
||||
engine.dmesg_window.redraw()
|
||||
|
@ -16,7 +16,7 @@ local config = require("coordinator.config")
|
||||
local coordinator = require("coordinator.coordinator")
|
||||
local renderer = require("coordinator.renderer")
|
||||
|
||||
local COORDINATOR_VERSION = "alpha-v0.4.8"
|
||||
local COORDINATOR_VERSION = "alpha-v0.4.9"
|
||||
|
||||
local print = util.print
|
||||
local println = util.println
|
||||
@ -138,7 +138,7 @@ local function init_start_ui()
|
||||
|
||||
local ui_ok, message = pcall(renderer.start_ui)
|
||||
if not ui_ok then
|
||||
renderer.close_ui(config.RECOLOR)
|
||||
renderer.close_ui()
|
||||
log_graphics(util.c("UI crashed: ", message))
|
||||
println_ts("UI crashed")
|
||||
log.fatal(util.c("ui crashed with error ", message))
|
||||
@ -275,7 +275,7 @@ while ui_ok do
|
||||
end
|
||||
end
|
||||
|
||||
renderer.close_ui(config.RECOLOR)
|
||||
renderer.close_ui()
|
||||
log_sys("system shutdown")
|
||||
|
||||
println_ts("exited")
|
||||
|
Loading…
Reference in New Issue
Block a user