def __init__(self, parent=None, name=None, fl=0): QtImport.QDialog.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- # AsyncResult to return values self._async_result = None # Layout QtImport.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.setWindowTitle("GPhL Workflow parameters") # Info box self.info_gbox = QtImport.QGroupBox("Info", self) QtImport.QVBoxLayout(self.info_gbox) main_layout.addWidget(self.info_gbox) self.info_text = QtImport.QTextEdit(self.info_gbox) self.info_text.setFont(QtImport.QFont("Courier")) self.info_text.setReadOnly(True) self.info_gbox.layout().addWidget(self.info_text) # Special parameter box self.cplx_gbox = QtImport.QGroupBox("Indexing solution", self) QtImport.QVBoxLayout(self.cplx_gbox) main_layout.addWidget(self.cplx_gbox) self.cplx_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.cplx_widget = None # Parameter box self.parameter_gbox = QtImport.QGroupBox("Parameters", self) main_layout.addWidget(self.parameter_gbox) self.parameter_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.params_widget = None # Button bar button_layout = QtImport.QHBoxLayout(None) hspacer = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = QtImport.QPushButton("Continue", self) button_layout.addWidget(self.continue_button) self.cancel_button = QtImport.QPushButton("Abort", self) button_layout.addWidget(self.cancel_button) main_layout.addLayout(button_layout) self.continue_button.clicked.connect(self.continue_button_click) self.cancel_button.clicked.connect(self.cancel_button_click) self.resize( QtImport.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
def __init__(self, parent, realtime_plot=False): QtImport.QWidget.__init__(self, parent) self.snapshot_gbox = QtImport.QGroupBox("Snapshot", self) self.animation_gbox = QtImport.QGroupBox("Animation", self) self.snapshot_label = QtImport.QLabel(self.snapshot_gbox) self.animation_label = QtImport.QLabel(self.animation_gbox) # Layout -------------------------------------------------------------- _snaphot_gbox_hlayout = QtImport.QHBoxLayout(self.snapshot_gbox) _snaphot_gbox_hlayout.addWidget(self.snapshot_label) _snaphot_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _animation_gbox_hlayout = QtImport.QHBoxLayout(self.animation_gbox) _animation_gbox_hlayout.addWidget(self.animation_label) _animation_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.snapshot_gbox) _main_vlayout.addWidget(self.animation_gbox) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout.addStretch(0) self.animation_gbox.setHidden(True)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("formatString", "formatString", "###.##") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Transmission", self) current_label = QtImport.QLabel("Current:", self.group_box) current_label.setFixedWidth(75) self.transmission_ledit = QtImport.QLineEdit(self.group_box) self.transmission_ledit.setReadOnly(True) set_to_label = QtImport.QLabel("Set to:", self.group_box) self.new_value_ledit = QtImport.QLineEdit(self.group_box) # Layout -------------------------------------------------------------- _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(current_label, 0, 0) _group_box_gridlayout.addWidget(self.transmission_ledit, 0, 1) _group_box_gridlayout.addWidget(set_to_label, 1, 0) _group_box_gridlayout.addWidget(self.new_value_ledit, 1, 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 -------------------------------------------------------- # Other --------------------------------------------------------------- self._update_ledit_color(Colors.LIGHT_GREEN) self.validator = QtImport.QDoubleValidator(0, 100, 2, self.new_value_ledit) self.new_value_ledit.setToolTip("Transmission limits 0 : 100 %") self.instance_synchronize("transmission_ledit", "new_value_ledit") if HWR.beamline.transmission is not None: # 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.connect(HWR.beamline.transmission, "stateChanged", self._state_changed) self.connect(HWR.beamline.transmission, "valueChanged", self._value_changed) self.connected() else: self.disconnected()
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _main_groupbox = QtImport.QGroupBox("Detector status", self) self.status_label = QtImport.QLabel("<b>unknown status</b>", _main_groupbox) self.frame_rate_label = QtImport.QLabel(" Frame rate : ", _main_groupbox) self.temperature_label = QtImport.QLabel(" Temperature:", _main_groupbox) self.humidity_label = QtImport.QLabel(" Humidity: ", _main_groupbox) # Layout -------------------------------------------------------------- _main_groupbox_vlayout = QtImport.QVBoxLayout(_main_groupbox) _main_groupbox_vlayout.addWidget(self.status_label) _main_groupbox_vlayout.addWidget(self.frame_rate_label) _main_groupbox_vlayout.addWidget(self.temperature_label) _main_groupbox_vlayout.addWidget(self.humidity_label) _main_groupbox_vlayout.setSpacing(2) _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4) main_layout = QtImport.QVBoxLayout(self) main_layout.addWidget(_main_groupbox) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) # SizePolicies ------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- Colors.set_widget_color( self.status_label, DetectorStatusBrick.DETECTOR_STATES["uninitialized"] ) Colors.set_widget_color( self.temperature_label, DetectorStatusBrick.STATES["unknown"] ) Colors.set_widget_color( self.humidity_label, DetectorStatusBrick.STATES["unknown"] ) Colors.set_widget_color(self.frame_rate_label, DetectorStatusBrick.STATES["OK"]) self.status_label.setMinimumHeight(20) self.status_label.setAlignment(QtImport.Qt.AlignCenter) self.temperature_label.setMinimumHeight(20) self.humidity_label.setMinimumHeight(20) self.frame_rate_label.setMinimumHeight(20) self.connect(api.detector, "temperatureChanged", self.temperature_changed) self.connect(api.detector, "humidityChanged", self.humidity_changed) self.connect(api.detector, "statusChanged", self.status_changed) self.connect(api.detector, "frameRateChanged", self.frame_rate_changed)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.motor_hwobj_list = [] self.motor_widget_list = [] self.motor_widget_labels = [] self.predefined_positions_list = [] self.positions = None # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("labels", "string", "") self.add_property("moveButtonIcons", "string", "") self.add_property("alignment", "combo", ("vertical", "horizontal"), "vertical") self.add_property("defaultSteps", "string", "") self.add_property("defaultDeltas", "string", "") self.add_property("defaultDecimals", "string", "") self.add_property("predefinedPositions", "string", "") 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("showEnableButtons", "boolean", False) self.add_property("inExpertMode", "boolean", False) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_group_box = QtImport.QGroupBox(self) self.enable_motors_buttons = QtImport.QPushButton("Enable", self.main_group_box) self.disable_motors_buttons = QtImport.QPushButton( "Disable", self.main_group_box ) # Layout -------------------------------------------------------------- if self["alignment"] == "horizontal": self.main_groupbox_hlayout = QtImport.QHBoxLayout(self.main_group_box) else: self.main_groupbox_hlayout = QtImport.QVBoxLayout(self.main_group_box) self.main_groupbox_hlayout.setSpacing(2) self.main_groupbox_hlayout.setContentsMargins(0, 0, 0, 0) self.main_hlayout = QtImport.QHBoxLayout(self) self.main_hlayout.addWidget(self.main_group_box) self.main_hlayout.setSpacing(2) self.main_hlayout.setContentsMargins(2, 2, 2, 2) # Size Policy --------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.enable_motors_buttons.clicked.connect(self.enable_motors) self.disable_motors_buttons.clicked.connect(self.disable_motors)
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, *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__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beam_info_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("formatString", "formatString", "#.#") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("Beam size", self) hor_label = QtImport.QLabel("Horizontal:", self.main_gbox) self.hor_size_ledit = QtImport.QLineEdit(self.main_gbox) self.hor_size_ledit.setMaximumWidth(120) self.hor_size_ledit.setEnabled(False) self.hor_size_ledit.setAlignment(QtImport.Qt.AlignRight) ver_label = QtImport.QLabel("Vertical:", self.main_gbox) self.ver_size_ledit = QtImport.QLineEdit(self.main_gbox) self.ver_size_ledit.setMaximumWidth(120) self.ver_size_ledit.setEnabled(False) self.ver_size_ledit.setAlignment(QtImport.Qt.AlignRight) bold_font = self.hor_size_ledit.font() bold_font.setBold(True) self.hor_size_ledit.setFont(bold_font) self.ver_size_ledit.setFont(bold_font) # Layout -------------------------------------------------------------- _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox) _main_gbox_gridlayout.addWidget(hor_label, 0, 0) _main_gbox_gridlayout.addWidget(self.hor_size_ledit, 0, 1) _main_gbox_gridlayout.addWidget(ver_label, 1, 0) _main_gbox_gridlayout.addWidget(self.ver_size_ledit, 1, 1) _main_gbox_gridlayout.setRowStretch(2, 10) _main_gbox_gridlayout.setSpacing(2) _main_gbox_gridlayout.setContentsMargins(0, 0, 0, 0) _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 ------------------------------------------ # Other --------------------------------------------------------------- self.connect(api.beam_info, "beamInfoChanged", self.beam_info_changed)
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)) self.setObjectName("char_type_widget") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.charact_type_gbox = QtImport.QGroupBox(self) # Fix the widths of the widgets to make the layout look nicer, # and beacuse the qt layout engine is so tremendosly good. self.charact_type_gbox.setFixedWidth(800) self.charact_type_gbox.setFixedHeight(220) self.charact_type_tbox = QtImport.QToolBox(self.charact_type_gbox) self.routine_dc_page = RoutineDCWidgetLayout(self.charact_type_tbox) self.sad_page = SADWidgetLayout(self.charact_type_tbox) self.rad_damage_page = RadiationDamageWidgetLayout( self.charact_type_tbox) self.charact_type_tbox.addItem(self.routine_dc_page, "Routine-DC") self.charact_type_tbox.addItem(self.sad_page, "SAD") self.charact_type_tbox.addItem(self.rad_damage_page, "Radiation damage") # Layout -------------------------------------------------------------- _charact_type_gbox_vlayout = QtImport.QVBoxLayout( self.charact_type_gbox) _charact_type_gbox_vlayout.addWidget(self.charact_type_tbox) _charact_type_gbox_vlayout.addStretch(0) _charact_type_gbox_vlayout.setSpacing(0) _charact_type_gbox_vlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.charact_type_gbox) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.routine_dc_page.dose_limit_cbx.toggled.connect( self.enable_dose_ledit) self.routine_dc_page.time_limit_cbx.toggled.connect( self.enable_time_ledit) self.routine_dc_page.dose_time_bgroup.buttonClicked.connect( self._toggle_time_dose) # Other --------------------------------------------------------------- self._toggle_time_dose( self.routine_dc_page.dose_time_bgroup.checkedId())
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- self.add_property("hwobj_shutter", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- self.shutter_hwobj = None # Internal values ----------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Shutter", self) self.main_groupbox.setAlignment(QtImport.Qt.AlignCenter) self.state_label = QtImport.QLabel("<b>unknown</b>", self.main_groupbox) self.state_label.setAlignment(QtImport.Qt.AlignCenter) self.state_label.setFixedHeight(24) Colors.set_widget_color(self.state_label, Colors.LIGHT_GRAY) _button_widget = QtImport.QWidget(self.main_groupbox) self.open_button = QtImport.QPushButton(Icons.load_icon("ShutterOpen"), "Open", _button_widget) self.close_button = QtImport.QPushButton( Icons.load_icon("ShutterClose"), "Close", _button_widget) # Layout -------------------------------------------------------------- _button_widget_hlayout = QtImport.QHBoxLayout(_button_widget) _button_widget_hlayout.addWidget(self.open_button) _button_widget_hlayout.addWidget(self.close_button) _button_widget_hlayout.setSpacing(2) _button_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_groupbox) _main_gbox_vlayout.addWidget(self.state_label) _main_gbox_vlayout.addWidget(_button_widget) _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.open_button.clicked.connect(self.open_button_clicked) self.close_button.clicked.connect(self.close_button_clicked)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.image_tracking_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "/image-tracking") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _main_groupbox = QtImport.QGroupBox("Image tracking", self) self.state_label = QtImport.QLabel("<b> </b>", _main_groupbox) self.image_tracking_cbox = QtImport.QCheckBox( "Enable Adxv image tracking", _main_groupbox ) self.filter_frames_cbox = QtImport.QCheckBox( "Filter frames based on Dozor score", _main_groupbox ) self.spot_list_cbox = QtImport.QCheckBox( "Indicate spots in ADxV", _main_groupbox ) # Layout -------------------------------------------------------------- _main_groupbox_vlayout = QtImport.QVBoxLayout(_main_groupbox) _main_groupbox_vlayout.addWidget(self.state_label) _main_groupbox_vlayout.addWidget(self.image_tracking_cbox) _main_groupbox_vlayout.addWidget(self.filter_frames_cbox) _main_groupbox_vlayout.addWidget(self.spot_list_cbox) _main_groupbox_vlayout.setSpacing(2) _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(_main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.image_tracking_cbox.toggled.connect(self.image_tracking_cbox_toggled) self.filter_frames_cbox.toggled.connect(self.filter_frames_cbox_toggled) self.spot_list_cbox.toggled.connect(self.spot_list_cbox_toggled) # Other --------------------------------------------------------------- self.state_label.setAlignment(QtImport.Qt.AlignCenter) self.state_label.setFixedHeight(24) self.state_changed("unknown")
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Door interlock", self) self.main_groupbox.setAlignment(QtImport.Qt.AlignCenter) self.state_label = QtImport.QLabel("<b>unknown</b>", self.main_groupbox) Colors.set_widget_color(self.state_label, self.STATES["unknown"]) self.state_label.setAlignment(QtImport.Qt.AlignCenter) self.state_label.setFixedHeight(24) self.unlock_door_button = QtImport.QPushButton( Icons.load_icon("EnterHutch"), "Unlock", self.main_groupbox ) # Layout -------------------------------------------------------------- _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_groupbox) _main_gbox_vlayout.addWidget(self.state_label) _main_gbox_vlayout.addWidget(self.unlock_door_button) _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(4, 4, 4, 4) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.unlock_door_button.clicked.connect(self.unlock_doors) # Other --------------------------------------------------------------- self.state_label.setToolTip("Shows the current door state") self.unlock_door_button.setToolTip("Unlocks the doors") self.connect( HWR.beamline.hutch_interlock, "doorInterlockStateChanged", self.state_changed ) HWR.beamline.hutch_interlock.re_emit_values()
def __init__(self, *args): BaseWidget.__init__(self, *args) # variables ----------------------------------------------------------- self.current_beam_position = None self.current_zoom_pos_name = None self.current_zoom_idx = -1 self.multipos_file_xml_path = None # Hardware objects ---------------------------------------------------- self.multipos_hwobj = None # Internal values ----------------------------------------------------- self.table_created = False # Properties ---------------------------------------------------------- self.add_property("zoom", "string", "") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Beam Position", self) self.ui_widgets_manager = QtImport.load_ui_file("camera_beam_brick.ui") # Size policy -------------------------------- self.ui_widgets_manager.beam_positions_table.setSizePolicy( QtImport.QSizePolicy.Minimum, QtImport.QSizePolicy.Minimum, ) # Layout -------------------------------------------------------------- _groupbox_vlayout = QtImport.QVBoxLayout(self) _groupbox_vlayout.addWidget(self.ui_widgets_manager) _groupbox_vlayout.setSpacing(0) _groupbox_vlayout.setContentsMargins(0, 0, 0, 0) self.main_groupbox.setLayout(_groupbox_vlayout) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) self.setLayout(_main_vlayout) # Qt signal/slot connections ------------------------------------------ self.ui_widgets_manager.save_current_beam_pos_pushbutton.clicked.connect( self.save_beam_position)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beamstop_hwobj = None # Internal variables -------------------------------------------------- self.beamstop_limits = [0, 200] # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("formatString", "formatString", "###.##") # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Beamstop distance", self) current_label = QtImport.QLabel("Current:", self.group_box) current_label.setFixedWidth(75) self.beamstop_distance_ledit = QtImport.QLineEdit(self.group_box) self.beamstop_distance_ledit.setReadOnly(True) set_to_label = QtImport.QLabel("Set to:", self.group_box) self.new_value_ledit = QtImport.QLineEdit(self.group_box) # Layout -------------------------------------------------------------- _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(current_label, 0, 0) _group_box_gridlayout.addWidget(self.beamstop_distance_ledit, 0, 1) _group_box_gridlayout.addWidget(set_to_label, 1, 0) _group_box_gridlayout.addWidget(self.new_value_ledit, 1, 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) # Other --------------------------------------------------------------- Colors.set_widget_color(self.new_value_ledit, Colors.LINE_EDIT_ACTIVE, QtImport.QPalette.Base) self.new_value_validator = QtImport.QDoubleValidator( 0, 100, 2, self.new_value_ledit)
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 __init__(self, parent=None, name=None, fl=0, data_model=None): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) main_gbox = QtImport.QGroupBox("Comments", self) self.comment_textbox = QtImport.QTextEdit(main_gbox) main_gbox_vbox = QtImport.QVBoxLayout(main_gbox) main_gbox_vbox.addWidget(self.comment_textbox) main_gbox_vbox.setSpacing(0) main_gbox_vbox.setContentsMargins(0, 0, 0, 0) self.main_layout = QtImport.QVBoxLayout(self) self.main_layout.addWidget(main_gbox) self.main_layout.setSpacing(0) self.main_layout.setContentsMargins(0, 0, 0, 0)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("data_policy_changed", ()) # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Export Data", self) self.ui_widgets_manager = QtImport.load_ui_file( "export_data_layout.ui") # Internal values ----------------------------------------------------- self.__current_sample = None self.__data_policy_info_dict = {} # Layout -------------------------------------------------------------- _groupbox_vlayout = QtImport.QVBoxLayout(self) _groupbox_vlayout.addWidget(self.ui_widgets_manager) _groupbox_vlayout.setSpacing(0) _groupbox_vlayout.setContentsMargins(0, 0, 0, 0) self.main_groupbox.setLayout(_groupbox_vlayout) # Qt signal/slot connections ------------------------------------------ self.ui_widgets_manager.export_button.clicked.connect( self.export_button_clicked) self.ui_widgets_manager.sample_name_tbox.textChanged.connect( self.set_export_file_name) self.ui_widgets_manager.filename_tbox.textChanged.connect( self.set_export_file_name) self.ui_widgets_manager.file_index_tbox.textChanged.connect( self.set_export_file_name) self.ui_widgets_manager.select_file_path_button.clicked.connect( self.select_file_path_button_clicked) self.ui_widgets_manager.reload_policy_data_button.clicked.connect( self.reload_policy_data_button_clicked)
def __init__(self, *args): """TurretBrick constructor Arguments: :params args: """ super(TurretBrick, self).__init__(*args) # Hardware objects ---------------------------------------------------- self.multiple_pos_hwobj = None self.turret_hwobj = None # hardware object # Graphic elements----------------------------------------------------- self.frame = QtImport.QGroupBox() self.frame_layout = QtImport.QVBoxLayout() self.custom_dial = DialWithTags(dict()) # self.dial.setMinimum(1) # self.dial.setMaximum(5) # self.dial.setSingleStep(1) # self.dial.setNotchesVisible(True) # Layout -------------------------------------------------------------- self.frame_layout.addWidget(self.custom_dial) self.frame.setLayout(self.frame_layout) self.main_layout = QtImport.QVBoxLayout() self.main_layout.addWidget(self.frame, 0, QtImport.Qt.AlignCenter) self.setLayout(self.main_layout) # Qt signal/slot connections ----------------------------------------- self.custom_dial.valueChanged.connect(self.value_changed) # define properties self.add_property("mnemonic", "string", "") # member variables -------------------------------------------------------------- self.zoom_position_dict = {}
def __init__(self, *args): """VolpiBrick constructor Arguments: :params args: """ super(VolpiBrick, self).__init__(*args) # Hardware objects ---------------------------------------------------- self.volpi_hwobj = None # hardware object # Graphic elements----------------------------------------------------- self.frame = QtImport.QGroupBox() self.frame_layout = QtImport.QVBoxLayout() self.dial = PowerBar([ "#5e4fa2", "#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#ffffbf", "#fee08b", "#fdae61", "#f46d43", "#d53e4f", "#9e0142" ]) self.dial.setMinimum(0) self.dial.setMaximum(100) self.dial.setSingleStep(1) self.dial.setNotchesVisible(True) # Layout -------------------------------------------------------------- self.frame_layout.addWidget(self.dial) self.frame.setLayout(self.frame_layout) self.main_layout = QtImport.QVBoxLayout() self.main_layout.addWidget(self.frame, 0, QtImport.Qt.AlignCenter) self.setLayout(self.main_layout) # Qt signal/slot connections ----------------------------------------- self.dial.valueChanged.connect(self.value_changed) # define properties self.add_property("mnemonic", "string", "")
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)
def __init__(self, parent=None, name=None, fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if not name: self.setObjectName("ReferenceImageWidget") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Reference images", self) self.tool_box = QtImport.QToolBox(self.group_box) self.page_widget = QtImport.QWidget(self.tool_box) self.path_widget = DataPathWidget(self.page_widget) self.acq_widget = AcquisitionWidget(self.page_widget, "horizontal") self.acq_widget.acq_widget_layout.shutterless_cbx.hide() # self.acq_widget.acq_widget_layout.setFixedHeight(130) self.tool_box.addItem(self.page_widget, "Acquisition parameters") # Layout -------------------------------------------------------------- _page_widget_layout = QtImport.QVBoxLayout(self.page_widget) _page_widget_layout.addWidget(self.path_widget) _page_widget_layout.addWidget(self.acq_widget) _page_widget_layout.addStretch(0) _page_widget_layout.setSpacing(0) _page_widget_layout.setContentsMargins(0, 0, 0, 0) _group_box_vlayout = QtImport.QVBoxLayout(self.group_box) _group_box_vlayout.addWidget(self.tool_box) _group_box_vlayout.setSpacing(0) _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(0, 0, 0, 0)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beam_align_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Beam align", self) self.align_button = QtImport.QPushButton("Align", self.group_box) # Layout -------------------------------------------------------------- _group_box_vlayout = QtImport.QVBoxLayout(self.group_box) _group_box_vlayout.addWidget(self.align_button) _group_box_vlayout.addStretch() _group_box_vlayout.setSpacing(0) _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.align_button.clicked.connect(self.align_beam_clicked)
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) # variables ----------------------------------------------------------- self.y_calib = None # metres/pixel self.z_calib = None # metres/pixel self.current_zoom_pos_name = None self.multipos_file_xml_path = None self.table_created = False # Hardware objects ---------------------------------------------------- self.multipos_hwobj = None self.h_motor_hwobj = None self.v_motor_hwobj = None # Properties ---------------------------------------------------------- self.add_property("zoom", "string", "") self.add_property("vertical motor", "string", "") self.add_property("horizontal motor", "string", "") # Signals ------------------------------------------------------------ # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Pixel Size Calibration", self) self.ui_widgets_manager = QtImport.load_ui_file( "camera_calibration.ui") # Size policy -------------------------------- self.ui_widgets_manager.calibration_table.setSizePolicy( QtImport.QSizePolicy.Minimum, QtImport.QSizePolicy.Minimum, ) # Layout -------------------------------------------------------------- _groupbox_vlayout = QtImport.QVBoxLayout(self) _groupbox_vlayout.addWidget(self.ui_widgets_manager) _groupbox_vlayout.setSpacing(0) _groupbox_vlayout.setContentsMargins(0, 0, 0, 0) self.main_groupbox.setLayout(_groupbox_vlayout) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) self.setLayout(_main_vlayout) # Qt signal/slot connections ------------------------------------------ self.ui_widgets_manager.save_calibration_pushbutton.clicked.connect( self.save_new_calibration_value) self.ui_widgets_manager.start_new_calibration_pushbutton.clicked.connect( self.start_new_calibration) self.ui_widgets_manager.cancel_calibration_pushbutton.clicked.connect( self.cancel_calibration) # Other hardware object connections -------------------------- self.connect( HWR.beamline.diffractometer, "new_calibration_done", self.diffractometer_manual_calibration_done, )
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, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.wrapper_hwobj = None # Internal values ----------------------------------------------------- self.__expertMode = False # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("forceNoControl", "boolean", False) self.add_property("expertModeControlOnly", "boolean", False) self.add_property("icons", "string", "") self.add_property("in", "string", "in") self.add_property("out", "string", "out") self.add_property("setin", "string", "Set in") self.add_property("setout", "string", "Set out") self.add_property("username", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- self.define_slot("allowControl", ()) # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("none", self) self.main_gbox.setAlignment(QtImport.Qt.AlignCenter) self.state_ledit = QtImport.QLineEdit("unknown", self.main_gbox) self.buttons_widget = QtImport.QWidget(self.main_gbox) self.set_in_button = QtImport.QPushButton("Set in", self.buttons_widget) self.set_in_button.setCheckable(True) self.set_out_button = QtImport.QPushButton("Set out", self.buttons_widget) self.set_out_button.setCheckable(True) # Layout -------------------------------------------------------------- _buttons_widget_hlayout = QtImport.QHBoxLayout(self.buttons_widget) _buttons_widget_hlayout.addWidget(self.set_in_button) _buttons_widget_hlayout.addWidget(self.set_out_button) _buttons_widget_hlayout.setSpacing(0) _buttons_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_gbox) _main_gbox_vlayout.addWidget(self.state_ledit) _main_gbox_vlayout.addWidget(self.buttons_widget) _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(4, 4, 4, 4) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.set_in_button.toggled.connect(self.set_in) self.set_out_button.toggled.connect(self.set_out) # Other --------------------------------------------------------------- self.state_ledit.setAlignment(QtImport.Qt.AlignCenter) self.state_ledit.setToolTip("Shows the current control state") self.state_ledit.setFrame(False) bold_font = self.state_ledit.font() bold_font.setBold(True) self.state_ledit.setFont(bold_font) self.state_ledit.setFixedHeight(24) self.set_in_button.setToolTip("Changes the control state") self.set_out_button.setToolTip("Changes the control state") self.instance_synchronize("state_ledit")
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)
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): BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.__shape_map = {} self.__point_map = {} self.__line_map = {} self.__grid_map = {} self.__original_height = 300 # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Graphics items", self) self.manager_widget = QtImport.load_ui_file("graphics_manager_layout.ui") # Layout -------------------------------------------------------------- _groupbox_vlayout = QtImport.QVBoxLayout(self) _groupbox_vlayout.addWidget(self.manager_widget) _groupbox_vlayout.setSpacing(0) _groupbox_vlayout.setContentsMargins(0, 0, 0, 0) self.main_groupbox.setLayout(_groupbox_vlayout) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) self.setLayout(_main_vlayout) # Qt signal/slot connections ------------------------------------------ self.main_groupbox.toggled.connect(self.main_groupbox_toggled) self.manager_widget.change_color_button.clicked.connect( self.change_color_clicked ) self.manager_widget.display_all_button.clicked.connect( self.display_all_button_clicked ) self.manager_widget.hide_all_button.clicked.connect( self.hide_all_button_clicked ) self.manager_widget.clear_all_button.clicked.connect( self.clear_all_button_clicked ) self.manager_widget.create_point_start_button.clicked.connect( self.create_point_start_button_clicked ) self.manager_widget.create_point_accept_button.clicked.connect( self.create_point_accept_button_clicked ) self.manager_widget.create_line_button.clicked.connect( self.create_line_button_clicked ) self.manager_widget.draw_grid_button.clicked.connect( self.draw_grid_button_clicked ) # self.manager_widget.shapes_treewidget.currentItemChanged.connect(\ # self.shape_treewiget_current_item_changed) self.manager_widget.shapes_treewidget.itemClicked.connect( self.shape_treewiget_item_clicked ) self.manager_widget.shapes_treewidget.customContextMenuRequested.connect( self.show_shape_treewidget_popup ) self.manager_widget.hor_spacing_ledit.textChanged.connect( self.grid_spacing_changed ) self.manager_widget.ver_spacing_ledit.textChanged.connect( self.grid_spacing_changed ) self.manager_widget.move_left_button.clicked.connect( self.grid_move_left_clicked ) self.manager_widget.move_right_button.clicked.connect( self.grid_move_right_clicked ) self.manager_widget.move_up_button.clicked.connect(self.grid_move_up_clicked) self.manager_widget.move_down_button.clicked.connect( self.grid_move_down_clicked ) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- # by default manager is closed self.main_groupbox.setCheckable(True) self.main_groupbox.setChecked(False) self.main_groupbox_toggled(False) self.main_groupbox.setToolTip("Click to open/close item manager") self.connect(HWR.beamline.sample_view, "shapeCreated", self.shape_created) self.connect(HWR.beamline.sample_view, "shapeDeleted", self.shape_deleted) self.connect(HWR.beamline.sample_view, "shapeSelected", self.shape_selected) self.connect( HWR.beamline.sample_view, "centringInProgress", self.centring_in_progress_changed )