Beispiel #1
0
    def refresh(self):
        if self.data_collection is not None:
            acq = self.data_collection.acquisitions[0]
            paths = acq.get_preview_image_paths()
            if acq.acquisition_parameters.shutterless and len(paths) > 1:
                temp = [paths[0], paths[-1]]
                paths = temp

            self.image_path = acq.path_template.get_image_path()

            self.image_tracking_widget_layout.current_path_ledit.setText(
                self.image_path % acq.acquisition_parameters.first_image)
            self.image_tracking_widget_layout.image_num_spinbox.setValue(
                acq.acquisition_parameters.first_image)
            self.image_tracking_widget_layout.image_num_spinbox.setRange(
                acq.acquisition_parameters.first_image,
                acq.acquisition_parameters.first_image +
                acq.acquisition_parameters.num_images - 1,
            )

            self.image_tracking_widget_layout.first_image_label.setPixmap(
                QtImport.QPixmap(paths[0]))
            if len(paths) > 1:
                self.image_tracking_widget_layout.last_image_label.setPixmap(
                    QtImport.QPixmap(paths[1]))
Beispiel #2
0
    def update_pin_icon(self):
        dc_tree_widget = self.listView().parent()

        if dc_tree_widget._loaded_sample_item:
            dc_tree_widget._loaded_sample_item.setIcon(0, QtImport.QPixmap())

        dc_tree_widget._loaded_sample_item = self
        self.setIcon(0, QtImport.QIcon(dc_tree_widget.pin_pixmap))
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.num_cols = None
        self.num_rows = None
        self.num_drops = None
        self.current_location = None
        self.plate_content = None
        self.xtal_map = None

        # Properties ----------------------------------------------------------
        self.add_property("icons", "string", "")

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

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

        # Graphic elements ----------------------------------------------------
        self.plate_navigator_widget = PlateNavigatorWidget(self)
        self.crims_widget = QtImport.load_ui_file(
            "plate_crims_widget_layout.ui")

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

        # Qt signal/slot connections ------------------------------------------
        self.crims_widget.search_button.clicked.connect(
            self.search_button_clicked)
        self.crims_widget.move_button.clicked.connect(
            self.move_to_xtal_clicked)
        self.crims_widget.abort_button.clicked.connect(self.abort_clicked)

        self.crims_widget.xtal_treewidget.currentItemChanged.connect(
            self.xtal_treewidget_current_item_changed)

        # Other ---------------------------------------------------------------
        self.xtal_image_graphicsscene = QtImport.QGraphicsScene(self)
        self.crims_widget.xtal_image_graphicsview.setScene(
            self.xtal_image_graphicsscene)
        self.xtal_image_pixmap = QtImport.QPixmap()
        self.xtal_image_graphics_pixmap = QtImport.QGraphicsPixmapItem()
        self.xtal_image_graphicsscene.addItem(self.xtal_image_graphics_pixmap)

        if HWR.beamline.plate_manipulator is not None:
            self.connect(
                HWR.beamline.plate_manipulator,
                SampleChanger.INFO_CHANGED_EVENT,
                self.plate_navigator_widget.refresh_plate_location,
            )
Beispiel #4
0
    def display_snapshot(self, image, width=None):
        if image is not None:
            if width is not None:
                ration = image.height() / float(image.width())
                image = image.scaled(width, width * ration,
                                     QtImport.Qt.KeepAspectRatio,
                                     QtImport.Qt.SmoothTransformation)
                self.setFixedWidth(width)

            self.snapshot_label.setPixmap(QtImport.QPixmap(image))
    def populate_parameter_widget(self, tree_view_item):
        """
        Descript. :
        """
        self._tree_view_item = tree_view_item
        self._char = tree_view_item.get_model()
        self._data_collection = self._char.reference_image_collection
        self._char_params = self._char.characterisation_parameters
        self._char_params_mib.set_model(self._char.characterisation_parameters)
        self._set_space_group(self._char_params.space_group)

        self.acq_widget.update_data_model(
            self._char.reference_image_collection.acquisitions[0].
            acquisition_parameters,
            self._char.reference_image_collection.acquisitions[0].
            path_template,
        )

        self.path_widget.update_data_model(
            self._char.reference_image_collection.acquisitions[0].path_template
        )

        if self._data_collection.acquisitions[
                0].acquisition_parameters.centred_position.snapshot_image:
            image = self._data_collection.acquisitions[
                0].acquisition_parameters.centred_position.snapshot_image
            ration = image.height() / float(image.width())
            image = image.scaled(
                400,
                400 * ration,
                QtImport.Qt.KeepAspectRatio,
                QtImport.Qt.SmoothTransformation,
            )
            self.position_widget.svideo.setPixmap(QtImport.QPixmap(image))

        self.toggle_permitted_range(self._char_params.use_permitted_rotation)
        self.enable_opt_parameters_widget(
            self._char_params.determine_rad_params)
        self.enable_maximum_res_ledit(self._char_params.use_aimed_resolution)
        self.enable_aimed_mult_ledit(self._char_params.use_aimed_multiplicity)

        item = self.char_type_widget.charact_type_tbox.widget(
            self._char_params.experiment_type)
        if item:
            self.char_type_widget.charact_type_tbox.setCurrentWidget(item)
        self.char_type_widget.toggle_time_dose()
        crystal = self._char.reference_image_collection.crystal
        self.acq_widget.set_energies(crystal.energy_scan_result)
