QRendererAnalysis#

class QRendererAnalysis(design: QDesign, initiate=False, options: Dict | None = None)[source]#

Abstract base class for all Renderers intended for Analysis.

Parameters:
  • design (QDesign) – The design.

  • initiate (bool) – True to initiate the renderer (Default: False).

  • settings (Dict, optional) – Used to override default settings. 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 = 'base'#

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.

static get_renderer(name: str)#

Returns an already loaded and instantiated renderer.

Parameters:

name (str) – rendering name

Returns:

Renderer with the given name

Return type:

QRenderer

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.

Parameters:

highlight_qcomponents (Union[list, None], optional) – Components to render. Defaults to None.

Returns:

Tuple: Empty or partial list of components in QDesign.
int: 0 subset selected

1 every component selected 2 invalid

Return type:

Tuple[list, int]

abstract initialized()[source]#

Abstract method. Must be implemented by the subclass. Is renderer ready to be used? Implementation must return boolean True if successful. False otherwise.

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:

bool

parse_value(value: Any | List | Dict | Iterable) Any#

Same as design.parse_value. See design for help.

Returns:

Parsed value of input.

Return type:

object

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.

abstract render_chip(name)[source]#

Abstract method. Must be implemented by the subclass. Render the given chip.

Parameters:

name (str) – chip to render

abstract render_chips()[source]#

Abstract method. Must be implemented by the subclass. Render all chips of the design. Calls render_chip for each chip.

abstract render_component(component)[source]#

Abstract method. Must be implemented by the subclass. Render the specified component.

Parameters:

component (QComponent) – Component to render.

abstract render_components(selection=None)[source]#

Abstract method. Must be implemented by the subclass. Render all components of the design. If selection is none, then render all components.

Parameters:

selection (QComponent) – Component to render.

abstract render_design()#

Abstract method. Must be implemented by the subclass. Renders all design chips and components.

abstract render_element(element)[source]#

Abstract method. Must be implemented by the subclass. Render the specified element

Parameters:

element (Element) – Element to render.

abstract render_element_path(path)[source]#

Abstract method. Must be implemented by the subclass. Render an element path.

Parameters:

path (str) – Path to render.

abstract render_element_poly(poly)[source]#

Abstract method. Must be implemented by the subclass. Render an element poly.

Parameters:

poly (Poly) – Poly to render.

abstract save_screenshot(path: str | None = None, show: bool = True)[source]#

Save the screenshot.

Parameters:
  • path (str, optional) – Path to save location. Defaults to None.

  • show (bool, optional) – Whether or not to display the screenshot. Defaults to True.

Returns:

path to png formatted screenshot.

Return type:

pathlib.WindowsPath

start(force=False)#

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.

Parameters:

force (bool) – If True, need to scrap the existing initialization and re-do If False, will start a new one only if none exists. Defaults to False.

Returns:

is the renderer initialized successfully (thus usable?)

Return type:

bool

stop()#

Any calls that one may want to make after a rendering is complete.

update_options(render_options: Dict | None = None, render_template: Dict | None = 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.