Example #1
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.max_log_lines = -1
        self.test_mode = False

        # Properties ----------------------------------------------------------
        self.add_property("maxLogLines", "integer", -1)

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

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

        # Graphic elements ----------------------------------------------------
        self._status_bar_widget = LogBarWidget(self)

        # Layout --------------------------------------------------------------
        _main_hlayout = qt_import.QHBoxLayout(self)
        _main_hlayout.addWidget(self._status_bar_widget)
        _main_hlayout.setSpacing(0)
        _main_hlayout.setContentsMargins(2, 2, 2, 2)

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

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

        # Other ---------------------------------------------------------------
        gui_log_handler.GUILogHandler().register(self)
Example #2
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Internal values -----------------------------------------------------
        self.target_menu = None
        self.image_scale_list = []

        # Properties ----------------------------------------------------------
        self.add_property("targetMenu", "combo",
                          ("menuBar", "toolBar", "both"), "menuBar")
        self.add_property("beamDefiner", "boolean", False)

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

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

        # Graphic elements ----------------------------------------------------
        self.tools_menu = None
        self.measure_distance_action = None
        self.measure_angle_action = None
        self.measure_area_action = None
        self.define_beam_action = None
        self.move_beam_mark_manual_action = None
        self.move_beam_mark_auto_action = None
        self.display_beam_size_action = None
        self.display_grid_action = None
        self.magnification_action = None
        self.image_scale_menu = None
Example #3
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.use_dialog = False

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

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

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

        # Graphic elements ----------------------------------------------------
        self.progress_type_label = qt_import.QLabel("", self)
        self.progress_bar = qt_import.QProgressBar(self)
        # $self.progress_bar.setCenterIndicator(True)
        self.progress_bar.setMinimum(0)

        main_layout = qt_import.QVBoxLayout(self)
        main_layout.addWidget(self.progress_type_label)
        main_layout.addWidget(self.progress_bar)
        main_layout.setContentsMargins(2, 2, 2, 2)
        main_layout.setSpacing(2)
        self.setEnabled(False)

        new_palette = qt_import.QPalette()
        new_palette.setColor(qt_import.QPalette.Highlight, colors.DARK_GREEN)
        self.progress_bar.setPalette(new_palette)
Example #4
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Properties ----------------------------------------------------------
        #self.add_property("useImageTracking", "boolean", True)

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

        # Slots ---------------------------------------------------------------
        self.define_slot("populate_ssx_parameter_widget", ({}))

        # Graphic elements ----------------------------------------------------
        self.tool_box = qt_import.QToolBox(self)
        self.parameters_widget = DCParametersWidget(self, "parameters_widget")
        #self.image_tracking_widget = ImageTrackingWidget(self.tool_box)
        self.advance_results_widget = AdvancedResultsWidget(self.tool_box)
        self.snapshot_widget = SnapshotWidget(self)

        self.tool_box.addItem(self.parameters_widget, "Parameters")
        
        #self.tool_box.addItem(self.results_static_view, "Results - Summary")
        #self.tool_box.addItem(
        #    self.advance_results_widget, "Results - online processing"
        #)

        # Layout --------------------------------------------------------------
        _main_vlayout = qt_import.QHBoxLayout(self)
        _main_vlayout.addWidget(self.tool_box)
        _main_vlayout.addWidget(self.snapshot_widget)
Example #5
0
    def __init__(self, *args):
        """Main init"""

        BaseWidget.__init__(self, *args)

        # Internal values -----------------------------------------------------
        self.graphics_initialized = False
        self.value_label_list = []

        # Properties (name, type, default value, comment)----------------------
        self.add_property("maxPlotPoints",
                          "integer",
                          100,
                          comment="Maximal number of plot points")

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

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

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

        # Layout --------------------------------------------------------------
        self.main_vlayout = qt_import.QVBoxLayout(self)
        self.main_vlayout.setSpacing(1)
        self.main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Other ---------------------------------------------------------------
        self.setToolTip("Main information about the beamline")
