def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        self.setDisabled(True)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            self._xray_imaging_parameters = copy.deepcopy(
                self._xray_imaging_parameters)
            self._xray_imaging_parameters_widget.update_data_model(
                self._xray_imaging_parameters)
            self._xray_imaging_parameters_widget.set_detector_distance(
                HWR.beamline.detector.distance.get_value())
            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(True)

        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(True)

        elif isinstance(tree_item, queue_item.XrayImagingQueueItem):
            data_model = tree_item.get_model()

            self._path_template = data_model.get_path_template()
            self._data_path_widget.update_data_model(self._path_template)

            self._acquisition_parameters = data_model.acquisitions[
                0].acquisition_parameters
            self._acq_widget.update_data_model(self._acquisition_parameters,
                                               self._path_template)

            self._xray_imaging_parameters = data_model.xray_imaging_parameters
            self._xray_imaging_parameters_widget.update_data_model(
                self._xray_imaging_parameters)

            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(False)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            sample_model = tree_item.get_model()
            self._processing_parameters = sample_model.processing_parameters
            # self._processing_parameters = copy.deepcopy(self._processing_parameters)
            self._processing_widget.update_data_model(self._processing_parameters)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            data_collection = tree_item.get_model()

            if data_collection.is_helical():
                self.setDisabled(tree_item.get_model().is_executed())

                self._path_template = data_collection.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)
                self._acquisition_parameters = data_collection.acquisitions[
                    0
                ].acquisition_parameters

                if len(data_collection.acquisitions) == 2:
                    start_cpos = data_collection.acquisitions[
                        0
                    ].acquisition_parameters.centred_position
                    end_cpos = data_collection.acquisitions[
                        1
                    ].acquisition_parameters.centred_position
                    num_images = data_collection.acquisitions[
                        0
                    ].acquisition_parameters.num_images
                    self.select_line_with_cpos(start_cpos, end_cpos, num_images)

                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template
                )
                # self.get_acquisition_widget().use_osc_start(True)

                self._processing_parameters = data_collection.processing_parameters
                self._processing_widget.update_data_model(self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)

        if (
            isinstance(tree_item, queue_item.SampleQueueItem)
            or isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)
            or isinstance(tree_item, queue_item.DataCollectionQueueItem)
        ):

            self._processing_widget.update_data_model(self._processing_parameters)
            self._acq_widget.update_data_model(
                self._acquisition_parameters, self._path_template
            )
Beispiel #3
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            sample_model = tree_item.get_model()
            self._processing_parameters = sample_model.processing_parameters
            # self._processing_parameters = copy.deepcopy(self._processing_parameters)
            self._processing_widget.update_data_model(
                self._processing_parameters)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            data_collection = tree_item.get_model()

            if data_collection.is_helical():
                self.setDisabled(tree_item.get_model().is_executed())

                self._path_template = data_collection.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)
                self._acquisition_parameters = data_collection.acquisitions[
                    0].acquisition_parameters

                if len(data_collection.acquisitions) == 2:
                    start_cpos = data_collection.acquisitions[
                        0].acquisition_parameters.centred_position
                    end_cpos = data_collection.acquisitions[
                        1].acquisition_parameters.centred_position
                    num_images = data_collection.acquisitions[
                        0].acquisition_parameters.num_images
                    self.select_line_with_cpos(start_cpos, end_cpos,
                                               num_images)

                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template)
                # self.get_acquisition_widget().use_osc_start(True)

                self._processing_parameters = data_collection.processing_parameters
                self._processing_widget.update_data_model(
                    self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)

        if (isinstance(tree_item, queue_item.SampleQueueItem) or isinstance(
                tree_item, queue_item.DataCollectionGroupQueueItem)
                or isinstance(tree_item, queue_item.DataCollectionQueueItem)):

            self._processing_widget.update_data_model(
                self._processing_parameters)
            self._acq_widget.update_data_model(self._acquisition_parameters,
                                               self._path_template)
