Exemple #1
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.info_widget = QtImport.QWidget(self)
        self.info_address_ledit = QtImport.QLineEdit(self.info_widget)
        self.info_refresh_button = QtImport.QPushButton(
            "Refresh", self.info_widget)
        self.method_table = QtImport.QTableWidget(self)
        self.property_table = QtImport.QTableWidget(self)

        # Layout --------------------------------------------------------------
        _info_widget_hlayout = QtImport.QHBoxLayout(self.info_widget)
        _info_widget_hlayout.addWidget(self.info_address_ledit)
        _info_widget_hlayout.addWidget(self.info_refresh_button)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.info_widget)
        _main_vlayout.addWidget(self.method_table)
        _main_vlayout.addWidget(self.property_table)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Other ---------------------------------------------------------------
        self.method_table.setColumnCount(2)
        self.method_table.setHorizontalHeaderLabels(
            ["Type", "Method (Parameters)"])
        self.property_table.setColumnCount(4)
        self.property_table.setHorizontalHeaderLabels(
            ["Type", "Property", "Access", "Value"])
        self.setFixedWidth(600)
    def __init__(self, parent, realtime_plot=False):

        QtImport.QWidget.__init__(self, parent)

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

        # Internal variables --------------------------------------------------
        self.__current_location = [0, 0]

        # Graphic elements ----------------------------------------------------
        self.plate_navigator_table = QtImport.QTableWidget(self)
        self.plate_navigator_cell = QtImport.QGraphicsView(self)

        # Layout --------------------------------------------------------------
        _main_hlayout = QtImport.QHBoxLayout(self)
        _main_hlayout.addWidget(self.plate_navigator_table)
        _main_hlayout.addWidget(self.plate_navigator_cell)
        _main_hlayout.addStretch()
        _main_hlayout.setSpacing(2)
        _main_hlayout.setContentsMargins(0, 0, 0, 0)

        # SizePolicies --------------------------------------------------------
        # self.plate_navigator_cell.setSizePolicy

        # Qt signal/slot connections ------------------------------------------
        self.plate_navigator_table.itemDoubleClicked.\
            connect(self.navigation_table_double_clicked)

        # Other ---------------------------------------------------------------
        self.navigation_graphicsscene = QtImport.QGraphicsScene(self)
        self.plate_navigator_cell.setScene(self.navigation_graphicsscene)
        self.navigation_item = NavigationItem(self)
        # self.navigation_item.mouseDoubleClickedSignal.connect(\
        #     self.navigation_item_double_clicked)
        self.navigation_graphicsscene.addItem(self.navigation_item)
        self.navigation_graphicsscene.update()
        self.plate_navigator_cell.setEnabled(False)
        #font = self.plate_navigator_table.font()
        # font.setPointSize(8)
        # self.plate_navigator_table.setFont(font)
        self.plate_navigator_table.setEditTriggers(
            QtImport.QAbstractItemView.NoEditTriggers)

        self.plate_navigator_table.setHorizontalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff)
        self.plate_navigator_table.setVerticalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff)
        self.plate_navigator_cell.setHorizontalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff)
        self.plate_navigator_cell.setVerticalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff)

        if HWR.beamline.plate_manipulator is not None:
            self.init_plate_view()
    def __init__(self, parent=None, name=None, fl=0):

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

        # Internal values -----------------------------------------------------
        self.chan_config = {}
        self.chan_seq = []
        self.chan_combo_items = []

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

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

        # Graphic elements ----------------------------------------------------
        _main_gbox = QtImport.QGroupBox("Channels", self)
        self.chan_table = QtImport.QTableWidget(_main_gbox)

        # Layout --------------------------------------------------------------
        _gbox_vlayout = QtImport.QGridLayout(_main_gbox)
        _gbox_vlayout.addWidget(self.chan_table, 0, 0)
        _gbox_vlayout.setSpacing(0)
        _gbox_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(_main_gbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.chan_table.cellChanged.connect(self.chan_table_cell_changed)

        if HWR.beamline.online_processing.ssx_setup is not None:
            self.chan_seq_graphics_view = HWR.beamline.online_processing.ssx_setup.get_graphics_view(
            )
            _gbox_vlayout.addWidget(self.chan_seq_graphics_view, 0, 1, 2, 1)
            self.init_view()
        _main_gbox.setCheckable(True)
        _main_gbox.setChecked(False)
Exemple #4
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.cond_list = None
        self.states_list = None
        self.trans_list = None

        self.state_graph_node_list = []
        self.trans_graph_node_list = []
        self.condition_value_dict = {}

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

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

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

        # Graphic elements ----------------------------------------------------
        _cond_states_gbox = QtImport.QGroupBox(r"States \ conditions", self)
        self.splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self)
        self.cond_states_table = QtImport.QTableWidget(self.splitter)
        self.log_treewidget = QtImport.QTreeWidget(self.splitter)
        self.graph_graphics_view = QtImport.QGraphicsView(self)
        self.graph_graphics_scene = QtImport.QGraphicsScene(self)

        self.check_icon = Icons.load_icon("Check")
        self.reject_icon = Icons.load_icon("Delete")

        # Layout --------------------------------------------------------------
        _cond_states_gbox_vlayout = QtImport.QVBoxLayout(_cond_states_gbox)
        _cond_states_gbox_vlayout.addWidget(self.splitter)
        _cond_states_gbox_vlayout.setSpacing(2)
        _cond_states_gbox_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QHBoxLayout(self)
        _main_vlayout.addWidget(_cond_states_gbox)
        _main_vlayout.addWidget(self.graph_graphics_view)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # Other ---------------------------------------------------------------
        self.cond_states_table.verticalHeader().setDefaultSectionSize(20)
        self.cond_states_table.horizontalHeader().setDefaultSectionSize(20)
        # setSelectionMode(QtImport.QAbstractItemView::SingleSelection);
        font = self.cond_states_table.font()
        font.setPointSize(8)
        self.cond_states_table.setFont(font)

        self.splitter.setSizes([200, 20])
        self.log_treewidget.setColumnCount(6)
        self.log_treewidget.setHeaderLabels(
            ["State", "Start time", "End time", "Total time", "Previous state", "Notes"]
        )
        self.graph_graphics_view.setFixedSize(900, 600)
        self.graph_graphics_scene.setSceneRect(0, 0, 900, 600)
        self.graph_graphics_view.setScene(self.graph_graphics_scene)
        self.graph_graphics_view.setHorizontalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setVerticalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setDragMode(QtImport.QGraphicsView.RubberBandDrag)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.Antialiasing)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.TextAntialiasing)
