QRenderer#
- class QRenderer(design: QDesign, initiate=False, render_template: Dict = None, render_options: Dict = None)[source]#
- Abstract base class for all Renderers of Metal designs and their
components and qgeometry.
- Handles:
designs components qgeometry paths polys chips
- Parameters:
design (QDesign) – The design
initiate (bool) – True to initiate the renderer. Defaults to False.
render_template (Dict, optional) – Typically used by GUI for template options for GDS. Defaults to None.
render_options (Dict, optional) – Used to override all options. 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)[source]#
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)[source]#
Returns an already loaded and instantiated renderer.
- Parameters:
name (str) – rendering name
- Returns:
Renderer with the given name
- Return type:
- classmethod get_template_options(design: QDesign, render_template: Dict = None, logger_: Logger = None, template_key: str = None) Dict [source]#
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] [source]#
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]
- classmethod load()[source]#
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 [source]#
Same as design.parse_value. See design for help.
- Returns:
Parsed value of input.
- Return type:
object
- classmethod populate_element_extensions()[source]#
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_design()[source]#
Abstract method. Must be implemented by the subclass. Renders all design chips and components.
- start(force=False)[source]#
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
- update_options(render_options: Dict | None = None, render_template: Dict | None = None)[source]#
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.