|
Uranium
Application Framework
|
Public Member Functions | |
| None | __init__ (self, str expression) |
| Any | __call__ (self, ContainerInterface value_provider, Optional[PropertyEvaluationContext] context=None) |
| bool | __eq__ (self, object other) |
| int | __hash__ (self) |
| bool | isValid (self) |
| FrozenSet[str] | getUsedSettingKeys (self) |
| str | __str__ (self) |
| str | __repr__ (self) |
| Dict[str, Any] | __getstate__ (self) |
| None | __setstate__ (self, Dict[str, Any] state) |
| None | registerOperator (cls, str name, Callable operator) |
Protected Member Functions | |
| _safeCompile (self) | |
Protected Attributes | |
| _code | |
| _used_keys | |
| _used_values | |
| _compiled | |
| _valid | |
Evaluates Python formulas for a setting's property. If a setting's property is a static type, e.g. a string, an int, a float, etc., its value will just be interpreted as it is, but when it's a Python code (formula), the value needs to be evaluated via this class.
| None UM.Settings.SettingFunction.SettingFunction.__init__ | ( | self, | |
| str | expression | ||
| ) |
Constructor. :param expression: The Python code this function should evaluate.
Reimplemented in UM.Settings.Validator.Validator.
| Any UM.Settings.SettingFunction.SettingFunction.__call__ | ( | self, | |
| ContainerInterface | value_provider, | ||
| Optional[PropertyEvaluationContext] | context = None |
||
| ) |
Call the actual function to calculate the value. :param value_provider: The container from which to get setting values in the formula. :param context: The context in which the call needs to be executed
Reimplemented in UM.Settings.Validator.Validator.
| Dict[str, Any] UM.Settings.SettingFunction.SettingFunction.__getstate__ | ( | self | ) |
To support Pickle Pickle does not support the compiled code, so instead remove it from the state. We can re-compile it later on anyway.
| FrozenSet[str] UM.Settings.SettingFunction.SettingFunction.getUsedSettingKeys | ( | self | ) |
Retrieve a set of the keys (strings) of all the settings used in this function. :return: A set of the keys (strings) of all the settings used in this functions.
| bool UM.Settings.SettingFunction.SettingFunction.isValid | ( | self | ) |
Returns whether the function is ready to be executed. :return: True if the function is valid, or False if it's not.
| None UM.Settings.SettingFunction.SettingFunction.registerOperator | ( | cls, | |
| str | name, | ||
| Callable | operator | ||
| ) |
Expose a custom function to the code executed by SettingFunction :param name: What identifier to use in the executed code. :param operator: A callable that implements the actual logic to execute.