autooptions.options module
- class autooptions.options.Options(applicationName, optionsName)[source]
Bases:
objectOptions are a list of parameters that are intended to be passed to an operation. Options have a name, a type and a value.
- addBool(name, value=False, transient=False, position=None, callback=None)[source]
An option that represents a binary choice.
- Parameters:
name – The name of the option
value – The boolean value, True or False
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called whenever the selected item is changed, whether via the gui or programmatically. The implementer must take care to avoid endless loops.
- addChoice(name, value=None, choices=None, transient=False, position=None, callback=None)[source]
An option that represents a choice in a list of given values.
- Parameters:
name – The name of the option
value – The text of the selected choice
choices – A collection of possible values
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called whenever the selected item is changed, whether via the gui or programmatically. The implementer must take care to avoid endless loops.
- addFFT(name='fft', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of an FFT image. Image options are often transient. The FFT is not a standard image, since only the amplitude information is in the image, while the phase information is kept in the metadata.
- Parameters:
name – The name of the option
value – The name of the fft layer
transient – Whether the fft option is transient. Transient options are not saved and reloaded.
position – The position of the fft option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the selected fft layer changes
- addFloat(name, value=0.0, transient=False, position=None, widget='input', callback=None)[source]
An option that represents a float value.
- Parameters:
name – The name of the option
value – The float value
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
widget – Currently only the input-widget, which means entering the number into an input field, is implemented. However, a float could also be entered in a different way, for example using a slider.
callback – A callback function, that is called when the value is changed via the graphical interface.
- addImage(name='image', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of an image. Image options are often transient.
- Parameters:
name – The name of the image option
value – The value of the image option
transient – Whether the image option is transient. Transient options are not saved and reloaded.
position – The position of the image option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addInt(name, value=1, transient=False, position=None, widget='input', callback=None)[source]
An option that represents an integer value.
- Parameters:
name – The name of the option
value – The integer value
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
widget – Currently only the input-widget, which means entering the number into an input field, is implemented. However, an integer could also be entered in a different way, for example using a slider.
callback – A callback function, that is called when the value is changed via the graphical interface.
- addLabels(name='labels', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of a labels image. Labels options are often transient.
- Parameters:
name – The name of the labels option
value – The value of the labels option
transient – Whether the labels option is transient. Transient options are not saved and reloaded.
position – The position of the labels option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addPoints(name='points', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of a points layer. Points options are often transient.
- Parameters:
name – The name of the points option
value – The value of the points option
transient – Whether the points option is transient. Transient options are not saved and reloaded.
position – The position of the points option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addStr(name, value='', transient=False, position=None, callback=None)[source]
An option that represents a textual value.
- Parameters:
name – The name of the option
value – The text
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the value is changed via the graphical interface.
- get(name)[source]
Answer the option with the given name.
- Parameters:
name – The name of an option
- Returns:
Answers the option with the given name as a dictionary
- getBaseOption(value, transient, position, callback)[source]
A helper method to set the parts of an option that a common to all kinds of options.
- Parameters:
value – The value of the option
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the value of the option changes.
- getItems()[source]
Return the items stored in the options object.
- Returns:
A dictionary of all options in the options object.
- set(name, option)[source]
Set the option in options under the given name.
- Parameters:
name – The name of an option
option – The new option
- setDefaultValues(defaultItems)[source]
Set the default values for all options in the options object. Currently unused. The idea is that it might be useful to have default values, other than in the code, to which the option can be reset.
- Parameters:
defaultItems – A dictionary of default values for all options in the options object.