Parameter system: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
(Created page with "Starting from SweepMe! version 1.5.5., a parameter system is introduced that allows you to use placeholder strings at many places in the program to make thing more variables....")
 
No edit summary
Line 6: Line 6:


# The content is exactly a known parameter. For example, using ''{Y}'' in a text edit will lead to insertion of the current year.
# The content is exactly a known parameter. For example, using ''{Y}'' in a text edit will lead to insertion of the current year.
# If the content is not a know parameter, SweepMe! will try to do an inline python evaluation, e.g. ''{2+2}'' will lead to insertion of 4.
# If the content is not a known parameter, SweepMe! will try to do an inline python evaluation, e.g. ''{2+2}'' will lead to insertion of 4.


You can combine the replacement of parameters and the inline python evaluation by using multiple curly brackets, e.g. ''{int({Y}) + int({m})}'' which will result in adding the integer of the current year with the integer of the current month.
You can combine the replacement of parameters and the inline python evaluation by using multiple curly brackets, e.g. ''{int({Y}) + int({m})}'' which will result in adding the integer of the current year with the integer of the current month.

Revision as of 10:26, 13 October 2020

Starting from SweepMe! version 1.5.5., a parameter system is introduced that allows you to use placeholder strings at many places in the program to make thing more variables.

A list of all defined parameters can be found using the widget Parameters.

Every parameter is a string. To enter such a parameter in a text edit field, curly brackets {...} are used. Whenever SweepMe! detects curly brackets, the content of the brackets will be replaced. There are two scenarios:

  1. The content is exactly a known parameter. For example, using {Y} in a text edit will lead to insertion of the current year.
  2. If the content is not a known parameter, SweepMe! will try to do an inline python evaluation, e.g. {2+2} will lead to insertion of 4.

You can combine the replacement of parameters and the inline python evaluation by using multiple curly brackets, e.g. {int({Y}) + int({m})} which will result in adding the integer of the current year with the integer of the current month.

Creation of individual parameters

Individual parameters can be defined using the add-on module 'Form' that is used to create formular like widgets.