Пример #1
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.image_tracking_hwobj = None

        # Internal values -----------------------------------------------------

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "/image-tracking")

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

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

        # Graphic elements ----------------------------------------------------
        _main_groupbox = qt_import.QGroupBox("Image tracking", self)
        self.state_label = qt_import.QLabel("<b> </b>", _main_groupbox)
        self.image_tracking_cbox = qt_import.QCheckBox(
            "Enable Adxv image tracking", _main_groupbox)
        self.filter_frames_cbox = qt_import.QCheckBox(
            "Filter frames based on Dozor score", _main_groupbox)
        self.spot_list_cbox = qt_import.QCheckBox("Indicate spots in ADxV",
                                                  _main_groupbox)

        # Layout --------------------------------------------------------------
        _main_groupbox_vlayout = qt_import.QVBoxLayout(_main_groupbox)
        _main_groupbox_vlayout.addWidget(self.state_label)
        _main_groupbox_vlayout.addWidget(self.image_tracking_cbox)
        _main_groupbox_vlayout.addWidget(self.filter_frames_cbox)
        _main_groupbox_vlayout.addWidget(self.spot_list_cbox)
        _main_groupbox_vlayout.setSpacing(2)
        _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(_main_groupbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.image_tracking_cbox.toggled.connect(
            self.image_tracking_cbox_toggled)
        self.filter_frames_cbox.toggled.connect(
            self.filter_frames_cbox_toggled)
        self.spot_list_cbox.toggled.connect(self.spot_list_cbox_toggled)

        # Other ---------------------------------------------------------------
        self.state_label.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label.setFixedHeight(24)
        self.state_changed("unknown")
Пример #2
0
    def __init__(self, parent=None, name=None, flags=0):

        qt_import.QWidget.__init__(self, parent,
                                   qt_import.Qt.WindowFlags(flags))

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

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

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

        # Graphic elements ----------------------------------------------------
        self.rad_damage_cbx = qt_import.QCheckBox(self)
        _label_widget = qt_import.QWidget(self)
        self.burn_osc_start_label = qt_import.QLabel(_label_widget)
        self.burn_osc_start_ledit = qt_import.QLineEdit(_label_widget)
        self.burn_osc_start_ledit.setMinimumSize(50, 0)
        self.burn_osc_start_ledit.setMaximumSize(50, 32767)

        _value_widget = qt_import.QWidget(self)
        self.burn_osc_interval_label = qt_import.QLabel(_value_widget)
        self.burn_osc_interval_ledit = qt_import.QLineEdit(_value_widget)
        self.burn_osc_interval_ledit.setMinimumSize(50, 0)
        self.burn_osc_interval_ledit.setMaximumSize(50, 32767)

        # Layout --------------------------------------------------------------
        _label_widget_hlayout = qt_import.QHBoxLayout(self)
        _label_widget_hlayout.addWidget(self.burn_osc_start_label)
        _label_widget_hlayout.addWidget(self.burn_osc_start_ledit)
        _label_widget_hlayout.addStretch(0)
        _label_widget_hlayout.setSpacing(0)
        _label_widget_hlayout.setContentsMargins(0, 0, 0, 0)
        _label_widget.setLayout(_label_widget_hlayout)

        _value_hlayout = qt_import.QHBoxLayout(self)
        _value_hlayout.addWidget(self.burn_osc_interval_label)
        _value_hlayout.addWidget(self.burn_osc_interval_ledit)
        _value_hlayout.addStretch(0)
        _value_hlayout.setSpacing(0)
        _value_hlayout.setContentsMargins(0, 0, 0, 0)
        _value_widget.setLayout(_value_hlayout)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.rad_damage_cbx)
        _main_vlayout.addWidget(_label_widget)
        _main_vlayout.addWidget(_value_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(_main_vlayout)

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

        # Qt signal/slot connections ------------------------------------------

        # Other ---------------------------------------------------------------
        self.languageChange()
Пример #3
0
    def __init__(self, parent=None, name=None, flags=0):

        qt_import.QWidget.__init__(self, parent,
                                   qt_import.Qt.WindowFlags(flags))

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

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

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

        # Graphic elements ----------------------------------------------------
        self.min_dose_radio = qt_import.QRadioButton(self)
        self.min_time_radio = qt_import.QRadioButton(self)
        self.dose_time_bgroup = qt_import.QButtonGroup(self)
        self.dose_time_bgroup.addButton(self.min_dose_radio)
        self.dose_time_bgroup.addButton(self.min_time_radio)
        self.dose_limit_cbx = qt_import.QCheckBox(self)
        self.time_limit_cbx = qt_import.QCheckBox(self)
        self.dose_ledit = qt_import.QLineEdit(self)
        self.dose_ledit.setMinimumSize(50, 0)
        self.dose_ledit.setMaximumSize(50, 32767)
        self.time_ledit = qt_import.QLineEdit(self)
        self.time_ledit.setMinimumSize(50, 0)
        self.time_ledit.setMaximumSize(50, 32767)
        self.radiation_damage_cbx = qt_import.QCheckBox(self)

        # Layout --------------------------------------------------------------
        _main_gridlayout = qt_import.QGridLayout(self)
        _main_gridlayout.addWidget(self.min_dose_radio, 0, 0)  # , 2, 1)
        _main_gridlayout.addWidget(self.min_time_radio, 1, 0)
        _main_gridlayout.addWidget(self.dose_limit_cbx, 0, 1)
        _main_gridlayout.addWidget(self.time_limit_cbx, 1, 1)
        _main_gridlayout.addWidget(self.dose_ledit, 0, 2)
        _main_gridlayout.addWidget(self.time_ledit, 1, 2)
        _main_gridlayout.addWidget(self.radiation_damage_cbx, 2, 0, 1, 2)
        _main_gridlayout.setColumnStretch(3, 0)

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

        # Qt signal/slot connections ------------------------------------------

        # Other ---------------------------------------------------------------
        self.languageChange()
Пример #4
0
    def __init__(self, parent=None, name=None, flags=0):

        qt_import.QWidget.__init__(self, parent,
                                   qt_import.Qt.WindowFlags(flags))

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

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

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

        # Graphic elements ----------------------------------------------------
        self.optimised_sad_cbx = qt_import.QCheckBox("Optimised SAD", self)
        self.automatic_resolution_radio = qt_import.QRadioButton(self)
        _optimal_sad_widget = qt_import.QWidget(self)
        self.optimal_sad_radio = qt_import.QRadioButton(
            "Optimal SAD for given resolution:", _optimal_sad_widget)
        self.sad_bgroup = qt_import.QButtonGroup(self)
        self.sad_bgroup.addButton(self.automatic_resolution_radio)
        self.sad_bgroup.addButton(self.optimal_sad_radio)
        self.sad_resolution_ledit = qt_import.QLineEdit(_optimal_sad_widget)
        self.sad_resolution_ledit.setMinimumSize(50, 0)
        self.sad_resolution_ledit.setMaximumSize(50, 32767)

        # Layout --------------------------------------------------------------
        _optimal_sad_widget_hlayout = qt_import.QHBoxLayout(
            _optimal_sad_widget)
        _optimal_sad_widget_hlayout.addWidget(self.optimal_sad_radio)
        _optimal_sad_widget_hlayout.addWidget(self.sad_resolution_ledit)
        _optimal_sad_widget_hlayout.setSpacing(0)
        _optimal_sad_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.optimised_sad_cbx)
        _main_vlayout.addWidget(self.automatic_resolution_radio)
        _main_vlayout.addWidget(_optimal_sad_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.automatic_resolution_radio.setText(
            self.trUtf8(
                "\x52\x65\x73\x6f\x6c\x75\x74\x69\x6f\x6e\x20\x73\x65\x6c\x65\x63\x74\x65\x64\x20\x61\x75\x74\x6f\x6d\x61\x74\x69\x63\x61\x6c\x6c\x79\x2c\x20\x72\x6f\x74\x61\x74\x69\x6f\x6e\x20\x69\x6e\x74\x65\x72\x76\x61\x6c\x3a\x20\x33\x36\x30\xc2\xb0"
            ))
    def __init__(self, parent=None, name="xrf_spectrum_parameters_widget"):
        qt_import.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 = qt_import.QWidget(self)
        _parameters_widget = qt_import.QWidget(_top_widget)
        self.data_path_widget = DataPathWidget(_parameters_widget)
        self.other_parameters_gbox = qt_import.QGroupBox(
            "Other parameters", _parameters_widget)
        self.count_time_label = qt_import.QLabel("Count time:",
                                                 self.other_parameters_gbox)
        self.count_time_ledit = qt_import.QLineEdit(self.other_parameters_gbox)
        self.count_time_ledit.setFixedWidth(50)
        self.adjust_transmission_cbox = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.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(qt_import.QSizePolicy.Expanding,
                                               qt_import.QSizePolicy.Expanding)
        _top_widget.setSizePolicy(qt_import.QSizePolicy.Expanding,
                                  qt_import.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 not None:
            HWR.beamline.xrf_spectrum.connect("xrfSpectrumFinished",
                                              self.spectrum_finished)
Пример #6
0
    def __init__(self, parent=None, name=None, flags=0):
        qt_import.QDialog.__init__(
            self,
            parent,
            qt_import.Qt.WindowFlags(flags | qt_import.Qt.WindowStaysOnTopHint),
        )

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

        # Graphic elements ----------------------------------------------------
        self.contrast_slider = qt_import.QSlider(qt_import.Qt.Horizontal, self)
        self.contrast_doublespinbox = qt_import.QDoubleSpinBox(self)
        self.contrast_checkbox = qt_import.QCheckBox("auto", self)
        self.brightness_slider = qt_import.QSlider(qt_import.Qt.Horizontal, self)
        self.brightness_doublespinbox = qt_import.QDoubleSpinBox(self)
        self.brightness_checkbox = qt_import.QCheckBox("auto", self)
        self.gain_slider = qt_import.QSlider(qt_import.Qt.Horizontal, self)
        self.gain_doublespinbox = qt_import.QDoubleSpinBox(self)
        self.gain_checkbox = qt_import.QCheckBox("auto", self)
        self.gamma_slider = qt_import.QSlider(qt_import.Qt.Horizontal, self)
        self.gamma_doublespinbox = qt_import.QDoubleSpinBox(self)
        self.gamma_checkbox = qt_import.QCheckBox("auto", self)
        self.exposure_time_slider = qt_import.QSlider(qt_import.Qt.Horizontal, self)
        self.exposure_time_doublespinbox = qt_import.QDoubleSpinBox(self)
        self.exposure_time_checkbox = qt_import.QCheckBox("auto", self)
        __close_button = qt_import.QPushButton("Close", self)

        # Layout --------------------------------------------------------------
        __main_gridlayout = qt_import.QGridLayout(self)
        __main_gridlayout.addWidget(qt_import.QLabel("Contrast:", self), 0, 0)
        __main_gridlayout.addWidget(self.contrast_slider, 0, 1)
        __main_gridlayout.addWidget(self.contrast_doublespinbox, 0, 2)
        __main_gridlayout.addWidget(self.contrast_checkbox, 0, 3)
        __main_gridlayout.addWidget(qt_import.QLabel("Brightness:", self), 1, 0)
        __main_gridlayout.addWidget(self.brightness_slider, 1, 1)
        __main_gridlayout.addWidget(self.brightness_doublespinbox, 1, 2)
        __main_gridlayout.addWidget(self.brightness_checkbox, 1, 3)
        __main_gridlayout.addWidget(qt_import.QLabel("Gain:", self), 2, 0)
        __main_gridlayout.addWidget(self.gain_slider, 2, 1)
        __main_gridlayout.addWidget(self.gain_doublespinbox, 2, 2)
        __main_gridlayout.addWidget(self.gain_checkbox, 2, 3)
        __main_gridlayout.addWidget(qt_import.QLabel("Gamma:", self), 3, 0)
        __main_gridlayout.addWidget(self.gamma_slider, 3, 1)
        __main_gridlayout.addWidget(self.gamma_doublespinbox, 3, 2)
        __main_gridlayout.addWidget(self.gamma_checkbox, 3, 3)
        __main_gridlayout.addWidget(qt_import.QLabel("Exposure time (ms):", self), 4, 0)
        __main_gridlayout.addWidget(self.exposure_time_slider, 4, 1)
        __main_gridlayout.addWidget(self.exposure_time_doublespinbox, 4, 2)
        __main_gridlayout.addWidget(self.exposure_time_checkbox, 4, 3)
        __main_gridlayout.addWidget(__close_button, 6, 2)
        __main_gridlayout.setSpacing(2)
        __main_gridlayout.setContentsMargins(5, 5, 5, 5)
        __main_gridlayout.setSizeConstraint(qt_import.QLayout.SetFixedSize)

        # Qt signal/slot connections ------------------------------------------
        self.contrast_slider.valueChanged.connect(self.set_contrast)
        self.contrast_doublespinbox.valueChanged.connect(self.set_contrast)
        self.contrast_checkbox.stateChanged.connect(self.set_contrast_auto)
        self.brightness_slider.valueChanged.connect(self.set_brightness)
        self.brightness_doublespinbox.valueChanged.connect(self.set_brightness)
        self.brightness_checkbox.stateChanged.connect(self.set_brightness_auto)
        self.gain_slider.valueChanged.connect(self.set_gain)
        self.gain_doublespinbox.valueChanged.connect(self.set_gain)
        self.gain_checkbox.stateChanged.connect(self.set_gain_auto)
        self.gamma_slider.valueChanged.connect(self.set_gamma)
        self.gamma_doublespinbox.valueChanged.connect(self.set_gamma)
        self.gamma_checkbox.stateChanged.connect(self.set_gamma_auto)
        self.exposure_time_slider.valueChanged.connect(self.set_exposure_time)
        self.exposure_time_doublespinbox.valueChanged.connect(self.set_exposure_time)
        self.exposure_time_checkbox.stateChanged.connect(self.set_exposure_time_auto)

        __close_button.clicked.connect(self.close)

        # SizePolicies --------------------------------------------------------
        self.contrast_slider.setFixedWidth(200)
        self.brightness_slider.setFixedWidth(200)
        self.gain_slider.setFixedWidth(200)
        self.gamma_slider.setFixedWidth(200)
        self.exposure_time_slider.setFixedWidth(200)
        __close_button.setSizePolicy(
            qt_import.QSizePolicy.Fixed, qt_import.QSizePolicy.Fixed
        )

        # Other ---------------------------------------------------------------
        self.setModal(True)
        self.setWindowTitle("Camera controls")
Пример #7
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.graphics_manager_hwobj = None

        # Internal values -----------------------------------------------------
        self.graphics_scene_size = None
        self.graphics_scene_fixed_size = None
        self.graphics_view = None
        # self.graphics_camera_frame = None
        self.fixed_size = None
        self.display_beam = None
        self.display_scale = None
        self.image_scale_list = []

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "/graphics")
        self.add_property("fixedSize", "string", "")
        self.add_property("displayBeam", "boolean", True)
        self.add_property("displayScale", "boolean", True)
        self.add_property("displayOmegaAxis", "boolean", True)
        self.add_property("beamDefiner", "boolean", False)
        self.add_property("cameraControls", "boolean", False)

        # Graphic elements-----------------------------------------------------
        self.info_widget = qt_import.QWidget(self)
        self.display_beam_size_cbox = qt_import.QCheckBox("Display beam size", self)
        self.display_beam_size_cbox.setHidden(False)
        self.coord_label = qt_import.QLabel(":", self)
        self.info_label = qt_import.QLabel(self)
        self.camera_control_dialog = CameraControlDialog(self)

        self.popup_menu = qt_import.QMenu(self)
        self.popup_menu.menuAction().setIconVisibleInMenu(True)
        create_menu = self.popup_menu.addMenu("Create")
        create_menu.menuAction().setIconVisibleInMenu(True)
        temp_action = create_menu.addAction(
            icons.load_icon("VCRPlay2"),
            "Centring point with 3 clicks",
            self.create_point_click_clicked,
        )
        temp_action.setShortcut("Ctrl+1")
        temp_action = create_menu.addAction(
            icons.load_icon("ThumbUp"),
            "Centring point on current position",
            self.create_point_current_clicked,
        )
        temp_action.setShortcut("Ctrl+2")
        temp_action.setIcon(icons.load_icon("ThumbUp"))
        create_menu.addAction(
            icons.load_icon("ThumbUp"),
            "Centring points with one click",
            self.create_points_one_click_clicked,
        )
        temp_action = create_menu.addAction(
            icons.load_icon("Line.png"), "Helical line", self.create_line_clicked
        )
        temp_action.setShortcut("Ctrl+3")
        temp_action = create_menu.addAction(
            icons.load_icon("Line.png"),
            "Automatic helical line",
            self.create_auto_line_clicked,
        )
        temp_action = create_menu.addAction(
            icons.load_icon("Grid"), "Grid", self.create_grid
        )
        temp_action.setShortcut("Ctrl+4")
        temp_action = create_menu.addAction(
            icons.load_icon("AutoGrid"), "Auto Grid", self.create_auto_grid
        )

        measure_menu = self.popup_menu.addMenu("Measure")
        self.measure_distance_action = measure_menu.addAction(
            icons.load_icon("measure_distance"),
            "Distance",
            self.measure_distance_clicked,
        )
        self.measure_angle_action = measure_menu.addAction(
            icons.load_icon("measure_angle"), "Angle", self.measure_angle_clicked
        )
        self.measure_area_action = measure_menu.addAction(
            icons.load_icon("measure_area"), "Area", self.measure_area_clicked
        )

        beam_mark_menu = self.popup_menu.addMenu("Beam mark")
        self.move_beam_mark_manual_action = beam_mark_menu.addAction(
            "Set position manually", self.move_beam_mark_manual
        )
        # self.move_beam_mark_manual_action.setEnabled(False)
        self.move_beam_mark_auto_action = beam_mark_menu.addAction(
            "Set position automaticaly", self.move_beam_mark_auto
        )
        # self.move_beam_mark_auto_action.setEnabled(False)
        self.display_beam_size_action = beam_mark_menu.addAction(
            "Display size", self.display_beam_size_toggled
        )
        self.display_beam_size_action.setCheckable(True)

        self.define_beam_action = self.popup_menu.addAction(
            icons.load_icon("Draw"),
            "Define beam size with slits",
            self.define_beam_size,
        )
        self.define_beam_action.setEnabled(False)
        self.popup_menu.addSeparator()

        temp_action = self.popup_menu.addAction(
            "Select all centring points", self.select_all_points_clicked
        )
        temp_action.setShortcut("Ctrl+A")
        temp_action = self.popup_menu.addAction(
            "Deselect all items", self.deselect_all_items_clicked
        )
        temp_action.setShortcut("Ctrl+D")
        temp_action = self.popup_menu.addAction(
            icons.load_icon("Delete"), "Clear all items", self.clear_all_items_clicked
        )
        temp_action.setShortcut("Ctrl+X")
        self.popup_menu.addSeparator()

        tools_menu = self.popup_menu.addMenu("Tools")
        self.display_grid_action = tools_menu.addAction(
            icons.load_icon("Grid"), "Display grid", self.display_grid_toggled
        )
        self.display_grid_action.setCheckable(True)
        self.display_histogram_action = tools_menu.addAction(
            icons.load_icon("Grid"),
            "Display historgram",
            self.display_histogram_toggled,
        )
        self.display_histogram_action.setCheckable(True)
        self.magnification_action = tools_menu.addAction(
            icons.load_icon("Magnify2"),
            "Magnification tool",
            self.start_magnification_tool,
        )
        # self.magnification_action.setCheckable(True)

        # self.display_histogram_action = self.popup_menu.addAction(\
        #     "Display histogram", self.display_histogram_toggled)
        # self.define_histogram_action = self.popup_menu.addAction(\
        #     "Define histogram", self.define_histogram_clicked)

        # self.display_histogram_action.setEnabled(False)
        # self.define_histogram_action.setEnabled(False)

        self.image_scale_menu = self.popup_menu.addMenu(
            icons.load_icon("DocumentMag2"), "Image scale"
        )
        self.image_scale_menu.setEnabled(False)
        self.image_scale_menu.triggered.connect(self.image_scale_triggered)
        self.camera_control_action = self.popup_menu.addAction(
            "Camera control", self.open_camera_control_dialog
        )
        self.camera_control_action.setEnabled(False)

        # Layout --------------------------------------------------------------
        _info_widget_hlayout = qt_import.QHBoxLayout(self.info_widget)
        _info_widget_hlayout.addWidget(self.display_beam_size_cbox)
        _info_widget_hlayout.addWidget(self.coord_label)
        _info_widget_hlayout.addStretch(0)
        _info_widget_hlayout.addWidget(self.info_label)
        _info_widget_hlayout.setSpacing(0)
        _info_widget_hlayout.setContentsMargins(0, 0, 0, 0)
        self.info_widget.setLayout(_info_widget_hlayout)

        self.main_layout = qt_import.QVBoxLayout(self)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)

        # Qt signal/slot connections -----------------------------------------
        self.display_beam_size_cbox.stateChanged.connect(self.display_beam_size_toggled)

        # SizePolicies --------------------------------------------------------
        self.info_widget.setSizePolicy(
            qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed
        )

        # Scene elements ------------------------------------------------------
        self.setMouseTracking(True)
