David Blume's GitList
Repositories
dxb_channel.git
Code
Commits
Branches
Tags
Search
Tree:
b5e7366
Branches
Tags
main
dxb_channel.git
components
dxb.brs
Remove some logging.
David Blume
commited
b5e7366
at 2020-05-07 00:02:46
dxb.brs
Blame
History
Raw
function init() m.top.ObserveField("pucidHash", "onUpdatePucidHash") m.title = m.top.findNode("title") m.title.font.size=248 m.title.color="0x62C7FF18" title_font_size = 34 font_size = 32 m.updates = m.top.findNode("updates") m.updates.font.size=font_size m.updates.color="0x52C7F8FF" m.updates.lineSpacing = 8 m.updates_title = m.top.findNode("updates_title") m.updates_title.font.size=title_font_size m.updates_title.color="0x62E7FFFF" m.updates_title.text = "Launch Parameters" m.updates_lower = m.top.findNode("updates_lower") m.updates_lower.font.size=font_size m.updates_lower.color="0x52C7F8FF" m.updates_lower.text = "" m.updates_lower.lineSpacing = 8 m.updates_lower_title = m.top.findNode("updates_lower_title") m.updates_lower_title.font.size=title_font_size m.updates_lower_title.color="0x62E7FFFF" m.updates_lower_title.text = "Events" m.updates_right = m.top.findNode("updates_right") m.updates_right.font.size=font_size m.updates_right.color="0x52C7F8FF" m.updates_right.lineSpacing = 8 m.updates_right_title = m.top.findNode("updates_right_title") m.updates_right_title.font.size=title_font_size m.updates_right_title.color="0x62E7FFFF" m.updates_right_title.text = "Test Output" m.title_color = "0x20204080" m.title_focus_color = "0x4060B0A0" m.tl_rect = m.top.findNode("updates_title_rect") m.tl_rect.color = m.title_color m.bl_rect = m.top.findNode("updates_lower_title_rect") m.bl_rect.color = m.title_color m.r_rect = m.top.findNode("updates_right_title_rect") m.r_rect.color = m.title_color label_color = "0x00002080" r = m.top.findNode("updates_rect") r.color = label_color r = m.top.findNode("updates_lower_rect") r.color = label_color r = m.top.findNode("updates_right_rect") r.color = label_color ' m.logger = CreateObject("roLogger") m.myTask = CreateObject("roSGNode", "MyTask") m.myTask.ObserveField("updateText", "onUpdateText") m.myTask.ObserveField("updateTextLower", "onUpdateTextLower") m.myTask.control = "RUN" m.testTask = CreateObject("roSGNode", "TestTask") m.testTask.ObserveField("updateText", "onUpdateTextRight") ' Note m.top.pucidHash is not set at this point, so we can't set it for testTask either. m.testTask.control = "RUN" texttimer = m.top.findNode("textTimer") texttimer.observeField("fire", "timerUpdate") texttimer.control = "start" m.updates_lower_array = CreateObject("roArray", 10, true) m.updates_right_array = CreateObject("roArray", 21, true) m.focus_rect = 1 doUpdateFocus() m.top.setFocus(true) end function function onUpdatePucidHash() as void m.testTask.setField("pucidHash", m.top.pucidHash) end function function onUpdateText() as void if m.updates.text.Len() = 0 m.updates.text = m.myTask.updateText else m.updates.text = m.updates.text + chr(10) + m.myTask.updateText end if print m.myTask.updateText ' m.logger.logConsole("upperleft", [m.myTask.updateText]) end function function onUpdateTextLower() as void updateTextLower(m.myTask.updateTextLower) end function function updateTextLower(s as String) as void while m.updates_lower_array.Count() > 9 m.updates_lower_array.Shift() end while m.updates_lower_array.Push(s) m.updates_lower.text = m.updates_lower_array.Join(chr(10)) print s ' m.logger.logConsole("lowerleft", [s]) end function function onUpdateTextRight() as void while m.updates_right_array.Count() > 20 m.updates_right_array.Shift() end while m.updates_right_array.Push(m.testTask.updateText) m.updates_right.text = m.updates_right_array.Join(chr(10)) print m.testTask.updateText ' m.logger.logConsole("right", [m.testTask.updateText]) end function function onKeyEvent(key as String, press as Boolean) as Boolean handled = false if press then if key = "back" then handled = false else update_ui = false if key = "OK" and (m.focus_rect = 1 or m.focus_rect = 2) m.testTask.control = "RUN" elseif key = "up" if m.focus_rect = 2: m.focus_rect = 1 elseif m.focus_rect = 3 m.focus_rect = 0 update_ui = true endif elseif key = "right" if m.focus_rect = 0: m.focus_rect = 1 update_ui = true elseif m.focus_rect = 3 m.focus_rect = 2 update_ui = true endif elseif key = "down" if m.focus_rect = 0: m.focus_rect = 3 update_ui = true elseif m.focus_rect = 1 m.focus_rect = 2 endif elseif key = "left" if m.focus_rect = 1: m.focus_rect = 0 update_ui = true elseif m.focus_rect = 2 m.focus_rect = 3 update_ui = true endif end if if update_ui doUpdateFocus() endif dt = Mid(CreateObject("roDateTime").ToISOString(), 15, 5) updateTextLower(dt + " " + key) handled = true end if end if return handled end function sub doUpdateFocus() if m.focus_rect = 0 m.tl_rect.color = m.title_focus_color m.bl_rect.color = m.title_color m.r_rect.color = m.title_color elseif m.focus_rect = 1 or m.focus_rect = 2 m.tl_rect.color = m.title_color m.bl_rect.color = m.title_color m.r_rect.color = m.title_focus_color elseif m.focus_rect = 3 m.tl_rect.color = m.title_color m.bl_rect.color = m.title_focus_color m.r_rect.color = m.title_color end if end sub sub timerUpdate() ' Not needed, but nice to have as an example. ' print "timerUpdate called." end sub