示例#1
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name,
                                QtImport.Qt.WindowFlags(fl), "Standard")

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

        # Internal variables --------------------------------------------------
        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )

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

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

        self._comments_widget = CommentsWidget(self)
        self._comments_widget.setHidden(True)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._processing_widget)
        _main_vlayout.addWidget(self._comments_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------
        self._comments_widget.setFixedHeight(100)

        # Qt signal/slot connections ------------------------------------------
        self._acq_widget.acqParametersChangedSignal.connect(
            self.acq_parameters_changed)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed)

        self._acq_widget.madEnergySelectedSignal.connect(
            self.mad_energy_selected)
        self._processing_widget.enableProcessingSignal.connect(
            self._run_processing_toggled)

        # Other ---------------------------------------------------------------
        self._processing_widget.processing_widget.run_processing_parallel_cbox.\
            setChecked(HWR.beamline.run_processing_parallel)
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "Standard"
        )

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

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )

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

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

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._processing_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )

        self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)
        self._processing_widget.enableProcessingSignal.connect(
            self._run_processing_toggled
        )

        # Other ---------------------------------------------------------------
        self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
             api.beamline_setup._get_run_processing_parallel()
        )
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "XRF spectrum"
        )

        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.count_time = None
        self.xrf_spectrum_model = None

        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._data_path_widget = DataPathWidget(
            self, data_model=self._path_template, layout="vertical"
        )

        _parameters_gbox = QtImport.QGroupBox("Parameters", self)
        _count_time_label = QtImport.QLabel("Count time (sec.):", _parameters_gbox)
        self.count_time_ledit = QtImport.QLineEdit("1", _parameters_gbox)
        # self.count_time_ledit.setMaximumWidth(75)
        self.adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", _parameters_gbox
        )
        self.adjust_transmission_cbox.setChecked(True)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = QtImport.QHBoxLayout(_parameters_gbox)
        _parameters_gbox_hlayout.addWidget(_count_time_label)
        _parameters_gbox_hlayout.addWidget(self.count_time_ledit)
        _parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
        _parameters_gbox_hlayout.addStretch(0)
        _parameters_gbox_hlayout.setSpacing(2)
        _parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(_parameters_gbox)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.addStretch(0)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )
        self.adjust_transmission_cbox.stateChanged.connect(
            self.adjust_transmission_state_changed
        )

        # Other ---------------------------------------------------------------
        self._data_path_widget.data_path_layout.compression_cbox.setVisible(False)
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name,
                                QtImport.Qt.WindowFlags(fl), "GphlWorkflow")

        if not name:
            self.setObjectName("create_gphl_workflow_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.current_prefix = None

        self.init_models()
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "GphlWorkflow"
        )

        if not name:
            self.setObjectName("create_gphl_workflow_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.current_prefix = None

        self.init_models()
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "XrayImaging"
        )

        if not name:
            self.setObjectName("create_xray_imaging_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._xray_imaging_parameters = None
        self._processing_parameters = None
        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )
        self._acq_widget.grid_mode = False

        self._xray_imaging_parameters_widget = XrayImagingParametersWidget(
            self,
            "xray_imaging_widget",
            xray_imaging_params=self._xray_imaging_parameters,
        )

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

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._xray_imaging_parameters_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )

        # Other ---------------------------------------------------------------
        self._acq_widget.use_osc_start(False)
        self._acq_widget.use_kappa(False)
        self._acq_widget.acq_widget_layout.max_osc_range_cbx.setVisible(False)
        self._acq_widget.acq_widget_layout.first_image_label.setVisible(False)
        self._acq_widget.acq_widget_layout.first_image_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.detector_roi_mode_label.setVisible(False)
        self._acq_widget.acq_widget_layout.detector_roi_mode_combo.setVisible(False)
        self._acq_widget.acq_widget_layout.energies_combo.setVisible(False)
        self._acq_widget.acq_widget_layout.mad_cbox.setVisible(False)
        self._acq_widget.acq_widget_layout.energy_label.setVisible(False)
        self._acq_widget.acq_widget_layout.energy_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.transmission_label.setVisible(False)
        self._acq_widget.acq_widget_layout.transmission_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.resolution_label.setVisible(False)
        self._acq_widget.acq_widget_layout.resolution_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.kappa_label.setVisible(False)
        self._acq_widget.acq_widget_layout.kappa_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.kappa_phi_label.setVisible(False)
        self._acq_widget.acq_widget_layout.kappa_phi_ledit.setVisible(False)
        self._acq_widget.acq_widget_layout.shutterless_cbx.setVisible(False)

        self.distance_listwidget = self._xray_imaging_parameters_widget._parameters_widget.detector_distance_listwidget

        api.detector_distance.connect(
            "positionChanged",
            self._xray_imaging_parameters_widget.set_detector_distance,
        )
