示例#1
0
    def go_back_clicked(self):
        """Act when 'go to old position' button clicked."""
        old_positions_menu = qt_import.QMenu(self)
        old_positions_menu.addSection(
            str("<nobr><b>Last positions :</b></nobr>"))

        old_positions_menu.addSeparator()

        for i in range(len(self.old_positions)):
            receiver = lambda i: self.go_to_old_position(i)
            position_action = old_positions_menu.addAction(
                self.old_positions[i])
            position_action.triggered.connect(receiver)

        old_positions_menu.exec_(qt_import.QCursor.pos())
示例#2
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)
示例#3
0
 def open_history_menu(self):
     menu = qt_import.QMenu(self)
     for item in self.position_history:
         menu.addAction(item, self.go_to_history_pos)
     menu.popup(qt_import.QCursor.pos())
示例#4
0
 def show_context_menu(self, context_menu_event):
     menu = qt_import.QMenu(self)
     menu.addAction("Clear", self.clear)
     menu.addAction("Copy", self.copy_log)
     menu.addAction("Save log", self.save_log)
     menu.popup(qt_import.QCursor.pos())
示例#5
0
 def run(self):
     """Adds menu to the tool bar"""
     self.tools_menu = qt_import.QMenu("Tools", self)
     self.tools_menu.addSeparator()
     BaseWidget._menubar.insert_menu(self.tools_menu, 2)
     self.init_tools()
