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 = qt_import.QWidget(self) self.grid_table = qt_import.QTableWidget(self.grid_widget) self.grid_cell_label = qt_import.QLabel("Selected grid cell: A1", self.grid_widget) self.chip_config_combo = qt_import.QComboBox(self) self.inverted_rows_cbox = qt_import.QCheckBox("Inverted rows", self.grid_widget) self.image_tracking_cbox = qt_import.QCheckBox("Live update", self.grid_widget) self.score_type_combo = qt_import.QComboBox(self.grid_widget) self.show_grid_dialog_button = qt_import.QPushButton( "Full grid view", self.grid_widget) self.comp_widget = qt_import.QWidget(self) self.comp_cell_label = qt_import.QLabel( "Selected compartment cell: A1", self.comp_widget) self.comp_table = qt_import.QTableWidget(self.comp_widget) self.hit_map_plot = PlotWidget(self.comp_widget) self.grid_dialog = qt_import.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 = qt_import.QPushButton( "Save", self.grid_dialog) self.save_grid_view_button.setFixedWidth(100) # Layout -------------------------------------------------------------- _grid_vlayout = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.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( qt_import.QAbstractItemView.NoEditTriggers) self.grid_table.setHorizontalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.grid_table.setVerticalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.grid_table.setMouseTracking(True) self.comp_table.setEditTriggers( qt_import.QAbstractItemView.NoEditTriggers) self.comp_table.setHorizontalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.comp_table.setVerticalScrollBarPolicy( qt_import.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)
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 = qt_import.QGroupBox("Status", self) self.mounted_sample_ledit = qt_import.QLineEdit("", self) self.sample_detected_ledit = qt_import.QLineEdit("", self) self.focus_mode_ledit = qt_import.QLineEdit("", self) self.puck_switches_gbox = qt_import.QGroupBox("Puck switches", self) self.puck_switches_table = qt_import.QTableWidget( self.puck_switches_gbox) self.central_puck_ledit = qt_import.QLineEdit("No center puck", self.puck_switches_gbox) self.control_gbox = qt_import.QGroupBox("Control", self) self.open_lid_button = qt_import.QPushButton("Open lid", self.control_gbox) self.close_lid_button = qt_import.QPushButton("Close lid", self.control_gbox) self.base_to_center_button = qt_import.QPushButton( "Base to center", self.control_gbox) self.center_to_base_button = qt_import.QPushButton( "Center to base", self.control_gbox) self.dry_gripper_button = qt_import.QPushButton( "Dry gripper", self.control_gbox) self.status_list_gbox = qt_import.QGroupBox("Status list", self) self.status_table = qt_import.QTableWidget(self) # Layout -------------------------------------------------------------- _status_gbox_gridlayout = qt_import.QGridLayout(self.status_gbox) _status_gbox_gridlayout.addWidget( qt_import.QLabel("Mounted sample", self.status_list_gbox), 0, 0) _status_gbox_gridlayout.addWidget( qt_import.QLabel("Sample detected", self.status_list_gbox), 1, 0) _status_gbox_gridlayout.addWidget( qt_import.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 = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.QTableWidgetItem(str(col_index + 1)) temp_item.setFlags(qt_import.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(qt_import.QSizePolicy.Preferred, qt_import.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()
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 = qt_import.QGroupBox("CRL", self) self.mode_combo = qt_import.QComboBox(self.main_gbox) self.set_according_to_energy_button = qt_import.QPushButton( "Set", self.main_gbox) self.set_out_button = qt_import.QPushButton("Out", self.main_gbox) # self.align_beam_button = qt_import.QtGui.QPushButton("Align", self.main_gbox) self.crl_widget = qt_import.QWidget(self.main_gbox) self.crl_value_table = qt_import.QTableWidget(self.crl_widget) self.crl_lense_spinbox = qt_import.QSpinBox(self.crl_widget) self.crl_lense_in_button = qt_import.QPushButton("In", self.crl_widget) self.crl_lense_out_button = qt_import.QPushButton("Out", self.crl_widget) self.move_up_button = qt_import.QPushButton("", self.main_gbox) self.move_down_button = qt_import.QPushButton("", self.main_gbox) # Layout -------------------------------------------------------------- _crl_widget_hlayout = qt_import.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 = qt_import.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 = qt_import.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)
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 = qt_import.QGroupBox(r"States \ conditions", self) self.splitter = qt_import.QSplitter(qt_import.Qt.Vertical, self) self.cond_states_table = qt_import.QTableWidget(self.splitter) self.log_treewidget = qt_import.QTreeWidget(self.splitter) self.graph_graphics_view = qt_import.QGraphicsView(self) self.graph_graphics_scene = qt_import.QGraphicsScene(self) self.check_icon = icons.load_icon("Check") self.reject_icon = icons.load_icon("Delete") # Layout -------------------------------------------------------------- _cond_states_gbox_vlayout = qt_import.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 = qt_import.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(qt_import.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( qt_import.Qt.ScrollBarAlwaysOff) self.graph_graphics_view.setVerticalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.graph_graphics_view.setDragMode( qt_import.QGraphicsView.RubberBandDrag) self.graph_graphics_view.setRenderHint(qt_import.QPainter.Antialiasing) self.graph_graphics_view.setRenderHint( qt_import.QPainter.TextAntialiasing)
def __init__(self, parent=None, name="dc_group_widget"): qt_import.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 = qt_import.QGroupBox("Summary", self) self.polar_scater_widget = PolarScaterWidget() self.subwedge_table = qt_import.QTableWidget(_subwedge_widget) self.position_widget = qt_import.load_ui_file("snapshot_widget_layout.ui") # Layout -------------------------------------------------------------- _subwedge_widget_vlayout = qt_import.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 = qt_import.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(qt_import.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, qt_import.QTableWidgetItem(header) )