Пример #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 = qt_import.QGroupBox("Parameters", self)
        self._adjust_transmission_cbox = qt_import.QCheckBox(
            "Adjust transmission", _parameters_gbox)
        self._adjust_transmission_cbox.setChecked(False)
        self._adjust_transmission_cbox.setEnabled(True)
        self._max_transmission_label = qt_import.QLabel(
            "Maximum transmission:")
        self._max_transmission_ledit = qt_import.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 = qt_import.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 = qt_import.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, *args):

        BaseWidget.__init__(self, *args)

        # Properties ----------------------------------------------------------
        self.add_property("defaultMode", "combo", ("keV", "Ang"), "keV")
        self.add_property("kevFormatString", "formatString", "##.####")
        self.add_property("angFormatString", "formatString", "##.####")
        self.add_property("displayStatus", "boolean", False)
        self.add_property("doBeamAlignment", "boolean", False)

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

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

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

        # Internal values -----------------------------------------------------

        # Graphic elements ----------------------------------------------------
        self.group_box = qt_import.QGroupBox("Energy", self)
        energy_label = qt_import.QLabel("Current:", self.group_box)
        energy_label.setFixedWidth(75)
        wavelength_label = qt_import.QLabel("Wavelength: ", self.group_box)
        self.energy_ledit = qt_import.QLineEdit(self.group_box)
        self.energy_ledit.setReadOnly(True)
        self.wavelength_ledit = qt_import.QLineEdit(self.group_box)
        self.wavelength_ledit.setReadOnly(True)

        self.status_label = qt_import.QLabel("Status:", self.group_box)
        self.status_label.setEnabled(False)
        self.status_ledit = qt_import.QLineEdit(self.group_box)
        self.status_ledit.setEnabled(False)

        self.new_value_widget = qt_import.QWidget(self)
        self.set_to_label = qt_import.QLabel("Set to: ", self)
        self.new_value_ledit = qt_import.QLineEdit(self.new_value_widget)
        # self.new_value_ledit.setMaximumWidth(60)
        self.units_combobox = qt_import.QComboBox(self.new_value_widget)
        self.units_combobox.addItems(["keV", u"\u212B"])
        self.stop_button = qt_import.QPushButton(self.new_value_widget)
        self.stop_button.setIcon(icons.load_icon("Stop2"))
        self.stop_button.setEnabled(False)
        self.stop_button.setFixedWidth(25)

        self.beam_align_cbox = qt_import.QCheckBox(
            "Center beam after energy change", self)

        # Layout --------------------------------------------------------------
        _new_value_widget_hlayout = qt_import.QHBoxLayout(
            self.new_value_widget)
        _new_value_widget_hlayout.addWidget(self.new_value_ledit)
        _new_value_widget_hlayout.addWidget(self.units_combobox)
        _new_value_widget_hlayout.addWidget(self.stop_button)
        _new_value_widget_hlayout.setSpacing(0)
        _new_value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _group_box_gridlayout = qt_import.QGridLayout(self.group_box)
        _group_box_gridlayout.addWidget(energy_label, 0, 0)
        _group_box_gridlayout.addWidget(self.energy_ledit, 0, 1)
        _group_box_gridlayout.addWidget(wavelength_label, 1, 0)
        _group_box_gridlayout.addWidget(self.wavelength_ledit, 1, 1)
        _group_box_gridlayout.addWidget(self.status_label, 2, 0)
        _group_box_gridlayout.addWidget(self.status_ledit, 2, 1)
        _group_box_gridlayout.addWidget(self.set_to_label, 3, 0)
        _group_box_gridlayout.addWidget(self.new_value_widget, 3, 1)
        _group_box_gridlayout.addWidget(self.beam_align_cbox, 4, 0, 1, 2)

        _group_box_gridlayout.setSpacing(0)
        _group_box_gridlayout.setContentsMargins(1, 1, 1, 1)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 2, 2)
        _main_vlayout.addWidget(self.group_box)

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

        # Qt signal/slot connections ------------------------------------------
        self.new_value_ledit.returnPressed.connect(self.current_value_changed)
        self.new_value_ledit.textChanged.connect(self.input_field_changed)
        self.units_combobox.activated.connect(self.units_changed)
        self.stop_button.clicked.connect(self.stop_clicked)
        self.beam_align_cbox.stateChanged.connect(self.do_beam_align_changed)

        # Other ---------------------------------------------------------------
        # self.group_box.setCheckable(True)
        # self.group_box.setChecked(True)
        self.new_value_validator = qt_import.QDoubleValidator(
            0, 15, 4, self.new_value_ledit)
        self.status_ledit.setEnabled(False)

        self.set_new_value_limits()
        self.connect(HWR.beamline.energy, "energyChanged", self.energy_changed)
        self.connect(HWR.beamline.energy, "stateChanged", self.state_changed)
        self.connect(HWR.beamline.energy, "statusInfoChanged",
                     self.status_info_changed)

        if hasattr(HWR.beamline.energy, "set_do_beam_alignment"):
            HWR.beamline.energy.set_do_beam_alignment(self["doBeamAlignment"])

        if HWR.beamline.energy.is_ready():
            tunable_energy = HWR.beamline.energy.is_tunable
            if tunable_energy is None:
                tunable_energy = False
            self.set_to_label.setEnabled(tunable_energy)
            self.new_value_ledit.setEnabled(tunable_energy)
            self.units_combobox.setEnabled(tunable_energy)
            if tunable_energy:
                colors.set_widget_color(self.new_value_ledit,
                                        colors.LINE_EDIT_ACTIVE,
                                        qt_import.QPalette.Base)
        else:
            self.setEnabled(False)

        self.instance_synchronize("energy_ledit", "new_value_ledit")
