Mask handlers

Description of the mask handler functions available in Schematic Editor and Schematic API

Mask handlers are functions that you can define on the mask level, and are called on specific events. Table 1 contains a summary of the Mask handlers available on component masks.

Table 1. Mask handlers
Handler name Description
init
  • Called during model loading, and when a component is added to the schematic.
  • Used to initialize the component.
  • Can be used to define functions that become available to Property handlers.
  • Can be used to define variables which can be accessed by inner components of subsystems.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
pre_compile
  • Called during model compilation, when the hard evaluation (errors are reported) of component/mask properties is performed.
  • Used to perform validations of component/mask properties.
  • In the case of a subsystem, it can also be used to update the namespace with variables that can be accessed by its inner components.
  • Properties depending on the terminal signal types or dimensions may still be unresolved.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
post_resolve
  • Called during model compilation, after terminal signal types and dimensions are resolved.
  • Used to perform validations of component/mask properties.
  • Values of all properties are resolved at this point.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
define_icon
  • Called during model compilation, after terminal signal types and dimensions are resolved.
  • Used to perform validations of component/mask properties.
  • Values of all properties are resolved at this point.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
model_loaded
  • Called after the model is successfully loaded.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
post_c_code_export
  • Called after succesfully performing the C code export action.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
name_changed
  • Called after a component's name is changed.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
pre_copy
  • Called before a component is copied.
  • If you copy a subsystem, this handler will be called (in top-down manner) for every component inside where the handle is defined.
  • This handler is executed strictly in the context of Schematc Editor's UI.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
post_copy
  • Called after a component is copied.
  • If you copy a subsystem, this handler will be called (in top-down manner) for every component inside where the handle is defined.
  • This handler is executed strictly in the context of Schematc Editor's UI.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
pre_validate
  • Called at the beginning of compilation, after the model_init handler and soft evaluation (errors are not reported) of component/mask properties.
  • Used to prepare a component for validation.
  • Some properties in this handler could still have unresolved values.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
pre_delete
  • Called before a component is deleted.
  • If you delete a subsystem, this handler will NOT be called for the components inside.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
post_delete
  • Called after a component is deleted, unless pre_delete exits with an error.
  • If you delete a subsystem, this handler will NOT be called for the components inside.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
before_change
  • Called after the OK button is pressed in the default component properties dialog.
  • Normally used to validate user input.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object;
    • prop_entered_values - dictionary of current user inputs, per property.
open
  • Called when the component is double-clicked.
  • When this handler is changed, the default component properties dialog will not appear after double-clicking on the component.
  • Generally used to define custom Qt dialogs.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
on_dialog_open
  • Called when the component is double-clicked and the default component properties dialog is about to be shown.
  • Normally used to configure initial property display states.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object.
on_dialog_close
  • Called when the default component properties dialog is closed by the user.
  • Used to run code that depends on the close reason.
  • Parameters:
    • mdl - Schematic API object;
    • item_handle - mask handle object;
    • reason - the reason for the dialog closure, in string format:
      • "reason_close_ok" - user clicked the OK button;

      • "reason_close_cancel" - user clicked the Cancel or Close button.