示例#1
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()
    def __init__(self, parent=None, name=None, flags=0):

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.rad_damage_cbx = QtImport.QCheckBox(self)
        _label_widget = QtImport.QWidget(self)
        self.burn_osc_start_label = QtImport.QLabel(_label_widget)
        self.burn_osc_start_ledit = QtImport.QLineEdit(_label_widget)
        self.burn_osc_start_ledit.setMinimumSize(50, 0)
        self.burn_osc_start_ledit.setMaximumSize(50, 32767)

        _value_widget = QtImport.QWidget(self)
        self.burn_osc_interval_label = QtImport.QLabel(_value_widget)
        self.burn_osc_interval_ledit = QtImport.QLineEdit(_value_widget)
        self.burn_osc_interval_ledit.setMinimumSize(50, 0)
        self.burn_osc_interval_ledit.setMaximumSize(50, 32767)

        # Layout --------------------------------------------------------------
        _label_widget_hlayout = QtImport.QHBoxLayout(self)
        _label_widget_hlayout.addWidget(self.burn_osc_start_label)
        _label_widget_hlayout.addWidget(self.burn_osc_start_ledit)
        _label_widget_hlayout.addStretch(0)
        _label_widget_hlayout.setSpacing(0)
        _label_widget_hlayout.setContentsMargins(0, 0, 0, 0)
        _label_widget.setLayout(_label_widget_hlayout)

        _value_hlayout = QtImport.QHBoxLayout(self)
        _value_hlayout.addWidget(self.burn_osc_interval_label)
        _value_hlayout.addWidget(self.burn_osc_interval_ledit)
        _value_hlayout.addStretch(0)
        _value_hlayout.setSpacing(0)
        _value_hlayout.setContentsMargins(0, 0, 0, 0)
        _value_widget.setLayout(_value_hlayout)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.rad_damage_cbx)
        _main_vlayout.addWidget(_label_widget)
        _main_vlayout.addWidget(_value_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(_main_vlayout)

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

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

        # Other ---------------------------------------------------------------
        self.languageChange()
示例#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, 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"))
示例#5
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()
示例#7
0
    def __init__(self, parent=None):
        """"
        Constructor of MoveBox

        :param parent: MoveBox parent widget
        """
        super(MoveBox, self).__init__(parent)

        self.old_positions = []  # history of motor positions

        self.label_move = QtImport.QLabel("go to ", self)
        self.text_move = QtImport.QLineEdit("", self)
        self.cmd_move = QtImport.QPushButton("", self)
        self.cmd_move.setCheckable(True)
        self.cmd_go_back = QtImport.QPushButton("", self)
        self.cmd_stop = QtImport.QPushButton("", self)

        self.text_move.setFixedWidth(
            self.text_move.fontMetrics().width("8888.8888"))
        self.cmd_move.setCheckable(True)
        self.cmd_stop.setIcon(Icons.load_icon("stop_small"))
        self.cmd_stop.setEnabled(False)
        self.cmd_go_back.setIcon(Icons.load_icon("goback_small"))
        self.cmd_move.setIcon(Icons.load_icon("move_small"))
        self.cmd_go_back.setEnabled(False)

        # connections

        self.text_move.textChanged.connect(self.text_move_text_changed)
        self.cmd_move.clicked.connect(self.move_clicked)
        self.cmd_stop.clicked.connect(self.stop_motor_signal)
        self.text_move.returnPressed.connect(self.text_move_return_pressed)
        self.cmd_go_back.clicked.connect(self.go_back_clicked)

        # layout

        hboxlayout = QtImport.QHBoxLayout(self)

        hboxlayout.insertSpacerItem(
            0,
            QtImport.QSpacerItem(0, 0, QtImport.QSizePolicy.Expanding,
                                 QtImport.QSizePolicy.Fixed))

        hboxlayout.addWidget(self.label_move)
        hboxlayout.addWidget(self.text_move)
        hboxlayout.addWidget(self.cmd_move)
        hboxlayout.addWidget(self.cmd_go_back)
        hboxlayout.addWidget(self.cmd_stop)
        hboxlayout.insertSpacerItem(
            0,
            QtImport.QSpacerItem(0, 0, QtImport.QSizePolicy.Expanding,
                                 QtImport.QSizePolicy.Fixed))

        self.setLayout(hboxlayout)
示例#8
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Signals ------------------------------------------------------------
        self.define_signal("incoming_unread_messages", ())
        self.define_signal("reset_unread_message", ())

        # Slots ---------------------------------------------------------------
        self.define_slot("tabSelected", ())
        self.define_slot("sessionSelected", ())

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

        # Internal values -----------------------------------------------------
        self.session_id = None
        self.nickname = ""
        self.role = BaseWidget.INSTANCE_ROLE_UNKNOWN

        # Graphic elements ----------------------------------------------------
        self.conversation_textedit = QtImport.QTextEdit(self)
        self.conversation_textedit.setReadOnly(True)
        _controls_widget = QtImport.QWidget(self)
        _say_label = QtImport.QLabel("Say:", _controls_widget)
        self.message_ledit = QtImport.QLineEdit(_controls_widget)
        self.send_button = QtImport.QPushButton("Send", _controls_widget)
        self.send_button.setEnabled(False)

        # Layout --------------------------------------------------------------
        _controls_widget_hlayout = QtImport.QHBoxLayout(_controls_widget)
        _controls_widget_hlayout.addWidget(_say_label)
        _controls_widget_hlayout.addWidget(self.message_ledit)
        _controls_widget_hlayout.addWidget(self.send_button)
        _controls_widget_hlayout.setSpacing(2)
        _controls_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.conversation_textedit)
        _main_vlayout.addWidget(_controls_widget)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # Qt signal/slot connections ------------------------------------------
        self.send_button.clicked.connect(self.send_current_message)
        self.message_ledit.returnPressed.connect(self.send_current_message)
        self.message_ledit.textChanged.connect(self.message_changed)