Exemple #5
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.crl_value = []

        # Properties ----------------------------------------------------------
        self.add_property("lenseCount", "integer", 6)
        self.add_property("mnemonic", "string", "")
        self.add_property("formatString", "formatString", "#.#")
        self.add_property("caption", "string", "")
        self.add_property(
            "style", "combo", ("table", "number"), "table"
        )

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

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

        # Graphic elements ----------------------------------------------------
        self.main_gbox = QtImport.QGroupBox("CRL", self)
        self.mode_combo = QtImport.QComboBox(self.main_gbox)
        self.set_according_to_energy_button = QtImport.QPushButton(
            "Set", self.main_gbox)
        self.set_out_button = QtImport.QPushButton("Out", self.main_gbox)
        # self.align_beam_button = QtImport.QtGui.QPushButton("Align", self.main_gbox)

        self.crl_widget = QtImport.QWidget(self.main_gbox)
        self.crl_value_table = QtImport.QTableWidget(self.crl_widget)
        self.crl_lense_spinbox = QtImport.QSpinBox(self.crl_widget)
        self.crl_lense_in_button = QtImport.QPushButton("In", self.crl_widget)
        self.crl_lense_out_button = QtImport.QPushButton("Out", self.crl_widget)

        self.move_up_button = QtImport.QPushButton("", self.main_gbox)
        self.move_down_button = QtImport.QPushButton("", self.main_gbox)

        # Layout --------------------------------------------------------------
        _crl_widget_hlayout = QtImport.QHBoxLayout(self.crl_widget)
        _crl_widget_hlayout.addWidget(self.crl_value_table)
        _crl_widget_hlayout.addWidget(self.crl_lense_spinbox)
        _crl_widget_hlayout.addWidget(self.crl_lense_in_button)
        _crl_widget_hlayout.addWidget(self.crl_lense_out_button)
        _crl_widget_hlayout.setSpacing(2)
        _crl_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox)
        _main_gbox_gridlayout.addWidget(self.mode_combo, 0, 0)
        _main_gbox_gridlayout.addWidget(self.set_according_to_energy_button, 0, 1)
        _main_gbox_gridlayout.addWidget(self.set_out_button, 1, 1)
        _main_gbox_gridlayout.addWidget(self.crl_widget, 1, 0)
        # _main_gbox_gridlayout.addWidget(self.align_beam_button, 1, 1)
        _main_gbox_gridlayout.addWidget(self.move_up_button, 0, 2)
        _main_gbox_gridlayout.addWidget(self.move_down_button, 1, 2)
        _main_gbox_gridlayout.setSpacing(2)
        _main_gbox_gridlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_gbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.mode_combo.activated.connect(self.set_crl_mode)
        self.crl_value_table.itemDoubleClicked.connect(
            self.crl_table_item_doubleclicked
        )
        self.set_according_to_energy_button.clicked.connect(
            self.set_according_to_energy
        )
        self.set_out_button.clicked.connect(self.set_out_clicked)
        self.move_up_button.clicked.connect(self.move_up_clicked)
        self.move_down_button.clicked.connect(self.move_down_clicked)

        # Other ---------------------------------------------------------------
        self.mode_combo.setCurrentIndex(1)
        self.crl_value_table.setRowCount(1)
        self.crl_value_table.verticalHeader().hide()
        self.crl_value_table.horizontalHeader().hide()
        self.crl_value_table.setRowHeight(0, 20)
        self.crl_value_table.setFixedHeight(24)
        self.crl_value_table.setShowGrid(True)

        # self.set_according_to_energy_button.setIcon(Icons.load_icon("Up2"))
        # self.set_out_button.setIcon(Icons.load_icon("Up2"))
        self.move_up_button.setIcon(Icons.load_icon("Up2"))
        self.move_up_button.setFixedWidth(25)
        self.move_down_button.setIcon(Icons.load_icon("Down2"))
        self.move_down_button.setFixedWidth(25)

        self.set_according_to_energy_button.setFixedWidth(30)
        self.set_out_button.setFixedWidth(30)
        self.crl_lense_in_button.setFixedWidth(30)
        self.crl_lense_out_button.setFixedWidth(30)