Example #6
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_gbox = qt_import.QGroupBox("Aperture", self)
        self.aperture_diameter_combo = qt_import.QComboBox(self.main_gbox)
        self.aperture_diameter_combo.setMinimumWidth(100)
        self.aperture_position_combo = qt_import.QComboBox(self.main_gbox)
        self.aperture_position_combo.setMinimumWidth(100)

        # Layout --------------------------------------------------------------
        _main_gbox_vlayout = qt_import.QVBoxLayout(self.main_gbox)
        _main_gbox_vlayout.addWidget(self.aperture_diameter_combo)
        _main_gbox_vlayout.addWidget(self.aperture_position_combo)
        _main_gbox_vlayout.addStretch()
        _main_gbox_vlayout.setSpacing(2)
        _main_gbox_vlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_gbox)
        _main_vlayout.setSpacing(0)
        # _main_vlayout.addSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # Qt signal/slot connections ------------------------------------------
        self.aperture_diameter_combo.activated.connect(self.change_diameter)
        self.aperture_position_combo.activated.connect(self.change_position)

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

        # Other ---------------------------------------------------------------
        colors.set_widget_color(
            self.aperture_diameter_combo, colors.LIGHT_GREEN, qt_import.QPalette.Button
        )
        colors.set_widget_color(
            self.aperture_position_combo, colors.LIGHT_GREEN, qt_import.QPalette.Button
        )

        self.aperture_diameter_combo.setMinimumWidth(100)
        self.aperture_position_combo.setMinimumWidth(100)

        self.init_aperture()
        self.connect(
                HWR.beamline.beam.aperture, "diameterIndexChanged", self.diameter_changed
        )
        self.connect(
                HWR.beamline.beam.aperture, "valueChanged", self.position_changed
        )
Example #7
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 = qt_import.QGroupBox(self)
        self.label = qt_import.QLabel("motor:", _main_gbox)
        self.positions_combo = qt_import.QComboBox(self)
        self.previous_position_button = qt_import.QPushButton(_main_gbox)
        self.next_position_button = qt_import.QPushButton(_main_gbox)

        # Layout --------------------------------------------------------------
        _main_gbox_hlayout = qt_import.QHBoxLayout(_main_gbox)
        _main_gbox_hlayout.addWidget(self.label)
        _main_gbox_hlayout.addWidget(self.positions_combo)
        _main_gbox_hlayout.addWidget(self.previous_position_button)
        _main_gbox_hlayout.addWidget(self.next_position_button)
        _main_gbox_hlayout.setSpacing(2)
        _main_gbox_hlayout.setContentsMargins(2, 2, 2, 2)

        _main_hlayout = qt_import.QHBoxLayout(self)
        _main_hlayout.addWidget(_main_gbox)
        _main_hlayout.setSpacing(0)
        _main_hlayout.setContentsMargins(0, 0, 0, 0)
        # Size Policy ---------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.positions_combo.activated.connect(self.position_selected)
        self.previous_position_button.clicked.connect(
            self.select_previous_position)
        self.next_position_button.clicked.connect(self.select_next_position)

        # Other ---------------------------------------------------------------
        self.positions_combo.setFixedHeight(27)
        self.positions_combo.setToolTip(
            "Moves the motor to a predefined position")
        self.previous_position_button.setIcon(icons.load_icon("Minus2"))
        self.previous_position_button.setFixedSize(27, 27)
        self.next_position_button.setIcon(icons.load_icon("Plus2"))
        self.next_position_button.setFixedSize(27, 27)
