Пример #1
0
    def __init__(self, parent=None, name="gphl_setup_widget"):
        QtImport.QWidget.__init__(self, parent)
        if name is not None:
            self.setObjectName(name)

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

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

        # Slots ---------------------------------------------------------------
        dispatcher.connect(self._refresh_interface, "model_update",
                           dispatcher.Any)

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

        # Internal variables -------------------------------------------------
        self._widget_data = OrderedDict()
        self._data_object = GphlAcquisitionData()
        self._pulldowns = {}
        self._pulldown_defaults = {}
        self._parameter_mib = DataModelInputBinder(self._data_object)

        # Graphic elements ----------------------------------------------------
        _parameters_widget = self._parameters_widget = QtImport.QWidget(self)
        QtImport.QGridLayout(_parameters_widget)
        _parameters_widget.layout().setColumnStretch(2, 1)

        # Layout --------------------------------------------------------------
        # This seems to be necessary to make widget visible
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(_parameters_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
Пример #2
0
    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()
Пример #3
0
    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)
Пример #4
0
    def __init__(self, fields, parent=None):
        QtImport.QWidget.__init__(self, parent)
        self.field_widgets = list()

        QtImport.QGridLayout(self)
        self.setSizePolicy(QtImport.QSizePolicy.Expanding,
                           QtImport.QSizePolicy.Expanding)

        current_row = 0
        col_incr = 0
        pad = ""
        for field in fields:
            # should not happen but lets just skip them
            if field["type"] != "message" and "uiLabel" not in field:
                continue

            # hack until the 'real' xml gets implemented server side
            # and this mess gets rewritten
            if field["type"] == "message":
                logging.debug("creating widget with options: %s", field)
                widget = make_widget(self, field)
                # message will be alone in the layout
                # so that will not fsck up the layout
                self.layout().addWidget(widget, current_row, current_row, 0, 1)
            else:
                logging.debug("creating widget with options: %s", field)
                widget = make_widget(self, field)
                # Temporary (like this brick ...) hack to get a nicer UI
                if isinstance(widget, TextEdit):
                    widget.setSizePolicy(
                        QtImport.QSizePolicy.MinimumExpanding,
                        QtImport.QSizePolicy.Minimum,
                    )
                else:
                    widget.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                         QtImport.QSizePolicy.Fixed)
                self.field_widgets.append(widget)
                if field["type"] == "boolean":
                    self.layout().addWidget(widget, current_row, 0 + col_incr,
                                            1, 2, QtImport.Qt.AlignLeft)
                else:
                    label = QtImport.QLabel(pad + field["uiLabel"], self)
                    self.layout().addWidget(label, current_row, 0 + col_incr,
                                            QtImport.Qt.AlignLeft)
                    self.layout().addWidget(widget, current_row, 1 + col_incr,
                                            QtImport.Qt.AlignLeft)

            current_row += 1
            if field.pop("NEW_COLUMN", False):
                # Increment column
                col_incr += 2
                current_row = 0
                pad = " " * 5
        self.update()
Пример #5
0
    def create_gui_from_ui(self, ui_filename):
        widget = self.loadUIFile(ui_filename)
        if widget is not None:
            children = self.children() or []
            for child in children:
                self.removeChild(child)

            layout = QtImport.QGridLayout(self, 1, 1)
            widget.reparent(self)
            widget.show()
            layout.addWidget(widget, 0, 0)
            self.setLayout(layout)
            return widget
Пример #6
0
    def __init__(self, parent):

        QtImport.QDialog.__init__(self, parent)
        # Graphic elements-----------------------------------------------------
        # self.main_gbox = QtGui.QGroupBox('Motor step', self)
        # box2 = QtGui.QWidget(self)
        self.grid = QtImport.QWidget(self)
        label1 = QtImport.QLabel("Current:", self)
        self.current_step = QtImport.QLineEdit(self)
        self.current_step.setEnabled(False)
        label2 = QtImport.QLabel("Set to:", self)
        self.new_step = QtImport.QLineEdit(self)
        self.new_step.setAlignment(QtImport.Qt.AlignRight)
        self.new_step.setValidator(QtImport.QDoubleValidator(self))

        self.button_box = QtImport.QWidget(self)
        self.apply_button = QtImport.QPushButton("Apply", self.button_box)
        self.close_button = QtImport.QPushButton("Dismiss", self.button_box)

        # Layout --------------------------------------------------------------
        self.button_box_layout = QtImport.QHBoxLayout(self.button_box)
        self.button_box_layout.addWidget(self.apply_button)
        self.button_box_layout.addWidget(self.close_button)

        self.grid_layout = QtImport.QGridLayout(self.grid)
        self.grid_layout.addWidget(label1, 0, 0)
        self.grid_layout.addWidget(self.current_step, 0, 1)
        self.grid_layout.addWidget(label2, 1, 0)
        self.grid_layout.addWidget(self.new_step, 1, 1)

        self.main_layout = QtImport.QVBoxLayout(self)
        self.main_layout.addWidget(self.grid)
        self.main_layout.addWidget(self.button_box)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)

        # Qt signal/slot connections -----------------------------------------
        self.new_step.returnPressed.connect(self.apply_clicked)
        self.apply_button.clicked.connect(self.apply_clicked)
        self.close_button.clicked.connect(self.accept)

        # SizePolicies --------------------------------------------------------
        self.close_button.setSizePolicy(
            QtImport.QSizePolicy.Fixed, QtImport.QSizePolicy.Fixed
        )
        self.setSizePolicy(QtImport.QSizePolicy.Minimum, QtImport.QSizePolicy.Minimum)

        # Other ---------------------------------------------------------------
        self.setWindowTitle("Motor step editor")
        self.apply_button.setIcon(Icons.load_icon("Check"))
        self.close_button.setIcon(Icons.load_icon("Delete"))
