Text View
- class TextView(text, width, height, font=None, font_size=None)[source]
Bases:
IViewObjectInitialize a TextView used for rendering text annotations inside a layout cell.
- Parameters:
text (str) – The text content of the annotation.
width (int) – The width of the text view in pixels.
height (int) – The height of the text view in pixels.
font (str) – The font used for the text annotation. Defaults to
"Arial". Other options include"Courier"and"Times".font_size (int) – The font size used for rendering the text. Defaults to 18.
- Returns:
None
- delete_view()
Delete the underlying render view.
This method removes the associated ParaView render view from the visualization pipeline and logs that the view should no longer be used.
- Returns:
None
- get_case()
Return the loaded case this view is based on.
- Returns:
The loaded case of the view object.
- Return type:
- get_height()
Return the height of the view in pixels.
If the internally stored height is less than or equal to zero, a warning is logged and the height is set to a failsafe value of
10to prevent division-by-zero issues during rendering.- Returns:
The height of the view in pixels.
- Return type:
- get_render_object()
Return the underlying render object.
This base implementation does not define a render object and logs an error indicating that subclasses should override this method.
- Returns:
Always returns
Nonein the base class.
- get_render_view()
Return the underlying ParaView render view.
This method provides access to the internal
_render_viewattribute, which represents the ParaViewRenderViewused by the view for visualization.- Returns:
The associated ParaView render view.
- get_width()
Return the width of the view in pixels.
If the internally stored width is less than or equal to zero, a warning is logged and the width is set to a failsafe value of
10to prevent division-by-zero issues during rendering.- Returns:
The width of the view in pixels.
- Return type:
- render(layout, row=0, col=0)
Render the view into the given layout and apply modifiers.
This method performs the following steps in order: 1. Validates that
layoutis aLayoutinstance. 2. Renders the view’s own content via_render_insideat the specified grid position (row,col). 3. Toggles the orientation axes visibility on the underlying render view, if available. 4. Applies all attached render modifiers via_render_modifiers. 5. If both a display and block selectors are present, applies the block selection to the display.
- set_blocks(blocks)
Set the list of blocks to be displayed in the view.
This method assigns the provided list of block identifiers to the internal
_blocksattribute, determining which blocks are shown in the rendered output.- Parameters:
blocks (List[str]) – A list of block names or identifiers.
- Returns:
None