Module lcdproc.menu
A LCDproc menu module.
Info:
- Copyright: denpamusic 2020
- License: MIT
- Author: denpamusic
Class Item
Item:new (menu, id, text, hidden, prev, next) | create new item |
Item:init (vars) | initialize item on the server |
Item:delete () | delete item on the server |
Item:set_text (text) | set item text |
Item:set_hidden (hidden) | set item as hidden |
Item:set_prev (prev) | set previous item |
Item:set_next (next) | set next item |
Class Action
Action.new (menu, id, text, result, hidden, prev) | add action to the menu |
Action:create () | create action on the server |
Action:update () | update action on the server |
Action:set_result (result) | set action result |
Class Checkbox
Checkbox.new (menu, id, text, value, allow_gray, hidden, prev) | create checkbox |
Checkbox:create () | create checkbox on the server |
Checkbox:update () | update checkbox on the server |
Checkbox:set_value (value) | set checkbox value |
Checkbox:allow_gray (allow_gray) | allow checkbox to be grayed out |
Class Ring
Ring.new (menu, id, text, value, strings, hidden, prev) | create ring |
Ring:create () | create ring on the server |
Ring:update () | update ring on the server |
Ring:set_value (value) | set ring value |
Ring:set_strings (strings) | set ring strings |
Class Slider
Slider.new (menu, id, text, value, range, labels, step, hidden, prev, next) | create slider |
Slider:create () | create slider on the server |
Slider:update () | update slider on the server |
Slider:set_value (value) | set slider value |
Slider:set_range (range) | set slider range |
Class Numeric
Numeric.new (menu, id, text, value, range, hidden, prev, next) | create numeric |
Numeric:create () | create numeric on the server |
Numeric:update () | update numeric on the server |
Numeric:set_value (value) | set numeric value |
Numeric:set_range (range) | set numeric range |
Class Alpha
Alpha.new (menu, id, text, value, mask, range, allowed, extra, hidden, prev, next) | create alpha |
Alpha:create () | create alpha on the server |
Alpha:update () | update alpha on the server |
Alpha:set_value (value) | set alpha value |
Alpha:set_range (range) | set alpha length range |
Alpha:set_allowed (allowed) | set allowed characters |
Alpha:set_extra (extra) | set extra allowed characters |
Class Ip
Ip.new (menu, id, text, value, v6, hidden, prev, next) | create ip |
Ip:create () | create ip address on the server |
Ip:update () | update ip address on the server |
Ip:set_value (value) | set ip address value |
Ip:set_v6 (v6) | set whether ip address is IPv6 |
Class Menu
Menu.new (server, menu, id, text, hidden, prev) | create menu |
Menu:create () | create menu on the server |
Menu:update () | update menu on the server |
Menu:go_to ([parent_id]) | go to current menu |
Menu:set_main () | set current menu as main |
Menu:add_action (id, text, result, hidden, prev) | add action to the menu |
Menu:add_checkbox (id, text, value, allow_gray, hidden, prev) | add checkbox to the menu |
Menu:add_ring (id, text, value, strings, hidden, prev) | add ring to the menu |
Menu:add_slider (id, text, value, range, labels, step, hidden, prev, next) | add slider to the menu |
Menu:add_numeric (id, text, value, range, hidden, prev, next) | add numeric to the menu |
Menu:add_alpha (id, text, value, mask, range, allowed, extra, hidden, prev, next) | add alpha to the menu |
Menu:add_ip (id, text, value, v6, hidden, prev, next) | add ip to the menu |
Menu:add_menu (id, text, hidden, prev) | add submenu |
Menu:del_item (id) | remove item from the menu |
Class Item
Menu item abstract class.
SHOULD NOT be used directly.
- Item:new (menu, id, text, hidden, prev, next)
-
create new item
Parameters:
- menu Menu menu that contains item
- id string item id
- text string item text
- hidden bool is item hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
the new item
- Item:init (vars)
-
initialize item on the server
Parameters:
- vars table variables to initialize item with
Returns:
- initialized item
- string error description
- Item:delete ()
-
delete item on the server
Returns:
- Item:set_text (text)
-
set item text
Parameters:
- text string item text
Returns:
- Item:set_hidden (hidden)
-
set item as hidden
Parameters:
- hidden bool is item hidden
Returns:
- Item:set_prev (prev)
-
set previous item
Parameters:
- prev item to show after pressing ESCAPE key (Item, or special string: close, quit or none)
Returns:
- Item:set_next (next)
-
set next item
Parameters:
- next item to show after pressing ENTER key (Item, or special string: close, quit or none)
Returns:
Class Action
Action class.
- Action.new (menu, id, text, result, hidden, prev)
-
add action to the menu
Parameters:
- menu Menu Menu instance
- id string action id
- text string action text
- result string result of action (none, close, quit)
- hidden bool if action is hidden
- prev Item previous item
Returns:
-
Action
the new action
- Action:create ()
-
create action on the server
Returns:
- Action:update ()
-
update action on the server
Returns:
- Action:set_result (result)
-
set action result
Parameters:
- result string result of action (none, close, quit)
Returns:
Class Checkbox
Checkbox class.
- Checkbox.new (menu, id, text, value, allow_gray, hidden, prev)
-
create checkbox
Parameters:
- menu Menu Menu instance
- id string checkbox id
- text string checkbox text
- value string checkbox value (off, on, gray)
- allow_gray bool whether to allow checkbox to be grayed out
- hidden bool is checkbox hidden
- prev Item item to show after pressing ESCAPE key
Returns:
-
Checkbox
the new checkbox
- Checkbox:create ()
-
create checkbox on the server
Returns:
- Checkbox:update ()
-
update checkbox on the server
Returns:
- Checkbox:set_value (value)
-
set checkbox value
Parameters:
- value int checkbox value (off, on, gray)
Returns:
- Checkbox:allow_gray (allow_gray)
-
allow checkbox to be grayed out
Parameters:
- allow_gray bool whether to allow checkbox to be grayed out
Returns:
Class Ring
Ring class.
- Ring.new (menu, id, text, value, strings, hidden, prev)
-
create ring
Parameters:
- menu Menu Menu instance
- id string ring id
- text string ring text
- value string index of currently selected string
- strings table table of strings
- hidden bool is ring hidden
- prev Item item to show after pressing ESCAPE key
Returns:
-
Ring
the new ring
- Ring:create ()
-
create ring on the server
Returns:
- Ring:update ()
-
update ring on the server
Returns:
- Ring:set_value (value)
-
set ring value
Parameters:
- value int index of current selection
Returns:
- Ring:set_strings (strings)
-
set ring strings
Parameters:
- strings table table of strings
Returns:
Class Slider
Slider class.
- Slider.new (menu, id, text, value, range, labels, step, hidden, prev, next)
-
create slider
Parameters:
- menu Menu Menu instance
- id string slider id
- text string slider text
- value int slider value
- range table slider range, i. e. {0, 100}
- labels table slider labels, i. e. {“empty”, “full”}
- step int slider step
- hidden bool if slider is hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Slider
the new slider
- Slider:create ()
-
create slider on the server
Returns:
- Slider:update ()
-
update slider on the server
Returns:
- Slider:set_value (value)
-
set slider value
Parameters:
- value int slider value
Returns:
- Slider:set_range (range)
-
set slider range
Parameters:
- range table set slider range
Returns:
Class Numeric
Numeric class.
- Numeric.new (menu, id, text, value, range, hidden, prev, next)
-
create numeric
Parameters:
- menu Menu Menu instance
- id string numeric id
- text string numeric text
- value int numeric value
- range table numeric range, i. e. {0, 100}
- hidden bool is numeric field hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Numeric
the new numeric
- Numeric:create ()
-
create numeric on the server
Returns:
- Numeric:update ()
-
update numeric on the server
Returns:
- Numeric:set_value (value)
-
set numeric value
Parameters:
- value int numeric value
Returns:
- Numeric:set_range (range)
-
set numeric range
Parameters:
- range table numeric range, i. e. {0, 100}
Returns:
Class Alpha
Alpha class.
- Alpha.new (menu, id, text, value, mask, range, allowed, extra, hidden, prev, next)
-
create alpha
Parameters:
- menu Menu Menu instance
- id string alpha id
- text string alpha text
- value string alpha value
- mask string character to mask input with
- range table input length range, i. e. {0, 10} – min: 0 chars, max: 10
- allowed table allowed characters { “:upper:”, “:lower:”, “:digit:” }
- extra string additional allowed characters
- hidden bool is alpha hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Alpha
the new alpha
- Alpha:create ()
-
create alpha on the server
Returns:
- Alpha:update ()
-
update alpha on the server
Returns:
- Alpha:set_value (value)
-
set alpha value
Parameters:
- value string alpha value
Returns:
- Alpha:set_range (range)
-
set alpha length range
Parameters:
- range table table range, i. e. {0, 10}
Returns:
- Alpha:set_allowed (allowed)
-
set allowed characters
Parameters:
- allowed table characters, i. e. {“:lower:”, “:upper:”, “:digit:”}
Returns:
- Alpha:set_extra (extra)
-
set extra allowed characters
Parameters:
- extra string allowed characters
Returns:
Class Ip
Ip class.
- Ip.new (menu, id, text, value, v6, hidden, prev, next)
-
create ip
Parameters:
- menu Menu Menu instance
- id string ip address field id
- text string ip address field text
- value string ip address value
- v6 bool is ip address an IPv6
- hidden bool is ip address hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Ip
the new ip address field
- Ip:create ()
-
create ip address on the server
Returns:
- Ip:update ()
-
update ip address on the server
Returns:
- Ip:set_value (value)
-
set ip address value
Parameters:
- value string ip address value
Returns:
- Ip:set_v6 (v6)
-
set whether ip address is IPv6
Parameters:
- v6 bool is ip address an IPv6
Returns:
Class Menu
LCDproc Menu class.
- Menu.new (server, menu, id, text, hidden, prev)
-
create menu
Parameters:
- server LCDproc LCDproc server
- menu Menu menu parent
- id string menu id
- text string menu text
- hidden bool is menu hidden
- prev Item item to show after pressing ESCAPE key
Returns:
-
Menu
the new menu
- Menu:create ()
-
create menu on the server
Returns:
- Menu:update ()
-
update menu on the server
Returns:
- Menu:go_to ([parent_id])
-
go to current menu
Parameters:
- parent_id string reset menu parent to this id (optional)
Returns:
- string LCDproc server response
- stri-ng error description
- Menu:set_main ()
-
set current menu as main
Returns:
- Menu:add_action (id, text, result, hidden, prev)
-
add action to the menu
Parameters:
- id string action id
- text string action text
- result string result of action (none, close, quit)
- hidden bool if action is hidden
- prev Item previous item
Returns:
-
Action
the new action
- Menu:add_checkbox (id, text, value, allow_gray, hidden, prev)
-
add checkbox to the menu
Parameters:
- id string checkbox id
- text string checkbox text
- value string checkbox value (off, on, gray)
- allow_gray bool whether to allow checkbox to be grayed out
- hidden bool is checkbox hidden
- prev Item previous item
Returns:
-
Checkbox
the new checkbox
- Menu:add_ring (id, text, value, strings, hidden, prev)
-
add ring to the menu
Parameters:
- id string ring id
- text string ring text
- value string index of currently selected string
- strings table table of strings
- hidden bool is ring hidden
- prev Item item to show after pressing ESCAPE key
Returns:
-
Ring
the new ring
- Menu:add_slider (id, text, value, range, labels, step, hidden, prev, next)
-
add slider to the menu
Parameters:
- id string slider id
- text string slider text
- value int slider value
- range table slider range, i. e. {0, 100}
- labels table slider labels, i. e. {“empty”, “full”}
- step int slider step
- hidden bool if slider is hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Slider
the new slider
- Menu:add_numeric (id, text, value, range, hidden, prev, next)
-
add numeric to the menu
Parameters:
- id string numeric id
- text string numeric text
- value int numeric value
- range table numeric range, i. e. {0, 100}
- hidden bool is numeric field hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Numeric
the new numeric
- Menu:add_alpha (id, text, value, mask, range, allowed, extra, hidden, prev, next)
-
add alpha to the menu
Parameters:
- id string alpha id
- text string alpha text
- value string alpha value
- mask string character to mask input with
- range table input length range, i. e. {0, 10} – min: 0 chars, max: 10
- allowed table allowed characters { “:upper:”, “:lower:”, “:digit:” }
- extra string additional allowed characters
- hidden bool is alpha hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Alpha
the new alpha
- Menu:add_ip (id, text, value, v6, hidden, prev, next)
-
add ip to the menu
Parameters:
- id string ip address field id
- text string ip address field text
- value string ip address value
- v6 bool is ip address an IPv6
- hidden bool is ip address hidden
- prev Item item to show after pressing ESCAPE key
- next Item item to show after pressing ENTER key
Returns:
-
Ip
the new ip address field
- Menu:add_menu (id, text, hidden, prev)
-
add submenu
Parameters:
- id string submenu id
- text string submenu text
- hidden bool is submenu hidden
- prev Item item to show after pressing ESCAPE key
Returns:
-
Menu
the new submenu
- Menu:del_item (id)
-
remove item from the menu
Parameters:
- id string item id