Beispiel #4
0
    def single_item_selection(self, tree_item):
        """
        Method called when a queue item in the tree is selected
        :param tree_item: queue_item
        :return: None
        """
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            sample_model = tree_item.get_model()
            # self._processing_parameters = copy.deepcopy(self._processing_parameters)
            self._processing_parameters = sample_model.processing_parameters
            self._processing_widget.update_data_model(
                self._processing_parameters)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            dc_model = tree_item.get_model()
            self._acq_widget.use_kappa(False)

            if not dc_model.is_helical():
                if dc_model.is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                sample_data_model = self.get_sample_item(tree_item).get_model()
                energy_scan_result = sample_data_model.crystals[
                    0].energy_scan_result
                self._acq_widget.set_energies(energy_scan_result)

                # self._acq_widget.disable_inverse_beam(True)

                self._path_template = dc_model.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = dc_model.acquisitions[
                    0].acquisition_parameters
                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template)
                # self.get_acquisition_widget().use_osc_start(True)
                if len(dc_model.acquisitions) == 1:
                    HWR.beamline.sample_view.select_shape_with_cpos(
                        self._acquisition_parameters.centred_position)

                self._processing_parameters = dc_model.processing_parameters
                self._processing_widget.update_data_model(
                    self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)
    def single_item_selection(self, tree_item):
        """
        Method called when a queue item in the tree is selected
        :param tree_item: queue_item
        :return: None
        """
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            sample_model = tree_item.get_model()
            # self._processing_parameters = copy.deepcopy(self._processing_parameters)
            self._processing_parameters = sample_model.processing_parameters
            self._processing_widget.update_data_model(self._processing_parameters)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            dc_model = tree_item.get_model()
            self._acq_widget.use_kappa(False)

            if not dc_model.is_helical():
                if dc_model.is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                sample_data_model = self.get_sample_item(tree_item).get_model()
                energy_scan_result = sample_data_model.crystals[0].energy_scan_result
                self._acq_widget.set_energies(energy_scan_result)

                # self._acq_widget.disable_inverse_beam(True)

                self._path_template = dc_model.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = dc_model.acquisitions[0].acquisition_parameters
                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template
                )
                # self.get_acquisition_widget().use_osc_start(True)
                if len(dc_model.acquisitions) == 1:
                    self.select_shape_with_cpos(
                        self._acquisition_parameters.centred_position
                    )

                self._processing_parameters = dc_model.processing_parameters
                self._processing_widget.update_data_model(self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)
    def single_item_selection(self, tree_item):
        """
        Descript. :
        """
        CreateTaskBase.single_item_selection(self, tree_item)
        self.dc_selected = False

        if isinstance(tree_item, queue_item.SampleQueueItem):
            pass
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            pass
            # self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem) or isinstance(
            tree_item, queue_item.XrayCenteringQueueItem
        ):

            if isinstance(tree_item, queue_item.XrayCenteringQueueItem):
                data_collection = tree_item.get_model().reference_image_collection
            else:
                data_collection = tree_item.get_model()

            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if data_collection.is_mesh():
                # sample_data_model = self.get_sample_item(tree_item).get_model()
                # self._acq_widget.disable_inverse_beam(True)
                # api.graphics.de_select_all()
                api.graphics.select_shape(data_collection.grid)
                self._advanced_methods_widget.grid_treewidget.setCurrentItem(
                    self._grid_map[data_collection.grid]
                )

                self._path_template = data_collection.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = data_collection.acquisitions[
                    0
                ].acquisition_parameters
                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template
                )
                # self.get_acquisition_widget().use_osc_start(True)
            self.dc_selected = True
        else:
            self.setDisabled(True)
        self.grid_treewidget_item_selection_changed()
Beispiel #7
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            # self._init_models()
            if self._char_params.space_group == "":
                sample_model = tree_item.get_model()
                self._set_space_group(sample_model.processing_parameters.space_group)
            # self._acq_widget.update_data_model(self._acquisition_parameters,
            #                                   self._path_template)
            # self._char_params_mib.set_model(self._char_params)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.CharacterisationQueueItem):
            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            self._char = tree_item.get_model()

            if self._char.get_path_template():
                self._path_template = self._char.get_path_template()

            self._data_path_widget.update_data_model(self._path_template)

            data_collection = self._char.reference_image_collection

            self._char_params = self._char.characterisation_parameters
            self._char_params_mib.set_model(self._char_params)

            self._acquisition_parameters = data_collection.acquisitions[
                0
            ].acquisition_parameters

            self._acq_widget.update_data_model(
                self._acquisition_parameters, self._path_template
            )
            # self.get_acquisition_widget().use_osc_start(True)

            if len(data_collection.acquisitions) == 1:
                self.select_shape_with_cpos(
                    self._acquisition_parameters.centred_position
                )

            self._processing_parameters = data_collection.processing_parameters
        else:
            self.setDisabled(True)