示例#7
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name, fl, "Characterisation")
        self.setObjectName("create_char_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._vertical_dimension_widget = None
        self._current_selected_item = None
        self._char = None
        self._char_params = None

        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionWidgetSimple(
            self,
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )

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

        self._vertical_dimension_widget = QtImport.load_ui_file(
            "vertical_crystal_dimension_widget_layout.ui"
        )

        self._char_widget = QtImport.load_ui_file(
            "characterise_simple_widget_vertical_layout.ui"
        )

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._char_widget)
        _main_vlayout.addWidget(self._vertical_dimension_widget)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(6)
        _main_vlayout.addStretch(0)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )
        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)

        self._vertical_dimension_widget.space_group_ledit.activated.connect(
            self._space_group_change
        )
        # self.connect(induced_burn_cbx, QtCore.SIGNAL("toggled(bool)"),
        #             self.use_induced_burn)

        self._char_widget.characterisation_gbox.toggled.connect(
            self.characterisation_gbox_toggled
        )
        self._char_widget.wait_result_cbx.toggled.connect(self.wait_results_cbx_toggled)
        self._char_widget.execute_plan_cbx.toggled.connect(
            self.run_diffraction_plan_cbx_toggled
        )

        # Other ---------------------------------------------------------------
        self._char_params_mib.bind_value_update(
            "opt_sad", self._char_widget.optimised_sad_cbx, bool, None
        )

        self._char_params_mib.bind_value_update(
            "account_rad_damage", self._char_widget.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", self._char_widget.start_comp_cbox, int, None
        )

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

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

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

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

        self._vertical_dimension_widget.space_group_ledit.addItems(XTAL_SPACEGROUPS)

        self._data_path_widget.data_path_layout.compression_cbox.setVisible(False)
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name, fl, "Helical")

        if not name:
            self.setObjectName("create_helical_widget")
        self.init_models()

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._lines_map = {}

        # Graphic elements ----------------------------------------------------
        self._lines_widget = QtImport.load_ui_file("helical_line_widget_layout.ui")

        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )

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

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

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._lines_widget)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._processing_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._lines_widget.lines_treewidget.itemSelectionChanged.connect(
            self.lines_treewidget_selection_changed
        )
        self._lines_widget.create_line_button.clicked.connect(
            self.create_line_button_clicked
        )
        self._lines_widget.create_auto_line_button.clicked.connect(
            self.create_auto_line_button_clicked
        )
        self._lines_widget.remove_line_button.clicked.connect(
            self.remove_line_button_clicked
        )
        self._lines_widget.overlay_cbox.stateChanged.connect(self.overlay_toggled)
        self._lines_widget.overlay_slider.valueChanged.connect(
            self.overlay_alpha_changed
        )
        self._lines_widget.swap_points_button.clicked.connect(self.swap_points_clicked)

        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
        self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )
        self._processing_widget.enableProcessingSignal.connect(
            self._run_processing_toggled
        )
        # Other ---------------------------------------------------------------
        for col in range(self._lines_widget.lines_treewidget.columnCount()):
            self._lines_widget.lines_treewidget.resizeColumnToContents(col)
        # self._processing_widget.processing_widget.\
        #     run_processing_parallel_cbox.setChecked(False)


        self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
            api.beamline_setup._get_run_processing_parallel()
        )
        self.enable_widgets(False)
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "Advanced"
        )

        if not name:
            self.setObjectName("create_advanced_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._advanced_methods = None
        self._grid_map = {}
        self.spacing = [0, 0]
        self.dc_selected = False

        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._advanced_methods_widget = QtImport.load_ui_file(
            "advanced_methods_layout.ui"
        )
        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )
        self._acq_widget.grid_mode = True

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

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._advanced_methods_widget)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
        self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)

        self._acq_widget.acq_widget_layout.osc_range_ledit.textEdited.connect(
            self.grid_osc_range_ledit_changed
        )
        self._acq_widget.acq_widget_layout.osc_total_range_ledit.textEdited.connect(
            self.grid_osc_total_range_ledit_changed
        )

        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )

        self._advanced_methods_widget.grid_treewidget.itemSelectionChanged.connect(
            self.grid_treewidget_item_selection_changed
        )
        self._advanced_methods_widget.draw_grid_button.clicked.connect(
            self.draw_grid_button_clicked
        )
        self._advanced_methods_widget.remove_grid_button.clicked.connect(
            self.remove_grid_button_clicked
        )
        self._advanced_methods_widget.hor_spacing_ledit.textEdited.connect(
            self.hor_spacing_changed
        )
        self._advanced_methods_widget.ver_spacing_ledit.textEdited.connect(
            self.ver_spacing_changed
        )

        self._advanced_methods_widget.move_right_button.clicked.connect(
            lambda: self.move_grid("right")
        )
        self._advanced_methods_widget.move_left_button.clicked.connect(
            lambda: self.move_grid("left")
        )
        self._advanced_methods_widget.move_up_button.clicked.connect(
            lambda: self.move_grid("up")
        )
        self._advanced_methods_widget.move_down_button.clicked.connect(
            lambda: self.move_grid("down")
        )

        self._advanced_methods_widget.overlay_cbox.toggled.connect(self.overlay_toggled)
        self._advanced_methods_widget.overlay_slider.valueChanged.connect(
            self.overlay_alpha_changed
        )
        self._advanced_methods_widget.overlay_color_button.clicked.connect(
            self.overlay_change_color
        )
        self._advanced_methods_widget.move_to_grid_button.clicked.connect(
            self.move_to_grid
        )

        # Other ---------------------------------------------------------------
        self._acq_widget.use_osc_start(False)
        self._acq_widget.use_kappa(False)
        self._acq_widget.acq_widget_layout.num_images_label.setEnabled(False)
        self._acq_widget.acq_widget_layout.num_images_ledit.setEnabled(False)
        for col in range(self._advanced_methods_widget.grid_treewidget.columnCount()):
            self._advanced_methods_widget.grid_treewidget.resizeColumnToContents(col)

        self._acq_widget.acq_widget_layout.osc_total_range_label.setText(
            "Total osc. range per line"
        )

        self._advanced_methods = (
            api.beamline_setup.get_advanced_methods()
        )
        if self._advanced_methods:
            for method in self._advanced_methods:
                self._advanced_methods_widget.method_combo.addItem(method)
        else:
            self.setEnabled(False)
