Пример #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 = QtImport.QGroupBox("Image tracking", self)
        self.state_label = QtImport.QLabel("<b> </b>", _main_groupbox)
        self.image_tracking_cbox = QtImport.QCheckBox(
            "Enable Adxv image tracking", _main_groupbox
        )
        self.filter_frames_cbox = QtImport.QCheckBox(
            "Filter frames based on Dozor score", _main_groupbox
        )
        self.spot_list_cbox = QtImport.QCheckBox(
            "Indicate spots in ADxV", _main_groupbox
        )

        # Layout --------------------------------------------------------------
        _main_groupbox_vlayout = QtImport.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 = QtImport.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(QtImport.Qt.AlignCenter)
        self.state_label.setFixedHeight(24)
        self.state_changed("unknown")
    def __init__(self, parent=None, name=None, flags=0):

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

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

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

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

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

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

        # Layout --------------------------------------------------------------
        _label_widget_hlayout = QtImport.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 = QtImport.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 = QtImport.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, *args):
        BaseWidget.__init__(self, *args)

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

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

        # Properties ----------------------------------------------------------
        self.add_property("beamline_setup", "string", "/beamline-setup")

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

        # Slots ---------------------------------------------------------------
        self.define_slot("populate_widget", ({}))

        # Graphic elements ----------------------------------------------------
        self.show_raw_results_cbox = QtImport.QCheckBox("Raw results", self)
        self.show_aligned_results_cbox = QtImport.QCheckBox("Aligned results", self)
        self.raw_results_widget = AdvancedResultsWidget(self, show_aligned_results=False)
        self.aligned_results_widget = AdvancedResultsWidget(self, show_aligned_results=True)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.raw_results_widget)
        _main_vlayout.addWidget(self.aligned_results_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

        # SizePolicies --------------------------------------------------------
        self.setSizePolicy(
            QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.MinimumExpanding
        )

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

        # Other ---------------------------------------------------------------
        self.raw_results_widget.heat_map_widget._heat_map_tools_widget.setHidden(True)
        self.raw_results_widget.heat_map_widget._summary_gbox.setHidden(True)
        self.aligned_results_widget.setHidden(True)
        self.aligned_results_widget.heat_map_widget._heat_map_tools_widget.setHidden(True)
        self.aligned_results_widget.heat_map_widget._summary_gbox.setHidden(True)

        self.aligned_results_widget.heat_map_widget.setFixedWidth(1300)
        self.raw_results_widget.heat_map_widget.setFixedWidth(1300)
    def __init__(self, parent=None, name=None, flags=0):

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

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

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

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

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

        # Layout --------------------------------------------------------------
        _main_gridlayout = QtImport.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()
Пример #5
0
    def __init__(self, parent=None, name=None, flags=0):

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

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

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

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

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

        # Layout --------------------------------------------------------------
        _optimal_sad_widget_hlayout = QtImport.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 = QtImport.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"
            )
        )
Пример #6
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 = QtImport.QWidget(self)
        status_label = QtImport.QLabel("Status: ", status_widget)
        self.status_ledit = QtImport.QLineEdit(status_widget)

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

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

        camera_widget = QtImport.QWidget(self)

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

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

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

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

        _main_vlayout = QtImport.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)
