QRendererGui¶
- class QRendererGui(gui, design: QDesign, initiate=True, fig=None, ax=None)[source]¶
Abstract base class for the GUI rendering.
Extends QRenderer. An interface class.
- Parameters:
gui (MetalGUI) – the GUI.
design (QDesign) – The design.
initiate (bool) – True to initiate the renderer. Defaults to True.
fig (matplotlib.figure.Figure) – current figure. Defaults to None.
ax (ax) – current ax. Defaults to None.
Attributes
- design¶
Return a reference to the parent design object.
- element_extensions = {}¶
Element extensions dictionary
- element_table_data = {}¶
Element table data.
- logger¶
Returns the logger.
- name = 'guibase'¶
Name
- options¶
Options for the QRenderer.
Methods
- add_table_data_to_QDesign(class_name: str)¶
During init of renderer, this needs to happen. In particular, each renderer needs to update custom columns and values within QDesign.
- Parameters:
class_name (str) – Name from cls.name for each renderer.
- clear_axis()[source]¶
Clear the axis.
- Raises:
NotImplementedError – Function not written yet
- clear_figure()[source]¶
Clear the figure.
- Raises:
NotImplementedError – Function not written yet
- classmethod get_template_options(design: QDesign, render_template: Dict = None, logger_: Logger = None, template_key: str = None) Dict¶
Creates template options for the Metal QRenderer class required for the class to function, based on the design template; i.e., be created, made, and rendered. Provides the blank option structure required.
The options can be extended by plugins, such as renderers.
- Parameters:
design (QDesign) – A design class.
render_template (Dict, optional) – Template options to overwrite the class ones. Defaults to None.
logger (logging.Logger, optional) – A logger for errors. Defaults to None.
template_key (str, optional) – The design.template_options key identifier. If None, then use _get_unique_class_name(). Defaults to None.
- Returns:
Dictionary of renderer’s default options based on design.template_options.
- Return type:
Dict
- get_unique_component_ids(highlight_qcomponents: list | None = None) Tuple[list, int]¶
Confirm the list doesn’t have names of components repeated. Confirm that the name of component exists in QDesign. If QDesign doesn’t contain any component, or if all components in QDesign are found in highlight_qcomponents, return an empty list; otherwise return a list of unique components to be sent to the renderer. The second returned item, an integer, specifies which of these 3 cases applies.
- classmethod load()¶
Load the renderer and register all its extensions. Only performed once.
Once complete, the renderer is added to the class attribute ‘__loaded_renderers__’ of QRenderer
- Returns:
True if success, otherwise throws an error.
- Return type:
- parse_value(value: Any | List | Dict | Iterable) Any¶
Same as design.parse_value. See design for help.
- Returns:
Parsed value of input.
- Return type:
- classmethod populate_element_extensions()¶
Populate cls.element_extensions which will be used to create columns for tables in QGeometry tables.
The structure of cls.element_table_data should be same as cls.element_extensions.
- render_component(component)[source]¶
Render the given component.
- Parameters:
component (QComponent) – the component
- Raises:
NotImplementedError – Function not written yet
- render_connectors()[source]¶
Render connectors.
- Raises:
NotImplementedError – Function not written yet
- render_design(selection=None)[source]¶
Render the design.
- Parameters:
selection (selection) – Not used
- render_shapely()[source]¶
Render shapely.
- Raises:
NotImplementedError – Function not written yet
- set_fig(fig)[source]¶
Set the given figure.
- Parameters:
fig (matplotlib.figure.Figure) – Figure to set
- setup_fig(fig)[source]¶
Setup the given figure.
- Parameters:
fig (matplotlib.figure.Figure) – figure to setup
- Raises:
NotImplementedError – Function not written yet
- start(force: bool = False) bool¶
Call any initialization (single run) step required to setup the renderer for the first execution, such as connecting to some API or COM, or importing the correct material libraries, etc.
- style_axis(ax)[source]¶
Style the axis.
- Parameters:
ax (ax) – ax to style
- Raises:
NotImplementedError – Function not written yet
- update_options(render_options: Dict = None, render_template: Dict = None)¶
If template options has not been set for this renderer, then gather all the default options for children and add to design. The GUI would use this to store the template options.
Then give the template options to render to store in self.options. Then user can over-ride the render_options.
- Parameters:
render_options (Dict, optional) – If user wants to over-ride the template options. Defaults to None.
render_template (Dict, optional) – All the template options for each child. Defaults to None.