Пример #7
0
    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, parent=None, name=None, flags=0):

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

        if not name:
            self.setObjectName("RoutineDCWidgetLayout")

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

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

        # Graphic elements ----------------------------------------------------
        self.min_dose_radio = QtImport.QRadioButton(self)
        self.min_time_radio = QtImport.QRadioButton(self)
        self.dose_time_bgroup = QtImport.QButtonGroup(self)
        self.dose_time_bgroup.addButton(self.min_dose_radio)
        self.dose_time_bgroup.addButton(self.min_time_radio)
        self.dose_limit_cbx = QtImport.QCheckBox(self)
        self.time_limit_cbx = QtImport.QCheckBox(self)
        self.dose_ledit = QtImport.QLineEdit(self)
        self.dose_ledit.setMinimumSize(50, 0)
        self.dose_ledit.setMaximumSize(50, 32767)
        self.time_ledit = QtImport.QLineEdit(self)
        self.time_ledit.setMinimumSize(50, 0)
        self.time_ledit.setMaximumSize(50, 32767)
        self.radiation_damage_cbx = QtImport.QCheckBox(self)

        # Layout --------------------------------------------------------------
        _main_gridlayout = QtImport.QGridLayout(self)
        _main_gridlayout.addWidget(self.min_dose_radio, 0, 0)  # , 2, 1)
        _main_gridlayout.addWidget(self.min_time_radio, 1, 0)
        _main_gridlayout.addWidget(self.dose_limit_cbx, 0, 1)
        _main_gridlayout.addWidget(self.time_limit_cbx, 1, 1)
        _main_gridlayout.addWidget(self.dose_ledit, 0, 2)
        _main_gridlayout.addWidget(self.time_ledit, 1, 2)
        _main_gridlayout.addWidget(self.radiation_damage_cbx, 2, 0, 1, 2)
        _main_gridlayout.setColumnStretch(3, 0)

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

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

        # Other ---------------------------------------------------------------
        self.languageChange()
Пример #9
0
    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)
Пример #10
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

        # Properties (name, type, default value, comment)----------------------

        # Properties for hwobj initialization ---------------------------------
        self.add_property("hwobj_flux", "string", "")

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

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

        # Graphic elements ----------------------------------------------------
        flux_label = QtImport.QLabel("Flux:", self)
        beam_label = QtImport.QLabel("Beam:", self)
        dose_label = QtImport.QLabel("Dose:", self)
        self.flux_value_label = QtImport.QLabel("-", self)
        self.beam_info_value_label = QtImport.QLabel("-", self)
        self.dose_value_label = QtImport.QLabel("-", self)

        # Layout --------------------------------------------------------------
        _groupbox_vlayout = QtImport.QGridLayout(self)
        _groupbox_vlayout.addWidget(flux_label, 0, 0)
        _groupbox_vlayout.addWidget(beam_label, 1, 0)
        _groupbox_vlayout.addWidget(dose_label, 2, 0)
        _groupbox_vlayout.addWidget(self.flux_value_label, 0, 1)
        _groupbox_vlayout.addWidget(self.beam_info_value_label, 1, 1)
        _groupbox_vlayout.addWidget(self.dose_value_label, 2, 1)
        _groupbox_vlayout.setSpacing(2)
        _groupbox_vlayout.setContentsMargins(0, 0, 0, 0)

        # SizePolicies --------------------------------------------------------
        flux_label.setMaximumWidth(40)