Пример #10
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.current_chip_config = None
        self.info_dict = {
            "collect_grid_cell": -1,
            "collect_comp_cell": -1,
            "processing_grid_cell": -1,
            "processing_comp_cell": -1
        }
        self.params_dict = None
        self.results = None
        self.collect_frame_num = 0
        self.processing_frame_num = 0
        self.score_type = "score"
        self.score_type_list = ("score", "spots_resolution", "spots_num")
        self.grid_table_item_fixed = False
        self.comp_table_item_fixed = False

        # Properties ----------------------------------------------------------
        self.add_property("cell_size", "integer", 22)

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

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

        # Graphic elements ----------------------------------------------------
        self.grid_widget = qt_import.QWidget(self)
        self.grid_table = qt_import.QTableWidget(self.grid_widget)
        self.grid_cell_label = qt_import.QLabel("Selected grid cell: A1",
                                                self.grid_widget)
        self.chip_config_combo = qt_import.QComboBox(self)

        self.inverted_rows_cbox = qt_import.QCheckBox("Inverted rows",
                                                      self.grid_widget)
        self.image_tracking_cbox = qt_import.QCheckBox("Live update",
                                                       self.grid_widget)
        self.score_type_combo = qt_import.QComboBox(self.grid_widget)
        self.show_grid_dialog_button = qt_import.QPushButton(
            "Full grid view", self.grid_widget)

        self.comp_widget = qt_import.QWidget(self)
        self.comp_cell_label = qt_import.QLabel(
            "Selected compartment cell: A1", self.comp_widget)
        self.comp_table = qt_import.QTableWidget(self.comp_widget)
        self.hit_map_plot = PlotWidget(self.comp_widget)

        self.grid_dialog = qt_import.QDialog(self)
        self.grid_graphics_view = GraphicsView()
        self.grid_graphics_base = GridViewGraphicsItem()
        self.grid_graphics_overlay = GridViewOverlayItem()
        # self.grid_graphics_view.scene().setSceneRect(0, 0, 2000, 2000)
        self.grid_graphics_view.scene().addItem(self.grid_graphics_base)
        self.grid_graphics_view.scene().addItem(self.grid_graphics_overlay)
        self.save_grid_view_button = qt_import.QPushButton(
            "Save", self.grid_dialog)
        self.save_grid_view_button.setFixedWidth(100)

        # Layout --------------------------------------------------------------
        _grid_vlayout = qt_import.QVBoxLayout(self.grid_widget)
        _grid_vlayout.addWidget(self.grid_cell_label)
        _grid_vlayout.addWidget(self.grid_table)
        _grid_vlayout.addStretch()
        _grid_vlayout.addWidget(self.chip_config_combo)
        _grid_vlayout.addWidget(self.inverted_rows_cbox)
        _grid_vlayout.addWidget(self.image_tracking_cbox)
        _grid_vlayout.addWidget(self.score_type_combo)
        _grid_vlayout.addWidget(self.show_grid_dialog_button)
        _grid_vlayout.setSpacing(2)
        _grid_vlayout.setContentsMargins(2, 2, 2, 2)

        _comp_vlayout = qt_import.QVBoxLayout(self.comp_widget)
        _comp_vlayout.addWidget(self.comp_cell_label)
        _comp_vlayout.addWidget(self.comp_table)
        _comp_vlayout.addWidget(self.hit_map_plot)
        _comp_vlayout.setSpacing(2)
        _comp_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = qt_import.QHBoxLayout(self)
        _main_vlayout.addWidget(self.grid_widget)
        _main_vlayout.addWidget(self.comp_widget)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_grid_dialog_vlayout = qt_import.QVBoxLayout(self.grid_dialog)
        _main_grid_dialog_vlayout.addWidget(self.grid_graphics_view)
        _main_grid_dialog_vlayout.addWidget(self.save_grid_view_button)

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

        # Qt signal/slot connections ------------------------------------------
        self.grid_table.cellClicked.connect(self.grid_cell_clicked)
        self.grid_table.cellEntered.connect(self.grid_cell_entered)

        self.comp_table.cellClicked.connect(self.comp_cell_clicked)
        self.comp_table.cellEntered.connect(self.comp_cell_entered)
        self.chip_config_combo.activated.connect(
            self.grid_properties_combo_changed)
        self.score_type_combo.activated.connect(self.score_type_changed)
        self.show_grid_dialog_button.clicked.connect(self.show_grid_dialog)
        self.hit_map_plot.mouseMovedSignal.connect(self.hit_map_mouse_moved)
        self.grid_graphics_view.mouseMovedSignal.connect(
            self.grid_view_mouse_moved)
        self.save_grid_view_button.clicked.connect(self.save_grid_view)

        # Other ---------------------------------------------------------------
        self.grid_table.setEditTriggers(
            qt_import.QAbstractItemView.NoEditTriggers)
        self.grid_table.setHorizontalScrollBarPolicy(
            qt_import.Qt.ScrollBarAlwaysOff)
        self.grid_table.setVerticalScrollBarPolicy(
            qt_import.Qt.ScrollBarAlwaysOff)
        self.grid_table.setMouseTracking(True)

        self.comp_table.setEditTriggers(
            qt_import.QAbstractItemView.NoEditTriggers)
        self.comp_table.setHorizontalScrollBarPolicy(
            qt_import.Qt.ScrollBarAlwaysOff)
        self.comp_table.setVerticalScrollBarPolicy(
            qt_import.Qt.ScrollBarAlwaysOff)
        self.comp_table.setMouseTracking(True)

        for score_type in ("Score", "Resolution", "Number of spots"):
            self.score_type_combo.addItem(score_type)

        HWR.beamline.online_processing.connect("processingStarted",
                                               self.processing_started)
        HWR.beamline.online_processing.connect("processingFinished",
                                               self.processing_finished)
        HWR.beamline.online_processing.connect("processingFailed",
                                               self.processing_failed)
        HWR.beamline.online_processing.connect("processingFrame",
                                               self.processing_frame_changed)
        self.current_grid_properties = (
            HWR.beamline.online_processing.get_current_grid_properties())

        self.grid_properties_combo.blockSignals(True)
        for prop in HWR.beamline.online_processing.get_available_grid_properties(
        ):
            self.grid_properties_combo.addItem(str(prop))
        self.grid_properties_combo.setCurrentIndex(0)
        self.grid_properties_combo.blockSignals(False)

        self.init_gui()
        self.grid_graphics_base.init_item(self.current_chip_config)
        self.grid_graphics_overlay.init_item(self.current_chip_config)
