예제 #1
0
    def on_preset(self, evt):
        preset_name = self.cmb_presets.GetValue()
        try:
            new_preset = self._preset_values[preset_name]
        except KeyError:
            logging.debug("Not changing settings for preset %s", preset_name)
            return

        logging.debug("Changing setting to preset %s", preset_name)

        # TODO: presets should also be able to change the special stream settings
        # (eg: accumulation/interpolation) when we have them

        # apply the recorded values
        apply_preset(new_preset)

        # The hardware might not exactly apply the setting as computed in the
        # preset. We need the _exact_ same value to find back which preset is
        # currently selected. So update the values the first time.
        # TODO: this should not be necessary once the settings only change the
        # stream settings, and not directly the hardware.
        if preset_name not in self._presets_confirmed:
            for se in new_preset.keys():
                new_preset[se] = se.vigilattr.value
            self._presets_confirmed.add(preset_name)

        self.update_setting_display()
예제 #2
0
    def open_acquisition_dialog(self):
        secom_live_tab = self._tab_data_model.main.getTabByName("secom_live")

        # save the original settings
        main_settings_controller = secom_live_tab.settings_controller
        orig_settings = preset_as_is(main_settings_controller.entries)
        main_settings_controller.pause()
        main_settings_controller.enable(False)
        # TODO: also pause the MicroscopeViews

        # pause all the live acquisitions
        main_stream_controller = secom_live_tab.stream_controller
        paused_streams = main_stream_controller.pauseStreams()

        # create the dialog
        acq_dialog = AcquisitionDialog(self._main_frame, self._tab_data_model)
        parent_size = [v * 0.77 for v in self._main_frame.GetSize()]

        try:
            acq_dialog.SetSize(parent_size)
            acq_dialog.Center()
            acq_dialog.ShowModal()
        finally:
            main_stream_controller.resumeStreams(paused_streams)

            acqmng.apply_preset(orig_settings)
            main_settings_controller.resume()
            main_settings_controller.enable(True)

            # Make sure that the acquisition button is enabled again.
            self._main_frame.btn_secom_acquire.Enable()
예제 #3
0
    def on_preset(self, evt):
        preset_name = self.cmb_presets.GetValue()
        try:
            new_preset = self._preset_values[preset_name]
        except KeyError:
            logging.debug("Not changing settings for preset %s", preset_name)
            return

        logging.debug("Changing setting to preset %s", preset_name)

        # TODO: presets should also be able to change the special stream settings
        # (eg: accumulation/interpolation) when we have them

        # apply the recorded values
        apply_preset(new_preset)

        # The hardware might not exactly apply the setting as computed in the
        # preset. We need the _exact_ same value to find back which preset is
        # currently selected. So update the values the first time.
        # TODO: this should not be necessary once the settings only change the
        # stream settings, and not directly the hardware.
        if not preset_name in self._presets_confirmed:
            for se in new_preset.keys():
                new_preset[se] = se.va.value
            self._presets_confirmed.add(preset_name)

        self.update_setting_display()
예제 #4
0
    def open_acquisition_dialog(self):
        main_data = self._tab_data_model.main
        secom_live_tab = main_data.getTabByName("secom_live")

        # Indicate we are acquiring, especially important for the SEM which
        # need to get the external signal to not scan (cf MicroscopeController)
        main_data.is_acquiring.value = True

        # save the original settings
        settingsbar_controller = secom_live_tab.settingsbar_controller
        orig_entries = get_global_settings_entries(settingsbar_controller)
        for sc in secom_live_tab.streambar_controller.stream_controllers:
            orig_entries += get_local_settings_entries(sc)
        orig_settings = preset_as_is(orig_entries)
        settingsbar_controller.pause()
        settingsbar_controller.enable(False)

        # pause all the live acquisitions
        streambar_controller = secom_live_tab.streambar_controller
        streambar_controller.pauseStreams()
        streambar_controller.pause()

        if self._tab_data_model.tool.value == TOOL_SPOT:
            self._tab_data_model.tool.value = TOOL_NONE

        streambar_controller.enable(False)

        # create the dialog
        try:
            acq_dialog = AcquisitionDialog(self._tab_panel.Parent,
                                           self._tab_data_model)
            parent_size = [v * 0.77 for v in self._tab_panel.Parent.GetSize()]

            acq_dialog.SetSize(parent_size)
            acq_dialog.Center()
            action = acq_dialog.ShowModal()
        except Exception:
            logging.exception("Failed to create acquisition dialog")
            raise
        finally:
            acqmng.apply_preset(orig_settings)

            settingsbar_controller.enable(True)
            settingsbar_controller.resume()

            streambar_controller.enable(True)
            streambar_controller.resume()

            main_data.is_acquiring.value = False

            acq_dialog.Destroy()

        if action == wx.ID_OPEN:
            tab = main_data.getTabByName('analysis')
            main_data.tab.value = tab
            tab.load_data(acq_dialog.last_saved_file)