Пример #11
0
    def __init__(self, *args):
        """
        Based on BaseWidget
        :param args:
        """

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.beam_focusing_hwobj = None
        self.beamline_test_hwobj = None
        self.unf_hor_motor = None
        self.unf_ver_motor = None
        self.double_hor_motor = None
        self.double_ver_motor = None
        self.motor_widget_list = []
        self.focus_mode = None
        self.is_beam_location_phase = False

        # Properties ----------------------------------------------------------
        self.add_property("hwobj_beam_focusing", "string", "")
        self.add_property("hwobj_beamline_test", "string", "/beamline-test")
        self.add_property("hwobj_motors_list", "string", "")
        self.add_property("icon_list", "string", "")
        self.add_property("defaultSteps", "string", "")
        self.add_property("defaultDeltas", "string", "")
        self.add_property("defaultDecimals", "string", "")
        self.add_property("enableCenterBeam", "boolean", True)
        self.add_property("enableMeasureFlux", "boolean", True)
        self.add_property("compactView", "boolean", False)

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

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

        # Graphic elements ----------------------------------------------------
        self.main_group_box = QtImport.QGroupBox(self)
        self.unf_hor_motor_brick = MotorSpinBoxBrick(self.main_group_box)
        self.unf_ver_motor_brick = MotorSpinBoxBrick(self.main_group_box)
        self.double_hor_motor_brick = MotorSpinBoxBrick(self.main_group_box)
        self.double_ver_motor_brick = MotorSpinBoxBrick(self.main_group_box)
        self.motor_widget_list = (
            self.unf_hor_motor_brick,
            self.unf_ver_motor_brick,
            self.double_hor_motor_brick,
            self.double_ver_motor_brick,
        )
        self.center_beam_button = QtImport.QPushButton(self.main_group_box)
        self.center_beam_button.setFixedSize(27, 27)
        self.measure_flux_button = QtImport.QPushButton(self.main_group_box)
        self.measure_flux_button.setFixedSize(27, 27)

        # Layout --------------------------------------------------------------
        _gbox_grid_layout = QtImport.QGridLayout(self.main_group_box)
        _gbox_grid_layout.addWidget(self.unf_hor_motor_brick, 0, 0)
        _gbox_grid_layout.addWidget(self.unf_ver_motor_brick, 1, 0)
        _gbox_grid_layout.addWidget(self.double_hor_motor_brick, 0, 1)
        _gbox_grid_layout.addWidget(self.double_ver_motor_brick, 1, 1)
        _gbox_grid_layout.addWidget(self.center_beam_button, 0, 2)
        _gbox_grid_layout.addWidget(self.measure_flux_button, 1, 2)
        _gbox_grid_layout.setSpacing(2)
        _gbox_grid_layout.setContentsMargins(2, 2, 2, 2)

        _main_hlayout = QtImport.QHBoxLayout(self)
        _main_hlayout.addWidget(self.main_group_box)
        _main_hlayout.setSpacing(0)
        _main_hlayout.setContentsMargins(0, 0, 0, 0)

        # Size Policy ---------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.center_beam_button.clicked.connect(self.center_beam_clicked)
        self.measure_flux_button.clicked.connect(self.measure_flux_clicked)

        # Other ---------------------------------------------------------------
        self.unf_hor_motor_brick.set_label("Horizontal")
        self.unf_ver_motor_brick.set_label("Vertical")
        self.double_hor_motor_brick.set_label("Horizontal")
        self.double_ver_motor_brick.set_label("Vertical")

        self.unf_hor_motor_brick.setEnabled(False)
        self.unf_ver_motor_brick.setEnabled(False)
        self.double_hor_motor_brick.setEnabled(False)
        self.double_ver_motor_brick.setEnabled(False)

        self.double_hor_motor_brick.setVisible(False)
        self.double_ver_motor_brick.setVisible(False)

        self.center_beam_button.setToolTip("Start center beam procedure")
        self.center_beam_button.setIcon(Icons.load_icon("QuickRealign"))
        self.measure_flux_button.setToolTip("Measure flux")
        self.measure_flux_button.setIcon(Icons.load_icon("Sun"))

        self.connect(api.diffractometer, "minidiffPhaseChanged",
                     self.phase_changed)

        api.diffractometer.update_values()
        self.update_gui()
Пример #12
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.set_according_to_energy_button.setFixedWidth(30)
        self.set_out_button.setFixedWidth(30)
        self.crl_lense_in_button.setFixedWidth(30)
        self.crl_lense_out_button.setFixedWidth(30)