Пример #11
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(
            self, parent, name, qt_import.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 = qt_import.QGroupBox("Parameters", self)
        _count_time_label = qt_import.QLabel("Count time (sec.):", _parameters_gbox)
        self.count_time_ledit = qt_import.QLineEdit("1", _parameters_gbox)
        # self.count_time_ledit.setMaximumWidth(75)
        self.adjust_transmission_cbox = qt_import.QCheckBox(
            "Adjust transmission", _parameters_gbox
        )
        self.adjust_transmission_cbox.setChecked(True)

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = qt_import.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 = qt_import.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)
Пример #12
0
    def __init__(self, parent=None):

        qt_import.QWidget.__init__(self, parent)

        self.setObjectName("hit_map_widget")

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

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

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

        # Internal values -----------------------------------------------------
        self.__result_types = []
        self.__results_raw = None
        self.__results_aligned = None
        self.__first_result = True
        self.__grid = None
        #self.__is_mesh_scan = False
        self.__data_collection = None
        self.__selected_col = 0
        self.__selected_row = 0
        self.__score_key = None
        self.__max_value = 0
        self.__filter_min_value = 0
        self.__best_pos_list = None
        self.__hitmap_clicked = False
        self.__enable_continues_image_display = False
        #self.__tooltip_text = None
        self.selected_image_serial = None

        # Graphic elements ----------------------------------------------------
        self._hit_map_gbox = qt_import.QGroupBox("Online processing results",
                                                 self)
        hit_maps_widget = qt_import.QWidget(self._hit_map_gbox)
        self._osc_hit_map_plot = PlotWidget(hit_maps_widget)
        self._osc_hit_map_plot.set_plot_type("1D")
        self._grid_hit_map_plot = PlotWidget(hit_maps_widget)
        self._grid_hit_map_plot.set_plot_type("2D")
        self._hit_map_popup_menu = qt_import.QMenu(self._hit_map_gbox)

        hit_map_info_widget = qt_import.QWidget(self._hit_map_gbox)
        score_type_label = qt_import.QLabel("Result: ", hit_map_info_widget)
        self._score_type_cbox = qt_import.QComboBox(hit_map_info_widget)
        self._autoscale_button = qt_import.QPushButton("Auto scale",
                                                       hit_map_info_widget)
        image_display_cbox = qt_import.QCheckBox("Display image in ADxV",
                                                 hit_map_info_widget)
        self._image_info_label = qt_import.QLabel("Image: #, value #",
                                                  hit_map_info_widget)

        self._hit_map_tools_widget = qt_import.QWidget(self._hit_map_gbox)

        _threshold_label = qt_import.QLabel("Threshold: ",
                                            self._hit_map_tools_widget)
        self._threshold_slider = qt_import.QSlider(qt_import.Qt.Horizontal,
                                                   self._hit_map_tools_widget)
        self._relaunch_processing_button = qt_import.QPushButton(
            "Relaunch processing", self._hit_map_tools_widget)
        self._create_points_button = qt_import.QPushButton(
            "Create centring points", self._hit_map_tools_widget)
        """
        self._summary_gbox = qt_import.QGroupBox("Summary", self)
        self._summary_textbrowser = qt_import.QTextBrowser(self._summary_gbox)
        self._best_pos_gbox = qt_import.QGroupBox("Best positions", self)
        self._best_pos_table = qt_import.QTableWidget(self._best_pos_gbox)
        self._best_pos_popup_menu = qt_import.QMenu(self._hit_map_gbox)
        self._best_pos_gbox.setHidden(True)
        """

        # Layout --------------------------------------------------------------
        _hit_map_info_hlayout = qt_import.QHBoxLayout(hit_map_info_widget)
        _hit_map_info_hlayout.addWidget(score_type_label)
        _hit_map_info_hlayout.addWidget(self._score_type_cbox)
        _hit_map_info_hlayout.addWidget(self._autoscale_button)
        _hit_map_info_hlayout.addWidget(image_display_cbox)
        _hit_map_info_hlayout.addStretch(0)
        _hit_map_info_hlayout.addWidget(self._image_info_label)
        _hit_map_info_hlayout.setSpacing(2)
        _hit_map_info_hlayout.setContentsMargins(0, 0, 0, 0)

        _hit_map_tools_hlayout = qt_import.QHBoxLayout(
            self._hit_map_tools_widget)
        _hit_map_tools_hlayout.addWidget(_threshold_label)
        _hit_map_tools_hlayout.addWidget(self._threshold_slider)
        _hit_map_tools_hlayout.addStretch(0)
        _hit_map_tools_hlayout.addWidget(self._relaunch_processing_button)
        _hit_map_tools_hlayout.addWidget(self._create_points_button)
        _hit_map_tools_hlayout.setSpacing(2)
        _hit_map_tools_hlayout.setContentsMargins(0, 0, 0, 0)

        _hit_maps_hlayout = qt_import.QHBoxLayout(hit_maps_widget)
        _hit_maps_hlayout.addWidget(self._osc_hit_map_plot)
        _hit_maps_hlayout.addWidget(self._grid_hit_map_plot)

        _hit_map_gbox_vlayout = qt_import.QVBoxLayout(self._hit_map_gbox)
        _hit_map_gbox_vlayout.addWidget(hit_maps_widget)
        _hit_map_gbox_vlayout.addWidget(hit_map_info_widget)
        _hit_map_gbox_vlayout.addWidget(self._hit_map_tools_widget)
        _hit_map_gbox_vlayout.setSpacing(2)
        _hit_map_gbox_vlayout.setContentsMargins(0, 0, 0, 0)
        """
        _summary_gbox_vlayout = qt_import.QVBoxLayout(self._summary_gbox)
        _summary_gbox_vlayout.addWidget(self._summary_textbrowser)
        _summary_gbox_vlayout.setSpacing(2)
        _summary_gbox_vlayout.setContentsMargins(0, 0, 0, 0)

        _best_postition_gbox_vlayout = qt_import.QVBoxLayout(self._best_pos_gbox)
        _best_postition_gbox_vlayout.addWidget(self._best_pos_table)
        _best_postition_gbox_vlayout.setSpacing(2)
        _best_postition_gbox_vlayout.setContentsMargins(0, 0, 0, 0)
        """

        _main_hlayout = qt_import.QVBoxLayout(self)
        _main_hlayout.addWidget(self._hit_map_gbox)
        #_main_hlayout.addWidget(self._summary_gbox)
        #_main_hlayout.addWidget(self._best_pos_gbox)
        _main_hlayout.setSpacing(2)
        _main_hlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signals and slots ------------------------------------------------
        image_display_cbox.stateChanged.connect(
            self.enable_image_display_state_changed)
        self._score_type_cbox.activated.connect(self.score_type_changed)
        self._threshold_slider.valueChanged.connect(
            self.filter_min_slider_changed)
        self._relaunch_processing_button.clicked.connect(
            self.relaunch_processing_clicked)
        self._create_points_button.clicked.connect(self.create_points_clicked)
        self._osc_hit_map_plot.mouseMovedSignal.connect(self.mouse_moved)
        self._osc_hit_map_plot.mouseClickedSignal.connect(self.mouse_clicked)
        self._osc_hit_map_plot.mouseDoubleClickedSignal.connect(
            self.move_to_position_clicked)
        self._osc_hit_map_plot.mouseLeftSignal.connect(self.mouse_left_plot)
        self._autoscale_button.clicked.connect(self.autoscale_pressed)

        # Other ---------------------------------------------------------------
        #self.__tooltip_text = (
        #    "Double click to move to the position. " + "Right click to open menu."
        #)
        #self._osc_hit_map_plot.setToolTip(self.__tooltip_text)
        self._hit_map_popup_menu.addSeparator()
        self._hit_map_popup_menu.addAction("Move to position",
                                           self.move_to_position_clicked)
        self._hit_map_popup_menu.addAction("Create centring point",
                                           self.create_centring_point_clicked)

        self._hit_map_popup_menu.addAction("Create helical line",
                                           self.create_helical_line_clicked)
        self._hit_map_popup_menu.addAction(
            "Rotate 90 degrees and create helical line",
            self.rotate_and_create_helical_line_clicked,
        )

        self._hit_map_popup_menu.addSeparator()
        self._hit_map_popup_menu.addAction("Open image in ADXV",
                                           self.display_image_clicked)
        self._hit_map_popup_menu.addSeparator()

        #self._osc_hit_map_plot.contextMenuEvent = self.open_hit_map_popup_menu

        if HWR.beamline.online_processing is not None:
            self.__result_types = HWR.beamline.online_processing.get_result_types(
            )
        for result in self.__result_types:
            self._score_type_cbox.addItem(result["descr"])
        self._score_type_cbox.setMaximumWidth(200)
        self.__score_key = "spots_resolution"

        self._relaunch_processing_button.setVisible(False)

        self._threshold_slider.setRange(0, 100)
        self._threshold_slider.setTickInterval(5)
        self._threshold_slider.setFixedWidth(200)
        self._threshold_slider.setTracking(False)

        #font = self._best_pos_table.font()
        #font.setPointSize(8)
        #self._best_pos_table.setFont(font)
        """
Пример #13
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.axis_camera = None
        self.sc_camera = None

        # Properties ----------------------------------------------------------
        self.add_property("hwobj_axis_camera", "string", "")
        self.add_property("hwobj_sc_camera", "string", "")

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

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

        # Graphic elements ----------------------------------------------------
        status_widget = qt_import.QWidget(self)
        status_label = qt_import.QLabel("Status: ", status_widget)
        self.status_ledit = qt_import.QLineEdit(status_widget)

        self.camera_live_cbx = qt_import.QCheckBox("Live view", self)
        self.camera_live_cbx.setChecked(False)

        self.progress_bar = qt_import.QProgressBar(self)
        self.progress_bar.setMinimum(0)

        camera_widget = qt_import.QWidget(self)

        self.axis_view = qt_import.QGraphicsView(camera_widget)
        axis_scene = qt_import.QGraphicsScene(self.axis_view)
        self.axis_view.setScene(axis_scene)
        self.axis_camera_pixmap_item = qt_import.QGraphicsPixmapItem()
        axis_scene.addItem(self.axis_camera_pixmap_item)

        self.sc_view = qt_import.QGraphicsView(camera_widget)
        sc_scene = qt_import.QGraphicsScene(self.sc_view)
        self.sc_view.setScene(sc_scene)
        self.sc_camera_pixmap_item = qt_import.QGraphicsPixmapItem()
        sc_scene.addItem(self.sc_camera_pixmap_item)

        # Layout --------------------------------------------------------------
        _status_widget_hlayout = qt_import.QHBoxLayout(status_widget)
        _status_widget_hlayout.addWidget(status_label)
        _status_widget_hlayout.addWidget(self.status_ledit)

        _camera_widget_hlayout = qt_import.QHBoxLayout(camera_widget)
        _camera_widget_hlayout.addWidget(self.axis_view)
        _camera_widget_hlayout.addWidget(self.sc_view)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(status_widget)
        _main_vlayout.addWidget(self.camera_live_cbx)
        _main_vlayout.addWidget(camera_widget)
        _main_vlayout.addWidget(self.progress_bar)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.camera_live_cbx.stateChanged.connect(
            self.camera_live_state_changed)

        if HWR.beamline.sample_changer is not None:
            self.connect(
                HWR.beamline.sample_changer,
                SampleChanger.STATUS_CHANGED_EVENT,
                self.sample_changer_status_changed,
            )
            self.connect(HWR.beamline.sample_changer, "progressInit",
                         self.init_progress)
            self.connect(HWR.beamline.sample_changer, "progressStep",
                         self.step_progress)
            self.connect(HWR.beamline.sample_changer, "progressStop",
                         self.stop_progress)