Пример #1
0
    def update_all(self, clear_canvases=False):
        # If there are no images loaded, skip the request
        if not HexrdConfig().has_images():
            return

        prev_blocked = self.calibration_config_widget.block_all_signals()

        # Need to clear focus from current widget if enter is pressed or
        # else all clicks are emit an editingFinished signal and view is
        # constantly re-rendered
        if QApplication.focusWidget() is not None:
            QApplication.focusWidget().clearFocus()

        if clear_canvases:
            for canvas in self.ui.image_tab_widget.image_canvases:
                canvas.clear()

        if self.image_mode == ViewType.cartesian:
            self.ui.image_tab_widget.show_cartesian()
        elif self.image_mode == ViewType.polar:
            # Rebuild polar masks
            HexrdConfig().polar_masks.clear()
            for name, line_data in HexrdConfig().polar_masks_line_data.items():
                if not isinstance(line_data, list):
                    line_data = [line_data]
                create_polar_mask(line_data, name)
            for name, value in HexrdConfig().raw_masks_line_data.items():
                det, data = value[0]
                line_data = convert_raw_to_polar(det, data)
                create_polar_mask(line_data, name)
            self.ui.image_tab_widget.show_polar()
        else:
            # Rebuild raw masks
            HexrdConfig().raw_masks.clear()
            for name, line_data in HexrdConfig().raw_masks_line_data.items():
                create_raw_mask(name, line_data)
            for name, data in HexrdConfig().polar_masks_line_data.items():
                if isinstance(data, list):
                    # These are Laue spots
                    continue
                else:
                    line_data = convert_polar_to_raw(data)
                    create_raw_mask(name, line_data)
            self.ui.image_tab_widget.load_images()

        # Only ask if have haven't asked before
        if HexrdConfig().workflow is None:
            self.workflow_selection_dialog.show()

        self.calibration_config_widget.unblock_all_signals(prev_blocked)
Пример #2
0
    def create_masks(self):
        for data in self.raw_masks_line_data:
            name = create_unique_name(HexrdConfig().raw_masks_line_data,
                                      'raw_mask_0')
            HexrdConfig().raw_masks_line_data[name] = [data]
            create_raw_mask(name, [data])
            HexrdConfig().visible_masks.append(name)
            HexrdConfig().raw_masks_changed.emit()

        for data_coords in self.polar_masks_line_data:
            name = create_unique_name(HexrdConfig().polar_masks_line_data,
                                      'polar_mask_0')
            HexrdConfig().polar_masks_line_data[name] = data_coords
            create_polar_mask([data_coords], name)
            HexrdConfig().visible_masks.append(name)
            HexrdConfig().polar_masks_changed.emit()