Пример #13
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_gbox = QtImport.QGroupBox("Slits", self)  # h
        hor_label = QtImport.QLabel("Horizontal:", self.main_gbox)
        self.current_hor_pos_ledit = QtImport.QLineEdit(self.main_gbox)
        self.current_hor_pos_ledit.setAlignment(QtImport.Qt.AlignRight)
        boldFont = self.current_hor_pos_ledit.font()
        boldFont.setBold(True)
        self.current_hor_pos_ledit.setFont(boldFont)
        self.current_hor_pos_ledit.setMaximumWidth(120)
        self.current_hor_pos_ledit.setEnabled(False)
        self.hor_pos_dspinbox = QtImport.QSpinBox(self.main_gbox)
        # self.hor_pos_dspinbox.setMaximumWidth(120)
        # self.hor_pos_dspinbox.setEnabled(False)
        self.set_hor_gap_button = QtImport.QPushButton(
            Icons.load_icon("Draw"), "", self.main_gbox
        )
        # self.set_hor_gap_button.setEnabled(False)
        self.set_hor_gap_button.setFixedSize(27, 27)
        self.stop_hor_button = QtImport.QPushButton(
            Icons.load_icon("Stop2"), "", self.main_gbox
        )
        self.stop_hor_button.setEnabled(False)
        self.stop_hor_button.setFixedSize(27, 27)

        # Vertical gap
        ver_label = QtImport.QLabel("Vertical:", self.main_gbox)
        self.current_ver_pos_ledit = QtImport.QLineEdit(self.main_gbox)
        self.current_ver_pos_ledit.setAlignment(QtImport.Qt.AlignRight)
        self.current_ver_pos_ledit.setFont(boldFont)
        self.current_ver_pos_ledit.setMaximumWidth(120)
        self.current_ver_pos_ledit.setEnabled(False)
        self.ver_pos_dspinbox = QtImport.QSpinBox(self.main_gbox)
        # self.ver_pos_dspinbox.setMaximumWidth(70)
        # self.ver_pos_dspinbox.setEnabled(False)
        self.set_ver_gap_button = QtImport.QPushButton(
            Icons.load_icon("Draw"), "", self.main_gbox
        )
        # self.set_ver_gap_button.setEnabled(False)
        self.set_ver_gap_button.setFixedSize(27, 27)
        self.stop_ver_button = QtImport.QPushButton(
            Icons.load_icon("Stop2"), "", self.main_gbox
        )
        self.stop_ver_button.setEnabled(False)
        self.stop_ver_button.setFixedSize(27, 27)

        self.test_button = QtImport.QPushButton("Test", self.main_gbox)
        self.test_button.hide()

        # Layout --------------------------------------------------------------
        _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox)
        _main_gbox_gridlayout.addWidget(hor_label, 0, 0)
        _main_gbox_gridlayout.addWidget(self.current_hor_pos_ledit, 0, 1)
        _main_gbox_gridlayout.addWidget(self.hor_pos_dspinbox, 0, 2)
        _main_gbox_gridlayout.addWidget(self.set_hor_gap_button, 0, 3)
        _main_gbox_gridlayout.addWidget(self.stop_hor_button, 0, 4)
        _main_gbox_gridlayout.addWidget(ver_label, 1, 0)
        _main_gbox_gridlayout.addWidget(self.current_ver_pos_ledit, 1, 1)
        _main_gbox_gridlayout.addWidget(self.ver_pos_dspinbox, 1, 2)
        _main_gbox_gridlayout.addWidget(self.set_ver_gap_button, 1, 3)
        _main_gbox_gridlayout.addWidget(self.stop_ver_button, 1, 4)
        _main_gbox_gridlayout.setSpacing(2)
        _main_gbox_gridlayout.setContentsMargins(0, 0, 0, 0)

        _main_gbox_gridlayout.addWidget(self.test_button, 0, 5)

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

        # Qt signal/slot connections ------------------------------------------
        hor_spinbox_event = SpinBoxEvent(self.hor_pos_dspinbox)
        self.hor_pos_dspinbox.installEventFilter(hor_spinbox_event)
        hor_spinbox_event.returnPressedSignal.connect(self.change_hor_gap)

        self.hor_pos_dspinbox.lineEdit().textChanged.connect(self.hor_gap_edited)
        self.set_hor_gap_button.clicked.connect(self.change_hor_gap)
        self.stop_hor_button.clicked.connect(self.stop_hor_clicked)

        ver_spinbox_event = SpinBoxEvent(self.ver_pos_dspinbox)
        self.ver_pos_dspinbox.installEventFilter(ver_spinbox_event)
        ver_spinbox_event.returnPressedSignal.connect(self.change_ver_gap)

        self.ver_pos_dspinbox.lineEdit().textChanged.connect(self.ver_gap_edited)
        self.ver_pos_dspinbox.lineEdit().returnPressed.connect(self.change_ver_gap)
        self.set_ver_gap_button.clicked.connect(self.change_ver_gap)
        self.stop_ver_button.clicked.connect(self.stop_ver_clicked)

        self.test_button.clicked.connect(self.test_clicked)

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

        # Other ---------------------------------------------------------------
        self.current_hor_pos_ledit.setToolTip("Current horizontal gap size")
        self.set_hor_gap_button.setToolTip("Set new horizontal gap size")
        self.stop_hor_button.setToolTip("Stop horizontal slits movements")
        self.current_ver_pos_ledit.setToolTip("Current vertical gap size")
        self.set_ver_gap_button.setToolTip("Set new vertical gap size")
        self.stop_ver_button.setToolTip("Stop vertical slits movements")
