def __init__(self, tab_panel, tab_data): super(SparcAlignSettingsController, self).__init__(tab_data) main_data = tab_data.main self._ar_setting_cont = AngularSettingsController( tab_panel.fp_ma_settings_ar, "No angle-resolved camera found") self._spect_setting_cont = SpectrumSettingsController( tab_panel.fp_ma_settings_spectrum, "No spectrometer found") if main_data.ccd: self.add_hw_component(main_data.ccd, self._ar_setting_cont) if main_data.spectrometer: self.add_hw_component(main_data.spectrometer, self._spect_setting_cont) # increase a bit the font size for easy reading from far self.add_spec_chronograph(self._spect_setting_cont, 12) if main_data.spectrograph: comp = main_data.spectrograph conf = get_hw_config(comp, self._hw_settings_config) for a in ("wavelength", "grating", "slit-in"): if a not in comp.axes: logging.debug( "Skipping non existent axis %s on component %s", a, comp.name) continue self._spect_setting_cont.add_axis(a, comp, conf.get(a))
def add_hw_component(self, hw_comp, setting_controller, hidden=None): """ Add setting entries for the given hardware component hidden (None or set of str): name of VAs to not show """ hidden = HIDDEN_VAS | (hidden or set()) self.setting_controllers.append(setting_controller) vas_comp = getVAs(hw_comp) vas_config = get_hw_config( hw_comp, self._hw_settings_config) # OrderedDict or dict # Re-order the VAs of the component in the same order as in the config vas_names = util.sorted_according_to(list(vas_comp.keys()), list(vas_config.keys())) for name in vas_names: try: if name in hidden: continue elif name in vas_config: va_conf = vas_config[name] else: logging.debug("No config found for %s: %s", hw_comp.role, name) va_conf = None va = vas_comp[name] setting_controller.add_setting_entry(name, va, hw_comp, va_conf) except TypeError: msg = "Error adding %s setting for: %s" logging.exception(msg, hw_comp.name, name)
def __init__(self, tab_panel, tab_data): super(SparcAlignSettingsController, self).__init__(tab_data) main_data = tab_data.main self._ar_setting_cont = AngularSettingsController(tab_panel.fp_ma_settings_ar, "No angle-resolved camera found") self._spect_setting_cont = SpectrumSettingsController(tab_panel.fp_ma_settings_spectrum, "No spectrometer found") if main_data.ccd: self.add_hw_component(main_data.ccd, self._ar_setting_cont) if main_data.spectrometer: self.add_hw_component(main_data.spectrometer, self._spect_setting_cont) # increase a bit the font size for easy reading from far self.add_spec_chronograph(self._spect_setting_cont, 12) if main_data.spectrograph: comp = main_data.spectrograph conf = get_hw_config(comp, self._hw_settings_config) for a in ("wavelength", "grating", "slit-in"): if a not in comp.axes: logging.debug("Skipping non existent axis %s on component %s", a, comp.name) continue self._spect_setting_cont.add_axis(a, comp, conf.get(a))
def add_hw_component(self, hw_comp, setting_controller, hidden=None): """ Add setting entries for the given hardware component hidden (None or set of str): name of VAs to not show """ hidden = HIDDEN_VAS | (hidden or set()) self.setting_controllers.append(setting_controller) vas_comp = getVAs(hw_comp) vas_config = get_hw_config(hw_comp, self._hw_settings_config) # OrderedDict or dict # Re-order the VAs of the component in the same order as in the config vas_names = util.sorted_according_to(vas_comp.keys(), vas_config.keys()) for name in vas_names: try: if name in hidden: continue elif name in vas_config: va_conf = vas_config[name] else: logging.debug("No config found for %s: %s", hw_comp.role, name) va_conf = None va = vas_comp[name] setting_controller.add_setting_entry(name, va, hw_comp, va_conf) except TypeError: msg = "Error adding %s setting for: %s" logging.exception(msg, hw_comp.name, name)
def __init__(self, tab_panel, tab_data, highlight_change=False): super(SecomSettingsController, self).__init__(tab_data) main_data = tab_data.main self._sem_panel = SemSettingsController( tab_panel.fp_settings_secom_sem, "No SEM found", highlight_change, tab_data) self._optical_panel = OpticalSettingsController( tab_panel.fp_settings_secom_optical, "No optical microscope found", highlight_change, tab_data) # Add the components based on what is available # TODO: move it to a separate thread to save time at init? if main_data.ccd: # Hide exposureTime as it's in local settings of the stream self.add_hw_component(main_data.ccd, self._optical_panel, hidden={"exposureTime"}) if hasattr(tab_data, "confocal_set_stream"): conf_set_e = StreamController(tab_panel.pnl_opt_streams, tab_data.confocal_set_stream, tab_data) conf_set_e.stream_panel.flatten() # removes the expander header # StreamController looks pretty much the same as SettingController self.setting_controllers.append(conf_set_e) else: tab_panel.pnl_opt_streams.Hide() # Not needed # For now, we assume that the pinhole (axis) is global: valid for all # the confocal streams and FLIM stream. That's partly because most likely # the user wouldn't want to have separate values... and also because # anyway we don't currently support local stream axes. if main_data.pinhole: conf = get_hw_config(main_data.pinhole, self._hw_settings_config) for a in ("d", ): if a not in main_data.pinhole.axes: continue self._optical_panel.add_axis(a, main_data.pinhole, conf.get(a)) if main_data.ebeam: self.add_hw_component(main_data.ebeam, self._sem_panel) # If can do AutoContrast, display the button # TODO: check if detector has a .applyAutoContrast() method, instead # of detecting indirectly via the presence of .bpp. det = main_data.sed or main_data.bsd if det and model.hasVA(det, "bpp"): self._sem_panel.add_bc_control(det)
def __init__(self, tab_panel, tab_data, highlight_change=False): super(SecomSettingsController, self).__init__(tab_data) main_data = tab_data.main self._sem_panel = SemSettingsController(tab_panel.fp_settings_secom_sem, "No SEM found", highlight_change, tab_data) self._optical_panel = OpticalSettingsController(tab_panel.fp_settings_secom_optical, "No optical microscope found", highlight_change, tab_data) # Add the components based on what is available # TODO: move it to a separate thread to save time at init? if main_data.ccd: # Hide exposureTime as it's in local settings of the stream self.add_hw_component(main_data.ccd, self._optical_panel, hidden={"exposureTime"}) if hasattr(tab_data, "confocal_set_stream"): conf_set_e = StreamController(tab_panel.pnl_opt_streams, tab_data.confocal_set_stream, tab_data) conf_set_e.stream_panel.flatten() # removes the expander header # StreamController looks pretty much the same as SettingController self.setting_controllers.append(conf_set_e) else: tab_panel.pnl_opt_streams.Hide() # Not needed # For now, we assume that the pinhole (axis) is global: valid for all # the confocal streams and FLIM stream. That's partly because most likely # the user wouldn't want to have separate values... and also because # anyway we don't currently support local stream axes. if main_data.pinhole: conf = get_hw_config(main_data.pinhole, self._hw_settings_config) for a in ("d",): if a not in main_data.pinhole.axes: continue self._optical_panel.add_axis(a, main_data.pinhole, conf.get(a)) if main_data.ebeam: self.add_hw_component(main_data.ebeam, self._sem_panel) # If can do AutoContrast, display the button # TODO: check if detector has a .applyAutoContrast() method, instead # of detecting indirectly via the presence of .bpp. det = main_data.sed or main_data.bsd if det and model.hasVA(det, "bpp"): self._sem_panel.add_bc_control(det)