Example #8
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_gbox = qt_import.QGroupBox("Beam size", self)
        hor_label = qt_import.QLabel("Horizontal:", self.main_gbox)
        self.hor_size_ledit = qt_import.QLineEdit(self.main_gbox)
        self.hor_size_ledit.setMaximumWidth(120)
        self.hor_size_ledit.setEnabled(False)
        self.hor_size_ledit.setAlignment(qt_import.Qt.AlignRight)

        ver_label = qt_import.QLabel("Vertical:", self.main_gbox)
        self.ver_size_ledit = qt_import.QLineEdit(self.main_gbox)
        self.ver_size_ledit.setMaximumWidth(120)
        self.ver_size_ledit.setEnabled(False)
        self.ver_size_ledit.setAlignment(qt_import.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 = qt_import.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 = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_gbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

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

        # Other ---------------------------------------------------------------

        self.connect(HWR.beamline.beam, "beamInfoChanged",
                     self.beam_info_changed)
Example #9
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.num_cols = None
        self.num_rows = None
        self.num_drops = None
        self.current_location = None
        self.plate_content = None
        self.xtal_map = None

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

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

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

        # Graphic elements ----------------------------------------------------
        self.plate_navigator_widget = PlateNavigatorWidget(self)
        self.crims_widget = qt_import.load_ui_file(
            "plate_crims_widget_layout.ui")

        # Layout --------------------------------------------------------------
        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.plate_navigator_widget)
        _main_vlayout.addWidget(self.crims_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

        # Qt signal/slot connections ------------------------------------------
        self.crims_widget.search_button.clicked.connect(
            self.search_button_clicked)
        self.crims_widget.move_button.clicked.connect(
            self.move_to_xtal_clicked)
        self.crims_widget.abort_button.clicked.connect(self.abort_clicked)

        self.crims_widget.xtal_treewidget.currentItemChanged.connect(
            self.xtal_treewidget_current_item_changed)

        # Other ---------------------------------------------------------------
        self.xtal_image_graphicsscene = qt_import.QGraphicsScene(self)
        self.crims_widget.xtal_image_graphicsview.setScene(
            self.xtal_image_graphicsscene)
        self.xtal_image_pixmap = qt_import.QPixmap()
        self.xtal_image_graphics_pixmap = qt_import.QGraphicsPixmapItem()
        self.xtal_image_graphicsscene.addItem(self.xtal_image_graphics_pixmap)

        if HWR.beamline.plate_manipulator is not None:
            self.connect(
                HWR.beamline.plate_manipulator,
                SampleChanger.INFO_CHANGED_EVENT,
                self.plate_navigator_widget.refresh_plate_location,
            )
Example #10
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        self.dc_group_widget = DCGroupWidget(self)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.dc_group_widget)

        # Qt-Slots
        self.define_slot("populate_dc_group_widget", ({}))
Example #11
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 = qt_import.QGroupBox("Transmission", self)
        current_label = qt_import.QLabel("Current:", self.group_box)
        current_label.setFixedWidth(75)
        self.transmission_ledit = qt_import.QLineEdit(self.group_box)
        self.transmission_ledit.setReadOnly(True)
        set_to_label = qt_import.QLabel("Set to:", self.group_box)
        self.new_value_ledit = qt_import.QLineEdit(self.group_box)

        # Layout --------------------------------------------------------------
        _group_box_gridlayout = qt_import.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 = qt_import.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 = qt_import.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()
Example #12
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Properties ----------------------------------------------------------
        self.add_property("title", "string", "Shutter")
        self.add_property("hwobj_shutter", "string", "")

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_groupbox = qt_import.QGroupBox("Shutter", self)
        self.main_groupbox.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label = qt_import.QLabel("<b>unknown</b>",
                                            self.main_groupbox)
        self.state_label.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label.setFixedHeight(24)
        colors.set_widget_color(self.state_label, colors.LIGHT_GRAY)
        _button_widget = qt_import.QWidget(self.main_groupbox)

        self.open_button = qt_import.QPushButton(
            icons.load_icon("ShutterOpen"), "Open", _button_widget)
        self.close_button = qt_import.QPushButton(
            icons.load_icon("ShutterClose"), "Close", _button_widget)

        # Layout --------------------------------------------------------------
        _button_widget_hlayout = qt_import.QHBoxLayout(_button_widget)
        _button_widget_hlayout.addWidget(self.open_button)
        _button_widget_hlayout.addWidget(self.close_button)
        _button_widget_hlayout.setSpacing(2)
        _button_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_gbox_vlayout = qt_import.QVBoxLayout(self.main_groupbox)
        _main_gbox_vlayout.addWidget(self.state_label)
        _main_gbox_vlayout.addWidget(_button_widget)
        _main_gbox_vlayout.setSpacing(2)
        _main_gbox_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_groupbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.open_button.clicked.connect(self.open_button_clicked)
        self.close_button.clicked.connect(self.close_button_clicked)
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Layout
        self.energy_scan_widget = EnergyScanParametersWidget(self)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.energy_scan_widget)

        # Qt-Slots
        self.define_slot("populate_parameter_widget", ({}))