示例#10
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name, fl, "Energy scan")

        if not name:
            self.setObjectName("create_energy_scan_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._periodic_table_widget = PeriodicTableWidget(self)
        self._data_path_widget = DataPathWidget(
            self, data_model=self._path_template, layout="vertical"
        )

        _parameters_gbox = QtImport.QGroupBox("Parameters", self)
        self._adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", _parameters_gbox
        )
        self._adjust_transmission_cbox.setChecked(False)
        self._adjust_transmission_cbox.setEnabled(True)
        self._max_transmission_label = QtImport.QLabel("Maximum transmission:")
        self._max_transmission_ledit = QtImport.QLineEdit("20", _parameters_gbox)
        self._max_transmission_ledit.setFixedWidth(80)
        self._max_transmission_ledit.setEnabled(False)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = QtImport.QGridLayout(_parameters_gbox)
        _parameters_gbox_hlayout.addWidget(self._adjust_transmission_cbox, 0, 0)
        _parameters_gbox_hlayout.addWidget(self._max_transmission_label, 1, 0)
        _parameters_gbox_hlayout.addWidget(self._max_transmission_ledit, 1, 1)
        _parameters_gbox_hlayout.setColumnStretch(2, 1)
        _parameters_gbox_hlayout.setSpacing(2)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._periodic_table_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(_parameters_gbox)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(6)
        _main_vlayout.addStretch(10)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        # self._periodic_table_widget.elementEdgeSelectedSignal.connect(\
        #     self.acq_parameters_changed)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )
        self._adjust_transmission_cbox.stateChanged.connect(
            self.adjust_transmission_state_changed
        )
        self._max_transmission_ledit.textEdited.connect(
            self.max_transmission_value_changed
        )

        self._data_path_widget.data_path_layout.compression_cbox.setVisible(False)

        try:
            self._periodic_table_widget.set_elements(api.energyscan.getElements())

            max_transmission_value = api.energyscan.get_max_transmission_value()

            self._adjust_transmission_cbox.setEnabled(True)
            self._adjust_transmission_cbox.setChecked(True)
            api.energyscan.adjust_transmission(True)

            if max_transmission_value:
                self._max_transmission_ledit.setText("%.2f" % max_transmission_value)
        except BaseException:
            pass
