This feature allows the user to save named presets (referring to a snapshot of key acquisition parameters), irrespective of spectrometer serial number.
More...
|
| | __init__ (self, ctl) |
| |
| | apply (self, preset) |
| | The user has selected a preset from the comboBox, so apply it.
|
| |
| | clear_all (self) |
| | The user selected (Clear All) from the comboBox, so prompt to delete all presets.
|
| |
| | combo_callback (self) |
| | The user has changed the comboBox selection.
|
| |
| | create_new (self) |
| | The user has selected "Create New..." on the comboBox.
|
| |
| | get_default_configuration (self) |
| |
| | load_config (self) |
| | Load all previously created presets from enlighten.ini / Configuration.
|
| |
| | register (self, obj, attr, getter, setter) |
| | Another BusinessObject or Plugin has requested to include one of their attributes as part of new Presets.
|
| |
| | remove (self, preset) |
| | The user selected (Remove) from the comboBox, so prompt to delete the currently selected preset.
|
| |
| | reset (self, selected=None) |
| | We have added or removed a preset, so rebuild the comboBox and Configuration section.
|
| |
| | store (self, preset, feature, attr, value) |
| | Store the given value in a local dict tree (NOT Configuration)
|
| |
| | unregister (self, obj) |
| |
This feature allows the user to save named presets (referring to a snapshot of key acquisition parameters), irrespective of spectrometer serial number.
The proposed design is to let any Feature (or Plugin) register itself to PresetFeature and add one or more attributes for automatic inclusion when creating and applying presets.
External API would be something like:
class IntegrationTimeFeature:
def __init__:
ctl.presets.register(self, "integration_time_ms", setter=self.set_ms, getter=self.get_ms)
def get_ms(self):
return self.current_ms
def set_ms(self, value):
value = int(value) # presets come as strings
... (existing code)
Note that all values will be written and read as strings; it will be on the receiving set_preset to cast any persisted values back to the expected type.
Things we haven't fully thought-through:
Some spectrometers may not support a preset value (out of range), or even the feature itself; consider if we have a preset for gain_db but only have an X-Series plugged in, or a preset for 3ms integration time but are connected to a 785X-C. I am basically assuming that the individual features will be able to recognize if a given value is impossible / inapplicable to the currently connected device (or devices under Multispec.locked) and react graciously (ignore, closest approx, etc).
- Todo
- This class should probably register as an observer on Multispec, and re-fire apply(self.selected_preset) when Multispec changes the active spectrometer.