mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#183 RTU front panel
This commit is contained in:
@ -451,19 +451,13 @@ function element.new(args)
|
||||
function public.show()
|
||||
protected.window.setVisible(true)
|
||||
protected.start_anim()
|
||||
|
||||
for i = 1, #self.children do
|
||||
self.children[i].show()
|
||||
end
|
||||
for _, child in pairs(self.children) do child.show() end
|
||||
end
|
||||
|
||||
-- hide the element
|
||||
function public.hide()
|
||||
protected.stop_anim()
|
||||
for i = 1, #self.children do
|
||||
self.children[i].hide()
|
||||
end
|
||||
|
||||
for _, child in pairs(self.children) do child.hide() end
|
||||
protected.window.setVisible(false)
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ local function indicator_led(args)
|
||||
args.height = 1
|
||||
|
||||
-- determine width
|
||||
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
|
||||
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
|
||||
|
||||
-- flasher state
|
||||
local flash_on = true
|
||||
@ -89,8 +89,10 @@ local function indicator_led(args)
|
||||
|
||||
-- write label and initial indicator light
|
||||
e.on_update(false)
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
if string.len(args.label) > 0 then
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
end
|
||||
|
||||
return e.get()
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ local function indicator_led_pair(args)
|
||||
args.height = 1
|
||||
|
||||
-- determine width
|
||||
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
|
||||
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
|
||||
|
||||
-- flasher state
|
||||
local flash_on = true
|
||||
@ -103,8 +103,10 @@ local function indicator_led_pair(args)
|
||||
|
||||
-- write label and initial indicator light
|
||||
e.on_update(1)
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
if string.len(args.label) > 0 then
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
end
|
||||
|
||||
return e.get()
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ local function indicator_led_rgb(args)
|
||||
args.height = 1
|
||||
|
||||
-- determine width
|
||||
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
|
||||
args.width = math.max(args.min_label_width or 0, string.len(args.label)) + 2
|
||||
|
||||
-- create new graphics element base object
|
||||
local e = element.new(args)
|
||||
@ -48,8 +48,10 @@ local function indicator_led_rgb(args)
|
||||
|
||||
-- write label and initial indicator light
|
||||
e.on_update(1)
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
if string.len(args.label) > 0 then
|
||||
e.window.setCursorPos(3, 1)
|
||||
e.window.write(args.label)
|
||||
end
|
||||
|
||||
return e.get()
|
||||
end
|
||||
|
Reference in New Issue
Block a user