Exemple #6
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)
Exemple #7
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)
Exemple #8
0
    def __init__(self, *args):
        """
        Main init
        :param args:
        """

        BaseWidget.__init__(self, *args)

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

        # Properties ----------------------------------------------------------
        self.add_property("formatString", "formatString", "#.#")

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

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

        # Graphic elements ----------------------------------------------------
        self.status_gbox = QtImport.QGroupBox("Status", self)
        self.mounted_sample_ledit = QtImport.QLineEdit("", self)
        self.sample_detected_ledit = QtImport.QLineEdit("", self)
        self.focus_mode_ledit = QtImport.QLineEdit("", self)

        self.puck_switches_gbox = QtImport.QGroupBox("Puck switches", self)
        self.puck_switches_table = QtImport.QTableWidget(
            self.puck_switches_gbox)
        self.central_puck_ledit = QtImport.QLineEdit("No center puck",
                                                     self.puck_switches_gbox)

        self.control_gbox = QtImport.QGroupBox("Control", self)
        self.open_lid_button = QtImport.QPushButton("Open lid",
                                                    self.control_gbox)
        self.close_lid_button = QtImport.QPushButton("Close lid",
                                                     self.control_gbox)
        self.base_to_center_button = QtImport.QPushButton(
            "Base to center", self.control_gbox)
        self.center_to_base_button = QtImport.QPushButton(
            "Center to base", self.control_gbox)
        self.dry_gripper_button = QtImport.QPushButton("Dry gripper",
                                                       self.control_gbox)

        self.status_list_gbox = QtImport.QGroupBox("Status list", self)
        self.status_table = QtImport.QTableWidget(self)

        # Layout --------------------------------------------------------------
        _status_gbox_gridlayout = QtImport.QGridLayout(self.status_gbox)
        _status_gbox_gridlayout.addWidget(
            QtImport.QLabel("Mounted sample", self.status_list_gbox), 0, 0)
        _status_gbox_gridlayout.addWidget(
            QtImport.QLabel("Sample detected", self.status_list_gbox), 1, 0)
        _status_gbox_gridlayout.addWidget(
            QtImport.QLabel("Focus mode", self.status_list_gbox), 2, 0)
        _status_gbox_gridlayout.addWidget(self.mounted_sample_ledit, 0, 1)
        _status_gbox_gridlayout.addWidget(self.sample_detected_ledit, 1, 1)
        _status_gbox_gridlayout.addWidget(self.focus_mode_ledit, 2, 1)
        _status_gbox_gridlayout.setSpacing(2)
        _status_gbox_gridlayout.setContentsMargins(0, 0, 0, 0)
        _status_gbox_gridlayout.setColumnStretch(2, 10)

        _puck_switches_gbox_vlayout = QtImport.QHBoxLayout(
            self.puck_switches_gbox)
        _puck_switches_gbox_vlayout.addWidget(self.puck_switches_table)
        _puck_switches_gbox_vlayout.addWidget(self.central_puck_ledit)
        _puck_switches_gbox_vlayout.setSpacing(2)
        _puck_switches_gbox_vlayout.setContentsMargins(0, 0, 0, 0)

        _status_vbox_layout = QtImport.QVBoxLayout(self.status_list_gbox)
        _status_vbox_layout.addWidget(self.status_table)
        _status_vbox_layout.setSpacing(2)
        _status_vbox_layout.setContentsMargins(0, 0, 0, 0)

        _control_gbox_hlayout = QtImport.QHBoxLayout(self.control_gbox)
        _control_gbox_hlayout.addWidget(self.open_lid_button)
        _control_gbox_hlayout.addWidget(self.close_lid_button)
        _control_gbox_hlayout.addWidget(self.base_to_center_button)
        _control_gbox_hlayout.addWidget(self.center_to_base_button)
        _control_gbox_hlayout.addWidget(self.dry_gripper_button)
        _control_gbox_hlayout.setSpacing(2)
        _control_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.status_gbox)
        _main_vlayout.addWidget(self.puck_switches_gbox)
        _main_vlayout.addWidget(self.control_gbox)
        _main_vlayout.addWidget(self.status_list_gbox)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.open_lid_button.clicked.connect(open_lid_clicked)
        self.close_lid_button.clicked.connect(close_lid_clicked)
        self.base_to_center_button.clicked.connect(base_to_center_clicked)
        self.center_to_base_button.clicked.connect(center_to_base_clicked)
        self.dry_gripper_button.clicked.connect(dry_gripper_clicked)

        # Other ---------------------------------------------------------------
        self.mounted_sample_ledit.setFixedWidth(80)
        self.sample_detected_ledit.setFixedWidth(80)
        self.focus_mode_ledit.setFixedWidth(80)

        self.puck_switches_table.setRowCount(1)
        self.puck_switches_table.setColumnCount(PUCK_COUNT)
        self.puck_switches_table.verticalHeader().hide()
        self.puck_switches_table.horizontalHeader().hide()
        self.puck_switches_table.setRowHeight(0, 28)
        self.puck_switches_table.setFixedHeight(28)
        self.puck_switches_table.setShowGrid(True)
        self.puck_switches_table.setFixedWidth(33 * PUCK_COUNT + 4)

        for col_index in range(PUCK_COUNT):
            temp_item = QtImport.QTableWidgetItem(str(col_index + 1))
            temp_item.setFlags(QtImport.Qt.ItemIsEnabled)
            temp_item.setBackground(Colors.WHITE)
            self.puck_switches_table.setItem(0, col_index, temp_item)
            self.puck_switches_table.setColumnWidth(col_index, 33)

        self.status_table.setColumnCount(3)
        self.status_table.setHorizontalHeaderLabels(
            ["Property", "Description", "Value"])

        self.puck_switches_gbox.setSizePolicy(QtImport.QSizePolicy.Preferred,
                                              QtImport.QSizePolicy.Fixed)
        self.init_tables()
        self.connect(HWR.beamline.sample_changer, "statusListChanged",
                     self.status_list_changed)
        self.connect(HWR.beamline.sample_changer, "infoDictChanged",
                     self.info_dict_changed)

        HWR.beamline.sample_changer.re_emit_values()