Пример #7
0
    def __init__(self, parent=None, name=None, flags=0):
        QtImport.QDialog.__init__(
            self,
            parent,
            QtImport.Qt.WindowFlags(flags | QtImport.Qt.WindowStaysOnTopHint),
        )

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

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

        # Layout --------------------------------------------------------------
        __main_gridlayout = QtImport.QGridLayout(self)
        __main_gridlayout.addWidget(QtImport.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(QtImport.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(QtImport.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(QtImport.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(
            QtImport.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(QtImport.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(QtImport.QSizePolicy.Fixed,
                                     QtImport.QSizePolicy.Fixed)

        # Other ---------------------------------------------------------------
        self.setModal(True)
        self.setWindowTitle("Camera controls")
Пример #8
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 = QtImport.QWidget(self)
        self.display_beam_size_cbox = QtImport.QCheckBox(
            "Display beam size", self)
        self.display_beam_size_cbox.setHidden(True)
        self.coord_label = QtImport.QLabel(":", self)
        self.info_label = QtImport.QLabel(self)
        self.camera_control_dialog = CameraControlDialog(self)

        self.popup_menu = QtImport.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 = QtImport.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 = QtImport.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(QtImport.QSizePolicy.Expanding,
                                       QtImport.QSizePolicy.Fixed)

        # Scene elements ------------------------------------------------------
        self.setMouseTracking(True)
Пример #9
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
Пример #10
0
    def __init__(self, parent=None, show_aligned_results=False):

        QtImport.QWidget.__init__(self, parent)

        self.setObjectName("hit_map_widget")

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

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

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

        # Internal values -----------------------------------------------------
        self.__plot_type = "1D"
        self.__result_types = []
        self.__results_raw = None
        self.__results_aligned = None
        self.__first_result = True
        self.__associated_grid = None
        self.__associated_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.__hit_map_max_size = []
        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 = QtImport.QGroupBox("Hit map", self)
        self._hit_map_plot = PlotWidget(self._hit_map_gbox)
        self._hit_map_popup_menu = QtImport.QMenu(self._hit_map_gbox)

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

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

        _threshold_label = QtImport.QLabel("Threshold: ",
                                           self._hit_map_tools_widget)
        self._threshold_slider = QtImport.QSlider(QtImport.Qt.Horizontal,
                                                  self._hit_map_tools_widget)
        self._relaunch_processing_button = QtImport.QPushButton(
            "Relaunch processing", self._hit_map_tools_widget)
        self._create_points_button = QtImport.QPushButton(
            "Create centring points", self._hit_map_tools_widget)

        self._summary_gbox = QtImport.QGroupBox("Summary", self)
        self._summary_textbrowser = QtImport.QTextBrowser(self._summary_gbox)
        self._best_pos_gbox = QtImport.QGroupBox("Best positions", self)
        self._best_pos_table = QtImport.QTableWidget(self._best_pos_gbox)
        self._best_pos_popup_menu = QtImport.QMenu(self._hit_map_gbox)
        self._best_pos_gbox.setHidden(True)

        # Layout --------------------------------------------------------------
        _hit_map_info_hlayout = QtImport.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 = QtImport.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_map_gbox_vlayout = QtImport.QVBoxLayout(self._hit_map_gbox)
        _hit_map_gbox_vlayout.addWidget(self._hit_map_plot)
        _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 = QtImport.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 = QtImport.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 = QtImport.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 --------------------------------------------------------
        #self._image_info_label.setAlignment(QtImport.Qt.AlignLeft)
        #self._image_info_label.setSizePolicy(
        #    QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Fixed
        #)

        # 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._hit_map_plot.mouseMovedSignal.connect(self.mouse_moved)
        self._hit_map_plot.mouseClickedSignal.connect(self.mouse_clicked)
        self._hit_map_plot.mouseDoubleClickedSignal.connect(
            self.move_to_position_clicked)
        self._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._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._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._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)
        self._best_pos_table.setEditTriggers(
            QtImport.QAbstractItemView.NoEditTriggers)
        self._best_pos_table.setColumnCount(9)
        self._best_pos_table.setAlternatingRowColors(True)
        self._best_pos_table.setWordWrap(False)
        self._best_pos_table.horizontalHeader().setSortIndicatorShown(True)
        self._best_pos_table.setHorizontalHeaderItem(
            0, QtImport.QTableWidgetItem("No."))
        for index, result_type in enumerate(self.__result_types):
            self._best_pos_table.setHorizontalHeaderItem(
                index + 1, QtImport.QTableWidgetItem(result_type["descr"]))

        for index, header_text in enumerate(
            ("Path", "Col", "Row", "Motor positions")):
            self._best_pos_table.setHorizontalHeaderItem(
                5 + index, QtImport.QTableWidgetItem(header_text))

        self._best_pos_popup_menu.addAction("Move to position",
                                            self.move_to_best_position_clicked)
        self._best_pos_table.contextMenuEvent = self.open_best_pos_popup_menu

        screen_shape = QtImport.QDesktopWidget().screenGeometry()
        self.__hit_map_max_size = (screen_shape.width() / 2,
                                   screen_shape.height() / 2)
Пример #11
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 = QtImport.QWidget(self)
        self.grid_table = QtImport.QTableWidget(self.grid_widget)
        self.grid_cell_label = QtImport.QLabel(
            "Selected grid cell: A1", self.grid_widget
        )
        self.chip_config_combo = QtImport.QComboBox(self)

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

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

        self.grid_dialog = QtImport.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 = QtImport.QPushButton("Save", self.grid_dialog)
        self.save_grid_view_button.setFixedWidth(100)

        # Layout --------------------------------------------------------------
        _grid_vlayout = QtImport.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 = QtImport.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 = QtImport.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 = QtImport.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(QtImport.QAbstractItemView.NoEditTriggers)
        self.grid_table.setHorizontalScrollBarPolicy(QtImport.Qt.ScrollBarAlwaysOff)
        self.grid_table.setVerticalScrollBarPolicy(QtImport.Qt.ScrollBarAlwaysOff)
        self.grid_table.setMouseTracking(True)

        self.comp_table.setEditTriggers(QtImport.QAbstractItemView.NoEditTriggers)
        self.comp_table.setHorizontalScrollBarPolicy(QtImport.Qt.ScrollBarAlwaysOff)
        self.comp_table.setVerticalScrollBarPolicy(QtImport.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)
Пример #12
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 -----------------------------------------------------
        self.energy_limits = None
        self.wavelength_limits = None

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

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

        self.new_value_widget = QtImport.QWidget(self)
        self.set_to_label = QtImport.QLabel("Set to: ", self)
        self.new_value_ledit = QtImport.QLineEdit(self.new_value_widget)
        # self.new_value_ledit.setMaximumWidth(60)
        self.units_combobox = QtImport.QComboBox(self.new_value_widget)
        self.units_combobox.addItems(["keV", u"\u212B"])
        self.stop_button = QtImport.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 = QtImport.QCheckBox(
            "Center beam after energy change", self)

        # Layout --------------------------------------------------------------
        _new_value_widget_hlayout = QtImport.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 = QtImport.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 = QtImport.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 = QtImport.QDoubleValidator(
            0, 15, 4, self.new_value_ledit)
        self.status_ledit.setEnabled(False)

        self.instance_synchronize("energy_ledit", "new_value_ledit")
    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)
Пример #14
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)