Description of component masks and their functionalities

Each component in Schematic Editor can be masked. A mask provides a functionality to change the view to the component. Also, a mask introduces a new level of namespace, so we can specify that some original property value is a name of a mask property, where its value will define the value of the original property. Mask is a way to specify properties for subsystem components.

A mask can be created by performing the Mask editor action which is located in the Mask menu which appears after right-clicking over a component for which the mask should be created. The Mask dialog is shown in Figure 1. Using the Mask dialog consists of three tabs, each of which enables the definition of different features of the Mask. These tabs are:

  • Properties tab - to define properties for the mask.
  • Initialization tab - to initialize masked components using Python code.
  • Compilation tab - to define the Python function that will be called during compilation.
  • Post-resolve tab - to define the Python function that will be called after model resolution.
  • Appearance tab - to specify the icon and the description for the masked component.

Figure 1: Mask dialog

Properties tab

The Properties tab consists of the Properties table and the Handler Definition panel.

The Properties table consists of following columns:
  • Label - Identifies the property in the component dialog.
  • Property - Uniquely identifies the property. Used for accessing the property through the API.
  • Widget - Defines the UI representation of the property.
  • Evaluate - Defines whether the entry for the property value will be evaluated (the default) or not.
  • Enabled - Defines whether the property can be modified in the component dialog (the default) or not.
  • Visible- Defines whether the property will be displayed in the component dialog (the default) or not.
  • Tab name - Allows organization of properties into separate tabs. Tab order can be defined by adding the prefix ":" after which an index number is specified. For example: General:1, Signal Processing:2, etc.
  • Unit - Defines the property value unit.
  • Handlers - Shows which handler is implemented for the property.

A property is added into the Properties table by pressing the button, and removed by pressing the button in the corresponding table column.

For each property it is possible to define a handler function that will be executed when a property value is manipulated in the Component Dialog. For a list of all property handlers, visit Property handlers.

Functions defined in the Initialization tab can be used inside all property handlers. Code outline, located on the left side of the property code editor, displays all functions that can be used inside handler.

Initialization tab

The Initialization tab allows you to write an implementation of init handler, that initializes the masked component. The Initialization tab is shown in Figure 2.

The Initialization tab consists of three parts:
  • Properties table - Displays all properties defined for the mask. Also, provides the functionality of inserting API commands into the Mask Intialization editor, either by double-clicking or left-clicking on the property name.
  • Mask Intialization editor - Allows for writing a Python function that initializes the masked component. For more details check init handler.
  • Code outline - Displays all function and variable definitions found in the Mask initialization script.

Property values are directly injected into the Mask Intialization function through a handler header. The handler header is a script that contains a series of get_property_valueAPI commands, and is used to simplify the Mask Intialization code. By default, the handler header is not visible, but it is possible to see its content by pressing the button.

After the Mask Intialization function is written, it is possible to run it and see how it performs by pressing the button. After running the function, any errors that occur will be reported in the Schematic Editor's message console.
Note: The Mask Initialization function is called during model and library loading.

Figure 2: Initialization tab

Compilation tab

The Compilation tab allows you to write an implementation of the pre_compile handler.
Note: Code written in this tab should not depend on the terminal types or dimensions, since they're being calculated later in the process of compilation.

Compilation tab is shown in the following picture:

Figure 3: Compilation tab

Post-resolve tab

The Post-resolve tab allows you to write an implementation of the post_resolve handler. Code written in this tab is intended to be used for various mask-level validations.

Post-resolve tab is shown in the following picture:

Figure 4: Post-resolve tab

Appearance tab

The Appearance tab allows two things:
  • Writing a masked component's description, and
  • Creating an icon for the masked component.

The Appearance tab is shown in the following figure:

Figure 5: Appearance tab