예제 #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)
예제 #2
0
    def __init__(self, parent=None, name="parameter_widget"):

        QtImport.QWidget.__init__(self, parent)
        if name is not None:
            self.setObjectName(name)

        # Properties ----------------------------------------------------------

        # Signals ------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Internal variables --------------------------------------------------
        self._data_collection = None
        self._tree_view_item = None
        self._acquisition_mib = None

        # Graphic elements ----------------------------------------------------
        _dc_parameters_widget = QtImport.QWidget(self)
        self._data_path_widget = DataPathWidget(_dc_parameters_widget)
        self._acq_widget = AcquisitionWidget(_dc_parameters_widget,
                                             layout="horizontal")
        self._processing_widget = ProcessingWidget(_dc_parameters_widget)

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

        _main_hlayout = QtImport.QHBoxLayout(self)
        _main_hlayout.addWidget(_dc_parameters_widget)
        _main_hlayout.setContentsMargins(0, 0, 0, 0)
        _main_hlayout.setSpacing(2)
        _main_hlayout.addStretch(0)

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

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.data_path_layout.prefix_ledit.textChanged.connect(
            self._prefix_ledit_change)
        self._data_path_widget.data_path_layout.run_number_ledit.textChanged.connect(
            self._run_number_ledit_change)
        self._acq_widget.madEnergySelectedSignal.connect(
            self.mad_energy_selected)
        self._acq_widget.acqParametersChangedSignal.connect(
            self.acq_parameters_changed)
예제 #3
0
    def __init__(self, parent=None, name="advanced_parameters_widget"):
        QtImport.QWidget.__init__(self, parent)

        # Internal values -----------------------------------------------------
        self._data_collection = None
        self._tree_view_item = None
        self._acquisition_mib = None

        # Properties ----------------------------------------------------------

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        _dc_parameters_widget = QtImport.QWidget(self)
        self._data_path_widget = DataPathWidget(_dc_parameters_widget)
        self._acq_widget = AcquisitionWidget(_dc_parameters_widget,
                                             layout="horizontal")

        # Layout --------------------------------------------------------------
        _dc_parameters_widget_layout = QtImport.QVBoxLayout(
            _dc_parameters_widget)
        _dc_parameters_widget_layout.addWidget(self._data_path_widget)
        _dc_parameters_widget_layout.addWidget(self._acq_widget)
        _dc_parameters_widget_layout.setSpacing(2)
        _dc_parameters_widget_layout.addStretch(10)
        _dc_parameters_widget_layout.setContentsMargins(0, 0, 0, 0)

        _main_hlayout = QtImport.QHBoxLayout(self)
        _main_hlayout.addWidget(_dc_parameters_widget)
        _main_hlayout.setSpacing(2)
        _main_hlayout.setContentsMargins(2, 2, 2, 2)
        _main_hlayout.addStretch(0)

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

        # Ohter ---------------------------------------------------------------
        self._acq_widget.use_osc_start(False)
        self._acq_widget.acq_widget_layout.mad_cbox.hide()
        self._acq_widget.acq_widget_layout.energies_combo.hide()
        self._acq_widget.acq_widget_layout.shutterless_cbx.hide()
