Mask

This section describes mask

Each component in the schematic 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 picture (Figure 1). Using the Mask dialog consists of three tabs, each of which enables definition of different features of the mask. These tabs are:

  • Properties tab - to define properties for the mask.
  • Initialization tab - to initialize masked component using Python code.
  • Compilation tab - to define Python function that will be called during compilation.
  • Post-resolve tab - to define Python function that will be called after resolving is performed.
  • 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 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 prefix ":" after which 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 Python function that will be executed when property value is being manipulated in the component dialog - handler. There are three types of handlers that can be defined and those are:
  • Property value changed - Available for edit, combo and checkbox widgets. Called when a) modified property value is confirmed from the component dialog, and b) property value is changed from the API.
  • Property value edited - Available for edit, combo and checkbox widgets. Called when the property value is edited in the component dialog.
  • Button clicked - Available only for button widget. Called when the button is pressed in the component dialog.
Each handler has different arguments, but common arguments for all three are following:
  • mdl - SchematicAPI object. This argument allows direct usage of the Schematic API in the handlers.
  • container_handle - ItemHandle object that references the masked component.
  • prop_handle - ItemHandle object that references property for which the handler is defined.

Functions defined in 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 writing a Python function that initializes the masked component. The Initialization tab is shown in picture (Initialization tab).

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 initialization editor, either by double-clicking or left-clicking on the property name.
  • Mask initialization editor - Allows writing a Python function that initializes the masked component.
  • Code outline - Displays all function and variable definitions found in Mask initialization script.

Property values are directly injected into the mask initialization 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 initialization code. By default, the handler header is not visible, but it is possible to see its content by pressing the button.

After the mask initialization 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: Mask initialization function is called during model and library loading.

Figure 2: Initialization tab

Compilation tab

Compilation tab allows you to write code that will be executed during compilation process, after all mask properties are evaluated. Variables defined in the code will be added to the namespace of the components inside the subsystem.
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

Post-resolve tab allows you to write code that will be executed after all terminal types and dimensions are resolved. 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

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

Appearance tab is shown the following picture:

Figure 5: Appearance tab