Source code for qiskit_metal.renderers.renderer_base.rndr_analysis
# -*- coding: utf-8 -*-# This code is part of Qiskit.## (C) Copyright IBM 2017, 2021.## This code is licensed under the Apache License, Version 2.0. You may# obtain a copy of this license in the LICENSE.txt file in the root directory# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.## Any modifications or derivative works of this code must retain this# copyright notice, and modified files need to carry a notice indicating# that they have been altered from the originals.from.importQRendererfrom...importDictfromabcimportabstractmethod,ABCfrom...designsimportQDesign,is_design__all__=['QRendererAnalysis']
[docs]classQRendererAnalysis(QRenderer):"""Abstract base class for all Renderers intended for Analysis. """def__init__(self,design:'QDesign',initiate=False,options:Dict=None):""" Args: design (QDesign): The design. initiate (bool): True to initiate the renderer (Default: False). settings (Dict, optional): Used to override default settings. Defaults to None. """super().__init__(design=design,initiate=initiate,render_options=options)
[docs]@abstractmethoddefinitialized(self):"""Abstract method. Must be implemented by the subclass. Is renderer ready to be used? Implementation must return boolean True if successful. False otherwise. """returnTrue
[docs]@abstractmethoddefrender_chips(self):"""Abstract method. Must be implemented by the subclass. Render all chips of the design. Calls render_chip for each chip. """pass
[docs]@abstractmethoddefrender_chip(self,name):"""Abstract method. Must be implemented by the subclass. Render the given chip. Args: name (str): chip to render """pass
[docs]@abstractmethoddefrender_components(self,selection=None):"""Abstract method. Must be implemented by the subclass. Render all components of the design. If selection is none, then render all components. Args: selection (QComponent): Component to render. """pass
[docs]@abstractmethoddefrender_component(self,component):"""Abstract method. Must be implemented by the subclass. Render the specified component. Args: component (QComponent): Component to render. """pass
[docs]@abstractmethoddefrender_element(self,element):"""Abstract method. Must be implemented by the subclass. Render the specified element Args: element (Element): Element to render. """pass
# if isinstance(element, path):# self.render_element_path(element)# elif isinstance(element, poly):# self.render_element_poly(element)# else:# self.logger.error('RENDERER ERROR: Unkown element {element}')
[docs]@abstractmethoddefrender_element_path(self,path):"""Abstract method. Must be implemented by the subclass. Render an element path. Args: path (str): Path to render. """pass
[docs]@abstractmethoddefrender_element_poly(self,poly):"""Abstract method. Must be implemented by the subclass. Render an element poly. Args: poly (Poly): Poly to render. """pass
[docs]@abstractmethoddefsave_screenshot(self,path:str=None,show:bool=True):"""Save the screenshot. Args: path (str, optional): Path to save location. Defaults to None. show (bool, optional): Whether or not to display the screenshot. Defaults to True. Returns: pathlib.WindowsPath: path to png formatted screenshot. """pass