示例#11
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(
            self, parent, name, QtImport.Qt.WindowFlags(fl), "Advanced"
        )

        if not name:
            self.setObjectName("create_advanced_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._advanced_methods = None
        self._grid_map = {}
        self.spacing = [0, 0]
        self.dc_selected = False

        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._advanced_methods_widget = QtImport.load_ui_file(
            "advanced_methods_layout.ui"
        )
        self._acq_widget = AcquisitionWidget(
            self,
            "acquisition_widget",
            layout="vertical",
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )
        self._acq_widget.grid_mode = True

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

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._advanced_methods_widget)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._comments_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self._acq_widget.acqParametersChangedSignal.connect(self.acq_parameters_changed)
        self._acq_widget.madEnergySelectedSignal.connect(self.mad_energy_selected)

        self._acq_widget.acq_widget_layout.osc_range_ledit.textEdited.connect(
            self.grid_osc_range_ledit_changed
        )
        self._acq_widget.acq_widget_layout.osc_total_range_ledit.textEdited.connect(
            self.grid_osc_total_range_ledit_changed
        )

        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed
        )

        self._advanced_methods_widget.grid_treewidget.itemSelectionChanged.connect(
            self.grid_treewidget_item_selection_changed
        )
        self._advanced_methods_widget.draw_grid_button.clicked.connect(
            self.draw_grid_button_clicked
        )
        self._advanced_methods_widget.remove_grid_button.clicked.connect(
            self.remove_grid_button_clicked
        )
        self._advanced_methods_widget.hor_spacing_ledit.textEdited.connect(
            self.hor_spacing_changed
        )
        self._advanced_methods_widget.ver_spacing_ledit.textEdited.connect(
            self.ver_spacing_changed
        )

        self._advanced_methods_widget.move_right_button.clicked.connect(
            lambda: self.move_grid("right")
        )
        self._advanced_methods_widget.move_left_button.clicked.connect(
            lambda: self.move_grid("left")
        )
        self._advanced_methods_widget.move_up_button.clicked.connect(
            lambda: self.move_grid("up")
        )
        self._advanced_methods_widget.move_down_button.clicked.connect(
            lambda: self.move_grid("down")
        )

        self._advanced_methods_widget.overlay_cbox.toggled.connect(self.overlay_toggled)
        self._advanced_methods_widget.overlay_slider.valueChanged.connect(
            self.overlay_alpha_changed
        )
        self._advanced_methods_widget.overlay_color_button.clicked.connect(
            self.overlay_change_color
        )
        self._advanced_methods_widget.move_to_grid_button.clicked.connect(
            self.move_to_grid
        )
        self._advanced_methods_widget.method_combo.activated.connect(
            self.method_combo_activated
        )

        # Other ---------------------------------------------------------------
        self._acq_widget.use_osc_start(False)
        self._acq_widget.use_kappa(False)
        self._acq_widget.acq_widget_layout.num_images_label.setEnabled(False)
        self._acq_widget.acq_widget_layout.num_images_ledit.setEnabled(False)
        for col in range(self._advanced_methods_widget.grid_treewidget.columnCount()):
            self._advanced_methods_widget.grid_treewidget.resizeColumnToContents(col)

        self._acq_widget.acq_widget_layout.osc_total_range_label.setText(
            "Total osc. range per line"
        )

        self._advanced_methods = list(HWR.beamline.advanced_methods)
        if self._advanced_methods:
            for method in self._advanced_methods:
                self._advanced_methods_widget.method_combo.addItem(method)
        else:
            self.setEnabled(False)

        self._acq_widget.acq_widget_layout.osc_start_label.setText(
            "Oscillation middle:"
        )

        hor_size, ver_size = HWR.beamline.beam.get_beam_size()
        self.spacing[0] = hor_size
        self.spacing[1] = ver_size

        self._advanced_methods_widget.hor_spacing_ledit.setText(
            "%.1f" % (hor_size * 1000)
        )
        self._advanced_methods_widget.ver_spacing_ledit.setText(
            "%.1f" % (ver_size * 1000)
        )

        HWR.beamline.sample_view.connect("shapeCreated", self.shape_created)
        HWR.beamline.sample_view.connect("shapeChanged", self.shape_changed)
        HWR.beamline.sample_view.connect("shapeDeleted", self.shape_deleted)
        self._comments_widget.setHidden(True)