예제 #4
0
    def _initialize_graphics(self):
        # Graphic elements ----------------------------------------------------
        self._workflow_type_widget = QtImport.QGroupBox("Workflow type", self)

        self._workflow_cbox = QtImport.QComboBox(self._workflow_type_widget)
        self._gphl_acq_widget = QtImport.QGroupBox("Acquisition", self)
        self._gphl_acq_param_widget = GphlAcquisitionWidget(
            self._gphl_acq_widget, "gphl_acquisition_parameter_widget")
        self._gphl_diffractcal_widget = GphlDiffractcalWidget(
            self._gphl_acq_widget, "gphl_diffractcal_widget")

        self._data_path_widget = DataPathWidget(self,
                                                "create_dc_path_widget",
                                                layout="vertical")
        data_path_layout = self._data_path_widget.data_path_layout
        data_path_layout.file_name_label.hide()
        data_path_layout.file_name_value_label.hide()
        data_path_layout.run_number_label.hide()
        data_path_layout.run_number_ledit.hide()
        data_path_layout.folder_ledit.setReadOnly(True)

        # Layout --------------------------------------------------------------
        _workflow_type_vlayout = QtImport.QVBoxLayout(
            self._workflow_type_widget)
        _workflow_type_vlayout.addWidget(self._workflow_cbox)
        _gphl_acq_vlayout = QtImport.QVBoxLayout(self._gphl_acq_widget)
        _gphl_acq_vlayout.addWidget(self._gphl_acq_param_widget)
        _gphl_acq_vlayout.addWidget(self._gphl_diffractcal_widget)
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._workflow_type_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._gphl_acq_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self._workflow_cbox.currentIndexChanged.connect(self.workflow_selected)

        # set up popup data dialog
        self.gphl_data_dialog = GphlDataDialog(self, "GPhL Workflow Data")
        self.gphl_data_dialog.setModal(True)
        self.gphl_data_dialog.continueClickedSignal.connect(self.data_acquired)
예제 #5
0
    def __init__(self, parent=None, name=None, fl=0):

        QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl))

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

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

        # Internal variables --------------------------------------------------

        # Graphic elements ----------------------------------------------------
        self.group_box = QtImport.QGroupBox("Reference images", self)
        self.tool_box = QtImport.QToolBox(self.group_box)
        self.page_widget = QtImport.QWidget(self.tool_box)
        self.path_widget = DataPathWidget(self.page_widget)
        self.acq_widget = AcquisitionWidget(self.page_widget, "horizontal")
        self.acq_widget.acq_widget_layout.shutterless_cbx.hide()
        # self.acq_widget.acq_widget_layout.setFixedHeight(130)
        self.tool_box.addItem(self.page_widget, "Acquisition parameters")

        # Layout --------------------------------------------------------------
        _page_widget_layout = QtImport.QVBoxLayout(self.page_widget)
        _page_widget_layout.addWidget(self.path_widget)
        _page_widget_layout.addWidget(self.acq_widget)
        _page_widget_layout.addStretch(0)
        _page_widget_layout.setSpacing(0)
        _page_widget_layout.setContentsMargins(0, 0, 0, 0)

        _group_box_vlayout = QtImport.QVBoxLayout(self.group_box)
        _group_box_vlayout.addWidget(self.tool_box)
        _group_box_vlayout.setSpacing(0)
        _group_box_vlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.group_box)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
예제 #6
0
    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)

        self._comments_widget = CommentsWidget(self)

        # 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.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._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(
            HWR.beamline.run_processing_parallel)
        self.enable_widgets(False)

        shapes = HWR.beamline.sample_view.get_shapes()
        for shape in shapes:
            if isinstance(shape, GraphicsItemLine):
                self.shape_created(shape, "Line")

        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)
예제 #7
0
    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

        HWR.beamline.detector.distance.connect(
            "valueChanged",
            self._xray_imaging_parameters_widget.set_detector_distance,
        )
예제 #8
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)

        self._comments_widget = CommentsWidget(self)

        # 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.addWidget(self._comments_widget)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(6)
        _main_vlayout.addStretch(10)

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

        # 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(
                HWR.beamline.energy_scan.get_elements())

            max_transmission_value = (
                HWR.beamline.energy_scan.get_max_transmission_value())

            self._adjust_transmission_cbox.setEnabled(True)
            self._adjust_transmission_cbox.setChecked(True)
            HWR.beamline.energy_scan.adjust_transmission(True)

            if max_transmission_value:
                self._max_transmission_ledit.setText("%.2f" %
                                                     max_transmission_value)
        except BaseException:
            pass