Пример #14
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)
        self.logger = logging.getLogger("GUI MachineInfo")
        self.logger.info("__init__()")
        # Hardware objects ----------------------------------------------------
        self.mach_info_hwobj = None

        # Internal values -----------------------------------------------------
        # self.last_value = None

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "")
        self.add_property("formatString", "formatString", "###.#")
        # self.addProperty('diskThreshold', 'float', '200')

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

        # Slots ---------------------------------------------------------------
        self.defineSlot("setColDir", ())

        # Graphic elements ----------------------------------------------------
        self.groupBox = QtImport.QGroupBox("Machine Info", self)
        _main_layout = QtImport.QVBoxLayout(self)
        _main_layout.addWidget(self.groupBox)
        _main_layout.setSpacing(1)
        _main_layout.setContentsMargins(1, 1, 1, 1)

        _glayout = QtImport.QGridLayout()

        self.groupBox.setLayout(_glayout)

        self.current_label = QtImport.QLabel("Machine current:")
        self.current_value_label = QtImport.QLabel()
        self.current_value_label.setAlignment(QtImport.Qt.AlignCenter)
        self.current_value_label.setStyleSheet(
            "font-size: 24px;font-weight: bold; color: #00f")

        # State text
        self.state_text_label = QtImport.QLabel("Machine status:")
        self.state_text_value_label = QtImport.QLabel()
        self.state_text_value_label.setAlignment(QtImport.Qt.AlignCenter)
        self.state_text_value_label.setStyleSheet("font-size: 18px;")

        # TopUp Remaining
        self.topup_remaining_label = QtImport.QLabel("TopUp Remaining:")
        self.topup_remaining_value_label = QtImport.QLabel()
        self.topup_remaining_value_label.setAlignment(QtImport.Qt.AlignCenter)
        self.topup_remaining_value_label.setStyleSheet("font-size: 18px;")

        # Layout --------------------------------------------------------------
        _glayout.addWidget(self.current_label, 0, 0)
        _glayout.addWidget(self.current_value_label, 0, 1)
        _glayout.addWidget(self.state_text_label, 1, 0)
        _glayout.addWidget(self.state_text_value_label, 1, 1)
        _glayout.addWidget(self.topup_remaining_label, 2, 0)
        _glayout.addWidget(self.topup_remaining_value_label, 2, 1)
        _glayout.setSpacing(1)
        _glayout.setContentsMargins(8, 8, 8, 8)

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

        # Other ---------------------------------------------------------------
        self.setToolTip("Main information about machine current, " +
                        "machine status and top-up remaining time.")
Пример #15
0
    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")
Пример #16
0
    def __init__(self, *args):
        """
        Main init
        :param args:
        """

        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        HWR.beamline.sample_changer.re_emit_values()
