def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        if isinstance(tree_item, queue_item.SampleQueueItem) or \
               isinstance(tree_item, queue_item.DataCollectionGroupQueueItem):
            self._processing_parameters = copy.deepcopy(self._processing_parameters)
            self._processing_widget.update_data_model(self._processing_parameters)
            self._acq_widget.disable_inverse_beam(False)

        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            dc = tree_item.get_model()

            if dc.experiment_type != queue_model_enumerables.EXPERIMENT_TYPE.HELICAL:
                self.setDisabled(False)
                self._acq_widget.disable_inverse_beam(True)
                
                self._path_template = dc.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = dc.acquisitions[0].acquisition_parameters
                self._acq_widget.update_data_model(self._acquisition_parameters,
                                                       self._path_template)
                
                if len(dc.acquisitions) == 1:
                    self.select_shape_with_cpos(self._acquisition_parameters.\
                                                centred_position)

                self._processing_parameters = dc.processing_parameters
                self._processing_widget.update_data_model(self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Discrete')

        if not name:
            self.setName("create_discrete_widget")

        self.previous_energy = None
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget",
                              layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)

        self._data_path_gbox = qt.QVGroupBox('Data location',
                                             self, 'data_path_gbox')
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           'create_dc_path_widget',
                           data_model=self._path_template,
                           layout=DataPathWidgetVerticalLayout)

        self._processing_gbox = qt.QVGroupBox('Processing', self,
                                              'processing_gbox')

        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model=self._processing_parameters)

        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)
        v_layout.addStretch()

        dp_layout = self._data_path_widget.data_path_widget_layout
        self.connect(self._acq_widget, qt.PYSIGNAL('mad_energy_selected'),
                     self.mad_energy_selected)
        
        self.connect(dp_layout.prefix_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(dp_layout.run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(self._acq_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Beispiel #3
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Standard')

        if not name:
            self.setName("create_discrete_widget")

        self.previous_energy = None
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget",
                              layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)

        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')        
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           'create_dc_path_widget',
                           data_model=self._path_template,
                           layout='vertical')

        self._processing_gbox = qt.QVGroupBox('Processing', self,
                                              'processing_gbox')

        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model=self._processing_parameters)
        
        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)
        v_layout.addStretch()

        dp_layout = self._data_path_widget.data_path_widget_layout
        self.connect(self._acq_widget, qt.PYSIGNAL('mad_energy_selected'),
                     self.mad_energy_selected)
        
        self.connect(dp_layout.child('prefix_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(dp_layout.child('run_number_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(self._acq_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
    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.experiment_type == EXPERIMENT_TYPE.HELICAL:
                if tree_item.get_model().is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                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

                    self.select_shape_with_cpos(start_cpos, end_cpos)

                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 #5
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "XRF-spectrum")

        self.count_time = None

        # Data attributes
        self.init_models()
        xrfspectrum_model = queue_model_objects.XRFSpectrum()
        self.xrfspectrum_mib = DataModelInputBinder(xrfspectrum_model)

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 6, "main_v_layout")

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        parameters_hor_gbox = qt.QHGroupBox("Parameters", self)

        self.count_time_label = qt.QLabel("Count time", parameters_hor_gbox)
        self.count_time_label.setFixedWidth(83)

        self.count_time_ledit = qt.QLineEdit(
            "1.0", parameters_hor_gbox, "count_time_ledit"
        )
        self.count_time_ledit.setFixedWidth(50)

        self.xrfspectrum_mib.bind_value_update(
            "count_time", self.count_time_ledit, float
        )  # ,

        spacer = qt.QWidget(parameters_hor_gbox)
        spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(parameters_hor_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
Beispiel #6
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.experiment_type == EXPERIMENT_TYPE.HELICAL:
                if tree_item.get_model().is_executed():
                    self.setDisabled(True)
                else:
                    self.setDisabled(False)

                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

                    self.select_shape_with_cpos(start_cpos, end_cpos)

                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)
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Workflow")

        # Data attributes
        self.workflow_hwobj = None
        self.workflows = {}

        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")

        self._workflow_type_gbox = qt.QVGroupBox(
            "Workflow type", self, "workflow_rtype"
        )

        self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        self._data_path_widget.data_path_widget_layout.child("file_name_label").setText(
            ""
        )
        self._data_path_widget.data_path_widget_layout.child(
            "file_name_value_label"
        ).hide()

        # self._grid_widget = MxLookupScanBrick.MxLookupScanBrick(self, 'grid_widget')

        v_layout.addWidget(self._workflow_type_gbox)
        v_layout.addWidget(self._data_path_gbox)
        # v_layout.addWidget(self._grid_widget)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
Beispiel #8
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Workflow")

        # Data attributes
        self.workflow_hwobj = None
        self.workflows = {}

        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")

        self._workflow_type_gbox = qt.QVGroupBox("Workflow type", self,
                                                 "workflow_rtype")

        self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)

        self._data_path_gbox = qt.QVGroupBox("Data location", self,
                                             "data_path_gbox")
        self._data_path_widget = DataPathWidget(self._data_path_gbox,
                                                data_model=self._path_template,
                                                layout="vertical")

        self._data_path_widget.data_path_widget_layout.child(
            "file_name_label").setText("")
        self._data_path_widget.data_path_widget_layout.child(
            "file_name_value_label").hide()

        # self._grid_widget = MxLookupScanBrick.MxLookupScanBrick(self, 'grid_widget')

        v_layout.addWidget(self._workflow_type_gbox)
        v_layout.addWidget(self._data_path_gbox)
        # v_layout.addWidget(self._grid_widget)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                "prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                "run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
    def init_models(self):
        CreateTaskBase.init_models(self)
        self._energy_scan_result = qmo.EnergyScanResult()
        self._processing_parameters = qmo.ProcessingParameters()

        if self._beamline_setup_hwobj is not None:
            has_shutter_less = self._beamline_setup_hwobj.detector_has_shutterless()
            self._acquisition_parameters.shutterless = has_shutter_less

            self._acquisition_parameters = self._beamline_setup_hwobj.get_default_acquisition_parameters()
        else:
            self._acquisition_parameters = qmo.AcquisitionParameters()
            self._path_template = qmo.PathTemplate()
Beispiel #10
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            logging.info("no update, sample level")
            """JN 20140829, keep the values user set up
            self._init_models()
            self._set_space_group(self._char_params.space_group)

            self._acq_widget.update_data_model(self._acquisition_parameters,
                                                self._path_template)
            self._char_params_mib.set_model(self._char_params)
            """

            #self._char_params = copy.deepcopy(self._char_params)
            #self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)

        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
            logging.info("resolution is set to %s",
                         str(self._acquisition_parameters.resolution))

            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 #11
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        
        if isinstance(tree_item, queue_item.SampleQueueItem):
            logging.info("no update, sample level")
            """JN 20140829, keep the values user set up
            self._init_models()
            self._set_space_group(self._char_params.space_group)

            self._acq_widget.update_data_model(self._acquisition_parameters,
                                                self._path_template)
            self._char_params_mib.set_model(self._char_params)
            """ 

            #self._char_params = copy.deepcopy(self._char_params)
            #self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)

        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
            logging.info("resolution is set to %s", str(self._acquisition_parameters.resolution))

            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)
    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):
            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)
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.SampleQueueItem):
            self._init_models()
            self._set_space_group(self._char_params.space_group)
            self._acq_widget.update_data_model(
                self._acquisition_parameters, self._path_template
            )
            self._char_params_mib.set_model(self._char_params)
            # self._char_params = copy.deepcopy(self._char_params)
            # self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
        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 #14
0
    def init_models(self):
        CreateTaskBase.init_models(self)
        self._energy_scan_result = qmo.EnergyScanResult()
        self._processing_parameters = qmo.ProcessingParameters()

        if self._beamline_setup_hwobj is not None:
            has_shutter_less = self._beamline_setup_hwobj.\
                               detector_has_shutterless()
            self._acquisition_parameters.shutterless = has_shutter_less

            self._acquisition_parameters = self._beamline_setup_hwobj.\
                get_default_acquisition_parameters("default_helical_values")
        else:
            self._acquisition_parameters = qmo.AcquisitionParameters()
            self._path_template = qmo.PathTemplate()
Beispiel #15
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Energy-scan")

        # Data attributes
        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox("Available elements", self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)

        h_box.setMaximumWidth(470)
        h_box.setMaximumHeight(310)

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )

        qt.QObject.connect(
            self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked
        )
    def __init__(self, parent = None, name = None, fl = 0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Workflow')

        # Data attributes
        self.workflow_hwobj = None
        self.workflows = {}
        
        self.init_models()

        #Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")

        self._workflow_type_gbox = qt.QVGroupBox('Workflow type', self,
                                                 'workflow_rtype')

        self._workflow_cbox = qt.QComboBox(self._workflow_type_gbox)

        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')
        self._data_path_widget = DataPathWidget(self._data_path_gbox, 
                                                data_model = self._path_template,
                                                layout = DataPathWidgetVerticalLayout)

        self._data_path_widget.data_path_widget_layout.file_name_label.setText('')
        self._data_path_widget.data_path_widget_layout.file_name_value_label.hide()


        self._grid_widget = MxLookupScanBrick.\
                            MxLookupScanBrick(self, 'grid_widget')

        v_layout.addWidget(self._workflow_type_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._grid_widget)
        v_layout.addStretch()

        self.connect(self._data_path_widget.data_path_widget_layout.prefix_ledit, 
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._prefix_ledit_change)

        self.connect(self._data_path_widget.data_path_widget_layout.run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._run_number_ledit_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Beispiel #17
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 = copy.deepcopy(self._processing_parameters)
            self._processing_parameters = sample_model.processing_parameters
            self._processing_widget.update_data_model(
                self._processing_parameters)
            self._acq_widget.disable_inverse_beam(False)

        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            dc = tree_item.get_model()

            if dc.experiment_type != queue_model_enumerables.EXPERIMENT_TYPE.HELICAL:
                if dc.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.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = dc.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.acquisitions) == 1:
                    self.select_shape_with_cpos(self._acquisition_parameters.\
                                                centred_position)

                self._processing_parameters = dc.processing_parameters
                self._processing_widget.update_data_model(
                    self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)
Beispiel #18
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()
            self._set_space_group(self._char_params.space_group)
            self._acq_widget.update_data_model(self._acquisition_parameters,
                                               self._path_template)
            self._char_params_mib.set_model(self._char_params)
            # self._char_params = copy.deepcopy(self._char_params)
            # self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
        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 #19
0
    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.GenericWorkflowQueueItem):
            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 not(isinstance(tree_item, queue_item.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
Beispiel #20
0
    def approve_creation(self):
        result = CreateTaskBase.approve_creation(self)
        selected_shapes = self._shape_history.selected_shapes

        for shape in selected_shapes:
            if isinstance(shape, shape_history.Line):
                result = False

        return result
    def approve_creation(self):
        return CreateTaskBase.approve_creation(self)
        selected_shapes = self._shape_history.selected_shapes

        for shape in selected_shapes:
            if isinstance(shape, shape_history.Line):
                result = False

        return result
    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.GenericWorkflowQueueItem):
            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 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)
                                                             
        if isinstance(tree_item, queue_item.SampleQueueItem) or \
               isinstance(tree_item, queue_item.DataCollectionGroupQueueItem):
            self._acquisition_parameters = copy.deepcopy(self._acquisition_parameters)
            self._processing_parameters = copy.deepcopy(self._processing_parameters)

        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            data_collection = tree_item.get_model()

            if data_collection.experiment_type == EXPERIMENT_TYPE.HELICAL:
                self.setDisabled(False)
                self._path_template = data_collection.acquisitions[0].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

                    self.select_shape_with_cpos(start_cpos, end_cpos)

                self._energy_scan_result = qmo.EnergyScanResult()
                self._processing_parameters = data_collection.processing_parameters
                self._energy_scan_result = data_collection.crystal.energy_scan_result
                self._acq_widget.set_energies(self._energy_scan_result)
                self._processing_widget.update_data_model(self._processing_parameters)
                self._acq_widget.update_data_model(self._acquisition_parameters,
                                                   self._path_template)
            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)
    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 = copy.deepcopy(self._processing_parameters)
            self._processing_parameters = sample_model.processing_parameters
            self._processing_widget.update_data_model(self._processing_parameters)
            self._acq_widget.disable_inverse_beam(False)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif isinstance(tree_item, queue_item.DataCollectionQueueItem):
            dc = tree_item.get_model()

            if dc.experiment_type != queue_model_enumerables.EXPERIMENT_TYPE.HELICAL:
                if dc.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.get_path_template()
                self._data_path_widget.update_data_model(self._path_template)

                self._acquisition_parameters = dc.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.acquisitions) == 1:
                    self.select_shape_with_cpos(
                        self._acquisition_parameters.centred_position
                    )

                self._processing_parameters = dc.processing_parameters
                self._processing_widget.update_data_model(self._processing_parameters)
            else:
                self.setDisabled(True)
        else:
            self.setDisabled(True)
