summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_toolbars.lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-08-05 20:37:03 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-08-05 20:37:03 +0300
commitcf29b701b19644062a1428a64023c3cf9829e2de (patch)
tree0852f0b9b7699dbf4756a3fae6ef4a65dc3bae8f /indra/newview/scripts/lua/test_toolbars.lua
parenta67a01240cbd58a1800290294be83e7b874fefb6 (diff)
Allow getting the list of floater names, hide top menu items; add demo script
Diffstat (limited to 'indra/newview/scripts/lua/test_toolbars.lua')
-rw-r--r--indra/newview/scripts/lua/test_toolbars.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/test_toolbars.lua b/indra/newview/scripts/lua/test_toolbars.lua
new file mode 100644
index 0000000000..70035db775
--- /dev/null
+++ b/indra/newview/scripts/lua/test_toolbars.lua
@@ -0,0 +1,27 @@
+popup = require 'popup'
+UI = require 'UI'
+
+local OK = 'OK_okcancelbuttons'
+local BUTTONS = UI.getToolbarBtnNames()
+
+-- Clear the toolbars and then add the toolbar buttons to the random toolbar
+response = popup:alertYesCancel('Toolbars will be randomly reshuffled. Proceed?')
+if next(response) == OK then
+ UI.clearToolbars()
+ math.randomseed(os.time())
+
+ -- add the buttons to the random toolbar
+ for i = 1, #BUTTONS do
+ UI.addToolbarBtn(BUTTONS[i], math.random(3))
+ end
+
+ -- remove some of the added buttons from the toolbars
+ for i = 1, #BUTTONS do
+ if math.random(100) < 30 then
+ UI.removeToolbarBtn(BUTTONS[i])
+ end
+ end
+ popup:tip('Toolbars were reshuffled')
+else
+ popup:tip('Canceled')
+end