示例#12
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name, fl, "Characterisation")
        self.setObjectName("create_char_widget")

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self._vertical_dimension_widget = None
        self._current_selected_item = None
        self._char = None
        self._char_params = None

        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionWidgetSimple(
            self,
            acq_params=self._acquisition_parameters,
            path_template=self._path_template,
        )

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

        self._vertical_dimension_widget = QtImport.load_ui_file(
            "vertical_crystal_dimension_widget_layout.ui")

        self._char_widget = QtImport.load_ui_file(
            "characterise_simple_widget_vertical_layout.ui")

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._char_widget)
        _main_vlayout.addWidget(self._vertical_dimension_widget)
        _main_vlayout.addWidget(self._comments_widget)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(6)
        _main_vlayout.addStretch(0)

        # SizePolicies --------------------------------------------------------
        self._comments_widget.setFixedHeight(100)

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed)
        self._acq_widget.acqParametersChangedSignal.connect(
            self.acq_parameters_changed)

        self._vertical_dimension_widget.space_group_ledit.activated.connect(
            self._space_group_change)

        self._char_widget.characterisation_gbox.toggled.connect(
            self.characterisation_gbox_toggled)
        self._char_widget.wait_result_cbx.toggled.connect(
            self.wait_results_cbx_toggled)
        self._char_widget.execute_plan_cbx.toggled.connect(
            self.run_diffraction_plan_cbx_toggled)

        # Other ---------------------------------------------------------------
        if False:
            self._char_params_mib.bind_value_update(
                "opt_sad", self._char_widget.optimised_sad_cbx, bool, None)

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

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

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

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

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

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

        self._vertical_dimension_widget.space_group_ledit.addItems(
            XTAL_SPACEGROUPS)

        self._data_path_widget.data_path_layout.compression_cbox.setVisible(
            False)
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name,
                                QtImport.Qt.WindowFlags(fl), "XRF spectrum")

        if name is not None:
            self.setObjectName(name)

        # Hardware objects ----------------------------------------------------

        # Internal variables --------------------------------------------------
        self.count_time = None
        self.xrf_spectrum_model = None

        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._data_path_widget = DataPathWidget(self,
                                                data_model=self._path_template,
                                                layout="vertical")

        _parameters_gbox = QtImport.QGroupBox("Parameters", self)
        _count_time_label = QtImport.QLabel("Count time (sec.):",
                                            _parameters_gbox)
        self.count_time_ledit = QtImport.QLineEdit("1", _parameters_gbox)
        # self.count_time_ledit.setMaximumWidth(75)
        self.adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", _parameters_gbox)
        self.adjust_transmission_cbox.setChecked(True)

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = QtImport.QHBoxLayout(_parameters_gbox)
        _parameters_gbox_hlayout.addWidget(_count_time_label)
        _parameters_gbox_hlayout.addWidget(self.count_time_ledit)
        _parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
        _parameters_gbox_hlayout.addStretch(0)
        _parameters_gbox_hlayout.setSpacing(2)
        _parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(_parameters_gbox)
        _main_vlayout.addWidget(self._comments_widget)
        _main_vlayout.setSpacing(6)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.addStretch(0)

        # SizePolicies --------------------------------------------------------
        self._comments_widget.setFixedHeight(100)

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed)
        self.adjust_transmission_cbox.stateChanged.connect(
            self.adjust_transmission_state_changed)

        # Other ---------------------------------------------------------------
        self._data_path_widget.data_path_layout.compression_cbox.setVisible(
            False)