diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-06-21 14:50:35 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-06-21 14:50:35 -0400 |
commit | 8fa98f095a89778cd3153f3ee88f5626fc5a0d02 (patch) | |
tree | 7be0546536961949153d5645c54384f35cf982d0 /indra/newview/scripts/lua | |
parent | a6d860f9f3bd7ce8ed5d42635a730c1ee9714aea (diff) |
Remove pre-Floater.lua versions of the floater test scripts.
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_demo.lua | 77 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_luafloater_gesture_list.lua | 75 |
2 files changed, 0 insertions, 152 deletions
diff --git a/indra/newview/scripts/lua/test_luafloater_demo.lua b/indra/newview/scripts/lua/test_luafloater_demo.lua deleted file mode 100644 index 65a31670c8..0000000000 --- a/indra/newview/scripts/lua/test_luafloater_demo.lua +++ /dev/null @@ -1,77 +0,0 @@ -XML_FILE_PATH = LL.abspath("luafloater_demo.xml") - -scriptparts = string.split(LL.source_path(), '/') -scriptname = scriptparts[#scriptparts] -print('Running ' .. scriptname) - -leap = require 'leap' -fiber = require 'fiber' -startup = require 'startup' - ---event pump for sending actions to the floater -local COMMAND_PUMP_NAME = "" -local reqid ---table of floater UI events -event_list=leap.request("LLFloaterReg", {op="getFloaterEvents"}).events - -local function _event(event_name) - if not table.find(event_list, event_name) then - LL.print_warning("Incorrect event name: " .. event_name) - end - return event_name -end - -function post(action) - leap.send(COMMAND_PUMP_NAME, action) -end - -function getCurrentTime() - local currentTime = os.date("*t") - return string.format("%02d:%02d:%02d", currentTime.hour, currentTime.min, currentTime.sec) -end - -function handleEvents(event_data) - post({action="add_text", ctrl_name="events_editor", value = event_data}) - if event_data.event == _event("commit") then - if event_data.ctrl_name == "disable_ctrl" then - post({action="set_enabled", ctrl_name="open_btn", value = (1 - event_data.value)}) - elseif event_data.ctrl_name == "title_cmb" then - post({action="set_title", value= event_data.value}) - elseif event_data.ctrl_name == "open_btn" then - floater_name = leap.request(COMMAND_PUMP_NAME, {action="get_value", ctrl_name='openfloater_cmd'})['value'] - leap.send("LLFloaterReg", {name = floater_name, op = "showInstance"}) - end - elseif event_data.event == _event("double_click") then - if event_data.ctrl_name == "show_time_lbl" then - post({action="set_value", ctrl_name="time_lbl", value= getCurrentTime()}) - end - elseif event_data.event == _event("floater_close") then - LL.print_warning("Floater was closed") - return false - end - return true -end - -startup.wait('STATE_LOGIN_WAIT') -local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"} ---sign for additional events for defined control {<control_name>= {action1, action2, ...}} -key.extra_events={show_time_lbl = {_event("right_mouse_down"), _event("double_click")}} -local resp = leap.request("LLFloaterReg", key) -COMMAND_PUMP_NAME = resp.command_name -reqid = resp.reqid - -catch_events = leap.WaitFor(-1, "all_events") -function catch_events:filter(pump, data) - if data.reqid == reqid then - return data - end -end - -function process_events(waitfor) - event_data = waitfor:wait() - while event_data and handleEvents(event_data) do - event_data = waitfor:wait() - end -end - -fiber.launch("catch_events", process_events, catch_events) diff --git a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua b/indra/newview/scripts/lua/test_luafloater_gesture_list.lua deleted file mode 100644 index a5fd325430..0000000000 --- a/indra/newview/scripts/lua/test_luafloater_gesture_list.lua +++ /dev/null @@ -1,75 +0,0 @@ -XML_FILE_PATH = LL.abspath("luafloater_gesture_list.xml") - -scriptparts = string.split(LL.source_path(), '/') -scriptname = scriptparts[#scriptparts] -print('Running ' .. scriptname) - -leap = require 'leap' -fiber = require 'fiber' -LLGesture = require 'LLGesture' -startup = require 'startup' - ---event pump for sending actions to the floater -local COMMAND_PUMP_NAME = "" -local reqid ---table of floater UI events -event_list=leap.request("LLFloaterReg", {op="getFloaterEvents"}).events - -local function _event(event_name) - if not table.find(event_list, event_name) then - LL.print_warning("Incorrect event name: " .. event_name) - end - return event_name -end - -function post(action) - leap.send(COMMAND_PUMP_NAME, action) -end - -function handleEvents(event_data) - if event_data.event == _event("floater_close") then - return false - end - - if event_data.event == _event("post_build") then - COMMAND_PUMP_NAME = event_data.command_name - reqid = event_data.reqid - gestures_uuid = LLGesture.getActiveGestures() - local action_data = {} - action_data.action = "add_list_element" - action_data.ctrl_name = "gesture_list" - gestures = {} - for uuid, info in pairs(gestures_uuid) do - table.insert(gestures, {value = uuid, columns ={column = "gesture_name", value = info.name}}) - end - action_data.value = gestures - post(action_data) - elseif event_data.event == _event("double_click") then - if event_data.ctrl_name == "gesture_list" then - LLGesture.startGesture(event_data.value) - end - end - return true -end - -startup.wait('STATE_STARTED') -local key = {xml_path = XML_FILE_PATH, op = "showLuaFloater"} ---receive additional events for defined control {<control_name>= {action1, action2, ...}} -key.extra_events={gesture_list = {_event("double_click")}} -handleEvents(leap.request("LLFloaterReg", key)) - -catch_events = leap.WaitFor(-1, "all_events") -function catch_events:filter(pump, data) - if data.reqid == reqid then - return data - end -end - -function process_events(waitfor) - event_data = waitfor:wait() - while event_data and handleEvents(event_data) do - event_data = waitfor:wait() - end -end - -fiber.launch("catch_events", process_events, catch_events) |