Example #14
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.tools_hwobj = None
        self.action_dict = {}

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

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "")
Example #15
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        self.define_slot("populate_xrf_widget", ({}))

        self.xrf_spectrum_widget = XRFSpectrumParametersWidget(self)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.xrf_spectrum_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
Example #16
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

        # variables -----------------------------------------------------------

        self.current_beam_position = None
        self.current_zoom_pos_name = None
        self.current_zoom_idx = -1
        self.multipos_file_xml_path = None

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

        # Internal values -----------------------------------------------------
        self.table_created = False

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_groupbox = qt_import.QGroupBox("Beam Position", self)
        self.ui_widgets_manager = qt_import.load_ui_file(
            "camera_beam_brick.ui")

        # Size policy --------------------------------
        self.ui_widgets_manager.beam_positions_table.setSizePolicy(
            qt_import.QSizePolicy.Minimum,
            qt_import.QSizePolicy.Minimum,
        )

        # Layout --------------------------------------------------------------
        _groupbox_vlayout = qt_import.QVBoxLayout(self)
        _groupbox_vlayout.addWidget(self.ui_widgets_manager)
        _groupbox_vlayout.setSpacing(0)
        _groupbox_vlayout.setContentsMargins(0, 0, 0, 0)
        self.main_groupbox.setLayout(_groupbox_vlayout)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_groupbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(_main_vlayout)

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

        self.ui_widgets_manager.save_current_beam_pos_pushbutton.clicked.connect(
            self.save_beam_position)
Example #17
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        _main_groupbox = qt_import.QGroupBox("Image tracking", self)
        self.state_label = qt_import.QLabel("<b> </b>", _main_groupbox)
        self.image_tracking_cbox = qt_import.QCheckBox(
            "Enable Adxv image tracking", _main_groupbox)
        self.filter_frames_cbox = qt_import.QCheckBox(
            "Filter frames based on Dozor score", _main_groupbox)
        self.spot_list_cbox = qt_import.QCheckBox("Indicate spots in ADxV",
                                                  _main_groupbox)

        # Layout --------------------------------------------------------------
        _main_groupbox_vlayout = qt_import.QVBoxLayout(_main_groupbox)
        _main_groupbox_vlayout.addWidget(self.state_label)
        _main_groupbox_vlayout.addWidget(self.image_tracking_cbox)
        _main_groupbox_vlayout.addWidget(self.filter_frames_cbox)
        _main_groupbox_vlayout.addWidget(self.spot_list_cbox)
        _main_groupbox_vlayout.setSpacing(2)
        _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(_main_groupbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.image_tracking_cbox.toggled.connect(
            self.image_tracking_cbox_toggled)
        self.filter_frames_cbox.toggled.connect(
            self.filter_frames_cbox_toggled)
        self.spot_list_cbox.toggled.connect(self.spot_list_cbox_toggled)

        # Other ---------------------------------------------------------------
        self.state_label.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label.setFixedHeight(24)
        self.state_changed("unknown")
Example #18
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 = qt_import.QTextEdit(self)
        self.conversation_textedit.setReadOnly(True)
        _controls_widget = qt_import.QWidget(self)
        _say_label = qt_import.QLabel("Say:", _controls_widget)
        self.message_ledit = qt_import.QLineEdit(_controls_widget)
        self.send_button = qt_import.QPushButton("Send", _controls_widget)
        self.send_button.setEnabled(False)

        # Layout --------------------------------------------------------------
        _controls_widget_hlayout = qt_import.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 = qt_import.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)