Beispiel #6
0
    def init(self):
        AbstractCollect.init(self)
        self.ready_event = gevent.event.Event()
        self.image_dimension = (2048, 2048)
        self.reference_distance = self.getProperty("reference_distance")
        self.reference_angle = self.getProperty("reference_angle")

        QtGraphicsManager.init(self)

        self.disconnect(HWR.beamline.sample_view.camera, "imageReceived",
                        self.camera_image_received)

        self.disconnect(
            HWR.beamline.diffractometer,
            "minidiffStateChanged",
            self.diffractometer_state_changed,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "centringStarted",
            self.diffractometer_centring_started,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "centringAccepted",
            self.create_centring_point,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "centringSuccessful",
            self.diffractometer_centring_successful,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "centringFailed",
            self.diffractometer_centring_failed,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "pixelsPerMmChanged",
            self.diffractometer_pixels_per_mm_changed,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "omegaReferenceChanged",
            self.diffractometer_omega_reference_changed,
        )
        self.disconnect(
            HWR.beamline.diffractometer,
            "minidiffPhaseChanged",
            self.diffractometer_phase_changed,
        )

        self.diffractometer_pixels_per_mm_changed((20., 20.))
        self.graphics_manager_hwobj = self.getObjectByRole("graphics_manager")

        self.graphics_scale_item.set_start_position(
            20, self.image_dimension[1] - 20)

        self.graphics_scale_item.set_custom_pen_color(Colors.BLUE)
        self.graphics_omega_reference_item.set_custom_pen_color(
            Colors.DARK_BLUE)
        self.graphics_measure_distance_item.set_custom_pen_color(
            Colors.DARK_BLUE)
        self.graphics_beam_item.hide()

        self.graphics_view.scene().measureItemChanged.connect(
            self.measure_item_changed)
        self.graphics_view.scene().setSceneRect(0, 0, self.image_dimension[0],
                                                self.image_dimension[1])

        self.qimage = QtImport.QImage()
        self.qpixmap = QtImport.QPixmap()

        self.chan_frame = self.get_channel_object("chanFrame")
        self.chan_frame.connectSignal("update", self.frame_changed)

        self.chan_ff_ssim = self.get_channel_object("chanFFSSIM")
        self.chan_ff_ssim.connectSignal("update", self.ff_ssim_changed)

        self.chan_collect_status = self.get_channel_object("collectStatus")
        #self._actual_collect_status = self.chan_collect_status.getValue()
        self.chan_collect_status.connectSignal("update",
                                               self.collect_status_update)

        self.chan_collect_frame = self.get_channel_object("chanFrameCount")
        self.chan_collect_frame.connectSignal("update",
                                              self.collect_frame_update)

        self.chan_collect_error = self.get_channel_object("collectError")
        self.chan_collect_error.connectSignal("update",
                                              self.collect_error_update)

        self.chan_camera_warning = self.get_channel_object("cameraWarning")
        self.chan_camera_warning.connectSignal("update",
                                               self.camera_warning_update)

        self.chan_camera_error = self.get_channel_object("cameraError")
        self.chan_camera_error.connectSignal("update",
                                             self.camera_error_update)

        self.cmd_collect_detector = self.get_command_object("collectDetector")
        self.cmd_collect_directory = self.get_command_object(
            "collectDirectory")
        self.cmd_collect_exposure_time = self.get_command_object(
            "collectExposureTime")
        self.cmd_collect_in_queue = self.get_command_object("collectInQueue")
        self.cmd_collect_num_images = self.get_command_object(
            "collectNumImages")
        self.cmd_collect_range = self.get_command_object("collectRange")
        self.cmd_collect_scan_type = self.get_command_object("collectScanType")
        self.cmd_collect_shutter = self.get_command_object("collectShutter")
        self.cmd_collect_shutterless = self.get_command_object(
            "collectShutterless")
        self.cmd_collect_start_angle = self.get_command_object(
            "collectStartAngle")
        self.cmd_collect_template = self.get_command_object("collectTemplate")

        self.cmd_collect_ff_num_images = self.get_command_object(
            "collectFFNumImages")
        self.cmd_collect_ff_offset = self.get_command_object("collectFFOffset")
        self.cmd_collect_ff_pre = self.get_command_object("collectFFPre")
        self.cmd_collect_ff_post = self.get_command_object("collectFFPost")

        self.cmd_camera_trigger = self.get_command_object("cameraTrigger")
        self.cmd_camera_live_view = self.get_command_object("cameraLiveView")
        self.cmd_camera_write_data = self.get_command_object("cameraWriteData")
        self.cmd_camera_ff_ssim = self.get_command_object("cameraFFSSIM")

        self.cmd_collect_start = self.get_command_object("collectStart")
        self.cmd_collect_abort = self.get_command_object("collectAbort")

        self.beam_focusing_hwobj = self.getObjectByRole("beam_focusing")