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, optional=[False, True])[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.
optional – Whether the boolean is optional and whether it should start active or not.
- addChoice(name, value=None, choices=None, transient=False, position=None, callback=None, optional=[False, True])[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.
optional – Whether the choice is optional and whether it should start active or not.
- addFFT(name='fft', value=None, transient=True, position=None, callback=None, optional=[False, True])[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
optional – Whether the fft option is optional and whether it should start active or not.
- addFile(name='file', value='', transient=True, position=None, callback=None, optional=[False, True])[source]
Add an option that represents the selection of a file. File options are often transient.
- Parameters:
name – The name of the file option
value – The value of the file option (path)
transient – Whether the file option is transient. Transient options are not saved and reloaded.
position – The position of the file 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.
optional – Whether the file option is optional and whether it should start active or not.
- addFloat(name, value=0.0, transient=False, position=None, widget='input', callback=None, optional=[False, True])[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.
optional – Whether the float is optional and whether it should start active or not.
- addFolder(name='folder', value='', transient=True, position=None, callback=None, optional=[False, True])[source]
Add an option that represents the selection of a folder. Folder options are often transient.
- Parameters:
name – The name of the folder option
value – The value of the folder option (path)
transient – Whether the folder option is transient. Transient options are not saved and reloaded.
position – The position of the folder 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.
optional – Whether the folder option is optional and whether it should start active or not.
- addImage(name='image', value=None, transient=True, position=None, callback=None, optional=[False, True])[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.
- Optional:
Whether the image is optional and whether it should start active or not.
- addInt(name, value=1, transient=False, position=None, widget='input', callback=None, optional=[False, True])[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.
optional – Whether the integer is optional and whether it should start active or not.
- addLabels(name='labels', value=None, transient=True, position=None, callback=None, optional=[False, True])[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.
optional – Whether the labels option is optional and whether it should start active or not.
- addPoints(name='points', value=None, transient=True, position=None, callback=None, optional=[False, True])[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.
optional – Whether the points option is optional and whether it should start active or not.
- addShapes(name='shapes', value=None, transient=True, position=None, callback=None, optional=[False, True])[source]
Add an option that represents the selection of a shapes image. Shapes options are often transient.
- Parameters:
name – The name of the shapes option
value – The value of the shapes option
transient – Whether the shapes option is transient. Transient options are not saved and reloaded.
position – The position of the shapes 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.
optional – Whether the shapes option is optional and whether it should start active or not.
- addStr(name, value='', transient=False, position=None, callback=None, optional=[False, True])[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.
optional – Whether the string is optional and whether it should start active or not.
- get(name, alt=None)[source]
Answer the option with the given name.
- Parameters:
name – The name of an option
alt – The alternative value to return if the option is not found
- Returns:
Answers the option with the given name as a dictionary or the alternative.
- getItems()[source]
Return a copy of the items stored in the options object.
- Returns:
A dictionary of all options in the options object.
- isOptional(name)[source]
Answer whether the option with the given name is optional.
- Parameters:
name – The name of an option
- Returns:
A boolean that answers whether the option is optional.
- 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.
- setValue(name, value)[source]
Set the value of the option with the given name to value.
- Parameters:
name – The name of an option
value – The new value of the option