Example #19
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        self._xray_imaging_results_widget = XrayImagingResultsWidget(
            self, "xray_imaging_results_widget")

        # Layout
        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self._xray_imaging_results_widget)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        _main_vlayout.setSpacing(2)
        _main_vlayout.addStretch(10)

        # Qt-Slots
        self.define_slot("populate_parameter_widget", ({}))
Example #20
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        self.defineSlot("setData", ())

        self.mcafit = McaAdvancedFit.McaAdvancedFit(self)
        self.mcafit.dismissButton.hide()

        # Layout --------------------------------------------------------------
        main_layout = qt_import.QVBoxLayout(self)
        main_layout.addWidget(self.mcafit)
        # main_layout.addWidget(self.scan_plot_widget)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(main_layout)
Example #21
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        self.define_slot("set_data", ())

        if pymca_imported:
            self.mcafit_widget = McaAdvancedFit.McaAdvancedFit(self)
            self.mcafit_widget.dismissButton.hide()
        else:
            self.mcafit_widget = TwoAxisPlotWidget(self)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.mcafit_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)
Example #22
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 = qt_import.QGroupBox("Beamstop distance", self)
        current_label = qt_import.QLabel("Current:", self.group_box)
        current_label.setFixedWidth(75)
        self.beamstop_distance_ledit = qt_import.QLineEdit(self.group_box)
        self.beamstop_distance_ledit.setReadOnly(True)
        set_to_label = qt_import.QLabel("Set to:", self.group_box)
        self.new_value_ledit = qt_import.QLineEdit(self.group_box)

        # Layout --------------------------------------------------------------
        _group_box_gridlayout = qt_import.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 = qt_import.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,
                                qt_import.QPalette.Base)
        self.new_value_validator = qt_import.QDoubleValidator(
            0, 100, 2, self.new_value_ledit)
Example #23
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

        # Graphic elements ----------------------------------------------------
        self.main_groupbox = qt_import.QGroupBox("Door interlock", self)
        self.main_groupbox.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label = qt_import.QLabel("<b>unknown</b>",
                                            self.main_groupbox)
        colors.set_widget_color(self.state_label, self.STATES["unknown"])
        self.state_label.setAlignment(qt_import.Qt.AlignCenter)
        self.state_label.setFixedHeight(24)
        self.unlock_door_button = qt_import.QPushButton(
            icons.load_icon("EnterHutch"), "Unlock", self.main_groupbox)

        # Layout --------------------------------------------------------------
        _main_gbox_vlayout = qt_import.QVBoxLayout(self.main_groupbox)
        _main_gbox_vlayout.addWidget(self.state_label)
        _main_gbox_vlayout.addWidget(self.unlock_door_button)
        _main_gbox_vlayout.setSpacing(2)
        _main_gbox_vlayout.setContentsMargins(4, 4, 4, 4)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.main_groupbox)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.unlock_door_button.clicked.connect(self.unlock_doors)

        # Other ---------------------------------------------------------------
        self.state_label.setToolTip("Shows the current door state")
        self.unlock_door_button.setToolTip("Unlocks the doors")

        self.connect(HWR.beamline.hutch_interlock, "valueChanged",
                     self.value_changed)