Beispiel #8
0
    def single_item_selection(self, tree_item):
        """
        Descript. :
        """
        CreateTaskBase.single_item_selection(self, tree_item)
        self.dc_selected = False

        if isinstance(tree_item, queue_item.SampleQueueItem):
            pass
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            pass
            # self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem) or isinstance(
            tree_item, queue_item.XrayCenteringQueueItem
        ):

            if isinstance(tree_item, queue_item.XrayCenteringQueueItem):
                data_collection = tree_item.get_model().reference_image_collection
            else:
                data_collection = tree_item.get_model()

            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if data_collection.is_mesh():
                HWR.beamline.sample_view.select_shape(data_collection.grid)
                self._advanced_methods_widget.grid_treewidget.setCurrentItem(
                    self._grid_map[data_collection.grid]
                )

                self._path_template = data_collection.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = data_collection.acquisitions[
                    0
                ].acquisition_parameters
                self._acq_widget.update_data_model(
                    self._acquisition_parameters, self._path_template
                )
                # self.get_acquisition_widget().use_osc_start(True)
            self.dc_selected = True
        else:
            self.setDisabled(True)
        self.grid_treewidget_item_selection_changed()
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        escan_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.EnergyScanQueueItem):
            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if escan_model.get_path_template():
                self._path_template = escan_model.get_path_template()

            self._data_path_widget.update_data_model(self._path_template)
        elif not (isinstance(tree_item, queue_item.SampleQueueItem)
                  or isinstance(tree_item,
                                queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
Beispiel #10
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            if self._char_params.space_group == "":
                sample_model = tree_item.get_model()
                self._set_space_group(sample_model.processing_parameters.space_group)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.CharacterisationQueueItem):
            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            self._char = tree_item.get_model()

            if self._char.get_path_template():
                self._path_template = self._char.get_path_template()

            self._data_path_widget.update_data_model(self._path_template)

            data_collection = self._char.reference_image_collection

            self._char_params = self._char.characterisation_parameters
            self._char_params_mib.set_model(self._char_params)

            self._acquisition_parameters = data_collection.acquisitions[
                0
            ].acquisition_parameters

            self._acq_widget.update_data_model(
                self._acquisition_parameters, self._path_template
            )
            # self.get_acquisition_widget().use_osc_start(True)

            if len(data_collection.acquisitions) == 1:
                HWR.beamline.sample_view.select_shape_with_cpos(
                    self._acquisition_parameters.centred_position
                )

            self._processing_parameters = data_collection.processing_parameters
        else:
            self.setDisabled(True)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        self.xrf_spectrum_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.XRFSpectrumQueueItem):
            if self.xrf_spectrum_model.is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if self.xrf_spectrum_model.get_path_template():
                self._path_template = self.xrf_spectrum_model.get_path_template()

            self._data_path_widget.update_data_model(self._path_template)
        elif not (
            isinstance(tree_item, queue_item.SampleQueueItem)
            or isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)
        ):
            self.setDisabled(True)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        wf_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.SampleQueueItem):
            self.init_models()

        else:
            if isinstance(tree_item, queue_item.GphlWorkflowQueueItem):
                if tree_item.get_model().is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                if wf_model.get_path_template():
                    self._path_template = wf_model.get_path_template()

                self._data_path_widget.update_data_model(self._path_template)

            elif isinstance(tree_item, queue_item.BasketQueueItem):
                self.setDisabled(False)
            elif not isinstance(tree_item, queue_item.DataCollectionGroupQueueItem):
                self.setDisabled(True)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        self.setDisabled(True)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            self._xray_imaging_parameters = copy.deepcopy(self._xray_imaging_parameters)
            self._xray_imaging_parameters_widget.update_data_model(
                self._xray_imaging_parameters
            )
            self._xray_imaging_parameters_widget.set_detector_distance(
                api.detector_distance.get_position()
            )
            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(True)

        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(True)

        elif isinstance(tree_item, queue_item.XrayImagingQueueItem):
            data_model = tree_item.get_model()

            self._path_template = data_model.get_path_template()
            self._data_path_widget.update_data_model(self._path_template)

            self._acquisition_parameters = data_model.acquisitions[0].acquisition_parameters
            self._acq_widget.update_data_model(
                self._acquisition_parameters, self._path_template
            )

            self._xray_imaging_parameters = data_model.xray_imaging_parameters
            self._xray_imaging_parameters_widget.update_data_model(
                self._xray_imaging_parameters
            )

            self.setDisabled(False)
            self._xray_imaging_parameters_widget.enable_distance_tools(False)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        wf_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.SampleQueueItem):
            self.init_models()

        else:
            if isinstance(tree_item, queue_item.GphlWorkflowQueueItem):
                if tree_item.get_model().is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                if wf_model.get_path_template():
                    self._path_template = wf_model.get_path_template()

                self._data_path_widget.update_data_model(self._path_template)

            elif isinstance(tree_item, queue_item.BasketQueueItem):
                self.setDisabled(False)
            elif not isinstance(tree_item,
                                queue_item.DataCollectionGroupQueueItem):
                self.setDisabled(True)