示例#9
0
 def populateColumn(self, colNum, values, colours=None):
     """Fill values into column, extending if necessary"""
     if len(values) > self.rowCount():
         self.setRowCount(len(values))
     for rowNum, text in enumerate(values):
         wdg = QtImport.QLineEdit(self)
         wdg.setFont(QtImport.QFont("Courier"))
         wdg.setReadOnly(True)
         wdg.setText(ConvertUtils.text_type(text))
         if colours:
             colour = colours[rowNum]
             if colour:
                 Colors.set_widget_color(wdg, getattr(Colors, colour),
                                         QtImport.QPalette.Base)
                 # wdg.setBackground(getattr(QtImport.QColor, colour))
         self.setCellWidget(rowNum, colNum, wdg)
示例#10
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

        # Other ---------------------------------------------------------------
        self.method_table.setColumnCount(2)
        self.method_table.setHorizontalHeaderLabels(
            ["Type", "Method (Parameters)"])
        self.property_table.setColumnCount(4)
        self.property_table.setHorizontalHeaderLabels(
            ["Type", "Property", "Access", "Value"])
        self.setFixedWidth(600)
示例#11
0
    def __init__(self, parent=None, name=None, flags=0):

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.optimised_sad_cbx = QtImport.QCheckBox("Optimised SAD", self)
        self.automatic_resolution_radio = QtImport.QRadioButton(self)
        _optimal_sad_widget = QtImport.QWidget(self)
        self.optimal_sad_radio = QtImport.QRadioButton(
            "Optimal SAD for given resolution:", _optimal_sad_widget
        )
        self.sad_bgroup = QtImport.QButtonGroup(self)
        self.sad_bgroup.addButton(self.automatic_resolution_radio)
        self.sad_bgroup.addButton(self.optimal_sad_radio)
        self.sad_resolution_ledit = QtImport.QLineEdit(_optimal_sad_widget)
        self.sad_resolution_ledit.setMinimumSize(50, 0)
        self.sad_resolution_ledit.setMaximumSize(50, 32767)

        # Layout --------------------------------------------------------------
        _optimal_sad_widget_hlayout = QtImport.QHBoxLayout(_optimal_sad_widget)
        _optimal_sad_widget_hlayout.addWidget(self.optimal_sad_radio)
        _optimal_sad_widget_hlayout.addWidget(self.sad_resolution_ledit)
        _optimal_sad_widget_hlayout.setSpacing(0)
        _optimal_sad_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.optimised_sad_cbx)
        _main_vlayout.addWidget(self.automatic_resolution_radio)
        _main_vlayout.addWidget(_optimal_sad_widget)
        _main_vlayout.addStretch(0)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.automatic_resolution_radio.setText(
            self.trUtf8(
                "\x52\x65\x73\x6f\x6c\x75\x74\x69\x6f\x6e\x20\x73\x65\x6c\x65\x63\x74\x65\x64\x20\x61\x75\x74\x6f\x6d\x61\x74\x69\x63\x61\x6c\x6c\x79\x2c\x20\x72\x6f\x74\x61\x74\x69\x6f\x6e\x20\x69\x6e\x74\x65\x72\x76\x61\x6c\x3a\x20\x33\x36\x30\xc2\xb0"
            )
        )