Example #24
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)
        self.logger = logging.getLogger("GUI Alba Actuator")
        self.logger.info("__init__()")

        self.on_color = colors.color_to_hexa(colors.LIGHT_GREEN)
        self.off_color = colors.color_to_hexa(colors.LIGHT_GRAY)
        self.fault_color = colors.color_to_hexa(colors.LIGHT_RED)
        self.unknown_color = colors.color_to_hexa(colors.DARK_GRAY)

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

        self.state = None
        self.level = None
        self.icons = None
        self.level_limits = [None, None]

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

        # Graphic elements ----------------------------------------------------
        self.widget = qt_import.load_ui_file("alba_lightcontrol.ui")

        qt_import.QHBoxLayout(self)

        self.layout().addWidget(self.widget)
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.widget.layout().setContentsMargins(0, 0, 0, 0)
        self.widget.horizontalLayout.setContentsMargins(0, 0, 0, 0)

        self.widget.button.clicked.connect(self.do_switch)
        self.widget.slider.valueChanged.connect(self.do_set_level)

        # SizePolicies --------------------------------------------------------
        self.setSizePolicy(qt_import.QSizePolicy.Expanding,
                           qt_import.QSizePolicy.MinimumExpanding)

        # Defaults
        self.set_icons("BulbCheck,BulbDelete")

        # Other ---------------------------------------------------------------
        self.setToolTip("Control of light (set level and on/off switch.")

        self.update()
Example #25
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 = qt_import.QWidget(self)
        self.info_address_ledit = qt_import.QLineEdit(self.info_widget)
        self.info_refresh_button = qt_import.QPushButton(
            "Refresh", self.info_widget)
        self.method_table = qt_import.QTableWidget(self)
        self.property_table = qt_import.QTableWidget(self)

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

        _main_vlayout = qt_import.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)
Example #26
0
    def __init__(self, parent, brick):

        qt_import.QGroupBox.__init__(self, "State", parent)
        BaseWidget.__init__(self, parent)
        # Graphic elements ----------------------------------------------------
        # self.contents_widget = QGroupBox("Sample Changer State", self)

        self._parent = brick
        self.status_label = qt_import.QLabel("")
        self.status_label.setAlignment(qt_import.Qt.AlignCenter)

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

        _layout = qt_import.QHBoxLayout(self)
        _layout.addWidget(self.status_label)
        _layout.setSpacing(2)
        _layout.setContentsMargins(6, 6, 6, 10)
Example #27
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Properties ----------------------------------------------------------
        self.add_property("confirmPhaseChange", "boolean", False)

        # Properties to initialize hardware objects --------------------------

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

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

        # Graphic elements ----------------------------------------------------
        self.group_box = qt_import.QGroupBox("Phase", self)
        self.phase_combobox = qt_import.QComboBox(self.group_box)

        # Layout --------------------------------------------------------------
        _group_box_vlayout = qt_import.QVBoxLayout(self.group_box)
        _group_box_vlayout.addWidget(self.phase_combobox)
        _group_box_vlayout.addStretch()
        _group_box_vlayout.setSpacing(2)
        _group_box_vlayout.setContentsMargins(0, 0, 0, 0)

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

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

        # Qt signal/slot connections ------------------------------------------
        self.phase_combobox.activated.connect(self.change_phase)

        # Other ---------------------------------------------------------------
        colors.set_widget_color(self.phase_combobox, colors.LIGHT_GREEN,
                                qt_import.QPalette.Button)

        self.init_phase_list()

        self.connect(HWR.beamline.diffractometer, "minidiffPhaseChanged",
                     self.phase_changed)