예제 #5
0
    def open_acquisition_dialog(self):
        main_data = self._tab_data_model.main
        secom_live_tab = main_data.getTabByName("secom_live")

        # Indicate we are acquiring, especially important for the SEM which
        # need to get the external signal to not scan (cf MicroscopeController)
        main_data.is_acquiring.value = True

        # save the original settings
        settingsbar_controller = secom_live_tab.settingsbar_controller
        orig_entries = get_global_settings_entries(settingsbar_controller)
        for sc in secom_live_tab.streambar_controller.stream_controllers:
            orig_entries += get_local_settings_entries(sc)
        orig_settings = preset_as_is(orig_entries)
        settingsbar_controller.pause()
        settingsbar_controller.enable(False)

        # pause all the live acquisitions
        streambar_controller = secom_live_tab.streambar_controller
        streambar_controller.pauseStreams()
        streambar_controller.pause()

        if self._tab_data_model.tool.value == TOOL_SPOT:
            self._tab_data_model.tool.value = TOOL_NONE

        streambar_controller.enable(False)

        # create the dialog
        try:
            acq_dialog = AcquisitionDialog(self._tab_panel.Parent, self._tab_data_model)
            parent_size = [v * 0.77 for v in self._tab_panel.Parent.GetSize()]

            acq_dialog.SetSize(parent_size)
            acq_dialog.Center()
            action = acq_dialog.ShowModal()
        except Exception:
            logging.exception("Failed to create acquisition dialog")
            raise
        finally:
            acqmng.apply_preset(orig_settings)

            settingsbar_controller.enable(True)
            settingsbar_controller.resume()

            streambar_controller.enable(True)
            streambar_controller.resume()

            main_data.is_acquiring.value = False

            acq_dialog.Destroy()

        if action == wx.ID_OPEN:
            tab = main_data.getTabByName('analysis')
            main_data.tab.value = tab
            tab.load_data(acq_dialog.last_saved_file)
예제 #6
0
    def _resume_settings(self):
        """
        Resume (unfreeze) the settings in the GUI and make sure the value are
        back to the previous value
        """
        live_streams = self._tab_data_model.focussedView.value.getStreams()
        for s in live_streams:
            s.should_update.value = True
            s.is_active.value = True

        acqmng.apply_preset(self._orig_settings)
        self._settings_controller.resume()
        self._settings_controller.enable(True)

        # Make sure that the acquisition button is enabled again.
        self._main_frame.btn_sparc_acquire.Enable()
예제 #7
0
    def _resume_settings(self):
        """
        Resume (unfreeze) the settings in the GUI and make sure the value are
        back to the previous value
        """
        live_streams = self._tab_data_model.focussedView.value.getStreams()
        for s in live_streams:
            s.should_update.value = True
            s.is_active.value = True

        acqmng.apply_preset(self._orig_settings)
        self._settings_controller.resume()
        self._settings_controller.enable(True)

        # Make sure that the acquisition button is enabled again.
        self._main_frame.btn_sparc_acquire.Enable()
예제 #8
0
    def open_acquisition_dialog(self):
        secom_live_tab = self._tab_data_model.main.getTabByName("secom_live")

        # Indicate we are acquiring, especially important for the SEM which
        # need to get the external signal to not scan (cf MicroscopeController)
        self._tab_data_model.main.is_acquiring.value = True

        # save the original settings
        settingsbar_controller = secom_live_tab.settingsbar_controller
        orig_entries = get_global_settings_entries(settingsbar_controller)
        for sc in secom_live_tab.streambar_controller.stream_controllers:
            orig_entries += get_local_settings_entries(sc)
        orig_settings = preset_as_is(orig_entries)
        settingsbar_controller.pause()
        settingsbar_controller.enable(False)

        # pause all the live acquisitions
        streambar_controller = secom_live_tab.streambar_controller
        paused_streams = streambar_controller.pauseStreams()
        streambar_controller.pause()
        streambar_controller.enable(False)

        # create the dialog
        try:
            acq_dialog = AcquisitionDialog(self._tab_panel.Parent, self._tab_data_model)
            parent_size = [v * 0.77 for v in self._tab_panel.Parent.GetSize()]

            acq_dialog.SetSize(parent_size)
            acq_dialog.Center()
            action = acq_dialog.ShowModal()
        finally:
            streambar_controller.resumeStreams(paused_streams)

            acqmng.apply_preset(orig_settings)

            settingsbar_controller.enable(True)
            settingsbar_controller.resume()

            streambar_controller.enable(True)
            streambar_controller.resume()

            self._tab_data_model.main.is_acquiring.value = False

        if action == wx.ID_OPEN:
            wx.GetApp().tab_controller.open_tab('analysis')
            self._tab_data_model.main.tab.value.load_data(acq_dialog.last_saved_file)