示例#12
0
    def __init__(self, parent):

        QtImport.QWidget.__init__(self, parent)

        self.home_url = None

        self.navigation_bar = QtImport.QWidget(self)
        self.url_ledit = QtImport.QLineEdit(self.navigation_bar)
        self.url_ledit.setReadOnly(True)
        self.home_button = QtImport.QPushButton(self.navigation_bar)
        self.back_button = QtImport.QPushButton(self.navigation_bar)
        self.forward_button = QtImport.QPushButton(self.navigation_bar)

        self.home_button.setIcon(Icons.load_icon("Home2"))
        self.back_button.setIcon(Icons.load_icon("Left2"))
        self.forward_button.setIcon(Icons.load_icon("Right2"))

        #if QWEBVIEW_AVAILABLE:
        #    self.web_page_viewer = QtImport.QWebView(self)
        #    self.web_page_viewer.settings().setObjectCacheCapacities(0, 0, 0)
        #else:
        self.web_page_viewer = QtImport.QTextBrowser(self)

        _navigation_bar_hlayout = QtImport.QHBoxLayout(self.navigation_bar)
        _navigation_bar_hlayout.addWidget(self.home_button)
        _navigation_bar_hlayout.addWidget(self.back_button)
        _navigation_bar_hlayout.addWidget(self.forward_button)
        _navigation_bar_hlayout.addWidget(self.url_ledit)
        _navigation_bar_hlayout.setSpacing(2)
        _navigation_bar_hlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.navigation_bar)
        _main_vlayout.addWidget(self.web_page_viewer)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        self.home_button.clicked.connect(self.go_to_home_page)
        self.back_button.clicked.connect(self.go_back)
        self.forward_button.clicked.connect(self.go_forward)
示例#13
0
    def __init__(self, parent, options):
        QtImport.QWidget.__init__(self, parent)

        # do not allow qt to stretch us vertically
        policy = self.sizePolicy()
        policy.setVerticalPolicy(QtImport.QSizePolicy.Fixed)
        self.setSizePolicy(policy)

        QtImport.QHBoxLayout(self)
        self.__name = options["variableName"]
        self.filepath = QtImport.QLineEdit(self)
        self.filepath.setAlignment(QtImport.Qt.AlignLeft)
        if "defaultValue" in options:
            self.filepath.setText(options["defaultValue"])
        self.open_dialog_btn = QtImport.QPushButton("...", self)
        self.open_dialog_btn.clicked.connect(self.open_file_dialog)

        self.layout().addWidget(self.filepath)
        self.layout().addWidget(self.open_dialog_btn)
示例#14
0
    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.position_label = QtImport.QLineEdit(self)
        self.position_label.setFixedWidth(60)
        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.position_label)
        _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.position_label.returnPressed.connect(self.position_edited)
        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)
示例#15
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()
示例#16
0
    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()))
示例#17
0
    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")
示例#18
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")
示例#19
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.axis_camera = None
        self.sc_camera = None

        # Properties ----------------------------------------------------------
        self.add_property("hwobj_axis_camera", "string", "")
        self.add_property("hwobj_sc_camera", "string", "")

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

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

        # Graphic elements ----------------------------------------------------
        status_widget = QtImport.QWidget(self)
        status_label = QtImport.QLabel("Status: ", status_widget)
        self.status_ledit = QtImport.QLineEdit(status_widget)

        self.camera_live_cbx = QtImport.QCheckBox("Live view", self)
        self.camera_live_cbx.setChecked(False)

        self.progress_bar = QtImport.QProgressBar(self)
        self.progress_bar.setMinimum(0)

        camera_widget = QtImport.QWidget(self)

        self.axis_view = QtImport.QGraphicsView(camera_widget)
        axis_scene = QtImport.QGraphicsScene(self.axis_view)
        self.axis_view.setScene(axis_scene)
        self.axis_camera_pixmap_item = QtImport.QGraphicsPixmapItem()
        axis_scene.addItem(self.axis_camera_pixmap_item)

        self.sc_view = QtImport.QGraphicsView(camera_widget)
        sc_scene = QtImport.QGraphicsScene(self.sc_view)
        self.sc_view.setScene(sc_scene)
        self.sc_camera_pixmap_item = QtImport.QGraphicsPixmapItem()
        sc_scene.addItem(self.sc_camera_pixmap_item)

        # Layout --------------------------------------------------------------
        _status_widget_hlayout = QtImport.QHBoxLayout(status_widget)
        _status_widget_hlayout.addWidget(status_label)
        _status_widget_hlayout.addWidget(self.status_ledit)

        _camera_widget_hlayout = QtImport.QHBoxLayout(camera_widget)
        _camera_widget_hlayout.addWidget(self.axis_view)
        _camera_widget_hlayout.addWidget(self.sc_view)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(status_widget)
        _main_vlayout.addWidget(self.camera_live_cbx)
        _main_vlayout.addWidget(camera_widget)
        _main_vlayout.addWidget(self.progress_bar)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.camera_live_cbx.stateChanged.connect(
            self.camera_live_state_changed)

        if HWR.beamline.sample_changer is not None:
            self.connect(
                HWR.beamline.sample_changer,
                SampleChanger.STATUS_CHANGED_EVENT,
                self.sample_changer_status_changed,
            )
            self.connect(HWR.beamline.sample_changer, "progressInit",
                         self.init_progress)
            self.connect(HWR.beamline.sample_changer, "progressStep",
                         self.step_progress)
            self.connect(HWR.beamline.sample_changer, "progressStop",
                         self.stop_progress)
示例#20
0
    def __init__(self,
                 layout,
                 initial_value,
                 parent=None,
                 title="",
                 prefix=""):
        """"
        Constructor of StepEditor

        :param layout: select step value edit widget position
        :param initial_value: set motor initial position
        :param parent: parent widget
        :param title: step value edit widget's title
        :param prefix: + / - symbol fordward/backward step buttons
        """
        super(StepEditor, self).__init__(parent)

        self.prefix = prefix
        self.value = initial_value

        # Graphic elements-----------------------------------------------------

        self.title_label = QtImport.QLabel(title)
        self.selection_box = QtImport.QFrame()
        self.edition_box = QtImport.QFrame()

        self.txt_new_value = QtImport.QLineEdit()
        self.cmd_ok = QtImport.QPushButton()
        self.cmd_ok.setIcon(Icons.load_icon("button_ok_small"))
        self.cmd_ok.setFixedWidth(20)

        self.cmd_cancel = QtImport.QPushButton()
        self.cmd_cancel.setIcon(Icons.load_icon("button_cancel_small"))
        self.cmd_cancel.setFixedWidth(20)

        self.edition_box.hide()
        self.title_label.hide()
        self.edition_box.setSizePolicy(QtImport.QSizePolicy.Fixed,
                                       QtImport.QSizePolicy.Fixed)

        self.double_validator = QtImport.QDoubleValidator(self.txt_new_value)
        self.double_validator.setNotation(
            QtImport.QDoubleValidator.StandardNotation)
        self.txt_new_value.setValidator(self.double_validator)

        # Layout --------------------------------------------------------------

        self.main_vertical_layout = QtImport.QVBoxLayout()
        self.selection_box_layout = QtImport.QHBoxLayout()
        self.edition_box_layout = QtImport.QHBoxLayout()

        # widget's addition order defines their position

        self.edition_box_layout.addWidget(self.txt_new_value)
        self.edition_box_layout.addWidget(self.cmd_ok)
        self.edition_box_layout.addWidget(self.cmd_cancel)
        self.edition_box.setLayout(self.edition_box_layout)

        self.selection_box_layout.addWidget(self.edition_box)

        if layout == StepEditor.RIGHT_LAYOUT:
            self.cmd_select_value = QtImport.QPushButton(prefix +
                                                         str(initial_value))
            self.cmd_edit_value = QtImport.QPushButton("...")
            self.selection_box_layout.addWidget(self.cmd_select_value)
            self.selection_box_layout.addWidget(self.cmd_edit_value)

        else:
            self.cmd_edit_value = QtImport.QPushButton("...")
            self.cmd_select_value = QtImport.QPushButton(prefix +
                                                         str(initial_value))
            self.selection_box_layout.addWidget(self.cmd_edit_value)
            self.selection_box_layout.addWidget(self.cmd_select_value)

        self.selection_box.setLayout(self.selection_box_layout)

        self.main_vertical_layout.addWidget(self.title_label)
        self.main_vertical_layout.addWidget(self.selection_box)

        self.setLayout(self.main_vertical_layout)

        self.cmd_select_value.setAutoDefault(False)

        # Qt signal/slot connections -----------------------------------------
        self.cmd_select_value.clicked.connect(self.cmd_select_value_clicked)
        self.cmd_edit_value.clicked.connect(self.cmd_edit_values_clicked)
        self.txt_new_value.returnPressed.connect(self.validate_new_value)
        self.cmd_ok.clicked.connect(self.validate_new_value)
        self.cmd_cancel.clicked.connect(self.end_edit)
示例#21
0
    def __init__(self, *args):
        """
        Proposal brick is used to authentificate current user.
        Brick can be used in two modes defined by ispyb hwobj
         - loginAsUser = True, Brick displays combobox with all
           proposals from ISPyB that are associated to the current user
         - loginAsUser = False. Brick displays combobox to choose proposal
           type and linedits to enter proposal number and password.
           In this case user is authentificated with
           LDAP and proposal from ISPyB is retrieved.
        """
        BaseWidget.__init__(self, *args)

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

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

        self.proposal = None
        self.person = None
        self.laboratory = None
        # self.sessionId=None
        self.inhouseProposal = None
        self.instance_server_hwobj = None
        self.secondary_proposals = []

        # Properties ----------------------------------------------------------
        self.add_property("instanceServer", "string", "")
        self.add_property("localLogin", "string", "")
        self.add_property("titlePrefix", "string", "")
        self.add_property("autoSessionUsers", "string", "")
        self.add_property("codes", "string", "fx ifx ih im ix ls mx opid")
        self.add_property("secondaryProposals", "string", "")
        self.add_property("icons", "string", "")
        self.add_property("serverStartDelay", "integer", 500)
        self.add_property("dbConnection", "string")

        # Signals ------------------------------------------------------------
        self.define_signal("sessionSelected", ())
        self.define_signal("setWindowTitle", ())
        self.define_signal("loggedIn", ())
        self.define_signal("userGroupSaved", ())

        # Slots ---------------------------------------------------------------
        self.define_slot("setButtonEnabled", ())
        self.define_slot("impersonateProposal", ())

        # Graphic elements ----------------------------------------------------
        self.main_gbox = QtImport.QGroupBox("ISPyB proposal", self)

        self.login_as_proposal_widget = QtImport.QWidget(self.main_gbox)
        code_label = QtImport.QLabel("  Code: ", self.login_as_proposal_widget)
        self.proposal_type_combox = QtImport.QComboBox(
            self.login_as_proposal_widget)
        self.proposal_type_combox.setEditable(True)
        self.proposal_type_combox.setFixedWidth(60)
        dash_label = QtImport.QLabel(" - ", self.login_as_proposal_widget)
        self.proposal_number_ledit = QtImport.QLineEdit(
            self.login_as_proposal_widget)
        self.proposal_number_ledit.setFixedWidth(60)
        password_label = QtImport.QLabel("   Password: "******"Login",
                                                 self.login_as_proposal_widget)
        self.login_button.setFixedWidth(70)
        self.logout_button = QtImport.QPushButton("Logout", self.main_gbox)
        self.logout_button.hide()
        self.logout_button.setFixedWidth(70)
        self.login_as_proposal_widget.hide()

        self.login_as_user_widget = QtImport.QWidget(self.main_gbox)
        self.proposal_combo = QtImport.QComboBox(self.login_as_user_widget)

        self.user_group_widget = QtImport.QWidget(self.main_gbox)
        # self.title_label = QtGui.QLabel(self.user_group_widget)
        # self.title_label.setAlignment(QtCore.Qt.AlignCenter)
        self.user_group_label = QtImport.QLabel("  Group: ",
                                                self.user_group_widget)
        self.user_group_ledit = QtImport.QLineEdit(self.user_group_widget)
        self.user_group_ledit.setFixedSize(100, 27)
        self.user_group_save_button = QtImport.QToolButton(
            self.user_group_widget)
        self.user_group_save_button.setText("Set")
        self.user_group_save_button.setFixedHeight(27)
        self.saved_group = True

        # Layout --------------------------------------------------------------
        _user_group_widget_hlayout = QtImport.QHBoxLayout(
            self.user_group_widget)
        _user_group_widget_hlayout.setSpacing(2)
        # _user_group_widget_hlayout.addWidget(self.title_label)
        _user_group_widget_hlayout.addWidget(self.user_group_label)
        _user_group_widget_hlayout.addWidget(self.user_group_ledit)
        _user_group_widget_hlayout.addWidget(self.user_group_save_button)
        _user_group_widget_hlayout.setContentsMargins(0, 0, 0, 0)
        self.user_group_widget.hide()

        _login_as_proposal_widget_layout = QtImport.QHBoxLayout(
            self.login_as_proposal_widget)
        _login_as_proposal_widget_layout.addWidget(code_label)
        _login_as_proposal_widget_layout.addWidget(self.proposal_type_combox)
        _login_as_proposal_widget_layout.addWidget(dash_label)
        _login_as_proposal_widget_layout.addWidget(self.proposal_number_ledit)
        _login_as_proposal_widget_layout.addWidget(password_label)
        _login_as_proposal_widget_layout.addWidget(
            self.proposal_password_ledit)
        _login_as_proposal_widget_layout.addWidget(self.login_button)
        _login_as_proposal_widget_layout.setSpacing(2)
        _login_as_proposal_widget_layout.setContentsMargins(0, 0, 0, 0)

        _login_as_user_widget_layout = QtImport.QHBoxLayout(
            self.login_as_user_widget)
        _login_as_user_widget_layout.addWidget(self.proposal_combo)
        _login_as_user_widget_layout.setSpacing(2)
        _login_as_user_widget_layout.setContentsMargins(0, 0, 0, 0)

        _main_gboxlayout = QtImport.QHBoxLayout(self.main_gbox)
        _main_gboxlayout.addWidget(self.login_as_proposal_widget)
        _main_gboxlayout.addWidget(self.logout_button)
        _main_gboxlayout.addWidget(self.login_as_user_widget)
        _main_gboxlayout.addStretch()
        _main_gboxlayout.addWidget(self.user_group_widget)
        _main_gboxlayout.setSpacing(2)
        _main_gboxlayout.setContentsMargins(0, 0, 0, 0)

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

        # SizePolicies --------------------------------------------------------
        #  self.user_group_ledit

        # Qt signal/slot connections ------------------------------------------
        self.proposal_password_ledit.returnPressed.connect(self.login)
        self.login_button.clicked.connect(self.login)
        self.logout_button.clicked.connect(self.logout_clicked)
        self.proposal_combo.activated.connect(self.proposal_combo_activated)
        self.user_group_save_button.clicked.connect(self.save_group)
        self.user_group_ledit.returnPressed.connect(self.save_group)
        self.user_group_ledit.textChanged.connect(self.user_group_changed)

        # Other ---------------------------------------------------------------
        Colors.set_widget_color(self.proposal_number_ledit, Colors.LIGHT_RED,
                                QtImport.QPalette.Base)
        Colors.set_widget_color(self.proposal_password_ledit, Colors.LIGHT_RED,
                                QtImport.QPalette.Base)
示例#22
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
示例#23
0
    def __init__(self, parent=None, name="gphl_acquisition_widget"):
        GphlSetupWidget.__init__(self, parent=parent, name=name)

        _parameters_widget = self._parameters_widget

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

        # Get test crystal data
        self.test_crystals = OrderedDict()
        xx0 = next(HWR.beamline.gphl_workflow.get_objects("test_crystals"))
        for test_crystal in xx0.get_objects("test_crystal"):
            dd0 = test_crystal.get_properties()
            self.test_crystals[dd0["name"]] = CrystalData(**dd0)

        row = 0
        field_name = "test_crystal"
        label_name = self._get_label_name(field_name)
        label_str = "Test Crystal :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._widget_data[field_name] = (widget, str, None, 0)
        self._pulldowns[field_name] = list(self.test_crystals)

        row += 1
        label_name = "test_crystal_spacegroup"
        label_str = " "
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        label_name = "test_crystal_parameters"
        label_str = " "
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 1)
        self._widget_data[label_name] = (label, str, None, label_str)

        row += 1
        field_name = "dose_budget"
        label_name = self._get_label_name(field_name)
        label_str = "Dose budget (MGy) :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._pulldowns[field_name] = list(
            HWR.beamline.gphl_workflow.dose_budgets)
        self._pulldown_defaults[
            field_name] = HWR.beamline.gphl_workflow.default_dose_budget_label
        indx = self._pulldowns[field_name].index(
            HWR.beamline.gphl_workflow.default_dose_budget_label)
        self._widget_data[field_name] = (widget, str, None, indx)

        row += 1
        field_name = "relative_rad_sensitivity"
        label_name = self._get_label_name(field_name)
        label_str = "Rel. radiation sensitivity"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QLineEdit()
        _parameters_widget.layout().addWidget(widget, row, 1)
        validator = QtImport.QDoubleValidator(0, 100, 4, widget)
        self._widget_data[field_name] = (widget, float, validator, 1.0)
示例#24
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")
示例#25
0
    def __init__(self, parent=None, name="gphl_acquisition_widget"):
        GphlSetupWidget.__init__(self, parent=parent, name=name)

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

        _parameters_widget = self._parameters_widget

        row = 0
        field_name = "crystal_system"
        label_name = self._get_label_name(field_name)
        label_str = "Crystal system :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._widget_data[field_name] = (widget, str, None, 0)
        self._pulldowns[field_name] = list(self._CRYSTAL_SYSTEM_DATA)

        row += 1
        field_name = "space_group"
        label_name = self._get_label_name(field_name)
        label_str = "Space group :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._widget_data[field_name] = (widget, str, None, 0)

        row += 1
        field_name = "characterisation_strategy"
        label_name = self._get_label_name(field_name)
        label_str = "Characterisation strategy :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._widget_data[field_name] = (widget, str, None, 0)
        strategy_names = HWR.beamline.gphl_workflow.get_property(
            "characterisation_strategies").split()
        self._pulldowns[field_name] = strategy_names

        row += 1
        field_name = "dose_budget"
        label_name = self._get_label_name(field_name)
        label_str = "Dose budget (MGy) :"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QComboBox()
        _parameters_widget.layout().addWidget(widget, row, 1)
        self._widget_data[field_name] = (widget, str, None, 0)
        self._pulldowns[field_name] = list(
            HWR.beamline.gphl_workflow.dose_budgets)
        self._pulldown_defaults[
            field_name] = HWR.beamline.gphl_workflow.default_dose_budget_label
        indx = self._pulldowns[field_name].index(
            HWR.beamline.gphl_workflow.default_dose_budget_label)
        self._widget_data[field_name] = (widget, str, None, indx)

        row += 1
        field_name = "relative_rad_sensitivity"
        label_name = self._get_label_name(field_name)
        label_str = "Rel. radiation sensitivity"
        label = QtImport.QLabel(label_str, _parameters_widget)
        _parameters_widget.layout().addWidget(label, row, 0)
        self._widget_data[label_name] = (label, str, None, label_str)
        widget = QtImport.QLineEdit()
        _parameters_widget.layout().addWidget(widget, row, 1)
        validator = QtImport.QDoubleValidator(0, 100, 4, widget)
        self._widget_data[field_name] = (widget, float, validator, 1.0)
    def __init__(self, parent=None, name="xrf_spectrum_parameters_widget"):
        QtImport.QWidget.__init__(self, parent)

        if name is not None:
            self.setObjectName(name)

        # Internal variables --------------------------------------------------
        self.xrf_spectrum_model = queue_model_objects.XRFSpectrum()
        self._tree_view_item = None

        # Graphic elements ----------------------------------------------------
        _top_widget = QtImport.QWidget(self)
        _parameters_widget = QtImport.QWidget(_top_widget)
        self.data_path_widget = DataPathWidget(_parameters_widget)
        self.other_parameters_gbox = QtImport.QGroupBox(
            "Other parameters", _parameters_widget)
        self.count_time_label = QtImport.QLabel("Count time:",
                                                self.other_parameters_gbox)
        self.count_time_ledit = QtImport.QLineEdit(self.other_parameters_gbox)
        self.count_time_ledit.setFixedWidth(50)
        self.adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", self.other_parameters_gbox)
        self.adjust_transmission_cbox.hide()
        self.mca_spectrum_widget = McaSpectrumWidget(self)
        self.snapshot_widget = SnapshotWidget(self)

        # Layout -------------------------------------------------------------
        _other_parameters_gbox_hlayout = QtImport.QHBoxLayout(
            self.other_parameters_gbox)
        _other_parameters_gbox_hlayout.addWidget(self.count_time_label)
        _other_parameters_gbox_hlayout.addWidget(self.count_time_ledit)
        _other_parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
        _other_parameters_gbox_hlayout.addStretch(0)
        _other_parameters_gbox_hlayout.setSpacing(2)
        _other_parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

        _parameters_widget_layout = QtImport.QVBoxLayout(_parameters_widget)
        _parameters_widget_layout.addWidget(self.data_path_widget)
        _parameters_widget_layout.addWidget(self.other_parameters_gbox)
        _parameters_widget_layout.addStretch(0)
        _parameters_widget_layout.setSpacing(2)
        _parameters_widget_layout.setContentsMargins(0, 0, 0, 0)

        _top_widget_layout = QtImport.QHBoxLayout(_top_widget)
        _top_widget_layout.addWidget(_parameters_widget)
        _top_widget_layout.addWidget(self.snapshot_widget)
        _top_widget_layout.setSpacing(2)
        _top_widget_layout.addStretch(0)
        _top_widget_layout.setContentsMargins(0, 0, 0, 0)

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

        # SizePolicies -------------------------------------------------------
        self.mca_spectrum_widget.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                               QtImport.QSizePolicy.Expanding)
        _top_widget.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                  QtImport.QSizePolicy.Fixed)

        # Qt signal/slot connections ------------------------------------------
        self.data_path_widget.data_path_layout.prefix_ledit.textChanged.connect(
            self._prefix_ledit_change)
        self.data_path_widget.data_path_layout.run_number_ledit.textChanged.connect(
            self._run_number_ledit_change)
        self.count_time_ledit.textChanged.connect(
            self._count_time_ledit_change)

        # Other ---------------------------------------------------------------
        self.data_path_widget.data_path_layout.compression_cbox.setVisible(
            False)

        if HWR.beamline.xrf_spectrum is None:
            HWR.beamline.xrf_spectrum.connect("xrfSpectrumFinished",
                                              self.spectrum_finished)