Example #28
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

        # Internal values -----------------------------------------------------
        self.ispyb_logged_in = False
        self.tree_brick = None

        # Properties ----------------------------------------------------------
        self.add_property("useOscStartCbox", "boolean", False)
        self.add_property("useCompression", "boolean", False)
        #self.add_property("availableTasks", "string", "discrete char helical")
        self.add_property("showDiscreetTask", "boolean", True)
        self.add_property("showHelicalTask", "boolean", True)
        self.add_property("showCharTask", "boolean", True)
        self.add_property("showAdvancedTask", "boolean", True)
        self.add_property("showSsxTask", "boolean", False)
        self.add_property("showCollectNowButton", "boolean", False)

        # Signals -------------------------------------------------------------
        self.define_signal("request_tree_brick", ())

        # Slots ---------------------------------------------------------------
        self.define_slot("logged_in", ())
        self.define_slot("set_session", ())
        self.define_slot("selection_changed", ())
        self.define_slot("user_group_saved", ())
        self.define_slot("set_tree_brick", ())

        # Graphic elements ----------------------------------------------------
        self.task_tool_box_widget = TaskToolBoxWidget(self)

        # Layout --------------------------------------------------------------
        self.main_layout = qt_import.QVBoxLayout(self)
        self.main_layout.addWidget(self.task_tool_box_widget)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.main_layout)

        # SizePolicies --------------------------------------------------------
        # self.setSizePolicy(qt_import.QSizePolicy.MinimumExpanding,
        #                   qt_import.QSizePolicy.MinimumExpanding)

        # Other ---------------------------------------------------------------
        HWR.beamline.sample_view.connect("pointSelected", self.point_selected)
Example #29
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Slots ---------------------------------------------------------------
        self.define_slot("data_policy_changed", ())

        # Graphic elements ----------------------------------------------------
        self.main_groupbox = qt_import.QGroupBox("Export Data", self)
        self.ui_widgets_manager = qt_import.load_ui_file(
            "export_data_layout.ui")

        # Internal values -----------------------------------------------------
        self.__current_sample = None
        self.__data_policy_info_dict = {}

        # Layout --------------------------------------------------------------
        _groupbox_vlayout = qt_import.QVBoxLayout(self)
        _groupbox_vlayout.addWidget(self.ui_widgets_manager)
        _groupbox_vlayout.setSpacing(0)
        _groupbox_vlayout.setContentsMargins(0, 0, 0, 0)
        self.main_groupbox.setLayout(_groupbox_vlayout)

        # Qt signal/slot connections ------------------------------------------
        self.ui_widgets_manager.export_button.clicked.connect(
            self.export_button_clicked)

        self.ui_widgets_manager.sample_name_tbox.textChanged.connect(
            self.set_export_file_name)

        self.ui_widgets_manager.filename_tbox.textChanged.connect(
            self.set_export_file_name)

        self.ui_widgets_manager.file_index_tbox.textChanged.connect(
            self.set_export_file_name)

        self.ui_widgets_manager.select_file_path_button.clicked.connect(
            self.select_file_path_button_clicked)

        self.ui_widgets_manager.reload_policy_data_button.clicked.connect(
            self.reload_policy_data_button_clicked)
Example #30
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Properties ----------------------------------------------------------
        self.add_property("tunable-energy", "boolean", "True")

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

        # Slots ---------------------------------------------------------------
        self.define_slot("populate_char_parameter_widget", {})

        # Graphic elements ----------------------------------------------------
        self.stacked_widget = qt_import.QStackedWidget(self)
        self.parameters_widget = CharParametersWidget(self)
        self.toggle_page_button = qt_import.QPushButton("View Results", self)
        self.toggle_page_button.setFixedWidth(100)

        self.results_view = WebViewWidget(self)
        self.stacked_widget.addWidget(self.parameters_widget)
        self.stacked_widget.addWidget(self.results_view)

        # Layout --------------------------------------------------------------
        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.stacked_widget)
        # _main_vlayout.addStretch(0)
        _main_vlayout.addWidget(self.toggle_page_button)

        # SizePolicies -------------------------------------------------------
        self.results_view.setSizePolicy(qt_import.QSizePolicy.Expanding,
                                        qt_import.QSizePolicy.Expanding)

        # Qt signal/slot connections ------------------------------------------
        self.toggle_page_button.clicked.connect(self.toggle_page)

        # Other ---------------------------------------------------------------
        self.stacked_widget.setCurrentWidget(self.parameters_widget)
        self.parameters_widget.collection_type = None
        self.toggle_page_button.setDisabled(True)