Uranium
Application Framework
UM.Settings.SettingFunction.SettingFunction Class Reference

Encapsulates Python code that provides a simple value calculation function. More...

Inheritance diagram for UM.Settings.SettingFunction.SettingFunction:
UM.Settings.Validator.Validator

Public Member Functions

def __init__
 Constructor. More...
 
def __call__
 Call the actual function to calculate the value. More...
 
def __eq__ (self, other)
 
def isValid (self)
 Returns whether the function is ready to be executed. More...
 
def getUsedSettingKeys (self)
 Retrieve a set of the keys (strings) of all the settings used in this function. More...
 
def __str__ (self)
 
def __repr__ (self)
 
def __getstate__ (self)
 To support Pickle. More...
 
def __setstate__
 
def registerOperator
 Expose a custom function to the code executed by SettingFunction. More...
 

Detailed Description

Encapsulates Python code that provides a simple value calculation function.

Constructor & Destructor Documentation

◆ __init__()

def UM.Settings.SettingFunction.SettingFunction.__init__ (   self,
  code 
)

Constructor.

Parameters
codeThe Python code this function should evaluate.

Member Function Documentation

◆ __call__()

def UM.Settings.SettingFunction.SettingFunction.__call__ (   self,
  value_provider 
)

Call the actual function to calculate the value.

◆ __getstate__()

def UM.Settings.SettingFunction.SettingFunction.__getstate__ (   self,
  Dict,
  str,
  Any 
)

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.

◆ getUsedSettingKeys()

def UM.Settings.SettingFunction.SettingFunction.getUsedSettingKeys (   self,
  FrozenSet,
  str 
)

Retrieve a set of the keys (strings) of all the settings used in this function.

Returns
A set of the keys (strings) of all the settings used in this functions.

◆ isValid()

def UM.Settings.SettingFunction.SettingFunction.isValid (   self,
  bool 
)

Returns whether the function is ready to be executed.

Returns
True if the function is valid, or False if it's not.

◆ registerOperator()

def UM.Settings.SettingFunction.SettingFunction.registerOperator (   cls,
  name 
)

Expose a custom function to the code executed by SettingFunction.

Parameters
nameWhat identifier to use in the executed code.
operatorA callable that implements the actual logic to execute.

The documentation for this class was generated from the following file: