def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("Aperture", self) self.aperture_diameter_combo = QtImport.QComboBox(self.main_gbox) self.aperture_diameter_combo.setMinimumWidth(100) self.aperture_position_combo = QtImport.QComboBox(self.main_gbox) self.aperture_position_combo.setMinimumWidth(100) # Layout -------------------------------------------------------------- _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_gbox) _main_gbox_vlayout.addWidget(self.aperture_diameter_combo) _main_gbox_vlayout.addWidget(self.aperture_position_combo) _main_gbox_vlayout.addStretch() _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(0) # _main_vlayout.addSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ self.aperture_diameter_combo.activated.connect(self.change_diameter) self.aperture_position_combo.activated.connect(self.change_position) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- Colors.set_widget_color(self.aperture_diameter_combo, Colors.LIGHT_GREEN, QtImport.QPalette.Button) Colors.set_widget_color(self.aperture_position_combo, Colors.LIGHT_GREEN, QtImport.QPalette.Button) self.aperture_diameter_combo.setMinimumWidth(100) self.aperture_position_combo.setMinimumWidth(100) self.init_aperture() self.connect(HWR.beamline.beam.aperture, "diameterIndexChanged", self.diameter_changed) self.connect(HWR.beamline.beam.aperture, "valueChanged", self.position_changed)
def __init__(self, parent=None, name=None, fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) self.selected_element = None self.selected_edge = "L3" # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- if PYMCA_IMPORTED: self.periodic_table = CustomPeriodicTable(self) else: self.periodic_elements_combo = QtImport.QComboBox(self) self.periodic_elements_combo.setFixedWidth(100) self.edge_widget = QtImport.QWidget(self) edge_label = QtImport.QLabel("Edge:", self.edge_widget) self.edge_combo = QtImport.QComboBox(self.edge_widget) # Layout -------------------------------------------------------------- _edge_hlayout = QtImport.QHBoxLayout(self.edge_widget) if not PYMCA_IMPORTED: _edge_hlayout.addWidget(self.periodic_elements_combo) _edge_hlayout.addWidget(edge_label) _edge_hlayout.addWidget(self.edge_combo) _edge_hlayout.addStretch(0) _edge_hlayout.setSpacing(2) _edge_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) if PYMCA_IMPORTED: _main_vlayout.addWidget(self.periodic_table, QtImport.Qt.AlignHCenter) _main_vlayout.addWidget(self.edge_widget) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ if PYMCA_IMPORTED: self.periodic_table.edgeSelectedSignal.connect(self.edge_selected) else: self.periodic_elements_combo.activated.connect( self.element_combo_activated) self.edge_combo.addItem("K") self.edge_combo.activated.connect(self.edge_combo_activated) self.edge_combo.setEnabled(False)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.motor_hwobj = None # Internal values ----------------------------------------------------- self.positions = None # Properties ---------------------------------------------------------- self.add_property("label", "string", "") self.add_property("mnemonic", "string", "") self.add_property("icons", "string", "") self.add_property("showMoveButtons", "boolean", True) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- self.define_slot("setEnabled", ()) # Graphic elements ---------------------------------------------------- _main_gbox = QtImport.QGroupBox(self) self.label = QtImport.QLabel("motor:", _main_gbox) self.positions_combo = QtImport.QComboBox(self) self.previous_position_button = QtImport.QPushButton(_main_gbox) self.next_position_button = QtImport.QPushButton(_main_gbox) # Layout -------------------------------------------------------------- _main_gbox_hlayout = QtImport.QHBoxLayout(_main_gbox) _main_gbox_hlayout.addWidget(self.label) _main_gbox_hlayout.addWidget(self.positions_combo) _main_gbox_hlayout.addWidget(self.previous_position_button) _main_gbox_hlayout.addWidget(self.next_position_button) _main_gbox_hlayout.setSpacing(2) _main_gbox_hlayout.setContentsMargins(2, 2, 2, 2) _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(_main_gbox) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(0, 0, 0, 0) # Size Policy --------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.positions_combo.activated.connect(self.position_selected) self.previous_position_button.clicked.connect( self.select_previous_position) self.next_position_button.clicked.connect(self.select_next_position) # Other --------------------------------------------------------------- self.positions_combo.setFixedHeight(27) self.positions_combo.setToolTip( "Moves the motor to a predefined position") self.previous_position_button.setIcon(Icons.load_icon("Minus2")) self.previous_position_button.setFixedSize(27, 27) self.next_position_button.setIcon(Icons.load_icon("Plus2")) self.next_position_button.setFixedSize(27, 27)
def init_view(self): self.chan_config = HWR.beamline.online_processing.ssx_setup.get_current_chip_config( ) self.chan_table.blockSignals(True) self.chan_table.setColumnCount(3) for index, header_text in enumerate(("Name", "Delay", "Length")): self.chan_table.setHorizontalHeaderItem( index, QtImport.QTableWidgetItem(header_text)) if index > 0: self.chan_table.resizeColumnToContents(index) self.chan_table.setRowCount(self.chan_config["num_channels"]) self.chan_seq = [None] * self.chan_config["num_channels"] self.chan_table.setFixedHeight(30 * (self.chan_config["num_channels"] + 1)) for index in range(self.chan_config["num_channels"]): combo = QtImport.QComboBox() combo.activated.connect(self.chan_seq_combo_activated) for chan_name in self.chan_config["channels"].keys(): combo.addItem(chan_name) combo.addItem("") combo.setCurrentIndex(-1) self.chan_table.setCellWidget(index, 0, combo) self.chan_combo_items.append(combo) for col in (1, 2): self.chan_table.setItem(index, col, QtImport.QTableWidgetItem("")) if index < len(self.chan_config["default_seq"]): def_chan_item_name = self.chan_config["default_seq"][index] combo.setCurrentIndex(combo.findText(def_chan_item_name)) self.chan_table.setItem( index, 1, QtImport.QTableWidgetItem( str(self.chan_config["channels"][def_chan_item_name] [0]))) self.chan_table.setItem( index, 2, QtImport.QTableWidgetItem( str(self.chan_config["channels"][def_chan_item_name] [1]))) self.chan_table.blockSignals(False) self.refresh_chan_sequence()
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("confirmPhaseChange", "boolean", False) # Properties to initialize hardware objects -------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Phase", self) self.phase_combobox = QtImport.QComboBox(self.group_box) # Layout -------------------------------------------------------------- _group_box_vlayout = QtImport.QVBoxLayout(self.group_box) _group_box_vlayout.addWidget(self.phase_combobox) _group_box_vlayout.addStretch() _group_box_vlayout.setSpacing(2) _group_box_vlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.group_box) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.phase_combobox.activated.connect(self.change_phase) # Other --------------------------------------------------------------- Colors.set_widget_color(self.phase_combobox, Colors.LIGHT_GREEN, QtImport.QPalette.Button) self.init_phase_list() self.connect(HWR.beamline.diffractometer, "minidiffPhaseChanged", self.phase_changed) HWR.beamline.diffractometer.re_emit_values()
def _initialize_graphics(self): # Graphic elements ---------------------------------------------------- self._workflow_type_widget = QtImport.QGroupBox("Workflow type", self) self._workflow_cbox = QtImport.QComboBox(self._workflow_type_widget) self._gphl_acq_widget = QtImport.QGroupBox("Acquisition", self) self._gphl_acq_param_widget = GphlAcquisitionWidget( self._gphl_acq_widget, "gphl_acquisition_parameter_widget") self._gphl_diffractcal_widget = GphlDiffractcalWidget( self._gphl_acq_widget, "gphl_diffractcal_widget") self._data_path_widget = DataPathWidget(self, "create_dc_path_widget", layout="vertical") data_path_layout = self._data_path_widget.data_path_layout data_path_layout.file_name_label.hide() data_path_layout.file_name_value_label.hide() data_path_layout.run_number_label.hide() data_path_layout.run_number_ledit.hide() data_path_layout.folder_ledit.setReadOnly(True) # Layout -------------------------------------------------------------- _workflow_type_vlayout = QtImport.QVBoxLayout( self._workflow_type_widget) _workflow_type_vlayout.addWidget(self._workflow_cbox) _gphl_acq_vlayout = QtImport.QVBoxLayout(self._gphl_acq_widget) _gphl_acq_vlayout.addWidget(self._gphl_acq_param_widget) _gphl_acq_vlayout.addWidget(self._gphl_diffractcal_widget) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self._workflow_type_widget) _main_vlayout.addWidget(self._data_path_widget) _main_vlayout.addWidget(self._gphl_acq_widget) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self._workflow_cbox.currentIndexChanged.connect(self.workflow_selected) # set up popup data dialog self.gphl_data_dialog = GphlDataDialog(self, "GPhL Workflow Data") self.gphl_data_dialog.setModal(True) self.gphl_data_dialog.continueClickedSignal.connect(self.data_acquired)
def __init__(self, parent=None, name="gphl_acquisition_widget"): GphlSetupWidget.__init__(self, parent=parent, name=name) _parameters_widget = self._parameters_widget # Internal variables ------------------------------------------------- # Get test crystal data self.test_crystals = OrderedDict() xx0 = next(HWR.beamline.gphl_workflow.get_objects("test_crystals")) for test_crystal in xx0.get_objects("test_crystal"): dd0 = test_crystal.get_properties() self.test_crystals[dd0["name"]] = CrystalData(**dd0) row = 0 field_name = "test_crystal" label_name = self._get_label_name(field_name) label_str = "Test Crystal :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._widget_data[field_name] = (widget, str, None, 0) self._pulldowns[field_name] = list(self.test_crystals) row += 1 label_name = "test_crystal_spacegroup" label_str = " " label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) label_name = "test_crystal_parameters" label_str = " " label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 1) self._widget_data[label_name] = (label, str, None, label_str) row += 1 field_name = "dose_budget" label_name = self._get_label_name(field_name) label_str = "Dose budget (MGy) :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._pulldowns[field_name] = list( HWR.beamline.gphl_workflow.dose_budgets) self._pulldown_defaults[ field_name] = HWR.beamline.gphl_workflow.default_dose_budget_label indx = self._pulldowns[field_name].index( HWR.beamline.gphl_workflow.default_dose_budget_label) self._widget_data[field_name] = (widget, str, None, indx) row += 1 field_name = "relative_rad_sensitivity" label_name = self._get_label_name(field_name) label_str = "Rel. radiation sensitivity" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QLineEdit() _parameters_widget.layout().addWidget(widget, row, 1) validator = QtImport.QDoubleValidator(0, 100, 4, widget) self._widget_data[field_name] = (widget, float, validator, 1.0)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.motor_hwobj = None # Internal values ----------------------------------------------------- self.step_editor = None self.move_step = 1 self.demand_move = 0 self.in_expert_mode = None self.position_history = [] # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("formatString", "formatString", "+##.##") self.add_property("label", "string", "") self.add_property("showLabel", "boolean", True) self.add_property("showMoveButtons", "boolean", True) self.add_property("showSlider", "boolean", False) self.add_property("showStop", "boolean", True) self.add_property("showStep", "boolean", True) self.add_property("showStepList", "boolean", False) self.add_property("showPosition", "boolean", True) self.add_property("invertButtons", "boolean", False) self.add_property("oneClickPressButton", "boolean", False) self.add_property("delta", "string", "") self.add_property("decimals", "integer", 2) self.add_property("icons", "string", "") self.add_property("helpDecrease", "string", "") self.add_property("helpIncrease", "string", "") self.add_property("hideInUser", "boolean", False) self.add_property("defaultSteps", "string", "180 90 45 30 10") self.add_property("enableSliderTracking", "boolean", False) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("toggle_enabled", ()) # Graphic elements----------------------------------------------------- self.main_gbox = QtImport.QGroupBox(self) self.motor_label = QtImport.QLabel(self.main_gbox) self.motor_label.setFixedHeight(27) # Main controls self.move_left_button = QtImport.QPushButton(self.main_gbox) self.move_left_button.setIcon(Icons.load_icon("Left2")) self.move_left_button.setToolTip("Moves the motor down (while pressed)") self.move_left_button.setFixedSize(27, 27) self.move_left_button.setAutoRepeatDelay(500) self.move_left_button.setAutoRepeatInterval(500) self.move_right_button = QtImport.QPushButton(self.main_gbox) self.move_right_button.setIcon(Icons.load_icon("Right2")) self.move_right_button.setToolTip("Moves the motor up (while pressed)") self.move_right_button.setFixedSize(27, 27) self.move_right_button.setAutoRepeatDelay(500) self.move_right_button.setAutoRepeatInterval(500) self.position_spinbox = QtImport.QDoubleSpinBox(self.main_gbox) self.position_spinbox.setMinimum(-10000) self.position_spinbox.setMaximum(10000) self.position_spinbox.setFixedSize(75, 27) self.position_spinbox.setDecimals(3) self.position_spinbox.setToolTip( "Moves the motor to a specific " + "position or step by step; right-click for motor history" ) self.position_spinbox.setContextMenuPolicy(QtImport.Qt.CustomContextMenu) # Extra controls self.stop_button = QtImport.QPushButton(self.main_gbox) self.stop_button.setIcon(Icons.load_icon("Stop2")) self.stop_button.setEnabled(False) self.stop_button.setToolTip("Stops the motor") self.stop_button.setFixedSize(27, 27) self.step_button = QtImport.QPushButton(self.main_gbox) self.step_button_icon = Icons.load_icon("TileCascade2") self.step_button.setIcon(self.step_button_icon) self.step_button.setToolTip("Changes the motor step") self.step_button.setFixedSize(27, 27) self.step_combo = QtImport.QComboBox(self.main_gbox) self.step_combo.setEditable(True) self.step_combo.setValidator( QtImport.QDoubleValidator(0, 360, 5, self.step_combo) ) self.step_combo.setDuplicatesEnabled(False) self.step_combo.setFixedHeight(27) self.position_slider = QtImport.QDoubleSlider( QtImport.Qt.Horizontal, self.main_gbox ) # Layout -------------------------------------------------------------- self._gbox_hbox_layout = QtImport.QHBoxLayout(self.main_gbox) self._gbox_hbox_layout.addWidget(self.motor_label) self._gbox_hbox_layout.addWidget(self.position_spinbox) self._gbox_hbox_layout.addWidget(self.move_left_button) self._gbox_hbox_layout.addWidget(self.move_right_button) self._gbox_hbox_layout.addWidget(self.position_slider) self._gbox_hbox_layout.addWidget(self.stop_button) self._gbox_hbox_layout.addWidget(self.step_button) self._gbox_hbox_layout.addWidget(self.step_combo) self._gbox_hbox_layout.setSpacing(2) self._gbox_hbox_layout.setContentsMargins(2, 2, 2, 2) self._main_hbox_layout = QtImport.QVBoxLayout(self) self._main_hbox_layout.addWidget(self.main_gbox) self._main_hbox_layout.setSpacing(0) self._main_hbox_layout.setContentsMargins(0, 0, 0, 0) # SizePolicy (horizontal, vertical) ----------------------------------- # self.setSizePolicy(QSizePolicy.Fixed, # QSizePolicy.Fixed) # Object events ------------------------------------------------------ spinbox_event = SpinBoxEvent(self.position_spinbox) self.position_spinbox.installEventFilter(spinbox_event) spinbox_event.returnPressedSignal.connect(self.change_position) spinbox_event.contextMenuSignal.connect(self.open_history_menu) self.position_spinbox.lineEdit().textEdited.connect(self.position_value_edited) self.step_combo.activated.connect(self.go_to_step) self.step_combo.activated.connect(self.step_changed) self.step_combo.editTextChanged.connect(self.step_edited) self.stop_button.clicked.connect(self.stop_motor) self.step_button.clicked.connect(self.open_step_editor) self.move_left_button.pressed.connect(self.move_down) self.move_left_button.released.connect(self.stop_moving) self.move_right_button.pressed.connect(self.move_up) self.move_right_button.released.connect(self.stop_moving) self.position_slider.doubleValueChanged.connect( self.position_slider_double_value_changed ) # Other --------------------------------------------------------------- self.instance_synchronize("position_spinbox", "step_combo")
def __init__(self, parent=None, name=None, fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if not name: self.setObjectName("VerticalCrystalDimensionWidgetLayout") return VerticalCrystalDimensionWidgetLayoutLayout = QtImport.QVBoxLayout( self, 0, 6, "VerticalCrystalDimensionWidgetLayoutLayout") self.gbox = QtImport.QGroupBox(self, "gbox") self.gbox.setSizePolicy(QtImport.QSizePolicy.MinimumExpanding, QtImport.QSizePolicy.MinimumExpanding) self.gbox.setChecked(0) self.gbox.setColumnLayout(0, QtImport.Qt.Vertical) self.gbox.layout().setSpacing(6) self.gbox.layout().setMargin(11) gboxLayout = QtImport.QHBoxLayout(self.gbox.layout()) gboxLayout.setAlignment(QtImport.Qt.AlignTop) main_layout = QtImport.QVBoxLayout(None, 0, 15, "main_layout") space_group_layout = QtImport.QHBoxLayout(None, 0, 6, "space_group_layout") space_group_ledit_layout = QtImport.QHBoxLayout( None, 0, 6, "space_group_ledit_layout") self.space_group_label = QtImport.QLabel(self.gbox, "space_group_label") space_group_ledit_layout.addWidget(self.space_group_label) self.space_group_ledit = QtImport.QComboBox(0, self.gbox, "space_group_ledit") self.space_group_ledit.setMinimumSize(QtImport.QSize(100, 0)) self.space_group_ledit.setMaximumSize(QtImport.QSize(100, 32767)) space_group_ledit_layout.addWidget(self.space_group_ledit) space_group_layout.addLayout(space_group_ledit_layout) space_group_hspacer = QtImport.QSpacerItem( 1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) space_group_layout.addItem(space_group_hspacer) main_layout.addLayout(space_group_layout) vdim_layout = QtImport.QVBoxLayout(None, 0, 2, "vdim_layout") vdim_heading_layout = QtImport.QHBoxLayout(None, 0, 6, "vdim_heading_layout") self.dimension_label = QtImport.QLabel(self.gbox, "dimension_label") vdim_heading_layout.addWidget(self.dimension_label) vdim_heading_spacer = QtImport.QSpacerItem( 1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) vdim_heading_layout.addItem(vdim_heading_spacer) vdim_layout.addLayout(vdim_heading_layout) vdim_control_layout = QtImport.QHBoxLayout(None, 0, 0, "vdim_control_layout") vdim_ledit_hlayout = QtImport.QHBoxLayout(None, 0, 20, "vdim_ledit_hlayout") col_one_vdim_ledit_hlayout = QtImport.QHBoxLayout( None, 0, 6, "col_one_vdim_ledit_hlayout") vlayout_min_vdim_label = QtImport.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_label") self.min_vdim_label = QtImport.QLabel(self.gbox, "min_vdim_label") vlayout_min_vdim_label.addWidget(self.min_vdim_label) self.vdim_min_phi_label = QtImport.QLabel(self.gbox, "vdim_min_phi_label") vlayout_min_vdim_label.addWidget(self.vdim_min_phi_label) col_one_vdim_ledit_hlayout.addLayout(vlayout_min_vdim_label) vlayout_min_vdim_ledit = QtImport.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_ledit") self.min_vdim_ledit = QtImport.QLineEdit(self.gbox, "min_vdim_ledit") self.min_vdim_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.min_vdim_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_min_vdim_ledit.addWidget(self.min_vdim_ledit) self.min_vphi_ledit = QtImport.QLineEdit(self.gbox, "min_vphi_ledit") self.min_vphi_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.min_vphi_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_min_vdim_ledit.addWidget(self.min_vphi_ledit) col_one_vdim_ledit_hlayout.addLayout(vlayout_min_vdim_ledit) vdim_ledit_hlayout.addLayout(col_one_vdim_ledit_hlayout) col_two_vdim_ledit_hlayout = QtImport.QHBoxLayout( None, 0, 6, "col_two_vdim_ledit_hlayout") vlayout_two_vdim_hlayout = QtImport.QVBoxLayout( None, 0, 6, "vlayout_two_vdim_hlayout") self.max_vdim_label = QtImport.QLabel(self.gbox, "max_vdim_label") vlayout_two_vdim_hlayout.addWidget(self.max_vdim_label) self.max_vphi_label = QtImport.QLabel(self.gbox, "max_vphi_label") vlayout_two_vdim_hlayout.addWidget(self.max_vphi_label) col_two_vdim_ledit_hlayout.addLayout(vlayout_two_vdim_hlayout) vlayout_max_vdim_ledit = QtImport.QVBoxLayout( None, 0, 6, "vlayout_max_vdim_ledit") self.max_vdim_ledit = QtImport.QLineEdit(self.gbox, "max_vdim_ledit") self.max_vdim_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.max_vdim_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_max_vdim_ledit.addWidget(self.max_vdim_ledit) self.max_vphi_ledit = QtImport.QLineEdit(self.gbox, "max_vphi_ledit") self.max_vphi_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.max_vphi_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_max_vdim_ledit.addWidget(self.max_vphi_ledit) col_two_vdim_ledit_hlayout.addLayout(vlayout_max_vdim_ledit) vdim_ledit_hlayout.addLayout(col_two_vdim_ledit_hlayout) vdim_control_layout.addLayout(vdim_ledit_hlayout) vspacer = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) vdim_control_layout.addItem(vspacer) vdim_layout.addLayout(vdim_control_layout) main_layout.addLayout(vdim_layout) gboxLayout.addLayout(main_layout) VerticalCrystalDimensionWidgetLayoutLayout.addWidget(self.gbox) self.languageChange() self.resize( QtImport.QSize(307, 163).expandedTo(self.minimumSizeHint()))
def __init__(self, *args): """ Proposal brick is used to authentificate current user. Brick can be used in two modes defined by ispyb hwobj - loginAsUser = True, Brick displays combobox with all proposals from ISPyB that are associated to the current user - loginAsUser = False. Brick displays combobox to choose proposal type and linedits to enter proposal number and password. In this case user is authentificated with LDAP and proposal from ISPyB is retrieved. """ BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.local_login_hwobj = None # Internal values ----------------------------------------------------- self.login_as_user = None self.proposal = None self.person = None self.laboratory = None # self.sessionId=None self.inhouseProposal = None self.instance_server_hwobj = None self.secondary_proposals = [] # Properties ---------------------------------------------------------- self.add_property("instanceServer", "string", "") self.add_property("localLogin", "string", "") self.add_property("titlePrefix", "string", "") self.add_property("autoSessionUsers", "string", "") self.add_property("codes", "string", "fx ifx ih im ix ls mx opid") self.add_property("secondaryProposals", "string", "") self.add_property("icons", "string", "") self.add_property("serverStartDelay", "integer", 500) self.add_property("dbConnection", "string") # Signals ------------------------------------------------------------ self.define_signal("sessionSelected", ()) self.define_signal("setWindowTitle", ()) self.define_signal("loggedIn", ()) self.define_signal("userGroupSaved", ()) # Slots --------------------------------------------------------------- self.define_slot("setButtonEnabled", ()) self.define_slot("impersonateProposal", ()) # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("ISPyB proposal", self) self.login_as_proposal_widget = QtImport.QWidget(self.main_gbox) code_label = QtImport.QLabel(" Code: ", self.login_as_proposal_widget) self.proposal_type_combox = QtImport.QComboBox( self.login_as_proposal_widget) self.proposal_type_combox.setEditable(True) self.proposal_type_combox.setFixedWidth(60) dash_label = QtImport.QLabel(" - ", self.login_as_proposal_widget) self.proposal_number_ledit = QtImport.QLineEdit( self.login_as_proposal_widget) self.proposal_number_ledit.setFixedWidth(60) password_label = QtImport.QLabel(" Password: "******"Login", self.login_as_proposal_widget) self.login_button.setFixedWidth(70) self.logout_button = QtImport.QPushButton("Logout", self.main_gbox) self.logout_button.hide() self.logout_button.setFixedWidth(70) self.login_as_proposal_widget.hide() self.login_as_user_widget = QtImport.QWidget(self.main_gbox) self.proposal_combo = QtImport.QComboBox(self.login_as_user_widget) self.user_group_widget = QtImport.QWidget(self.main_gbox) # self.title_label = QtGui.QLabel(self.user_group_widget) # self.title_label.setAlignment(QtCore.Qt.AlignCenter) self.user_group_label = QtImport.QLabel(" Group: ", self.user_group_widget) self.user_group_ledit = QtImport.QLineEdit(self.user_group_widget) self.user_group_ledit.setFixedSize(100, 27) self.user_group_save_button = QtImport.QToolButton( self.user_group_widget) self.user_group_save_button.setText("Set") self.user_group_save_button.setFixedHeight(27) self.saved_group = True # Layout -------------------------------------------------------------- _user_group_widget_hlayout = QtImport.QHBoxLayout( self.user_group_widget) _user_group_widget_hlayout.setSpacing(2) # _user_group_widget_hlayout.addWidget(self.title_label) _user_group_widget_hlayout.addWidget(self.user_group_label) _user_group_widget_hlayout.addWidget(self.user_group_ledit) _user_group_widget_hlayout.addWidget(self.user_group_save_button) _user_group_widget_hlayout.setContentsMargins(0, 0, 0, 0) self.user_group_widget.hide() _login_as_proposal_widget_layout = QtImport.QHBoxLayout( self.login_as_proposal_widget) _login_as_proposal_widget_layout.addWidget(code_label) _login_as_proposal_widget_layout.addWidget(self.proposal_type_combox) _login_as_proposal_widget_layout.addWidget(dash_label) _login_as_proposal_widget_layout.addWidget(self.proposal_number_ledit) _login_as_proposal_widget_layout.addWidget(password_label) _login_as_proposal_widget_layout.addWidget( self.proposal_password_ledit) _login_as_proposal_widget_layout.addWidget(self.login_button) _login_as_proposal_widget_layout.setSpacing(2) _login_as_proposal_widget_layout.setContentsMargins(0, 0, 0, 0) _login_as_user_widget_layout = QtImport.QHBoxLayout( self.login_as_user_widget) _login_as_user_widget_layout.addWidget(self.proposal_combo) _login_as_user_widget_layout.setSpacing(2) _login_as_user_widget_layout.setContentsMargins(0, 0, 0, 0) _main_gboxlayout = QtImport.QHBoxLayout(self.main_gbox) _main_gboxlayout.addWidget(self.login_as_proposal_widget) _main_gboxlayout.addWidget(self.logout_button) _main_gboxlayout.addWidget(self.login_as_user_widget) _main_gboxlayout.addStretch() _main_gboxlayout.addWidget(self.user_group_widget) _main_gboxlayout.setSpacing(2) _main_gboxlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # self.user_group_ledit # Qt signal/slot connections ------------------------------------------ self.proposal_password_ledit.returnPressed.connect(self.login) self.login_button.clicked.connect(self.login) self.logout_button.clicked.connect(self.logout_clicked) self.proposal_combo.activated.connect(self.proposal_combo_activated) self.user_group_save_button.clicked.connect(self.save_group) self.user_group_ledit.returnPressed.connect(self.save_group) self.user_group_ledit.textChanged.connect(self.user_group_changed) # Other --------------------------------------------------------------- Colors.set_widget_color(self.proposal_number_ledit, Colors.LIGHT_RED, QtImport.QPalette.Base) Colors.set_widget_color(self.proposal_password_ledit, Colors.LIGHT_RED, QtImport.QPalette.Base)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("label", "string", "") self.add_property("showStop", "boolean", True) self.add_property("defaultStep", "string", "10.0") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements----------------------------------------------------- _main_gbox = QtImport.QGroupBox(self) self.kappa_dspinbox = QtImport.QDoubleSpinBox(_main_gbox) self.kappa_dspinbox.setRange(-360, 360) self.kappaphi_dspinbox = QtImport.QDoubleSpinBox(_main_gbox) self.kappaphi_dspinbox.setRange(-360, 360) self.step_cbox = QtImport.QComboBox(_main_gbox) self.step_button_icon = Icons.load_icon("TileCascade2") self.close_button = QtImport.QPushButton(_main_gbox) self.stop_button = QtImport.QPushButton(_main_gbox) # Layout -------------------------------------------------------------- _main_gbox_hlayout = QtImport.QHBoxLayout(_main_gbox) _main_gbox_hlayout.addWidget(QtImport.QLabel("Kappa:", _main_gbox)) _main_gbox_hlayout.addWidget(self.kappa_dspinbox) _main_gbox_hlayout.addWidget(QtImport.QLabel("Phi:", _main_gbox)) _main_gbox_hlayout.addWidget(self.kappaphi_dspinbox) _main_gbox_hlayout.addWidget(self.step_cbox) _main_gbox_hlayout.addWidget(self.close_button) _main_gbox_hlayout.addWidget(self.stop_button) _main_gbox_hlayout.setSpacing(2) _main_gbox_hlayout.setContentsMargins(2, 2, 2, 2) _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(_main_gbox) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ kappa_dspinbox_event = SpinBoxEvent(self.kappa_dspinbox) kappaphi_dspinbox_event = SpinBoxEvent(self.kappaphi_dspinbox) self.kappa_dspinbox.installEventFilter(kappa_dspinbox_event) self.kappaphi_dspinbox.installEventFilter(kappaphi_dspinbox_event) kappa_dspinbox_event.returnPressedSignal.connect(self.change_position) kappaphi_dspinbox_event.returnPressedSignal.connect(self.change_position) self.kappa_dspinbox.lineEdit().textEdited.connect(self.kappa_value_edited) self.kappaphi_dspinbox.lineEdit().textEdited.connect(self.kappaphi_value_edited) self.step_cbox.activated.connect(self.go_to_step) self.step_cbox.activated.connect(self.step_changed) self.step_cbox.textChanged.connect(self.step_edited) self.close_button.clicked.connect(self.close_clicked) self.stop_button.clicked.connect(self.stop_clicked) # self.stop_button.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Minimum) # Other --------------------------------------------------------------- self.kappa_dspinbox.setAlignment(QtImport.Qt.AlignRight) self.kappa_dspinbox.setFixedWidth(75) self.kappaphi_dspinbox.setAlignment(QtImport.Qt.AlignRight) self.kappaphi_dspinbox.setFixedWidth(75) self.step_cbox.setEditable(True) self.step_cbox.setValidator( QtImport.QDoubleValidator(0, 360, 5, self.step_cbox) ) self.step_cbox.setDuplicatesEnabled(False) self.step_cbox.setFixedHeight(27) self.close_button.setIcon(Icons.load_icon("Home2")) self.close_button.setFixedSize(27, 27) self.stop_button.setIcon(Icons.load_icon("Stop2")) self.stop_button.setEnabled(False) self.stop_button.setFixedSize(27, 27) self.connect(HWR.beamline.diffractometer, "kappaMotorMoved", self.kappa_motor_moved) self.connect(HWR.beamline.diffractometer, "kappaPhiMotorMoved", self.kappaphi_motor_moved) self.connect(HWR.beamline.diffractometer, "minidiffStatusChanged", self.diffractometer_state_changed)
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)
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)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- self.add_property("defaultMode", "combo", ("keV", "Ang"), "keV") self.add_property("kevFormatString", "formatString", "##.####") self.add_property("angFormatString", "formatString", "##.####") self.add_property("displayStatus", "boolean", False) self.add_property("doBeamAlignment", "boolean", False) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.energy_limits = None self.wavelength_limits = None # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Energy", self) energy_label = QtImport.QLabel("Current:", self.group_box) energy_label.setFixedWidth(75) wavelength_label = QtImport.QLabel("Wavelength: ", self.group_box) self.energy_ledit = QtImport.QLineEdit(self.group_box) self.energy_ledit.setReadOnly(True) self.wavelength_ledit = QtImport.QLineEdit(self.group_box) self.wavelength_ledit.setReadOnly(True) self.status_label = QtImport.QLabel("Status:", self.group_box) self.status_label.setEnabled(False) self.status_ledit = QtImport.QLineEdit(self.group_box) self.status_ledit.setEnabled(False) self.new_value_widget = QtImport.QWidget(self) self.set_to_label = QtImport.QLabel("Set to: ", self) self.new_value_ledit = QtImport.QLineEdit(self.new_value_widget) # self.new_value_ledit.setMaximumWidth(60) self.units_combobox = QtImport.QComboBox(self.new_value_widget) self.units_combobox.addItems(["keV", u"\u212B"]) self.stop_button = QtImport.QPushButton(self.new_value_widget) self.stop_button.setIcon(Icons.load_icon("Stop2")) self.stop_button.setEnabled(False) self.stop_button.setFixedWidth(25) self.beam_align_cbox = QtImport.QCheckBox( "Center beam after energy change", self) # Layout -------------------------------------------------------------- _new_value_widget_hlayout = QtImport.QHBoxLayout(self.new_value_widget) _new_value_widget_hlayout.addWidget(self.new_value_ledit) _new_value_widget_hlayout.addWidget(self.units_combobox) _new_value_widget_hlayout.addWidget(self.stop_button) _new_value_widget_hlayout.setSpacing(0) _new_value_widget_hlayout.setContentsMargins(0, 0, 0, 0) _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(energy_label, 0, 0) _group_box_gridlayout.addWidget(self.energy_ledit, 0, 1) _group_box_gridlayout.addWidget(wavelength_label, 1, 0) _group_box_gridlayout.addWidget(self.wavelength_ledit, 1, 1) _group_box_gridlayout.addWidget(self.status_label, 2, 0) _group_box_gridlayout.addWidget(self.status_ledit, 2, 1) _group_box_gridlayout.addWidget(self.set_to_label, 3, 0) _group_box_gridlayout.addWidget(self.new_value_widget, 3, 1) _group_box_gridlayout.addWidget(self.beam_align_cbox, 4, 0, 1, 2) _group_box_gridlayout.setSpacing(0) _group_box_gridlayout.setContentsMargins(1, 1, 1, 1) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 2, 2) _main_vlayout.addWidget(self.group_box) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.new_value_ledit.returnPressed.connect(self.current_value_changed) self.new_value_ledit.textChanged.connect(self.input_field_changed) self.units_combobox.activated.connect(self.units_changed) self.stop_button.clicked.connect(self.stop_clicked) self.beam_align_cbox.stateChanged.connect(self.do_beam_align_changed) # Other --------------------------------------------------------------- # self.group_box.setCheckable(True) # self.group_box.setChecked(True) self.new_value_validator = QtImport.QDoubleValidator( 0, 15, 4, self.new_value_ledit) self.status_ledit.setEnabled(False) self.instance_synchronize("energy_ledit", "new_value_ledit")
def __init__(self, parent=None, name="gphl_acquisition_widget"): GphlSetupWidget.__init__(self, parent=parent, name=name) # Internal variables ------------------------------------------------- _parameters_widget = self._parameters_widget row = 0 field_name = "crystal_system" label_name = self._get_label_name(field_name) label_str = "Crystal system :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._widget_data[field_name] = (widget, str, None, 0) self._pulldowns[field_name] = list(self._CRYSTAL_SYSTEM_DATA) row += 1 field_name = "space_group" label_name = self._get_label_name(field_name) label_str = "Space group :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._widget_data[field_name] = (widget, str, None, 0) row += 1 field_name = "characterisation_strategy" label_name = self._get_label_name(field_name) label_str = "Characterisation strategy :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._widget_data[field_name] = (widget, str, None, 0) strategy_names = HWR.beamline.gphl_workflow.get_property( "characterisation_strategies").split() self._pulldowns[field_name] = strategy_names row += 1 field_name = "dose_budget" label_name = self._get_label_name(field_name) label_str = "Dose budget (MGy) :" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QComboBox() _parameters_widget.layout().addWidget(widget, row, 1) self._widget_data[field_name] = (widget, str, None, 0) self._pulldowns[field_name] = list( HWR.beamline.gphl_workflow.dose_budgets) self._pulldown_defaults[ field_name] = HWR.beamline.gphl_workflow.default_dose_budget_label indx = self._pulldowns[field_name].index( HWR.beamline.gphl_workflow.default_dose_budget_label) self._widget_data[field_name] = (widget, str, None, indx) row += 1 field_name = "relative_rad_sensitivity" label_name = self._get_label_name(field_name) label_str = "Rel. radiation sensitivity" label = QtImport.QLabel(label_str, _parameters_widget) _parameters_widget.layout().addWidget(label, row, 0) self._widget_data[label_name] = (label, str, None, label_str) widget = QtImport.QLineEdit() _parameters_widget.layout().addWidget(widget, row, 1) validator = QtImport.QDoubleValidator(0, 100, 4, widget) self._widget_data[field_name] = (widget, float, validator, 1.0)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.resolution_limits = None self.detector_distance_limits = None self.door_interlocked = True # Properties ---------------------------------------------------------- self.add_property("defaultMode", "combo", ("Ang", "mm"), "Ang") self.add_property("mmFormatString", "formatString", "###.##") self.add_property("angFormatString", "formatString", "##.###") self.group_box = QtImport.QGroupBox("Resolution", self) current_label = QtImport.QLabel("Current:", self.group_box) current_label.setFixedWidth(75) self.resolution_ledit = QtImport.QLineEdit(self.group_box) self.resolution_ledit.setReadOnly(True) self.detector_distance_ledit = QtImport.QLineEdit(self.group_box) self.detector_distance_ledit.setReadOnly(True) _new_value_widget = QtImport.QWidget(self) set_to_label = QtImport.QLabel("Set to:", self.group_box) self.new_value_ledit = QtImport.QLineEdit(self.group_box) self.units_combobox = QtImport.QComboBox(_new_value_widget) self.stop_button = QtImport.QPushButton(_new_value_widget) self.stop_button.setIcon(Icons.load_icon("Stop2")) self.stop_button.setEnabled(False) self.stop_button.setFixedWidth(25) # Layout -------------------------------------------------------------- _new_value_widget_hlayout = QtImport.QHBoxLayout(_new_value_widget) _new_value_widget_hlayout.addWidget(self.new_value_ledit) _new_value_widget_hlayout.addWidget(self.units_combobox) _new_value_widget_hlayout.addWidget(self.stop_button) _new_value_widget_hlayout.setSpacing(0) _new_value_widget_hlayout.setContentsMargins(0, 0, 0, 0) _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(current_label, 0, 0, 2, 1) _group_box_gridlayout.addWidget(self.resolution_ledit, 0, 1) _group_box_gridlayout.addWidget(self.detector_distance_ledit, 1, 1) _group_box_gridlayout.addWidget(set_to_label, 2, 0) _group_box_gridlayout.addWidget(_new_value_widget, 2, 1) _group_box_gridlayout.setSpacing(0) _group_box_gridlayout.setContentsMargins(1, 1, 1, 1) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 2, 2) _main_vlayout.addWidget(self.group_box) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.new_value_ledit.returnPressed.connect(self.current_value_changed) self.new_value_ledit.textChanged.connect(self.input_field_changed) self.units_combobox.activated.connect(self.unit_changed) self.stop_button.clicked.connect(self.stop_clicked) # Other --------------------------------------------------------------- Colors.set_widget_color( self.new_value_ledit, Colors.LINE_EDIT_ACTIVE, QtImport.QPalette.Base ) self.new_value_validator = QtImport.QDoubleValidator( 0, 15, 4, self.new_value_ledit ) self.units_combobox.addItem(chr(197)) self.units_combobox.addItem("mm") self.instance_synchronize( "group_box", "resolution_ledit", "detector_distance_ledit", "new_value_ledit", "units_combobox", )
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)