cave_utils.api.appBar
The app bar is a key element of the CAVE App, positioned on the left or right side of the screen. It provides actions that allow users to navigate between pages, launch panes, and interact with the CAVE API through predefined or custom commands.
If specified, both left and right side app bars can be displayed simultaneously.
1""" 2The app bar is a key element of the CAVE App, positioned on the left or 3right side of the screen. It provides actions that allow users to 4navigate between [pages][], launch [panes][], and interact with the 5CAVE API through [predefined][] or [custom][] commands. 6 7If specified, both left and right side app bars can be displayed 8simultaneously. 9 10[pages]: pages.html 11[panes]: panes.html 12[predefined]: #appBar_data_star.spec 13[custom]: #appBar_data_star.spec 14""" 15 16from cave_utils.api_utils.validator_utils import ApiValidator, CustomKeyValidator 17import type_enforced 18 19 20@type_enforced.Enforcer 21class appBar(ApiValidator): 22 """ 23 The app bar is located under the path **`appBar`**. 24 """ 25 26 @staticmethod 27 def spec(data: dict = dict(), **kwargs): 28 """ 29 @private 30 Arguments: 31 32 * **`data`**: `[dict]` = `{}` → The data to pass to `appBar.data.*`. 33 """ 34 return {"kwargs": kwargs, "accepted_values": {}} 35 36 def __extend_spec__(self, **kwargs): 37 data = self.data.get("data", {}) 38 CustomKeyValidator( 39 data=data, log=self.log, prepend_path=["data"], validator=appBar_data_star, **kwargs 40 ) 41 42 43@type_enforced.Enforcer 44class appBar_data_star(ApiValidator): 45 """ 46 The app bar data is located under the path **`appBar.data`**. 47 """ 48 49 @staticmethod 50 def spec( 51 icon: str, 52 type: str, 53 bar: str, 54 variant: [str, None] = None, 55 color: [str, None] = None, 56 apiCommand: [str, None] = None, 57 apiCommandKeys: [list[str], None] = None, 58 **kwargs, 59 ): 60 """ 61 Arguments: 62 63 * **`icon`**: `[str]` → An icon to display in the center of the action element. 64 * **Note**: It must be a valid icon name from the [react-icons][] bundle, preceded by the abbreviated name of the icon library source. 65 * **Example**: `"md/MdRocket"`. 66 * **`type`**: `[str]` → The type of object displayed when the action is triggered. 67 * **Accepted Values**: 68 * `"session"`: The Session Pane 69 * `"settings"`: The Application Settings Pane 70 * `"button"`: A button that allows you to send a command to the CAVE API 71 * `"pane"`: A [custom pane][] 72 * `"page"`: A [page][] 73 * **`bar`**: `[str]` → The location of the action element. 74 * **Accepted Values**: 75 * `"upperLeft"`: Upper section of the left-side bar 76 * `"lowerLeft"`: Lower section of the left-side bar 77 * `"upperRight"`: Upper section of the right-side bar 78 * `"lowerRight"`: Lower section of the right-side bar 79 * **`variant`**: `[str]` = `None` → The variant of the button. 80 * **Accepted Values**: 81 * When **`type`** == `"pane"`: 82 * `"modal"`: A [modal pane][] 83 * `"wall"`: A [wall pane][] 84 * Otherwise: 85 * `None` 86 * **`color`**: `[str]` = `<system-default-value>` → 87 * The color of the button. If omitted, the default value is set by the system. 88 * **Note**: It must be a valid RGBA string. 89 * **Example**: `"rgba(255, 255, 255, 1)"`. 90 * **`apiCommand`**: `[str]` = `None` → The name of the [API command][] to trigger. 91 * **`apiCommandKeys`**: `[list[str]]` = `None` → 92 * The root API keys to pass to your `execute_command` function if an 93 `apiCommand` is provided. If omitted, all API keys are 94 passed to `execute_command`. 95 96 [page]: pages.html 97 [pane]: panes.html 98 [modal pane]: panes.html 99 [wall pane]: panes.html 100 [API command]: #appBar_data_star.spec 101 [react-icons]: https://react-icons.github.io/react-icons/search 102 """ 103 return { 104 "kwargs": kwargs, 105 "accepted_values": { 106 "type": ["session", "settings", "button", "pane", "page"], 107 "variant": ["modal", "wall"] if type == "pane" else [], 108 "bar": ["upperLeft", "lowerLeft", "upperRight", "lowerRight"], 109 }, 110 } 111 112 def __extend_spec__(self, **kwargs): 113 color = self.data.get("color") 114 if color: 115 self.__check_color_string_valid__(color_string=color, prepend_path=["color"]) 116 # Validate pageIds 117 bar_type = self.data.get("type") 118 if bar_type == "page": 119 self.__check_subset_valid__( 120 subset=[kwargs.get("CustomKeyValidatorFieldId")], 121 valid_values=kwargs.get("page_validPageIds", []), 122 prepend_path=[], 123 ) 124 if bar_type == "pane": 125 self.__check_subset_valid__( 126 subset=[kwargs.get("CustomKeyValidatorFieldId")], 127 valid_values=kwargs.get("pane_validPaneIds", []), 128 prepend_path=[], 129 )
21@type_enforced.Enforcer 22class appBar(ApiValidator): 23 """ 24 The app bar is located under the path **`appBar`**. 25 """ 26 27 @staticmethod 28 def spec(data: dict = dict(), **kwargs): 29 """ 30 @private 31 Arguments: 32 33 * **`data`**: `[dict]` = `{}` → The data to pass to `appBar.data.*`. 34 """ 35 return {"kwargs": kwargs, "accepted_values": {}} 36 37 def __extend_spec__(self, **kwargs): 38 data = self.data.get("data", {}) 39 CustomKeyValidator( 40 data=data, log=self.log, prepend_path=["data"], validator=appBar_data_star, **kwargs 41 )
The app bar is located under the path appBar
.
Inherited Members
44@type_enforced.Enforcer 45class appBar_data_star(ApiValidator): 46 """ 47 The app bar data is located under the path **`appBar.data`**. 48 """ 49 50 @staticmethod 51 def spec( 52 icon: str, 53 type: str, 54 bar: str, 55 variant: [str, None] = None, 56 color: [str, None] = None, 57 apiCommand: [str, None] = None, 58 apiCommandKeys: [list[str], None] = None, 59 **kwargs, 60 ): 61 """ 62 Arguments: 63 64 * **`icon`**: `[str]` → An icon to display in the center of the action element. 65 * **Note**: It must be a valid icon name from the [react-icons][] bundle, preceded by the abbreviated name of the icon library source. 66 * **Example**: `"md/MdRocket"`. 67 * **`type`**: `[str]` → The type of object displayed when the action is triggered. 68 * **Accepted Values**: 69 * `"session"`: The Session Pane 70 * `"settings"`: The Application Settings Pane 71 * `"button"`: A button that allows you to send a command to the CAVE API 72 * `"pane"`: A [custom pane][] 73 * `"page"`: A [page][] 74 * **`bar`**: `[str]` → The location of the action element. 75 * **Accepted Values**: 76 * `"upperLeft"`: Upper section of the left-side bar 77 * `"lowerLeft"`: Lower section of the left-side bar 78 * `"upperRight"`: Upper section of the right-side bar 79 * `"lowerRight"`: Lower section of the right-side bar 80 * **`variant`**: `[str]` = `None` → The variant of the button. 81 * **Accepted Values**: 82 * When **`type`** == `"pane"`: 83 * `"modal"`: A [modal pane][] 84 * `"wall"`: A [wall pane][] 85 * Otherwise: 86 * `None` 87 * **`color`**: `[str]` = `<system-default-value>` → 88 * The color of the button. If omitted, the default value is set by the system. 89 * **Note**: It must be a valid RGBA string. 90 * **Example**: `"rgba(255, 255, 255, 1)"`. 91 * **`apiCommand`**: `[str]` = `None` → The name of the [API command][] to trigger. 92 * **`apiCommandKeys`**: `[list[str]]` = `None` → 93 * The root API keys to pass to your `execute_command` function if an 94 `apiCommand` is provided. If omitted, all API keys are 95 passed to `execute_command`. 96 97 [page]: pages.html 98 [pane]: panes.html 99 [modal pane]: panes.html 100 [wall pane]: panes.html 101 [API command]: #appBar_data_star.spec 102 [react-icons]: https://react-icons.github.io/react-icons/search 103 """ 104 return { 105 "kwargs": kwargs, 106 "accepted_values": { 107 "type": ["session", "settings", "button", "pane", "page"], 108 "variant": ["modal", "wall"] if type == "pane" else [], 109 "bar": ["upperLeft", "lowerLeft", "upperRight", "lowerRight"], 110 }, 111 } 112 113 def __extend_spec__(self, **kwargs): 114 color = self.data.get("color") 115 if color: 116 self.__check_color_string_valid__(color_string=color, prepend_path=["color"]) 117 # Validate pageIds 118 bar_type = self.data.get("type") 119 if bar_type == "page": 120 self.__check_subset_valid__( 121 subset=[kwargs.get("CustomKeyValidatorFieldId")], 122 valid_values=kwargs.get("page_validPageIds", []), 123 prepend_path=[], 124 ) 125 if bar_type == "pane": 126 self.__check_subset_valid__( 127 subset=[kwargs.get("CustomKeyValidatorFieldId")], 128 valid_values=kwargs.get("pane_validPaneIds", []), 129 prepend_path=[], 130 )
The app bar data is located under the path appBar.data
.
@staticmethod
def
spec( icon: str, type: str, bar: str, variant: [<class 'str'>, None] = None, color: [<class 'str'>, None] = None, apiCommand: [<class 'str'>, None] = None, apiCommandKeys: [list[str], None] = None, **kwargs):
50 @staticmethod 51 def spec( 52 icon: str, 53 type: str, 54 bar: str, 55 variant: [str, None] = None, 56 color: [str, None] = None, 57 apiCommand: [str, None] = None, 58 apiCommandKeys: [list[str], None] = None, 59 **kwargs, 60 ): 61 """ 62 Arguments: 63 64 * **`icon`**: `[str]` → An icon to display in the center of the action element. 65 * **Note**: It must be a valid icon name from the [react-icons][] bundle, preceded by the abbreviated name of the icon library source. 66 * **Example**: `"md/MdRocket"`. 67 * **`type`**: `[str]` → The type of object displayed when the action is triggered. 68 * **Accepted Values**: 69 * `"session"`: The Session Pane 70 * `"settings"`: The Application Settings Pane 71 * `"button"`: A button that allows you to send a command to the CAVE API 72 * `"pane"`: A [custom pane][] 73 * `"page"`: A [page][] 74 * **`bar`**: `[str]` → The location of the action element. 75 * **Accepted Values**: 76 * `"upperLeft"`: Upper section of the left-side bar 77 * `"lowerLeft"`: Lower section of the left-side bar 78 * `"upperRight"`: Upper section of the right-side bar 79 * `"lowerRight"`: Lower section of the right-side bar 80 * **`variant`**: `[str]` = `None` → The variant of the button. 81 * **Accepted Values**: 82 * When **`type`** == `"pane"`: 83 * `"modal"`: A [modal pane][] 84 * `"wall"`: A [wall pane][] 85 * Otherwise: 86 * `None` 87 * **`color`**: `[str]` = `<system-default-value>` → 88 * The color of the button. If omitted, the default value is set by the system. 89 * **Note**: It must be a valid RGBA string. 90 * **Example**: `"rgba(255, 255, 255, 1)"`. 91 * **`apiCommand`**: `[str]` = `None` → The name of the [API command][] to trigger. 92 * **`apiCommandKeys`**: `[list[str]]` = `None` → 93 * The root API keys to pass to your `execute_command` function if an 94 `apiCommand` is provided. If omitted, all API keys are 95 passed to `execute_command`. 96 97 [page]: pages.html 98 [pane]: panes.html 99 [modal pane]: panes.html 100 [wall pane]: panes.html 101 [API command]: #appBar_data_star.spec 102 [react-icons]: https://react-icons.github.io/react-icons/search 103 """ 104 return { 105 "kwargs": kwargs, 106 "accepted_values": { 107 "type": ["session", "settings", "button", "pane", "page"], 108 "variant": ["modal", "wall"] if type == "pane" else [], 109 "bar": ["upperLeft", "lowerLeft", "upperRight", "lowerRight"], 110 }, 111 }
Arguments:
icon
:[str]
→ An icon to display in the center of the action element.- Note: It must be a valid icon name from the react-icons bundle, preceded by the abbreviated name of the icon library source.
- Example:
"md/MdRocket"
.
type
:[str]
→ The type of object displayed when the action is triggered.- Accepted Values:
"session"
: The Session Pane"settings"
: The Application Settings Pane"button"
: A button that allows you to send a command to the CAVE API"pane"
: A [custom pane][]"page"
: A page
- Accepted Values:
bar
:[str]
→ The location of the action element.- Accepted Values:
"upperLeft"
: Upper section of the left-side bar"lowerLeft"
: Lower section of the left-side bar"upperRight"
: Upper section of the right-side bar"lowerRight"
: Lower section of the right-side bar
- Accepted Values:
variant
:[str]
=None
→ The variant of the button.- Accepted Values:
- When
type
=="pane"
:"modal"
: A modal pane"wall"
: A wall pane
- Otherwise:
None
- When
- Accepted Values:
color
:[str]
=<system-default-value>
→- The color of the button. If omitted, the default value is set by the system.
- Note: It must be a valid RGBA string.
- Example:
"rgba(255, 255, 255, 1)"
.
apiCommand
:[str]
=None
→ The name of the API command to trigger.apiCommandKeys
:[list[str]]
=None
→- The root API keys to pass to your
execute_command
function if anapiCommand
is provided. If omitted, all API keys are passed toexecute_command
.
- The root API keys to pass to your