Пример #17
0
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name, fl, "Energy scan")

        if not name:
            self.setObjectName("create_energy_scan_widget")

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

        # Internal variables --------------------------------------------------
        self.init_models()

        # Graphic elements ----------------------------------------------------
        self._periodic_table_widget = PeriodicTableWidget(self)
        self._data_path_widget = DataPathWidget(self,
                                                data_model=self._path_template,
                                                layout="vertical")

        _parameters_gbox = QtImport.QGroupBox("Parameters", self)
        self._adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", _parameters_gbox)
        self._adjust_transmission_cbox.setChecked(False)
        self._adjust_transmission_cbox.setEnabled(True)
        self._max_transmission_label = QtImport.QLabel("Maximum transmission:")
        self._max_transmission_ledit = QtImport.QLineEdit(
            "20", _parameters_gbox)
        self._max_transmission_ledit.setFixedWidth(80)
        self._max_transmission_ledit.setEnabled(False)

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = QtImport.QGridLayout(_parameters_gbox)
        _parameters_gbox_hlayout.addWidget(self._adjust_transmission_cbox, 0,
                                           0)
        _parameters_gbox_hlayout.addWidget(self._max_transmission_label, 1, 0)
        _parameters_gbox_hlayout.addWidget(self._max_transmission_ledit, 1, 1)
        _parameters_gbox_hlayout.setColumnStretch(2, 1)
        _parameters_gbox_hlayout.setSpacing(2)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self._periodic_table_widget)
        _main_vlayout.addWidget(self._data_path_widget)
        _main_vlayout.addWidget(_parameters_gbox)
        _main_vlayout.addWidget(self._comments_widget)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(6)
        _main_vlayout.addStretch(10)

        # SizePolicies --------------------------------------------------------
        self._comments_widget.setFixedHeight(100)

        # Qt signal/slot connections ------------------------------------------
        # self._periodic_table_widget.elementEdgeSelectedSignal.connect(\
        #     self.acq_parameters_changed)
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed)
        self._adjust_transmission_cbox.stateChanged.connect(
            self.adjust_transmission_state_changed)
        self._max_transmission_ledit.textEdited.connect(
            self.max_transmission_value_changed)

        self._data_path_widget.data_path_layout.compression_cbox.setVisible(
            False)

        try:
            self._periodic_table_widget.set_elements(
                HWR.beamline.energy_scan.get_elements())

            max_transmission_value = (
                HWR.beamline.energy_scan.get_max_transmission_value())

            self._adjust_transmission_cbox.setEnabled(True)
            self._adjust_transmission_cbox.setChecked(True)
            HWR.beamline.energy_scan.adjust_transmission(True)

            if max_transmission_value:
                self._max_transmission_ledit.setText("%.2f" %
                                                     max_transmission_value)
        except BaseException:
            pass
Пример #18
0
    def __init__(self, parent=None, name=None, flags=0):
        QtImport.QDialog.__init__(
            self,
            parent,
            QtImport.Qt.WindowFlags(flags | QtImport.Qt.WindowStaysOnTopHint),
        )

        # Internal variables --------------------------------------------------
        self.camera_hwobj = None

        # Graphic elements ----------------------------------------------------
        self.contrast_slider = QtImport.QSlider(QtImport.Qt.Horizontal, self)
        self.contrast_doublespinbox = QtImport.QDoubleSpinBox(self)
        self.contrast_checkbox = QtImport.QCheckBox("auto", self)
        self.brightness_slider = QtImport.QSlider(QtImport.Qt.Horizontal, self)
        self.brightness_doublespinbox = QtImport.QDoubleSpinBox(self)
        self.brightness_checkbox = QtImport.QCheckBox("auto", self)
        self.gain_slider = QtImport.QSlider(QtImport.Qt.Horizontal, self)
        self.gain_doublespinbox = QtImport.QDoubleSpinBox(self)
        self.gain_checkbox = QtImport.QCheckBox("auto", self)
        self.gamma_slider = QtImport.QSlider(QtImport.Qt.Horizontal, self)
        self.gamma_doublespinbox = QtImport.QDoubleSpinBox(self)
        self.gamma_checkbox = QtImport.QCheckBox("auto", self)
        self.exposure_time_slider = QtImport.QSlider(QtImport.Qt.Horizontal,
                                                     self)
        self.exposure_time_doublespinbox = QtImport.QDoubleSpinBox(self)
        self.exposure_time_checkbox = QtImport.QCheckBox("auto", self)
        __close_button = QtImport.QPushButton("Close", self)

        # Layout --------------------------------------------------------------
        __main_gridlayout = QtImport.QGridLayout(self)
        __main_gridlayout.addWidget(QtImport.QLabel("Contrast:", self), 0, 0)
        __main_gridlayout.addWidget(self.contrast_slider, 0, 1)
        __main_gridlayout.addWidget(self.contrast_doublespinbox, 0, 2)
        __main_gridlayout.addWidget(self.contrast_checkbox, 0, 3)
        __main_gridlayout.addWidget(QtImport.QLabel("Brightness:", self), 1, 0)
        __main_gridlayout.addWidget(self.brightness_slider, 1, 1)
        __main_gridlayout.addWidget(self.brightness_doublespinbox, 1, 2)
        __main_gridlayout.addWidget(self.brightness_checkbox, 1, 3)
        __main_gridlayout.addWidget(QtImport.QLabel("Gain:", self), 2, 0)
        __main_gridlayout.addWidget(self.gain_slider, 2, 1)
        __main_gridlayout.addWidget(self.gain_doublespinbox, 2, 2)
        __main_gridlayout.addWidget(self.gain_checkbox, 2, 3)
        __main_gridlayout.addWidget(QtImport.QLabel("Gamma:", self), 3, 0)
        __main_gridlayout.addWidget(self.gamma_slider, 3, 1)
        __main_gridlayout.addWidget(self.gamma_doublespinbox, 3, 2)
        __main_gridlayout.addWidget(self.gamma_checkbox, 3, 3)
        __main_gridlayout.addWidget(
            QtImport.QLabel("Exposure time (ms):", self), 4, 0)
        __main_gridlayout.addWidget(self.exposure_time_slider, 4, 1)
        __main_gridlayout.addWidget(self.exposure_time_doublespinbox, 4, 2)
        __main_gridlayout.addWidget(self.exposure_time_checkbox, 4, 3)
        __main_gridlayout.addWidget(__close_button, 6, 2)
        __main_gridlayout.setSpacing(2)
        __main_gridlayout.setContentsMargins(5, 5, 5, 5)
        __main_gridlayout.setSizeConstraint(QtImport.QLayout.SetFixedSize)

        # Qt signal/slot connections ------------------------------------------
        self.contrast_slider.valueChanged.connect(self.set_contrast)
        self.contrast_doublespinbox.valueChanged.connect(self.set_contrast)
        self.contrast_checkbox.stateChanged.connect(self.set_contrast_auto)
        self.brightness_slider.valueChanged.connect(self.set_brightness)
        self.brightness_doublespinbox.valueChanged.connect(self.set_brightness)
        self.brightness_checkbox.stateChanged.connect(self.set_brightness_auto)
        self.gain_slider.valueChanged.connect(self.set_gain)
        self.gain_doublespinbox.valueChanged.connect(self.set_gain)
        self.gain_checkbox.stateChanged.connect(self.set_gain_auto)
        self.gamma_slider.valueChanged.connect(self.set_gamma)
        self.gamma_doublespinbox.valueChanged.connect(self.set_gamma)
        self.gamma_checkbox.stateChanged.connect(self.set_gamma_auto)
        self.exposure_time_slider.valueChanged.connect(self.set_exposure_time)
        self.exposure_time_doublespinbox.valueChanged.connect(
            self.set_exposure_time)
        self.exposure_time_checkbox.stateChanged.connect(
            self.set_exposure_time_auto)

        __close_button.clicked.connect(self.close)

        # SizePolicies --------------------------------------------------------
        self.contrast_slider.setFixedWidth(200)
        self.brightness_slider.setFixedWidth(200)
        self.gain_slider.setFixedWidth(200)
        self.gamma_slider.setFixedWidth(200)
        self.exposure_time_slider.setFixedWidth(200)
        __close_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                     QtImport.QSizePolicy.Fixed)

        # Other ---------------------------------------------------------------
        self.setModal(True)
        self.setWindowTitle("Camera controls")