Exemple #9
0
    def __init__(self, parent=None, name="dc_group_widget"):

        QtImport.QWidget.__init__(self, parent)
        if name is not None:
            self.setObjectName(name)

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

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

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

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

        # Internal variables --------------------------------------------------
        self._data_collection = None
        self.add_dc_cb = None
        self._tree_view_item = None

        _subwedge_widget = QtImport.QGroupBox("Summary", self)
        self.polar_scater_widget = PolarScaterWidget()
        self.subwedge_table = QtImport.QTableWidget(_subwedge_widget)
        self.position_widget = QtImport.load_ui_file(
            "snapshot_widget_layout.ui")

        # Layout --------------------------------------------------------------
        _subwedge_widget_vlayout = QtImport.QVBoxLayout(_subwedge_widget)
        _subwedge_widget_vlayout.addWidget(self.polar_scater_widget)
        _subwedge_widget_vlayout.addWidget(self.subwedge_table)
        _subwedge_widget_vlayout.setContentsMargins(0, 4, 0, 0)
        _subwedge_widget_vlayout.setSpacing(6)
        _subwedge_widget_vlayout.addStretch(0)

        _main_hlayout = QtImport.QHBoxLayout(self)
        _main_hlayout.addWidget(_subwedge_widget)
        _main_hlayout.setContentsMargins(0, 0, 0, 0)
        _main_hlayout.setSpacing(2)
        _main_hlayout.addStretch(0)

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

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

        # Other ---------------------------------------------------------------
        # self.polar_scater_widget.setFixedSize(600, 600)
        font = self.subwedge_table.font()
        font.setPointSize(8)
        self.subwedge_table.setFont(font)
        self.subwedge_table.setEditTriggers(
            QtImport.QAbstractItemView.NoEditTriggers)
        self.subwedge_table.setColumnCount(7)
        self.subwedge_table.horizontalHeader().setStretchLastSection(False)

        horizontal_headers = [
            "Osc start",
            "Osc range",
            "Images",
            "Exposure time",
            "Energy",
            "Transmission",
            "Resolution",
        ]
        for index, header in enumerate(horizontal_headers):
            self.subwedge_table.setHorizontalHeaderItem(
                index, QtImport.QTableWidgetItem(header))