Beispiel #25
0
    def init_models(self):
        CreateTaskBase.init_models(self)
        
        self._char = queue_model_objects.Characterisation()
        self._char_params = self._char.characterisation_parameters
        self._char_params.experiment_type = queue_model_enumerables.EXPERIMENT_TYPE.OSC
        self._processing_parameters = queue_model_objects.ProcessingParameters()

        if self._beamline_setup_hwobj is not None:            
            self._acquisition_parameters = self._beamline_setup_hwobj.\
                get_default_characterisation_parameters()

            try:
                transmission = self._beamline_setup_hwobj.transmission_hwobj.getAttFactor()
                transmission = round(float(transmission), 1)
            except AttributeError:
                transmission = 0

            try:
                resolution = self._beamline_setup_hwobj.resolution_hwobj.getPosition()
                resolution = round(float(resolution), 4)
            except AttributeError:
                resolution = 0

            try:
                energy = self._beamline_setup_hwobj.energy_hwobj.getCurrentEnergy()
                energy = round(float(energy), 2)
            except AttributeError:
                energy = 0

            self._acquisition_parameters.resolution = resolution
            self._acquisition_parameters.energy = energy
            self._acquisition_parameters.transmission = transmission
        else:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters()
            
        self._path_template.reference_image_prefix = 'ref'
        # The num images drop down default value is 1
        # we would like it to be 2
        self._acquisition_parameters.num_images = 2
        self._char.characterisation_software =\
            queue_model_enumerables.COLLECTION_ORIGIN.EDNA
        self._path_template.num_files = 2
        self._acquisition_parameters.shutterless = False
Beispiel #26
0
    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)

        selected_lines = False

        if self.selected_items():
            selected_lines = True
        else:
            logging.getLogger("user_level_log").warning("No lines selected, please select one or more lines.")

        return base_result and selected_lines
    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()

            # JN,20140829, fix the bug-periodicTable not updated when selecting task
            self._data_path_widget.update_data_model(self._path_template)
            self.periodic_table.periodicTable.tableElementChanged(escan_model.element_symbol) 

        elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
    def init_models(self):
        CreateTaskBase.init_models(self)

        self._energy_scan_result = queue_model_objects.EnergyScanResult()
        self._processing_parameters = queue_model_objects.ProcessingParameters()

        if self._beamline_setup_hwobj is not None:
            has_shutter_less = self._beamline_setup_hwobj.\
                               detector_has_shutterless()
            self._acquisition_parameters.shutterless = has_shutter_less
            self._acquisition_parameters = self._beamline_setup_hwobj.\
                get_default_acquisition_parameters()

            try:
                transmission = self._beamline_setup_hwobj.transmission_hwobj.getAttFactor()
                transmission = round(float(transmission), 2)
            except AttributeError:
                transmission = 0

            try:
                resolution = self._beamline_setup_hwobj.resolution_hwobj.getPosition()
                resolution = round(float(resolution), 2)
            except AttributeError:
                resolution = 0

            try:
                energy = self._beamline_setup_hwobj.\
                         energy_hwobj.getCurrentEnergy()
                if energy:
                    energy = round(float(energy), 4)
                else:
                    energy = round(float(-1), 4)
            except AttributeError:
                energy = 0

            self._acquisition_parameters.resolution = resolution
            self._acquisition_parameters.energy = energy
            self._acquisition_parameters.transmission = transmission
        else:
            self._acquisition_parameters = queue_model_objects.\
                                           AcquisitionParameters()