示例#27
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

        # Internal values -----------------------------------------------------
        self.resolution_limits = None
        self.detector_distance_limits = None
        self.door_interlocked = True

        # Properties ----------------------------------------------------------
        self.add_property("defaultMode", "combo", ("Ang", "mm"), "Ang")
        self.add_property("mmFormatString", "formatString", "###.##")
        self.add_property("angFormatString", "formatString", "##.###")

        self.group_box = QtImport.QGroupBox("Resolution", self)
        current_label = QtImport.QLabel("Current:", self.group_box)
        current_label.setFixedWidth(75)

        self.resolution_ledit = QtImport.QLineEdit(self.group_box)
        self.resolution_ledit.setReadOnly(True)
        self.detector_distance_ledit = QtImport.QLineEdit(self.group_box)
        self.detector_distance_ledit.setReadOnly(True)

        _new_value_widget = QtImport.QWidget(self)
        set_to_label = QtImport.QLabel("Set to:", self.group_box)
        self.new_value_ledit = QtImport.QLineEdit(self.group_box)
        self.units_combobox = QtImport.QComboBox(_new_value_widget)
        self.stop_button = QtImport.QPushButton(_new_value_widget)
        self.stop_button.setIcon(Icons.load_icon("Stop2"))
        self.stop_button.setEnabled(False)
        self.stop_button.setFixedWidth(25)

        # Layout --------------------------------------------------------------
        _new_value_widget_hlayout = QtImport.QHBoxLayout(_new_value_widget)
        _new_value_widget_hlayout.addWidget(self.new_value_ledit)
        _new_value_widget_hlayout.addWidget(self.units_combobox)
        _new_value_widget_hlayout.addWidget(self.stop_button)
        _new_value_widget_hlayout.setSpacing(0)
        _new_value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _group_box_gridlayout = QtImport.QGridLayout(self.group_box)
        _group_box_gridlayout.addWidget(current_label, 0, 0, 2, 1)
        _group_box_gridlayout.addWidget(self.resolution_ledit, 0, 1)
        _group_box_gridlayout.addWidget(self.detector_distance_ledit, 1, 1)
        _group_box_gridlayout.addWidget(set_to_label, 2, 0)
        _group_box_gridlayout.addWidget(_new_value_widget, 2, 1)
        _group_box_gridlayout.setSpacing(0)
        _group_box_gridlayout.setContentsMargins(1, 1, 1, 1)

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

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

        # Qt signal/slot connections ------------------------------------------
        self.new_value_ledit.returnPressed.connect(self.current_value_changed)
        self.new_value_ledit.textChanged.connect(self.input_field_changed)
        self.units_combobox.activated.connect(self.unit_changed)
        self.stop_button.clicked.connect(self.stop_clicked)

        # Other ---------------------------------------------------------------
        Colors.set_widget_color(
            self.new_value_ledit, Colors.LINE_EDIT_ACTIVE, QtImport.QPalette.Base
        )
        self.new_value_validator = QtImport.QDoubleValidator(
            0, 15, 4, self.new_value_ledit
        )

        self.units_combobox.addItem(chr(197))
        self.units_combobox.addItem("mm")
        self.instance_synchronize(
            "group_box",
            "resolution_ledit",
            "detector_distance_ledit",
            "new_value_ledit",
            "units_combobox",
        )
    def __init__(self, parent=None, name=None, fl=0):

        CreateTaskBase.__init__(self, parent, name,
                                QtImport.Qt.WindowFlags(fl), "XRF spectrum")

        if name is not None:
            self.setObjectName(name)

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

        # Internal variables --------------------------------------------------
        self.count_time = None
        self.xrf_spectrum_model = None

        self.init_models()

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

        _parameters_gbox = QtImport.QGroupBox("Parameters", self)
        _count_time_label = QtImport.QLabel("Count time (sec.):",
                                            _parameters_gbox)
        self.count_time_ledit = QtImport.QLineEdit("1", _parameters_gbox)
        # self.count_time_ledit.setMaximumWidth(75)
        self.adjust_transmission_cbox = QtImport.QCheckBox(
            "Adjust transmission", _parameters_gbox)
        self.adjust_transmission_cbox.setChecked(True)

        self._comments_widget = CommentsWidget(self)

        # Layout --------------------------------------------------------------
        _parameters_gbox_hlayout = QtImport.QHBoxLayout(_parameters_gbox)
        _parameters_gbox_hlayout.addWidget(_count_time_label)
        _parameters_gbox_hlayout.addWidget(self.count_time_ledit)
        _parameters_gbox_hlayout.addWidget(self.adjust_transmission_cbox)
        _parameters_gbox_hlayout.addStretch(0)
        _parameters_gbox_hlayout.setSpacing(2)
        _parameters_gbox_hlayout.setContentsMargins(0, 0, 0, 0)

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

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

        # Qt signal/slot connections ------------------------------------------
        self._data_path_widget.pathTemplateChangedSignal.connect(
            self.path_template_changed)
        self.adjust_transmission_cbox.stateChanged.connect(
            self.adjust_transmission_state_changed)

        # Other ---------------------------------------------------------------
        self._data_path_widget.data_path_layout.compression_cbox.setVisible(
            False)