示例#6
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)
        """
示例#7
0
    def __init__(self, parent=None, name=None, fl=0, xray_imaging_params=None):

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

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

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

        # Internal variables --------------------------------------------------
        self.current_image_num = 0
        self.total_image_num = 0

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

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

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

        # Graphic elements ----------------------------------------------------
        results_gbox = qt_import.QGroupBox("Results", self)
        
        self.graphics_view_widget = qt_import.QWidget(results_gbox)
        self.results_widget = qt_import.load_ui_file(
            "xray_imaging_results_widget_layout.ui"
        )
        tools_widget = qt_import.QGroupBox(self) 
        button_widget = qt_import.QWidget(self)
        self.start_centering_button = qt_import.QPushButton(
            icons.load_icon("VCRPlay2"), "3 Click", tools_widget
        )
        self.start_n_centering_button = qt_import.QPushButton(
            icons.load_icon("VCRPlay"), "n Click", tools_widget
        )
        self.accept_centering_button = qt_import.QPushButton(
            icons.load_icon("ThumbUp"), "Save", tools_widget
        )
        self.histogram_plot = PlotWidget(self)

        self.popup_menu = qt_import.QMenu(self)
        self.popup_menu.menuAction().setIconVisibleInMenu(True)

        self.popup_menu.addAction(
            icons.load_icon("VCRPlay2"),
            "Start 3-click centering",
            start_centering_clicked,
        )
        self.popup_menu.addAction(
            icons.load_icon("VCRPlay"),
            "Start n-click centering",
            start_n_centering_clicked,
        )
        self.popup_menu.addAction(
            icons.load_icon("ThumbUp"),
            "Create centering point",
            self.accept_centering_clicked,
        )

        self.popup_menu.addSeparator()
        self.measure_distance_action = self.popup_menu.addAction(
            icons.load_icon("measure_distance"),
            "Distance and histogram",
            measure_distance_clicked,
        )

        # Layout --------------------------------------------------------------
        self._graphics_view_widget_vlayout = qt_import.QVBoxLayout(
            self.graphics_view_widget
        )
        self._graphics_view_widget_vlayout.setSpacing(0)
        self._graphics_view_widget_vlayout.setContentsMargins(0, 0, 0, 0)

        __button_widget_hlayout = qt_import.QHBoxLayout(button_widget)
        __button_widget_hlayout.addWidget(self.start_centering_button)
        __button_widget_hlayout.addWidget(self.start_n_centering_button)
        __button_widget_hlayout.addWidget(self.accept_centering_button)
        __button_widget_hlayout.addStretch()
        __button_widget_hlayout.setSpacing(2)
        __button_widget_hlayout.setContentsMargins(2, 2, 2, 2)

        __tools_widget_vlayout = qt_import.QVBoxLayout(tools_widget)
        __tools_widget_vlayout.addWidget(button_widget)
        __tools_widget_vlayout.addWidget(self.results_widget)
        __tools_widget_vlayout.addWidget(self.histogram_plot)
        __tools_widget_vlayout.addStretch()
        __tools_widget_vlayout.setSpacing(2)
        __tools_widget_vlayout.setContentsMargins(2, 2, 2, 2)

        __main_hlayout = qt_import.QHBoxLayout(self)
        __main_hlayout.addWidget(self.graphics_view_widget)
        __main_hlayout.addWidget(tools_widget)
        __main_hlayout.setSpacing(0)
        __main_hlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.results_widget.data_browse_button.clicked.connect(
            self.data_browse_button_clicked
        )
        self.results_widget.ff_browse_button.clicked.connect(
            self.ff_browse_button_clicked
        )
        self.results_widget.config_browse_button.clicked.connect(
            self.config_browse_button_clicked
        ) 
        self.results_widget.load_button.clicked.connect(
            self.load_button_clicked
        )
        self.results_widget.first_image_button.clicked.connect(
            first_image_button_clicked
        )
        self.results_widget.prev_image_button.clicked.connect(
            self.prev_image_button_clicked
        )
        self.results_widget.next_image_button.clicked.connect(
            self.next_image_button_clicked
        )
        self.results_widget.last_image_button.clicked.connect(
            self.last_image_button_clicked
        )
        self.results_widget.minus_quarter_button.clicked.connect(
            self.minus_quater_button_clicked
        )
        self.results_widget.plus_quarter_button.clicked.connect(
            plus_quater_button_clicked
        )

        self.results_widget.image_dial.valueChanged.connect(
            dial_value_changed
        )

        self.results_widget.image_spinbox.valueChanged.connect(
            spinbox_value_changed
        )

        self.results_widget.play_button.clicked.connect(self.play_button_clicked)
        self.results_widget.stop_button.clicked.connect(stop_button_clicked)
        self.results_widget.repeat_cbox.stateChanged.connect(repeat_state_changed)
        self.results_widget.ff_apply_cbox.stateChanged.connect(
            ff_apply_state_changed
        )

        self.start_centering_button.clicked.connect(start_centering_clicked)
        self.accept_centering_button.clicked.connect(accept_centering_clicked)

        # Other ---------------------------------------------------------------
        self.results_widget.first_image_button.setIcon(icons.load_icon("VCRRewind"))
        self.results_widget.prev_image_button.setIcon(icons.load_icon("VCRPlay4"))
        self.results_widget.next_image_button.setIcon(icons.load_icon("VCRPlay2"))
        self.results_widget.last_image_button.setIcon(
            icons.load_icon("VCRFastForward2")
        )
        self.results_widget.play_button.setIcon(icons.load_icon("VCRPlay"))
        self.results_widget.stop_button.setIcon(icons.load_icon("Stop2"))

        self.start_centering_button.setFixedSize(70, 50)
        self.start_n_centering_button.setFixedSize(70, 50)
        self.accept_centering_button.setFixedSize(70, 50)

        if HWR.beamline.imaging is not None:
            HWR.beamline.imaging.connect("imageInit", self.image_init)
            HWR.beamline.imaging.connect("imageLoaded", self.image_loaded)
            HWR.beamline.imaging.connect(
                "measureItemChanged", self.measure_item_changed
            )

            self.graphics_view = HWR.beamline.imaging.get_graphics_view()
            self._graphics_view_widget_vlayout.addWidget(self.graphics_view)
            self.graphics_view_widget.setFixedSize(
                self.graphics_view.scene().width(), self.graphics_view.scene().height()
            )

            self.setDisabled(False)
        else:
            self.setDisabled(True)
示例#8
0
    def run(self):
        self.tools_menu = qt_import.QMenu("Graphics", self)

        _create_menu = self.tools_menu.addMenu("Create")
        temp_action = _create_menu.addAction(
            icons.load_icon("VCRPlay2"),
            "Centring point with 3 clicks",
            self.create_point_click_clicked,
        )
        temp_action = _create_menu.addAction(
            icons.load_icon("ThumbUp"),
            "Centring point on current position",
            self.create_point_current_clicked,
        )
        temp_action = _create_menu.addAction(icons.load_icon("Line.png"),
                                             "Helical line",
                                             self.create_line_clicked)
        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_clicked)

        _measure_menu = self.tools_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.tools_menu.addMenu("Beam mark")
        self.move_beam_mark_manual_action = _beam_mark_menu.addAction(
            "Set position manualy", 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 = _beam_mark_menu.addAction(
            "Define size with slits", self.define_beam_size)
        self.define_beam_action.setEnabled(self["beamDefiner"])

        self.tools_menu.addSeparator()

        temp_action = self.tools_menu.addAction("Select all centring points",
                                                self.select_all_points_clicked)
        temp_action = self.tools_menu.addAction(
            "Deselect all items", self.deselect_all_items_clicked)
        temp_action = self.tools_menu.addAction(icons.load_icon("Delete"),
                                                "Clear all items",
                                                self.clear_all_items_clicked)

        self.tools_menu.addSeparator()

        self.display_grid_action = self.tools_menu.addAction(
            "Display grid", self.display_grid_toggled)
        self.display_grid_action.setCheckable(True)
        self.magnification_action = self.tools_menu.addAction(
            icons.load_icon("Magnify2"),
            "Magnification tool",
            self.start_magnification_tool,
        )

        self.image_scale_menu = self.tools_menu.addMenu(
            icons.load_icon("DocumentMag2"), "Image scale")
        self.image_scale_menu.setEnabled(False)
        self.init_image_scale_list()
        self.image_scale_menu.triggered.connect(self.image_scale_triggered)

        # self.camera_control_action = self.tools_menu.addAction(\
        #     "Camera control", self.open_camera_control_dialog)
        # self.camera_control_action.setEnabled(False)

        if self.target_menu == "menuBar":
            if BaseWidget._menubar is not None:
                BaseWidget._menubar.insert_menu(self.tools_menu, 3)
        elif self.target_menu == "toolBar":
            if BaseWidget._toolbar is not None:
                for action in self.tools_menu.actions():
                    BaseWidget._toolbar.addAction(action)
        else:
            if BaseWidget._menubar is not None:
                BaseWidget._menubar.insert_menu(self.tools_menu, 2)

            if BaseWidget._toolbar is not None:
                for action in self.tools_menu.actions():
                    BaseWidget._toolbar.addAction(action)
示例#9
0
 def show_shape_treewidget_popup(self, item, point, col):
     qt_import.QMenu(self.manager_widget.shapes_treewidget)