예제 #9
0
    def __init__(self, parent=None, name=None, flags=0):

        CreateTaskBase.__init__(self, parent, name,
                                QtImport.Qt.WindowFlags(flags), "Still")

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

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

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

        # Graphic elements ----------------------------------------------------
        self._acq_widget = AcquisitionStillWidget(
            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._col_seq_widget = SSXSequenceWidget(self)

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

        #self._comment_widget = CommentWidget(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._acq_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(self._col_seq_widget)
        _main_vlayout.addWidget(self._processing_widget)
        #_main_vlayout.addWidget(self._comment_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._processing_widget.enableProcessingSignal.connect(
            self._run_processing_toggled)

        # Other ---------------------------------------------------------------
        self._processing_widget.processing_widget.run_processing_parallel_cbox.setChecked(
            HWR.beamline.run_processing_parallel)

        #Rename to self._processing_widget.layout
        self._processing_widget.processing_widget.resolution_cutoff_label.setHidden(
            False)
        self._processing_widget.processing_widget.resolution_cutoff_ledit.setHidden(
            False)
        self._processing_widget.processing_widget.pdb_file_label.setHidden(
            False)
        self._processing_widget.processing_widget.pdb_file_ledit.setHidden(
            False)
        self._processing_widget.processing_widget.pdb_file_browse_button.setHidden(
            False)
예제 #10
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)
예제 #11
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="xrf_spectrum_parameters_widget"):
        QtImport.QWidget.__init__(self, parent)

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

        # Internal variables --------------------------------------------------
        self.xrf_spectrum_model = queue_model_objects.XRFSpectrum()
        self._tree_view_item = None

        # Graphic elements ----------------------------------------------------
        _top_widget = QtImport.QWidget(self)
        _parameters_widget = QtImport.QWidget(_top_widget)
        self.data_path_widget = DataPathWidget(_parameters_widget)
        self.other_parameters_gbox = QtImport.QGroupBox(
            "Other parameters", _parameters_widget)
        self.count_time_label = QtImport.QLabel("Count time:",
                                                self.other_parameters_gbox)
        self.count_time_ledit = QtImport.QLineEdit(self.other_parameters_gbox)
        self.count_time_ledit.setFixedWidth(50)
        self.adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", self.other_parameters_gbox)
        self.adjust_transmission_cbox.hide()
        self.mca_spectrum_widget = McaSpectrumWidget(self)
        self.snapshot_widget = SnapshotWidget(self)

        # Layout -------------------------------------------------------------
        _other_parameters_gbox_hlayout = QtImport.QHBoxLayout(
            self.other_parameters_gbox)
        _other_parameters_gbox_hlayout.addWidget(self.count_time_label)
        _other_parameters_gbox_hlayout.addWidget(self.count_time_ledit)
        _other_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
        _other_parameters_gbox_hlayout.addStretch(0)
        _other_parameters_gbox_hlayout.setSpacing(2)
        _other_parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

        _parameters_widget_layout = QtImport.QVBoxLayout(_parameters_widget)
        _parameters_widget_layout.addWidget(self.data_path_widget)
        _parameters_widget_layout.addWidget(self.other_parameters_gbox)
        _parameters_widget_layout.addStretch(0)
        _parameters_widget_layout.setSpacing(2)
        _parameters_widget_layout.setContentsMargins(0, 0, 0, 0)

        _top_widget_layout = QtImport.QHBoxLayout(_top_widget)
        _top_widget_layout.addWidget(_parameters_widget)
        _top_widget_layout.addWidget(self.snapshot_widget)
        _top_widget_layout.setSpacing(2)
        _top_widget_layout.addStretch(0)
        _top_widget_layout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(_top_widget)
        _main_vlayout.addWidget(self.mca_spectrum_widget)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

        # SizePolicies -------------------------------------------------------
        self.mca_spectrum_widget.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                               QtImport.QSizePolicy.Expanding)
        _top_widget.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                  QtImport.QSizePolicy.Fixed)

        # Qt signal/slot connections ------------------------------------------
        self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect(
            self._prefix_ledit_change)
        self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect(
            self._run_number_ledit_change)
        self.count_time_ledit.textChanged.connect(
            self._count_time_ledit_change)

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

        if HWR.beamline.xrf_spectrum is None:
            HWR.beamline.xrf_spectrum.connect("xrfSpectrumFinished",
                                              self.spectrum_finished)
예제 #13
0
    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)