Beispiel #29
0
    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()

            # JN,20140829, fix the bug-periodicTable not updated when selecting task
            self._data_path_widget.update_data_model(self._path_template)
            self.periodic_table.periodicTable.tableElementChanged(
                escan_model.element_symbol)

        elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
Beispiel #30
0
    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)

        selected_lines = False

        if self.selected_items():
            selected_lines = True
        else:
            logging.getLogger("user_level_log").\
                warning("No lines selected, please select one or more lines.")

        return base_result and selected_lines
Beispiel #31
0
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.XRFScanQueueItem):
            xrfscan_model = tree_item.get_model()
            self.xrfscan_mib.set_model(xrfscan_model)

            if xrfscan_model.is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if xrfscan_model.get_path_template():
                self._path_template = xrfscan_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.SampleQueueItem) or \
                 isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)
        
        selected_edge = False
        
        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.") 

        return base_result and selected_edge
    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)

        if isinstance(tree_item, queue_item.XRFSpectrumQueueItem):
            xrfspectrum_model = tree_item.get_model()
            self.xrfspectrum_mib.set_model(xrfspectrum_model)

            if xrfspectrum_model.is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)    

            if xrfspectrum_model.get_path_template():
                self._path_template = xrfspectrum_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.SampleQueueItem) or \
                 isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
Beispiel #34
0
    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)

        selected_edge = False

        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.")

        return base_result and selected_edge
    def __init__(self, parent = None, name = None, fl = 0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Energy-scan')

        # Data attributes
        self.init_models()

        #Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox('Available elements', self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)
        
        h_box.setMaximumWidth(454)
        h_box.setMaximumHeight(300)

        self._data_path_gbox = qt.QVGroupBox('Data location', self, 'data_path_gbox')
        self._data_path_widget = DataPathWidget(self._data_path_gbox, 
                                               data_model = self._path_template,
                                               layout = DataPathWidgetVerticalLayout)

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()


        self.connect(self._data_path_widget.data_path_widget_layout.prefix_ledit, 
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._prefix_ledit_change)


        self.connect(self._data_path_widget.data_path_widget_layout.run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._run_number_ledit_change)
        
        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Beispiel #36
0
    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()

            symbol, edge = escan_model.element_symbol, escan_model.edge
            self.periodic_table.setTableElement(symbol, edge)
            
            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.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)
    def approve_creation(self):
        result = CreateTaskBase.approve_creation(self)
        selected_shapes = self._shape_history.selected_shapes

        for shape in selected_shapes:
            if isinstance(shape, shape_history.Line) or isinstance(shape, shape_history.CanvasGrid):
                result = False

        self.count_time = None
        try:
            self.count_time = float(str(self.count_time_ledit.text()))
        except:
            logging.getLogger("user_level_log").info("Incorrect count time value.")
        return result and self.count_time
Beispiel #38
0
    def approve_creation(self):
        result = CreateTaskBase.approve_creation(self)
        selected_shapes = self._shape_history.selected_shapes

        for shape in selected_shapes:
            if (isinstance(shape, shape_history.Line)
                    or isinstance(shape, shape_history.CanvasGrid)):
                result = False

        self.count_time = None
        try:
            self.count_time = float(str(self.count_time_ledit.text()))
        except:
            logging.getLogger("user_level_log").\
                        info("Incorrect count time value.")
        return result and self.count_time
Beispiel #39
0
    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)
        
        selected_shapes = self._shape_history.selected_shapes
        for shape in selected_shapes:
            if isinstance(shape, shape_history.Line):
                base_result = False
 
        selected_edge = False
        
        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.") 

        return base_result and selected_edge
Beispiel #40
0
 def approve_creation(self):
     return CreateTaskBase.approve_creation(self)
