The documentation from version 39.5.17 of PLANTA project can be found in the new PLANTA Online Help.

Python Macros MOD009954

Access path
  • Customizer Module Customizer Modules Python Macros

Information

  • In this module, the existing module Python macro can be edited or, in case it has not existed yet, you can create a new macro.
  • Python macros can be customized by means of the functions in the Python API or standard Python functions.
  • PLANTA recommends to work with module subclasses instead of Python macros.

Procedure

From DB 39.5.13

  • Open the required module in the Modules module.
  • Click on the Edit macro button (at the right margin of the module header).
    • The Python Macros module is opened.
      • If a Python macro already exists, it can be edited. Therefore, see the Python API.
      • If there is no Python macro in the module yet, NEW click on the Insert template button which causes a template macro to be copied in automatically.
#MacroTemplate

mod_obj = ppms.get_target_module()

def on_load():
    pass

def on_initial_focus():
    mod_obj.menu(11)

def on_focus():
    pass

def on_reset():
    on_initial_focus()

def on_before_mv_switch(old_mv, new_mv):
    pass

def on_after_mv_switch(old_mv, new_mv):
    pass

From DB 39.5.4

  • Open the required module in the Modules module.
  • Click on the Edit macro button (at the right margin of the module header).
    • The Python Macros module is opened.
      • If a Python macro already exists, it can be edited. Therefore, see the Python API.
      • If there is no Python macro in the module yet, the following message will be displayed: No macro text available. Do you want to insert a template? If the message is answered with Yes, the following macro template is copied in:
#MacroTemplate

mod_obj = ppms.get_target_module()

def on_load():
    pass

def on_initial_focus():
    mod_obj.menu(11)

def on_focus():
    pass

def on_reset():
    on_initial_focus()

def on_before_mv_switch(old_mv, new_mv):
    pass

def on_after_mv_switch(old_mv, new_mv):
    pass

Up to DB 39.5.4

  • In the Modules module, click on the Edit macro button.
    • The Python Macros module is opened.
      • If a Python macro already exists, it can be edited. Therefore, see the Python API.
      • If there is no Python macro in the module yet, you can create a new macro.

Buttons

From DB 39.5.13

  • NEW Insert template: inserts a default macro (see the procedure above).
  • SQL : opens the statement entered in the PY macro of the module in the SQL Statements module. The statement can be edited here.
  • MSG: opens the dialog message(s) entered in the PY macro of the source DI in the Dialog Messages module. The dialog message(s) can be edited here.
  • CONST: opens the text constant entered in the PY value range of the source DI in the Text Constants module. The text constant(s) can be edited here.

Up to DB 39.5.13

  • SQL : opens the statement entered in the PY macro of the module in the SQL Statements module. The statement can be edited here.
  • MSG: opens the dialog message(s) entered in the PY macro of the source DI in the Dialog Messages module. The dialog message(s) can be edited here.
  • CONST: opens the text constant entered in the PY value range of the source DI in the Text Constants module. The text constant(s) can be edited here.
  • Notes

    • The Python macro of a module can also be opened and edited from the Modules module via the Edit Python macro button in an editor stored in the Global Settings.
    • If a module has a Python macro and macro lines, only the Python macro will be executed.

             PLANTA project









     
    • Suche in Topic-Namen

    • Suche in Topic-Inhalten
    This site is powered by the TWiki collaboration platform Powered by Perl