Пример #19
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",
        )
Пример #20
0
    def __init__(self, configuration):

        QtImport.QDialog.__init__(self, None)

        # Internal values -----------------------------------------------------
        self.has_changed = None
        self.configuration = configuration
        self.signalling_child_dict = {}
        self.receiving_child_dict = {}
        self.connecting_child_dict = {}

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

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

        # Graphic elements ----------------------------------------------------
        main_splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self)
        top_panel = QtImport.QWidget(main_splitter)
        bot_panel = QtImport.QWidget(main_splitter)

        emitter_panel = QtImport.QWidget(top_panel)
        self.emitter_windows_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_objects_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_signals_listwidget = QtImport.QListWidget(emitter_panel)
        self.emitter_objects_listwidget.setSortingEnabled(True)
        self.emitter_signals_listwidget.setSortingEnabled(True)

        receiver_panel = QtImport.QWidget(top_panel)
        self.receiver_windows_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_objects_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_slots_listwidget = QtImport.QListWidget(emitter_panel)
        self.receiver_objects_listwidget.setSortingEnabled(True)
        self.receiver_slots_listwidget.setSortingEnabled(True)

        self.add_connection_button = QtImport.QPushButton(
            "Add connection", self)

        self.connections_treewidget = QtImport.QTreeWidget(bot_panel)
        button_panel = QtImport.QWidget(bot_panel)
        self.remove_connection_button = QtImport.QPushButton(
            "Remove connection", button_panel)
        self.ok_button = QtImport.QPushButton("OK", button_panel)
        self.cancel_button = QtImport.QPushButton("Cancel", button_panel)

        # Layout --------------------------------------------------------------
        emitter_panel_layout = QtImport.QGridLayout(emitter_panel)
        emitter_panel_layout.addWidget(
            QtImport.QLabel("<h3>Emitters</h3>", self), 0, 1,
            QtImport.Qt.AlignHCenter)
        emitter_panel_layout.addWidget(QtImport.QLabel("Windows", self), 1, 0)
        emitter_panel_layout.addWidget(QtImport.QLabel("Objects", self), 1, 1)
        emitter_panel_layout.addWidget(QtImport.QLabel("Signals", self), 1, 2)
        emitter_panel_layout.addWidget(self.emitter_windows_listwidget, 2, 0)
        emitter_panel_layout.addWidget(self.emitter_objects_listwidget, 2, 1)
        emitter_panel_layout.addWidget(self.emitter_signals_listwidget, 2, 2)

        receiver_panel_layout = QtImport.QGridLayout(receiver_panel)
        receiver_panel_layout.addWidget(
            QtImport.QLabel("<h3>Receivers</h3>", self), 0, 1,
            QtImport.Qt.AlignHCenter)
        receiver_panel_layout.addWidget(QtImport.QLabel("Windows", self), 1, 0)
        receiver_panel_layout.addWidget(QtImport.QLabel("Objects", self), 1, 1)
        receiver_panel_layout.addWidget(QtImport.QLabel("Slots", self), 1, 2)
        receiver_panel_layout.addWidget(self.receiver_windows_listwidget, 2, 0)
        receiver_panel_layout.addWidget(self.receiver_objects_listwidget, 2, 1)
        receiver_panel_layout.addWidget(self.receiver_slots_listwidget, 2, 2)

        top_panel_layout = QtImport.QHBoxLayout(top_panel)
        top_panel_layout.addWidget(emitter_panel)
        top_panel_layout.addWidget(receiver_panel)
        top_panel_layout.addWidget(self.add_connection_button)
        top_panel_layout.setSpacing(0)
        top_panel_layout.setContentsMargins(0, 0, 0, 0)

        button_panel_layout = QtImport.QHBoxLayout(button_panel)
        button_panel_layout.addWidget(self.remove_connection_button)
        button_panel_layout.addStretch(0)
        button_panel_layout.addWidget(self.ok_button, QtImport.Qt.AlignRight)
        button_panel_layout.addWidget(self.cancel_button,
                                      QtImport.Qt.AlignRight)

        bot_panel_vlayout = QtImport.QVBoxLayout(bot_panel)
        bot_panel_vlayout.addWidget(
            QtImport.QLabel("<h3>Established connections</h3>", bot_panel))
        bot_panel_vlayout.addWidget(self.connections_treewidget)
        bot_panel_vlayout.addWidget(button_panel)

        main_splitter_vbox = QtImport.QVBoxLayout(main_splitter)
        main_splitter_vbox.addWidget(top_panel)
        main_splitter_vbox.addWidget(bot_panel)
        main_splitter_vbox.setSpacing(5)
        main_splitter_vbox.setContentsMargins(2, 2, 2, 2)

        main_layout = QtImport.QVBoxLayout(self)
        main_layout.addWidget(main_splitter)

        # SizePolicies --------------------------------------------------------
        self.add_connection_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                                 QtImport.QSizePolicy.Fixed)
        self.remove_connection_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                                    QtImport.QSizePolicy.Fixed)
        self.ok_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                     QtImport.QSizePolicy.Fixed)
        self.cancel_button.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                         QtImport.QSizePolicy.Fixed)
        self.connections_treewidget.setSizePolicy(
            QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding)

        # Qt signal/slot connections ------------------------------------------
        self.emitter_windows_listwidget.currentItemChanged.connect(
            self.emitter_window_changed)
        self.emitter_objects_listwidget.currentItemChanged.connect(
            self.emitter_object_changed)
        self.receiver_windows_listwidget.currentItemChanged.connect(
            self.receiver_window_changed)
        self.receiver_objects_listwidget.currentItemChanged.connect(
            self.receiver_object_changed)
        self.add_connection_button.clicked.connect(
            self.add_connection_button_clicked)
        self.remove_connection_button.clicked.connect(
            self.remove_connection_button_clicked)
        self.ok_button.clicked.connect(self.ok_button_clicked)
        self.cancel_button.clicked.connect(self.cancel_button_clicked)
        self.connections_treewidget.itemSelectionChanged.connect(
            self.connections_treewidget_selection_changed)

        # Other ---------------------------------------------------------------
        self.connections_treewidget.setColumnCount(7)
        self.connections_treewidget.setHeaderLabels([
            "",
            "Emitter window",
            "Emitter object",
            "Signal",
            "Receiver window",
            "Receiver object",
            "Slot",
        ])
        self.setWindowTitle("Connection Editor")
        self.connections_treewidget.setSortingEnabled(True)