Beispiel #41
0
 def init_models(self):
     CreateTaskBase.init_models(self)
     self._energy_scan_result = qmo.EnergyScanResult()
     self._processing_parameters = qmo.ProcessingParameters()
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Characterisation")

        if not name:
            self.setName("create_char_widget")

        #
        # Data attributes
        #
        self._current_selected_item = None
        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")

        self._acq_widget = AcquisitionWidgetSimple(
            self,
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )
        # self._acq_widget.setFixedHeight(170)

        current_dir = os.path.dirname(__file__)
        ui_file = "ui_files/vertical_crystal_dimension_widget_layout.ui"
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._vertical_dimension_widget = widget

        ui_file = "ui_files/characterise_simple_widget_vertical_layout.ui"
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._char_widget = widget

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")

        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        v_layout.addWidget(self._acq_widget)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._char_widget)
        v_layout.addWidget(self._vertical_dimension_widget)
        v_layout.addStretch(100)

        #
        # Logic
        #
        optimised_sad_cbx = self._char_widget.child("optimised_sad_cbx")
        account_rad_dmg_cbx = self._char_widget.child("account_rad_dmg_cbx")
        start_comp_cbox = self._char_widget.child("start_comp_cbox")
        # induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
        max_vdim_ledit = self._vertical_dimension_widget.child("max_vdim_ledit")
        min_vdim_ledit = self._vertical_dimension_widget.child("min_vdim_ledit")

        min_vphi_ledit = self._vertical_dimension_widget.child("min_vphi_ledit")

        max_vphi_ledit = self._vertical_dimension_widget.child("max_vphi_ledit")

        space_group_ledit = self._vertical_dimension_widget.child("space_group_ledit")

        self._char_params_mib.bind_value_update(
            "opt_sad", optimised_sad_cbx, bool, None
        )

        self._char_params_mib.bind_value_update(
            "account_rad_damage", account_rad_dmg_cbx, bool, None
        )

        # self._char_params_mib.bind_value_update('determine_rad_params',
        #                                        induced_burn_cbx,
        #                                        bool, None)

        self._char_params_mib.bind_value_update(
            "strategy_complexity", start_comp_cbox, int, None
        )

        self._char_params_mib.bind_value_update(
            "max_crystal_vdim",
            max_vdim_ledit,
            float,
            qt.QDoubleValidator(0.0, 1000, 2, self),
        )

        self._char_params_mib.bind_value_update(
            "min_crystal_vdim",
            min_vdim_ledit,
            float,
            qt.QDoubleValidator(0.0, 1000, 2, self),
        )

        self._char_params_mib.bind_value_update(
            "min_crystal_vphi",
            min_vphi_ledit,
            float,
            qt.QDoubleValidator(0.0, 1000, 2, self),
        )

        self._char_params_mib.bind_value_update(
            "max_crystal_vphi",
            max_vphi_ledit,
            float,
            qt.QDoubleValidator(0.0, 1000, 2, self),
        )

        space_group_ledit.insertStrList(queue_model_enumerables.XTAL_SPACEGROUPS)

        prefix_ledit = self._data_path_widget.data_path_widget_layout.child(
            "prefix_ledit"
        )

        run_number_ledit = self._data_path_widget.data_path_widget_layout.child(
            "run_number_ledit"
        )

        self.connect(
            prefix_ledit,
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            run_number_ledit,
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            space_group_ledit, qt.SIGNAL("activated(int)"), self._space_group_change
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )
Beispiel #43
0
 def init_models(self):
     CreateTaskBase.init_models(self)
     self._path_template.start_num = 1
     self._path_template.num_files = 1
     self._path_template.suffix = 'raw'
 def init_models(self):
     CreateTaskBase.init_models(self)
     self.enery_scan = queue_model_objects.EnergyScan()
     self._path_template.start_num = 1
     self._path_template.num_files = 1
     self._path_template.suffix = 'raw'
Beispiel #45
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Helical')

        if not name:
            self.setName("create_helical_widget")

        #
        # Data attributes
        #
        self.init_models()
        self._prev_pos = None
        self._current_pos = None
        self._list_item_map = {}
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._lines_gbox = qt.QGroupBox('Lines', self, "lines_gbox")
        self._lines_gbox.setColumnLayout(0, qt.Qt.Vertical)
        self._lines_gbox.layout().setSpacing(6)
        self._lines_gbox.layout().setMargin(11)
        lines_gbox_layout = qt.QHBoxLayout(self._lines_gbox.layout())
        lines_gbox_layout.setAlignment(qt.Qt.AlignTop)

        self._list_box = qt.QListBox(self._lines_gbox, "helical_page")
        self._list_box.setSelectionMode(qt.QListBox.Extended)
        self._list_box.setFixedWidth(200)
        self._list_box.setFixedHeight(75)
        list_box_tool_tip = "Select the line(s) to perfrom helical scan on"
        qt.QToolTip.add(self._list_box, list_box_tool_tip)

        lines_gbox_layout.addWidget(self._list_box)

        button_layout = qt.QVBoxLayout(None, 0, 6, "button_layout")
        button_layout.setSpacing(5)
        add_button = qt.QPushButton("+", self._lines_gbox, "add_button")
        add_button.setFixedWidth(20)
        add_button.setFixedHeight(20)
        remove_button = qt.QPushButton("-", self._lines_gbox, "add_button")
        remove_button.setFixedWidth(20)
        remove_button.setFixedHeight(20)
        button_layout.addWidget(add_button)
        button_layout.addWidget(remove_button)
        lines_gbox_layout.addLayout(button_layout)

        add_button_tool_tip = "Add a line between two saved positions, " \
                              "CTRL click to select more than one position"
        qt.QToolTip.add(add_button, add_button_tool_tip)
        remove_button_tool_tip = "Remove selected line(s)"
        qt.QToolTip.add(remove_button, remove_button_tool_tip)

        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget", layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)

        self._acq_widget.disable_inverse_beam(True)
        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           data_model = self._path_template,
                           layout = 'vertical')

        self._processing_gbox = qt.QVGroupBox('Processing', self,
                                              'processing_gbox')

        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model = self._processing_parameters)

        v_layout.addWidget(self._lines_gbox)
        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)

        qt.QObject.connect(add_button, qt.SIGNAL("clicked()"),
                           self.add_clicked)

        qt.QObject.connect(remove_button, qt.SIGNAL("clicked()"),
                           self.remove_clicked)

        qt.QObject.connect(self._list_box, qt.SIGNAL("selectionChanged()"),
                           self.list_box_selection_changed)

        prefix_ledit = self._data_path_widget.\
                       data_path_widget_layout.child('prefix_ledit')

        run_number_ledit = self._data_path_widget.\
                           data_path_widget_layout.child('run_number_ledit')

        self.connect(prefix_ledit, qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
    def __init__(self, parent = None,name = None, fl = 0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Helical')

        if not name:
            self.setName("create_helical_widget")

        #
        # Data attributes
        #
        self.init_models()
        self._prev_pos = None
        self._current_pos = None
        self._list_item_map = {}
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._lines_gbox = qt.QGroupBox('Lines', self, "lines_gbox")
        self._lines_gbox.setColumnLayout(0, qt.Qt.Vertical)
        self._lines_gbox.layout().setSpacing(6)
        self._lines_gbox.layout().setMargin(11)
        lines_gbox_layout = qt.QHBoxLayout(self._lines_gbox.layout())
        lines_gbox_layout.setAlignment(qt.Qt.AlignTop)

        self._list_box = qt.QListBox(self._lines_gbox, "helical_page")
        self._list_box.setSelectionMode(qt.QListBox.Extended)
        self._list_box.setFixedWidth(200)
        self._list_box.setFixedHeight(75)
        list_box_tool_tip = "Select the line(s) to perfrom helical scan on"
        qt.QToolTip.add(self._list_box, list_box_tool_tip)

        lines_gbox_layout.addWidget(self._list_box)

        button_layout = qt.QVBoxLayout(None, 0, 6, "button_layout")
        button_layout.setSpacing(5)
        add_button = qt.QPushButton("+", self._lines_gbox, "add_button")
        add_button.setFixedWidth(20)
        add_button.setFixedHeight(20)
        remove_button = qt.QPushButton("-", self._lines_gbox, "add_button")
        remove_button.setFixedWidth(20)
        remove_button.setFixedHeight(20)        
        button_layout.addWidget(add_button)
        button_layout.addWidget(remove_button)
        lines_gbox_layout.addLayout(button_layout)

        add_button_tool_tip = "Add a line between two saved positions, " \
                              "CTRL click to select more than one position"
        qt.QToolTip.add(add_button, add_button_tool_tip)
        remove_button_tool_tip = "Remove selected line(s)"
        qt.QToolTip.add(remove_button, remove_button_tool_tip)

        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget", layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)


        self._acq_widget.disable_inverse_beam(True)
        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox, 
                           data_model = self._path_template,
                           layout = 'vertical')

        self._processing_gbox = qt.QVGroupBox('Processing', self, 
                                              'processing_gbox')
        
        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model = self._processing_parameters)

        v_layout.addWidget(self._lines_gbox)
        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)

        qt.QObject.connect(add_button, qt.SIGNAL("clicked()"),
                        self.add_clicked)

        qt.QObject.connect(remove_button, qt.SIGNAL("clicked()"),
                        self.remove_clicked)

        qt.QObject.connect(self._list_box, qt.SIGNAL("selectionChanged()"),
                           self.list_box_selection_changed)

        prefix_ledit = self._data_path_widget.\
                       data_path_widget_layout.child('prefix_ledit')

        run_number_ledit = self._data_path_widget.\
                           data_path_widget_layout.child('run_number_ledit')

        self.connect(prefix_ledit, 
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._prefix_ledit_change)

        self.connect(run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._run_number_ledit_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
 def approve_creation(self):
     return CreateTaskBase.approve_creation(self)
Beispiel #48
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')

        if not name:
            self.setName("create_char_widget")

        #
        # Data attributes
        #
        self._current_selected_item = None
        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")

        self._acq_widget = \
            AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
                                    path_template = self._path_template)
        #self._acq_widget.setFixedHeight(170)

        current_dir = os.path.dirname(__file__)
        ui_file = 'ui_files/vertical_crystal_dimension_widget_layout.ui'
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._vertical_dimension_widget = widget

        ui_file = 'ui_files/characterise_simple_widget_vertical_layout.ui'
        widget = qtui.QWidgetFactory.\
                 create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._char_widget = widget

        self._data_path_gbox = \
            qt.QVGroupBox('Data location', self, 'data_path_gbox')

        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           data_model = self._path_template,
                           layout = 'vertical')

        v_layout.addWidget(self._acq_widget)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._char_widget)
        v_layout.addWidget(self._vertical_dimension_widget)
        v_layout.addStretch(100)

        #
        # Logic
        #
        optimised_sad_cbx = self._char_widget.\
                            child('optimised_sad_cbx')
        account_rad_dmg_cbx = self._char_widget.\
                              child('account_rad_dmg_cbx')
        start_comp_cbox = self._char_widget.child('start_comp_cbox')
        #induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
        max_vdim_ledit = self._vertical_dimension_widget.\
                         child('max_vdim_ledit')
        min_vdim_ledit = self._vertical_dimension_widget.\
                         child('min_vdim_ledit')

        min_vphi_ledit = self._vertical_dimension_widget.\
                         child('min_vphi_ledit')

        max_vphi_ledit = self._vertical_dimension_widget.\
                         child('max_vphi_ledit')

        space_group_ledit = self._vertical_dimension_widget.\
                            child('space_group_ledit')

        self._char_params_mib.bind_value_update('opt_sad', optimised_sad_cbx,
                                                bool, None)

        self._char_params_mib.bind_value_update('account_rad_damage',
                                                account_rad_dmg_cbx, bool,
                                                None)

        #self._char_params_mib.bind_value_update('determine_rad_params',
        #                                        induced_burn_cbx,
        #                                        bool, None)

        self._char_params_mib.bind_value_update('strategy_complexity',
                                                start_comp_cbox, int, None)

        self._char_params_mib.\
            bind_value_update('max_crystal_vdim',
                              max_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vdim',
                              min_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vphi',
                              min_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('max_crystal_vphi',
                              max_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        space_group_ledit.insertStrList(XTAL_SPACEGROUPS)

        prefix_ledit = self._data_path_widget.\
                       data_path_widget_layout.child('prefix_ledit')

        run_number_ledit = self._data_path_widget.\
                           data_path_widget_layout.child('run_number_ledit')

        self.connect(prefix_ledit, qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(space_group_ledit, qt.SIGNAL("activated(int)"),
                     self._space_group_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Beispiel #49
0
 def init_models(self):
     CreateTaskBase.init_models(self)
 def init_models(self):
     CreateTaskBase.init_models(self)
Beispiel #51
0
 def init_models(self):
     CreateTaskBase.init_models(self)
     self.energy_scan = queue_model_objects.EnergyScan()
     self._path_template.start_num = 1
     self._path_template.num_files = 1
     self._path_template.suffix = "raw"