Exemple #1
0
 def centring_in_progress_changed(self, centring_in_progress):
     if centring_in_progress:
         self.manager_widget.create_point_start_button.setIcon(
             Icons.load_icon("Delete"))
     else:
         self.manager_widget.create_point_start_button.setIcon(
             Icons.load_icon("VCRPlay2"))
Exemple #2
0
    def __init__(self, *args):

        MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args)

        self.light_actuator_hwo = None
        self.light_saved_pos = None

        self.light_off_button = QtImport.QPushButton(self.main_gbox)
        self.light_off_button.setIcon(Icons.load_icon("BulbDelete"))
        self.light_off_button.setFixedSize(27, 27)

        self.light_on_button = QtImport.QPushButton(self.main_gbox)
        self.light_on_button.setIcon(Icons.load_icon("BulbCheck"))
        self.light_on_button.setFixedSize(27, 27)

        self.light_off_button.clicked.connect(self.light_button_off_clicked)
        self.light_on_button.clicked.connect(self.light_button_on_clicked)

        self._gbox_hbox_layout.addWidget(self.light_off_button)
        self._gbox_hbox_layout.addWidget(self.light_on_button)

        self.light_off_button.setToolTip(
            "Switches off the light and sets the intensity to zero"
        )
        self.light_on_button.setToolTip(
            "Switches on the light and sets the intensity back to the previous setting"
        )

        self.light_off_button.setSizePolicy(
            QtImport.QSizePolicy.Fixed, QtImport.QSizePolicy.Minimum
        )
        self.light_on_button.setSizePolicy(
            QtImport.QSizePolicy.Fixed, QtImport.QSizePolicy.Minimum
        )
Exemple #3
0
 def property_changed(self, property_name, old_value, new_value):
     if property_name == "codes":
         self.set_codes(new_value)
     elif property_name == "localLogin":
         self.local_login_hwobj = self.get_hardware_object(new_value,
                                                           optional=True)
     elif property_name == "instanceServer":
         if self.instance_server_hwobj is not None:
             self.disconnect(self.instance_server_hwobj, "passControl",
                             self.pass_control)
             self.disconnect(self.instance_server_hwobj, "haveControl",
                             self.have_control)
         self.instance_server_hwobj = self.get_hardware_object(
             new_value, optional=True)
         if self.instance_server_hwobj is not None:
             self.connect(self.instance_server_hwobj, "passControl",
                          self.pass_control)
             self.connect(self.instance_server_hwobj, "haveControl",
                          self.have_control)
     elif property_name == "icons":
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(Icons.load_icon(icons_list[0]))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(Icons.load_icon(icons_list[1]))
         except IndexError:
             pass
     elif property_name == "secondaryProposals":
         self.secondary_proposals = new_value.split()
     else:
         BaseWidget.property_changed(self, property_name, old_value,
                                     new_value)
 def set_icons(self, icon_run, icon_stop):
     self.run_icon = Icons.load_icon(icon_run)
     self.stop_icon = Icons.load_icon(icon_stop)
     if self.executing:
         self.setIcon(self.stop_icon)
     else:
         self.setIcon(self.run_icon)
Exemple #5
0
 def set_icons(self, icon_run, icon_stop):
     self.run_icon = Icons.load_icon(icon_run)
     self.stop_icon = Icons.load_icon(icon_stop)
     if self.executing:
         self.setIcon(self.stop_icon)
     else:
         self.setIcon(self.run_icon)
    def __init__(self, *args):

        MotorSpinBoxBrick.MotorSpinBoxBrick.__init__(self, *args)

        self.light_actuator_hwo = None
        self.light_saved_pos = None

        self.light_off_button = QtImport.QPushButton(self.main_gbox)
        self.light_off_button.setIcon(Icons.load_icon("BulbDelete"))
        self.light_off_button.setFixedSize(27, 27)

        self.light_on_button = QtImport.QPushButton(self.main_gbox)
        self.light_on_button.setIcon(Icons.load_icon("BulbCheck"))
        self.light_on_button.setFixedSize(27, 27)

        self.light_off_button.clicked.connect(self.light_button_off_clicked)
        self.light_on_button.clicked.connect(self.light_button_on_clicked)

        self._gbox_hbox_layout.addWidget(self.light_off_button)
        self._gbox_hbox_layout.addWidget(self.light_on_button)

        self.light_off_button.setToolTip(
            "Switches off the light and sets the intensity to zero"
        )
        self.light_on_button.setToolTip(
            "Switches on the light and sets the intensity back to the previous setting"
        )

        self.light_off_button.setSizePolicy(QtImport.QSizePolicy.Fixed, QtImport.QSizePolicy.Minimum)
        self.light_on_button.setSizePolicy(QtImport.QSizePolicy.Fixed, QtImport.QSizePolicy.Minimum)
Exemple #7
0
 def set_icons(self, icons):
     icons = icons.split(",")
     if len(icons) == 2:
         self.icons = {
             "on": Icons.load_icon(icons[0]),
             "off": Icons.load_icon(icons[1]),
         }
         self.widget.button.setIcon(self.icons["on"])
 def set_icons(self, icons):
     icons = icons.split(",")
     if len(icons) == 2:
         self.icons = {
             "on": Icons.load_icon(icons[0]),
             "off": Icons.load_icon(icons[1]),
         }
         self.widget.button.setIcon(self.icons["on"])
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

        self.positions = None

        # Properties ----------------------------------------------------------
        self.add_property("label", "string", "")
        self.add_property("mnemonic", "string", "")
        self.add_property("icons", "string", "")
        self.add_property("showMoveButtons", "boolean", True)

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

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

        # Graphic elements ----------------------------------------------------
        _main_gbox = QtImport.QGroupBox(self)
        self.label = QtImport.QLabel("motor:", _main_gbox)
        self.positions_combo = QtImport.QComboBox(self)
        self.previous_position_button = QtImport.QPushButton(_main_gbox)
        self.next_position_button = QtImport.QPushButton(_main_gbox)

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

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

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

        # Other ---------------------------------------------------------------
        self.positions_combo.setFixedHeight(27)
        self.positions_combo.setToolTip(
            "Moves the motor to a predefined position")
        self.previous_position_button.setIcon(Icons.load_icon("Minus2"))
        self.previous_position_button.setFixedSize(27, 27)
        self.next_position_button.setIcon(Icons.load_icon("Plus2"))
        self.next_position_button.setFixedSize(27, 27)
 def centring_in_progress_changed(self, centring_in_progress):
     if centring_in_progress:
         self.manager_widget.create_point_start_button.setIcon(
             Icons.load_icon("Delete")
         )
     else:
         self.manager_widget.create_point_start_button.setIcon(
             Icons.load_icon("VCRPlay2")
         )
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

        self.positions = None

        # Properties ----------------------------------------------------------
        self.add_property("label", "string", "")
        self.add_property("mnemonic", "string", "")
        self.add_property("icons", "string", "")
        self.add_property("showMoveButtons", "boolean", True)

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

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

        # Graphic elements ----------------------------------------------------
        _main_gbox = QtImport.QGroupBox(self)
        self.label = QtImport.QLabel("motor:", _main_gbox)
        self.positions_combo = QtImport.QComboBox(self)
        self.previous_position_button = QtImport.QPushButton(_main_gbox)
        self.next_position_button = QtImport.QPushButton(_main_gbox)

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

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

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

        # Other ---------------------------------------------------------------
        self.positions_combo.setFixedHeight(27)
        self.positions_combo.setToolTip("Moves the motor to a predefined position")
        self.previous_position_button.setIcon(Icons.load_icon("Minus2"))
        self.previous_position_button.setFixedSize(27, 27)
        self.next_position_button.setIcon(Icons.load_icon("Plus2"))
        self.next_position_button.setFixedSize(27, 27)
Exemple #12
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)
Exemple #13
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        # Qt signal/slot connections ------------------------------------------
        self.open_button.clicked.connect(self.open_button_clicked)
        self.close_button.clicked.connect(self.close_button_clicked)
    def __init__(self, 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"))
Exemple #16
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"))
Exemple #17
0
    def __init__(self, *args):
        QtImport.QWidget.__init__(self, *args)

        self.value_plot = None

        self.title_label = QtImport.QLabel(self)
        self.value_widget = QtImport.QWidget(self)
        self.value_label = QtImport.QLabel(self.value_widget)
        self.value_label.setAlignment(QtImport.Qt.AlignCenter)
        self.history_button = QtImport.QPushButton(
            Icons.load_icon("LineGraph"), "", self.value_widget)
        self.history_button.hide()
        self.history_button.setFixedWidth(22)
        self.history_button.setFixedHeight(22)

        _value_widget_hlayout = QtImport.QHBoxLayout(self.value_widget)
        _value_widget_hlayout.addWidget(self.value_label)
        _value_widget_hlayout.addWidget(self.history_button)
        _value_widget_hlayout.setSpacing(2)
        _value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        self.main_vlayout = QtImport.QVBoxLayout(self)
        self.main_vlayout.addWidget(self.title_label)
        self.main_vlayout.addWidget(self.value_widget)
        self.main_vlayout.setSpacing(1)
        self.main_vlayout.setContentsMargins(0, 0, 0, 0)

        self.history_button.clicked.connect(self.open_history_view)
Exemple #18
0
    def __init__(self, *args):
        QtImport.QWidget.__init__(self, *args)

        self.value_plot = None

        self.title_label = QtImport.QLabel(self)
        self.value_widget = QtImport.QWidget(self)
        self.value_label = QtImport.QLabel(self.value_widget)
        self.value_label.setAlignment(QtImport.Qt.AlignCenter)
        self.history_button = QtImport.QPushButton(
            Icons.load_icon("LineGraph"), "", self.value_widget
        )
        self.history_button.hide()
        self.history_button.setFixedWidth(22)
        self.history_button.setFixedHeight(22)

        _value_widget_hlayout = QtImport.QHBoxLayout(self.value_widget)
        _value_widget_hlayout.addWidget(self.value_label)
        _value_widget_hlayout.addWidget(self.history_button)
        _value_widget_hlayout.setSpacing(2)
        _value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        self.main_vlayout = QtImport.QVBoxLayout(self)
        self.main_vlayout.addWidget(self.title_label)
        self.main_vlayout.addWidget(self.value_widget)
        self.main_vlayout.setSpacing(1)
        self.main_vlayout.setContentsMargins(0, 0, 0, 0)

        self.history_button.clicked.connect(self.open_history_view)
Exemple #19
0
    def __init__(self,
                 design_mode=False,
                 show_maximized=False,
                 no_border=False):
        """Main mxcube gui widget"""

        QtImport.QWidget.__init__(self)

        self.framework = None
        self.gui_config_file = None
        self.user_file_dir = None
        self.configuration = None
        self.user_settings = None

        self.launch_in_design_mode = design_mode
        self.hardware_repository = HardwareRepository.getHardwareRepository()
        self.show_maximized = show_maximized
        self.no_border = no_border
        self.windows = []

        self.splash_screen = SplashScreen(Icons.load_pixmap("splash"))

        set_splash_screen(self.splash_screen)
        self.splash_screen.show()

        self.time_stamp = 0
Exemple #20
0
    def __init__(self, parent, email_addresses, tab_label):
        QtImport.QWidget.__init__(self, parent)

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

        # Internal values -----------------------------------------------------
        self.tab_label = tab_label
        self.unread_messages = 0
        self.email_addresses = email_addresses
        self.from_email_address = None

        msg = [
            "Feel free to report any comment about this software;",
            " an email will be sent to the people concerned.",
            "Do not forget to put your name or email address if you require an answer.",
        ]
        # Properties ----------------------------------------------------------

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

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

        # Graphic elements ----------------------------------------------------
        __label = QtImport.QLabel("<b>%s</b>" % "\n".join(msg), self)
        __msg_label = QtImport.QLabel("Message:", self)

        self.submit_button = QtImport.QToolButton(self)
        self.message_textedit = QtImport.QTextEdit(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(__label)
        _main_vlayout.addWidget(__msg_label)
        _main_vlayout.addWidget(self.message_textedit)
        _main_vlayout.addWidget(self.submit_button)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.submit_button.clicked.connect(self.submit_message)

        # Other ---------------------------------------------------------------
        self.message_textedit.setToolTip("Write here your comments or feedback")
        self.submit_button.setText("Submit")

        # if hasattr(self.submit_button, "setUsesTextLabel"):
        #    self.submit_button.setUsesTextLabel(True)
        # elif hasattr(self.submit_button, "setToolButtonStyle"):
        #    self.submit_button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.submit_button.setToolButtonStyle(True)
        self.submit_button.setIcon(Icons.load_icon("Envelope"))
        self.submit_button.setToolTip(
            "Click here to send your feedback " + "to the authors of this software"
        )
Exemple #21
0
    def __init__(self, parent, email_addresses, tab_label):
        QtImport.QWidget.__init__(self, parent)

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

        # Internal values -----------------------------------------------------
        self.tab_label = tab_label
        self.unread_messages = 0
        self.email_addresses = email_addresses
        self.from_email_address = None

        msg = [
            "Feel free to report any comment about this software;",
            " an email will be sent to the people concerned.",
            "Do not forget to put your name or email address if you require an answer.",
        ]
        # Properties ----------------------------------------------------------

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

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

        # Graphic elements ----------------------------------------------------
        __label = QtImport.QLabel("<b>%s</b>" % "\n".join(msg), self)
        __msg_label = QtImport.QLabel("Message:", self)

        self.submit_button = QtImport.QToolButton(self)
        self.message_textedit = QtImport.QTextEdit(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(__label)
        _main_vlayout.addWidget(__msg_label)
        _main_vlayout.addWidget(self.message_textedit)
        _main_vlayout.addWidget(self.submit_button)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

        # Qt signal/slot connections ------------------------------------------
        self.submit_button.clicked.connect(self.submit_message)

        # Other ---------------------------------------------------------------
        self.message_textedit.setToolTip("Write here your comments or feedback")
        self.submit_button.setText("Submit")

        # if hasattr(self.submit_button, "setUsesTextLabel"):
        #    self.submit_button.setUsesTextLabel(True)
        # elif hasattr(self.submit_button, "setToolButtonStyle"):
        #    self.submit_button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.submit_button.setToolButtonStyle(True)
        self.submit_button.setIcon(Icons.load_icon("Envelope"))
        self.submit_button.setToolTip(
            "Click here to send your feedback " + "to the authors of this software"
        )
Exemple #22
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)
Exemple #23
0
    def __init__(self, parent, caption=None, icon=None):

        QtImport.QToolButton.__init__(self, parent)
        self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Fixed)
        self.setToolButtonStyle(QtImport.Qt.ToolButtonTextUnderIcon)
        if caption:
            self.setText(caption)
            self.setWindowIconText(caption)
        if icon:
            self.setIcon(Icons.load_icon(icon))
Exemple #24
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)
Exemple #25
0
    def __init__(self, parent, caption=None, icon=None):

        QtImport.QToolButton.__init__(self, parent)
        self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Fixed)
        self.setToolButtonStyle(QtImport.Qt.ToolButtonTextUnderIcon)
        if caption:
            self.setText(caption)
            self.setWindowIconText(caption)
        if icon:
            self.setIcon(Icons.load_icon(icon))
Exemple #26
0
    def __init__(self, parent=None):

        QtImport.QWidget.__init__(self, parent)

        self.ok_button = QtImport.QToolButton(parent)
        self.ok_button.setAutoRaise(True)
        self.ok_button.setIcon(Icons.load_icon("button_ok_small"))
        self.cancel_button = QtImport.QToolButton(parent)
        self.cancel_button.setAutoRaise(True)
        self.cancel_button.setIcon(Icons.load_icon("button_cancel_small"))
        self.reset_button = QtImport.QToolButton(parent)
        self.reset_button.setIcon(Icons.load_icon("button_default_small"))
        self.reset_button.setAutoRaise(True)
        self.setEnabled(False)

        _main_layout = QtImport.QHBoxLayout(self)
        _main_layout.addWidget(self.ok_button)
        _main_layout.addWidget(self.cancel_button)
        _main_layout.addWidget(self.reset_button)
        _main_layout.setSpacing(0)
        _main_layout.setContentsMargins(0, 0, 0, 0)
Exemple #27
0
    def __init__(self, parent=None):

        QtImport.QWidget.__init__(self, parent)

        self.ok_button = QtImport.QToolButton(parent)
        self.ok_button.setAutoRaise(True)
        self.ok_button.setIcon(Icons.load_icon("button_ok_small"))
        self.cancel_button = QtImport.QToolButton(parent)
        self.cancel_button.setAutoRaise(True)
        self.cancel_button.setIcon(Icons.load_icon("button_cancel_small"))
        self.reset_button = QtImport.QToolButton(parent)
        self.reset_button.setIcon(Icons.load_icon("button_default_small"))
        self.reset_button.setAutoRaise(True)
        self.setEnabled(False)

        _main_layout = QtImport.QHBoxLayout(self)
        _main_layout.addWidget(self.ok_button)
        _main_layout.addWidget(self.cancel_button)
        _main_layout.addWidget(self.reset_button)
        _main_layout.setSpacing(0)
        _main_layout.setContentsMargins(0, 0, 0, 0)
Exemple #28
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

        self.connect(
            HWR.beamline.hutch_interlock,
            "doorInterlockStateChanged",
            self.state_changed
        )
        HWR.beamline.hutch_interlock.re_emit_values()
        def __add_connection(sender_window, sender, connection):
            """Adds connection"""

            new_item = QtImport.QTreeWidgetItem(self.connections_treewidget)

            window_name = sender_window["name"]
            new_item.setText(1, window_name)

            if sender != sender_window:
                new_item.setText(2, sender["name"])

            new_item.setText(4, connection["receiverWindow"])

            try:
                receiver_window = self.configuration.windows[
                    connection["receiverWindow"]
                ]
            except KeyError:
                receiver_window = {}
                result = False
            else:
                result = True

            if len(connection["receiver"]):
                # *-object
                new_item.setText(5, connection["receiver"])

                result = result and __receiver_in_window(
                    connection["receiver"], receiver_window
                )

            if result:
                new_item.setIcon(0, Icons.load_icon("button_ok_small"))
            else:
                new_item.setIcon(0, Icons.load_icon("button_cancel_small"))

            new_item.setText(3, connection["signal"])
            new_item.setText(6, connection["slot"])
Exemple #30
0
 def property_changed(self, property_name, old_value, new_value):
     if property_name == "codes":
         self.set_codes(new_value)
     elif property_name == "localLogin":
         self.local_login_hwobj = self.get_hardware_object(new_value, optional=True)
     elif property_name == "instanceServer":
         if self.instance_server_hwobj is not None:
             self.disconnect(
                 self.instance_server_hwobj, "passControl", self.pass_control
             )
             self.disconnect(
                 self.instance_server_hwobj, "haveControl", self.have_control
             )
         self.instance_server_hwobj = self.get_hardware_object(
             new_value, optional=True
         )
         if self.instance_server_hwobj is not None:
             self.connect(
                 self.instance_server_hwobj, "passControl", self.pass_control
             )
             self.connect(
                 self.instance_server_hwobj, "haveControl", self.have_control
             )
     elif property_name == "icons":
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(Icons.load_icon(icons_list[0]))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(Icons.load_icon(icons_list[1]))
         except IndexError:
             pass
     elif property_name == "secondaryProposals":
         self.secondary_proposals = new_value.split()
     else:
         BaseWidget.property_changed(self, property_name, old_value, new_value)
Exemple #31
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

        self.connect(
            api.door_interlock, "doorInterlockStateChanged", self.state_changed
        )
        api.door_interlock.update_values()
Exemple #32
0
        def __add_connection(sender_window, sender, connection):
            """Adds connection"""

            new_item = QtImport.QTreeWidgetItem(self.connections_treewidget)

            window_name = sender_window["name"]
            new_item.setText(1, window_name)

            if sender != sender_window:
                new_item.setText(2, sender["name"])

            new_item.setText(4, connection["receiverWindow"])

            try:
                receiver_window = self.configuration.windows[
                    connection["receiverWindow"]]
            except KeyError:
                receiver_window = {}
                result = False
            else:
                result = True

            if len(connection["receiver"]):
                # *-object
                new_item.setText(5, connection["receiver"])

                result = result and __receiver_in_window(
                    connection["receiver"], receiver_window)

            if result:
                new_item.setIcon(0, Icons.load_icon("button_ok_small"))
            else:
                new_item.setIcon(0, Icons.load_icon("button_cancel_small"))

            new_item.setText(3, connection["signal"])
            new_item.setText(6, connection["slot"])
Exemple #33
0
 def init_tools(self):
     """Gets available methods and populates menubar with methods
        If icon name exists then adds icon
     """
     self.tools_list = self.tools_hwobj.get_tools_list()
     for tool in self.tools_list:
         if tool == "separator":
             self.tools_menu.addSeparator()
         elif hasattr(tool["hwobj"], tool["method"]):
             temp_action = self.tools_menu.addAction(
                 tool["display"], self.execute_tool)
             if tool.get("icon"):
                 temp_action.setIcon(Icons.load_icon(tool["icon"]))
             temp_action.setDisabled(tool.get("expertMode", False))
             self.action_dict[temp_action] = tool
    def add_pending_connection(self, connection_dict):
        """Adds pendinf connection"""

        parameter_list = (
            "",
            connection_dict["senderWindow"],
            connection_dict["senderObject"],
            connection_dict["signal"],
            connection_dict["receiverWindow"],
            connection_dict["receiverObject"],
            connection_dict["slot"],
        )

        new_item = QtImport.QTreeWidgetItem(self.connections_treewidget, parameter_list)
        new_item.setIcon(0, Icons.load_icon("button_ok_small"))
        self.connections_treewidget.addTopLevelItem(new_item)
Exemple #35
0
    def add_pending_connection(self, connection_dict):
        """Adds pendinf connection"""

        parameter_list = (
            "",
            connection_dict["senderWindow"],
            connection_dict["senderObject"],
            connection_dict["signal"],
            connection_dict["receiverWindow"],
            connection_dict["receiverObject"],
            connection_dict["slot"],
        )

        new_item = QtImport.QTreeWidgetItem(self.connections_treewidget,
                                            parameter_list)
        new_item.setIcon(0, Icons.load_icon("button_ok_small"))
        self.connections_treewidget.addTopLevelItem(new_item)
    def refresh_plate_location(self):
        new_location = HWR.beamline.plate_manipulator.get_plate_location()
        self.plate_navigator_cell.setEnabled(True)

        if new_location:
            row = new_location[0]
            col = new_location[1]
            pos_x = new_location[2]
            pos_y = new_location[3]
            self.navigation_item.set_navigation_pos(pos_x, pos_y)
            self.plate_navigator_cell.update()
            if self.__current_location != new_location:
                empty_item = QtImport.QTableWidgetItem(QtImport.QIcon(), "")
                self.plate_navigator_table.setItem(self.__current_location[0],
                                                   self.__current_location[1],
                                                   empty_item)
                new_item = QtImport.QTableWidgetItem(
                    Icons.load_icon("sample_axis"), "")
                self.plate_navigator_table.setItem(row, col, new_item)
                self.__current_location = new_location
Exemple #37
0
    def __init__(self, design_mode=False, show_maximized=False, no_border=False):
        """Main mxcube gui widget"""

        QtImport.QWidget.__init__(self)

        self.framework = None
        self.gui_config_file = None
        self.user_file_dir = None
        self.configuration = None
        self.user_settings = None

        self.launch_in_design_mode = design_mode
        self.hardware_repository = HardwareRepository.getHardwareRepository()
        self.show_maximized = show_maximized
        self.no_border = no_border
        self.windows = []

        self.splash_screen = SplashScreen(Icons.load_pixmap("splash"))

        set_splash_screen(self.splash_screen)
        self.splash_screen.show()

        self.time_stamp = 0
Exemple #38
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

        # Properties ----------------------------------------------------------
        self.add_property(
            "level", "combo", ("NOT SET", "INFO", "WARNING", "ERROR"), "NOT SET"
        )
        self.add_property("showDebug", "boolean", True)
        self.add_property("appearance", "combo", ("list", "tabs"), "tabs")
        self.add_property("enableFeedback", "boolean", True)
        self.add_property("emailAddresses", "string", "")
        self.add_property("fromEmailAddress", "string", "")
        self.add_property("maxLogLines", "integer", -1)
        self.add_property("autoSwitchTabs", "boolean", False)
        self.add_property("myTabLabel", "string", "")

        # Signals -------------------------------------------------------------
        self.define_signal("incUnreadMessagesSignal", ())
        self.define_signal("resetUnreadMessagesSignal", ())

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

        # Graphic elements ----------------------------------------------------
        self.tab_widget = QtImport.QTabWidget(self)

        self.details_log = CustomTreeWidget(self.tab_widget, "Errors and warnings")
        self.info_log = CustomTreeWidget(self.tab_widget, "Information")
        self.debug_log = CustomTreeWidget(self.tab_widget, "Debug")
        self.feedback_log = Submitfeedback(
            self.tab_widget, self["emailAddresses"], "Submit feedback"
        )

        self.tab_widget.addTab(
            self.details_log, Icons.load_icon("Caution"), "Errors and warnings"
        )
        self.tab_widget.addTab(self.info_log, Icons.load_icon("Inform"), "Information")
        self.tab_widget.addTab(self.debug_log, Icons.load_icon("Hammer"), "Debug")
        self.tab_widget.addTab(
            self.feedback_log, Icons.load_icon("Envelope"), "Submit feedback"
        )

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.tab_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

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

        # Other ---------------------------------------------------------------
        self.tab_levels = {
            logging.NOTSET: self.info_log,
            logging.DEBUG: self.info_log,
            logging.INFO: self.info_log,
            logging.WARNING: self.info_log,
            logging.ERROR: self.info_log,
            logging.CRITICAL: self.info_log,
        }

        self.filter_level = logging.NOTSET
        # Register to GUI log handler
        GUILogHandler.GUILogHandler().register(self)
 def set_step_button_icon(self, icon_name):
     self.step_button_icon = Icons.load_icon(icon_name)
     self.step_button.setIcon(self.step_button_icon)
     for i in range(self.step_combo.count()):
         # xt = self.step_combo.itemText(i)
         self.step_combo.setItemIcon(i, self.step_button_icon)
Exemple #40
0
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.step_editor = None
        self.move_step = 1
        self.demand_move = 0
        self.in_expert_mode = None
        self.position_history = []

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "")
        self.add_property("formatString", "formatString", "+##.##")
        self.add_property("label", "string", "")
        self.add_property("showLabel", "boolean", True)
        self.add_property("showMoveButtons", "boolean", True)
        self.add_property("showSlider", "boolean", False)
        self.add_property("showStop", "boolean", True)
        self.add_property("showStep", "boolean", True)
        self.add_property("showStepList", "boolean", False)
        self.add_property("showPosition", "boolean", True)
        self.add_property("invertButtons", "boolean", False)
        self.add_property("oneClickPressButton", "boolean", False)
        self.add_property("delta", "string", "")
        self.add_property("decimals", "integer", 2)
        self.add_property("icons", "string", "")
        self.add_property("helpDecrease", "string", "")
        self.add_property("helpIncrease", "string", "")
        self.add_property("hideInUser", "boolean", False)
        self.add_property("defaultSteps", "string", "180 90 45 30 10")
        self.add_property("enableSliderTracking", "boolean", False)

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

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

        # Graphic elements-----------------------------------------------------
        self.main_gbox = QtImport.QGroupBox(self)
        self.motor_label = QtImport.QLabel(self.main_gbox)
        self.motor_label.setFixedHeight(27)

        # Main controls
        self.move_left_button = QtImport.QPushButton(self.main_gbox)
        self.move_left_button.setIcon(Icons.load_icon("Left2"))
        self.move_left_button.setToolTip("Moves the motor down (while pressed)")
        self.move_left_button.setFixedSize(27, 27)
        self.move_left_button.setAutoRepeatDelay(500)
        self.move_left_button.setAutoRepeatInterval(500)
        self.move_right_button = QtImport.QPushButton(self.main_gbox)
        self.move_right_button.setIcon(Icons.load_icon("Right2"))
        self.move_right_button.setToolTip("Moves the motor up (while pressed)")
        self.move_right_button.setFixedSize(27, 27)
        self.move_right_button.setAutoRepeatDelay(500)
        self.move_right_button.setAutoRepeatInterval(500)
        self.position_spinbox = QtImport.QDoubleSpinBox(self.main_gbox)
        self.position_spinbox.setMinimum(-10000)
        self.position_spinbox.setMaximum(10000)
        self.position_spinbox.setFixedSize(75, 27)
        self.position_spinbox.setDecimals(3)
        self.position_spinbox.setToolTip(
            "Moves the motor to a specific "
            + "position or step by step; right-click for motor history"
        )
        self.position_spinbox.setContextMenuPolicy(QtImport.Qt.CustomContextMenu)

        # Extra controls
        self.stop_button = QtImport.QPushButton(self.main_gbox)
        self.stop_button.setIcon(Icons.load_icon("Stop2"))
        self.stop_button.setEnabled(False)
        self.stop_button.setToolTip("Stops the motor")
        self.stop_button.setFixedSize(27, 27)

        self.step_button = QtImport.QPushButton(self.main_gbox)
        self.step_button_icon = Icons.load_icon("TileCascade2")
        self.step_button.setIcon(self.step_button_icon)
        self.step_button.setToolTip("Changes the motor step")
        self.step_button.setFixedSize(27, 27)

        self.step_combo = QtImport.QComboBox(self.main_gbox)
        self.step_combo.setEditable(True)
        self.step_combo.setValidator(
            QtImport.QDoubleValidator(0, 360, 5, self.step_combo)
        )
        self.step_combo.setDuplicatesEnabled(False)
        self.step_combo.setFixedHeight(27)

        self.position_slider = QtImport.QDoubleSlider(
            QtImport.Qt.Horizontal, self.main_gbox
        )

        # Layout --------------------------------------------------------------
        self._gbox_hbox_layout = QtImport.QHBoxLayout(self.main_gbox)
        self._gbox_hbox_layout.addWidget(self.motor_label)
        self._gbox_hbox_layout.addWidget(self.position_spinbox)
        self._gbox_hbox_layout.addWidget(self.move_left_button)
        self._gbox_hbox_layout.addWidget(self.move_right_button)
        self._gbox_hbox_layout.addWidget(self.position_slider)
        self._gbox_hbox_layout.addWidget(self.stop_button)
        self._gbox_hbox_layout.addWidget(self.step_button)
        self._gbox_hbox_layout.addWidget(self.step_combo)
        self._gbox_hbox_layout.setSpacing(2)
        self._gbox_hbox_layout.setContentsMargins(2, 2, 2, 2)

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

        # SizePolicy (horizontal, vertical) -----------------------------------
        # self.setSizePolicy(QSizePolicy.Fixed,
        #                   QSizePolicy.Fixed)

        # Object events ------------------------------------------------------
        spinbox_event = SpinBoxEvent(self.position_spinbox)
        self.position_spinbox.installEventFilter(spinbox_event)
        spinbox_event.returnPressedSignal.connect(self.change_position)
        spinbox_event.contextMenuSignal.connect(self.open_history_menu)
        self.position_spinbox.lineEdit().textEdited.connect(self.position_value_edited)
        
        self.step_combo.activated.connect(self.go_to_step)
        self.step_combo.activated.connect(self.step_changed)
        self.step_combo.editTextChanged.connect(self.step_edited)

        self.stop_button.clicked.connect(self.stop_motor)
        self.step_button.clicked.connect(self.open_step_editor)

        self.move_left_button.pressed.connect(self.move_down)
        self.move_left_button.released.connect(self.stop_moving)
        self.move_right_button.pressed.connect(self.move_up)
        self.move_right_button.released.connect(self.stop_moving)

        self.position_slider.doubleValueChanged.connect(
            self.position_slider_double_value_changed
        )

        # Other ---------------------------------------------------------------
        self.instance_synchronize("position_spinbox", "step_combo")
Exemple #41
0
 def property_changed(self, property_name, old_value, new_value):
     if property_name == "mnemonic":
         self.set_motor(self.motor_hwobj, new_value)
     elif property_name == "formatString":
         if self.motor_hwobj is not None:
             self.update_gui()
     elif property_name == "label":
         self.set_label(new_value)
     elif property_name == "showLabel":
         if new_value:
             self.set_label(self["label"])
         else:
             self.set_label(None)
     elif property_name == "showMoveButtons":
         if new_value:
             self.move_left_button.show()
             self.move_right_button.show()
         else:
             self.move_left_button.hide()
             self.move_right_button.hide()
     elif property_name == "showStop":
         if new_value:
             self.stop_button.show()
         else:
             self.stop_button.hide()
     elif property_name == "showStep":
         if new_value:
             self.step_button.show()
         else:
             self.step_button.hide()
     elif property_name == "showStepList":
         if new_value:
             self.step_combo.show()
         else:
             self.step_combo.hide()
     elif property_name == "showPosition":
         if new_value:
             self.position_spinbox.show()
         else:
             self.position_spinbox.hide()
     elif property_name == "icons":
         icons_list = new_value.split()
         try:
             self.move_left_button.setIcon(Icons.load_icon(icons_list[0]))
             self.move_right_button.setIcon(Icons.load_icon(icons_list[1]))
             self.stop_button.setIcon(Icons.load_icon(icons_list[2]))
             self.set_step_button_icon(icons_list[3])
         except IndexError:
             pass
     elif property_name == "helpDecrease":
         if new_value == "":
             self.move_left_button.setToolTip("Moves the motor down (while pressed)")
         else:
             self.move_left_button.setToolTip(new_value)
     elif property_name == "helpIncrease":
         if new_value == "":
             self.move_right_button.setToolTip("Moves the motor up (while pressed)")
         else:
             self.move_right_button.setToolTip(new_value)
     elif property_name == "defaultSteps":
         if new_value != "":
             default_step_list = new_value.split()
             for default_step in default_step_list:
                 self.set_line_step(float(default_step))
             self.step_changed(None)
     elif property_name == "decimals":
         self.position_spinbox.setDecimals(new_value)
     elif property_name == "showSlider":
         self.position_slider.setVisible(new_value)
     elif property_name == "enableSliderTracking":
         self.position_slider.setTracking(new_value)
     elif property_name == "oneClickPressButton":
         self.set_buttons_press_nature(new_value)
     else:
         BaseWidget.property_changed(self, property_name, old_value, new_value)
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "")
        self.add_property("label", "string", "")
        self.add_property("showStop", "boolean", True)
        self.add_property("defaultStep", "string", "10.0")

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

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

        # Graphic elements-----------------------------------------------------
        _main_gbox = QtImport.QGroupBox(self)

        self.kappa_dspinbox = QtImport.QDoubleSpinBox(_main_gbox)
        self.kappa_dspinbox.setRange(-360, 360)
        self.kappaphi_dspinbox = QtImport.QDoubleSpinBox(_main_gbox)
        self.kappaphi_dspinbox.setRange(-360, 360)
        self.step_cbox = QtImport.QComboBox(_main_gbox)
        self.step_button_icon = Icons.load_icon("TileCascade2")
        self.close_button = QtImport.QPushButton(_main_gbox)
        self.stop_button = QtImport.QPushButton(_main_gbox)

        # Layout --------------------------------------------------------------
        _main_gbox_hlayout = QtImport.QHBoxLayout(_main_gbox)
        _main_gbox_hlayout.addWidget(QtImport.QLabel("Kappa:", _main_gbox))
        _main_gbox_hlayout.addWidget(self.kappa_dspinbox)
        _main_gbox_hlayout.addWidget(QtImport.QLabel("Phi:", _main_gbox))
        _main_gbox_hlayout.addWidget(self.kappaphi_dspinbox)
        _main_gbox_hlayout.addWidget(self.step_cbox)
        _main_gbox_hlayout.addWidget(self.close_button)
        _main_gbox_hlayout.addWidget(self.stop_button)
        _main_gbox_hlayout.setSpacing(2)
        _main_gbox_hlayout.setContentsMargins(2, 2, 2, 2)

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

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

        # Qt signal/slot connections ------------------------------------------
        kappa_dspinbox_event = SpinBoxEvent(self.kappa_dspinbox)
        kappaphi_dspinbox_event = SpinBoxEvent(self.kappaphi_dspinbox)
        self.kappa_dspinbox.installEventFilter(kappa_dspinbox_event)
        self.kappaphi_dspinbox.installEventFilter(kappaphi_dspinbox_event)
        kappa_dspinbox_event.returnPressedSignal.connect(self.change_position)
        kappaphi_dspinbox_event.returnPressedSignal.connect(self.change_position)
        self.kappa_dspinbox.lineEdit().textEdited.connect(self.kappa_value_edited)
        self.kappaphi_dspinbox.lineEdit().textEdited.connect(self.kappaphi_value_edited)

        self.step_cbox.activated.connect(self.go_to_step)
        self.step_cbox.activated.connect(self.step_changed)
        self.step_cbox.textChanged.connect(self.step_edited)

        self.close_button.clicked.connect(self.close_clicked)
        self.stop_button.clicked.connect(self.stop_clicked)

        # self.stop_button.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Minimum)
        # Other ---------------------------------------------------------------
        self.kappa_dspinbox.setAlignment(QtImport.Qt.AlignRight)
        self.kappa_dspinbox.setFixedWidth(75)
        self.kappaphi_dspinbox.setAlignment(QtImport.Qt.AlignRight)
        self.kappaphi_dspinbox.setFixedWidth(75)

        self.step_cbox.setEditable(True)
        self.step_cbox.setValidator(
            QtImport.QDoubleValidator(0, 360, 5, self.step_cbox)
        )
        self.step_cbox.setDuplicatesEnabled(False)
        self.step_cbox.setFixedHeight(27)

        self.close_button.setIcon(Icons.load_icon("Home2"))
        self.close_button.setFixedSize(27, 27)

        self.stop_button.setIcon(Icons.load_icon("Stop2"))
        self.stop_button.setEnabled(False)
        self.stop_button.setFixedSize(27, 27)
Exemple #43
0
 def set_step_button_icon(self, icon_name):
     self.step_button_icon = Icons.load_icon(icon_name)
     self.step_button.setIcon(self.step_button_icon)
     for i in range(self.step_combo.count()):
         # xt = self.step_combo.itemText(i)
         self.step_combo.setItemIcon(i, self.step_button_icon)
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.step_editor = None
        self.move_step = 1
        self.demand_move = 0
        self.in_expert_mode = None

        # Properties ----------------------------------------------------------
        self.add_property("mnemonic", "string", "")
        self.add_property("formatString", "formatString", "+##.##")
        self.add_property("label", "string", "")
        self.add_property("showLabel", "boolean", True)
        self.add_property("showMoveButtons", "boolean", True)
        self.add_property("showSlider", "boolean", False)
        self.add_property("showStop", "boolean", True)
        self.add_property("showStep", "boolean", True)
        self.add_property("showStepList", "boolean", False)
        self.add_property("showPosition", "boolean", True)
        self.add_property("invertButtons", "boolean", False)
        self.add_property("delta", "string", "")
        self.add_property("decimals", "integer", 2)
        self.add_property("icons", "string", "")
        self.add_property("helpDecrease", "string", "")
        self.add_property("helpIncrease", "string", "")
        self.add_property("hideInUser", "boolean", False)
        self.add_property("defaultSteps", "string", "180 90 45 30 10")
        self.add_property("enableSliderTracking", "boolean", False)

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

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

        # Graphic elements-----------------------------------------------------
        self.main_gbox = QtImport.QGroupBox(self)
        self.motor_label = QtImport.QLabel(self.main_gbox)
        self.motor_label.setFixedHeight(27)

        # Main controls
        self.move_left_button = QtImport.QPushButton(self.main_gbox)
        self.move_left_button.setIcon(Icons.load_icon("Left2"))
        self.move_left_button.setToolTip("Moves the motor down (while pressed)")
        self.move_left_button.setFixedSize(27, 27)
        self.move_right_button = QtImport.QPushButton(self.main_gbox)
        self.move_right_button.setIcon(Icons.load_icon("Right2"))
        self.move_right_button.setToolTip("Moves the motor up (while pressed)")
        self.move_right_button.setFixedSize(27, 27)

        self.position_spinbox = QtImport.QDoubleSpinBox(self.main_gbox)
        self.position_spinbox.setMinimum(-10000)
        self.position_spinbox.setMaximum(10000)
        self.position_spinbox.setFixedSize(75, 27)
        self.position_spinbox.setDecimals(3)
        self.position_spinbox.setToolTip(
            "Moves the motor to a specific "
            + "position or step by step; right-click for motor history"
        )

        # Extra controls
        self.stop_button = QtImport.QPushButton(self.main_gbox)
        self.stop_button.setIcon(Icons.load_icon("Stop2"))
        self.stop_button.setEnabled(False)
        self.stop_button.setToolTip("Stops the motor")
        self.stop_button.setFixedSize(27, 27)

        self.step_button = QtImport.QPushButton(self.main_gbox)
        self.step_button_icon = Icons.load_icon("TileCascade2")
        self.step_button.setIcon(self.step_button_icon)
        self.step_button.setToolTip("Changes the motor step")
        self.step_button.setFixedSize(27, 27)

        self.step_combo = QtImport.QComboBox(self.main_gbox)
        self.step_combo.setEditable(True)
        self.step_combo.setValidator(
            QtImport.QDoubleValidator(0, 360, 5, self.step_combo)
        )
        self.step_combo.setDuplicatesEnabled(False)
        self.step_combo.setFixedHeight(27)

        self.position_slider = QtImport.QDoubleSlider(
            QtImport.Qt.Horizontal, self.main_gbox
        )

        # Layout --------------------------------------------------------------
        self._gbox_hbox_layout = QtImport.QHBoxLayout(self.main_gbox)
        self._gbox_hbox_layout.addWidget(self.motor_label)
        self._gbox_hbox_layout.addWidget(self.position_spinbox)
        self._gbox_hbox_layout.addWidget(self.move_left_button)
        self._gbox_hbox_layout.addWidget(self.move_right_button)
        self._gbox_hbox_layout.addWidget(self.position_slider)
        self._gbox_hbox_layout.addWidget(self.stop_button)
        self._gbox_hbox_layout.addWidget(self.step_button)
        self._gbox_hbox_layout.addWidget(self.step_combo)
        self._gbox_hbox_layout.setSpacing(2)
        self._gbox_hbox_layout.setContentsMargins(2, 2, 2, 2)

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

        # SizePolicy (horizontal, vertical) -----------------------------------
        # self.setSizePolicy(QSizePolicy.Fixed,
        #                   QSizePolicy.Fixed)

        # Object events ------------------------------------------------------
        spinbox_event = SpinBoxEvent(self.position_spinbox)
        self.position_spinbox.installEventFilter(spinbox_event)
        spinbox_event.returnPressedSignal.connect(self.change_position)
        spinbox_event.contextMenuSignal.connect(self.open_history_menu)
        self.position_spinbox.lineEdit().textEdited.connect(self.position_value_edited)

        self.step_combo.activated.connect(self.go_to_step)
        self.step_combo.activated.connect(self.step_changed)
        self.step_combo.editTextChanged.connect(self.step_edited)

        self.stop_button.clicked.connect(self.stop_motor)
        self.step_button.clicked.connect(self.open_step_editor)

        self.move_left_button.pressed.connect(self.move_down)
        self.move_left_button.released.connect(self.stop_moving)
        self.move_right_button.pressed.connect(self.move_up)
        self.move_right_button.released.connect(self.stop_moving)

        self.position_slider.doubleValueChanged.connect(
            self.position_slider_double_value_changed
        )

        # Other ---------------------------------------------------------------
        self.instance_synchronize("position_spinbox", "step_combo")
Exemple #45
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.cond_list = None
        self.states_list = None
        self.trans_list = None

        self.state_graph_node_list = []
        self.trans_graph_node_list = []
        self.condition_value_dict = {}

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

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

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

        # Graphic elements ----------------------------------------------------
        _cond_states_gbox = QtImport.QGroupBox(r"States \ conditions", self)
        self.splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self)
        self.cond_states_table = QtImport.QTableWidget(self.splitter)
        self.log_treewidget = QtImport.QTreeWidget(self.splitter)
        self.graph_graphics_view = QtImport.QGraphicsView(self)
        self.graph_graphics_scene = QtImport.QGraphicsScene(self)

        self.check_icon = Icons.load_icon("Check")
        self.reject_icon = Icons.load_icon("Delete")

        # Layout --------------------------------------------------------------
        _cond_states_gbox_vlayout = QtImport.QVBoxLayout(_cond_states_gbox)
        _cond_states_gbox_vlayout.addWidget(self.splitter)
        _cond_states_gbox_vlayout.setSpacing(2)
        _cond_states_gbox_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QHBoxLayout(self)
        _main_vlayout.addWidget(_cond_states_gbox)
        _main_vlayout.addWidget(self.graph_graphics_view)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # Other ---------------------------------------------------------------
        self.cond_states_table.verticalHeader().setDefaultSectionSize(20)
        self.cond_states_table.horizontalHeader().setDefaultSectionSize(20)
        # setSelectionMode(QtImport.QAbstractItemView::SingleSelection);
        font = self.cond_states_table.font()
        font.setPointSize(8)
        self.cond_states_table.setFont(font)

        self.splitter.setSizes([200, 20])
        self.log_treewidget.setColumnCount(6)
        self.log_treewidget.setHeaderLabels(
            ["State", "Start time", "End time", "Total time", "Previous state", "Notes"]
        )
        self.graph_graphics_view.setFixedSize(900, 600)
        self.graph_graphics_scene.setSceneRect(0, 0, 900, 600)
        self.graph_graphics_view.setScene(self.graph_graphics_scene)
        self.graph_graphics_view.setHorizontalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setVerticalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setDragMode(QtImport.QGraphicsView.RubberBandDrag)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.Antialiasing)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.TextAntialiasing)
Exemple #46
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "mnemonic":
            if self.instance_server_hwobj is not None:
                self.disconnect(
                    self.instance_server_hwobj,
                    "chatMessageReceived",
                    self.message_arrived,
                )
                self.disconnect(
                    self.instance_server_hwobj, "newClient", self.new_client
                )
                self.disconnect(
                    self.instance_server_hwobj,
                    "serverInitialized",
                    self.server_initialized,
                )
                self.disconnect(
                    self.instance_server_hwobj,
                    "clientInitialized",
                    self.client_initialized,
                )
                self.disconnect(
                    self.instance_server_hwobj, "serverClosed", self.client_closed
                )
                self.disconnect(
                    self.instance_server_hwobj, "wantsControl", self.wants_control
                )
                self.disconnect(
                    self.instance_server_hwobj, "haveControl", self.have_control
                )
                self.disconnect(
                    self.instance_server_hwobj, "passControl", self.pass_control
                )
                self.disconnect(
                    self.instance_server_hwobj, "clientClosed", self.client_closed
                )
                self.disconnect(
                    self.instance_server_hwobj, "clientChanged", self.client_changed
                )

            self.instance_server_hwobj = self.get_hardware_object(new_value)

            if self.instance_server_hwobj is not None:
                self.connect(
                    self.instance_server_hwobj,
                    "chatMessageReceived",
                    self.message_arrived,
                )
                self.connect(self.instance_server_hwobj, "newClient", self.new_client)
                self.connect(
                    self.instance_server_hwobj,
                    "serverInitialized",
                    self.server_initialized,
                )
                self.connect(
                    self.instance_server_hwobj,
                    "clientInitialized",
                    self.client_initialized,
                )
                self.connect(
                    self.instance_server_hwobj, "serverClosed", self.client_closed
                )
                self.connect(
                    self.instance_server_hwobj, "wantsControl", self.wants_control
                )
                self.connect(
                    self.instance_server_hwobj, "haveControl", self.have_control
                )
                self.connect(
                    self.instance_server_hwobj, "passControl", self.pass_control
                )
                self.connect(
                    self.instance_server_hwobj, "clientClosed", self.client_closed
                )
                self.connect(
                    self.instance_server_hwobj, "clientChanged", self.client_changed
                )

        elif property_name == "icons":
            icons_list = new_value.split()
            try:
                self.send_button.setIcon(Icons.load_icon(icons_list[0]))
            except IndexError:
                pass
        else:
            BaseWidget.property_changed(self, property_name, old_value, new_value)
Exemple #47
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")
    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 property_changed(self, property_name, old_value, new_value):
     if property_name == "mnemonic":
         self.set_motor(self.motor_hwobj, new_value)
     elif property_name == "formatString":
         if self.motor_hwobj is not None:
             self.update_gui()
     elif property_name == "label":
         self.set_label(new_value)
     elif property_name == "showLabel":
         if new_value:
             self.set_label(self["label"])
         else:
             self.set_label(None)
     elif property_name == "showMoveButtons":
         if new_value:
             self.move_left_button.show()
             self.move_right_button.show()
         else:
             self.move_left_button.hide()
             self.move_right_button.hide()
     elif property_name == "showStop":
         if new_value:
             self.stop_button.show()
         else:
             self.stop_button.hide()
     elif property_name == "showStep":
         if new_value:
             self.step_button.show()
         else:
             self.step_button.hide()
     elif property_name == "showStepList":
         if new_value:
             self.step_combo.show()
         else:
             self.step_combo.hide()
     elif property_name == "showPosition":
         if new_value:
             self.position_spinbox.show()
         else:
             self.position_spinbox.hide()
     elif property_name == "icons":
         icons_list = new_value.split()
         try:
             self.move_left_button.setIcon(Icons.load_icon(icons_list[0]))
             self.move_right_button.setIcon(Icons.load_icon(icons_list[1]))
             self.stop_button.setIcon(Icons.load_icon(icons_list[2]))
             self.set_step_button_icon(icons_list[3])
         except IndexError:
             pass
     elif property_name == "helpDecrease":
         if new_value == "":
             self.move_left_button.setToolTip("Moves the motor down (while pressed)")
         else:
             self.move_left_button.setToolTip(new_value)
     elif property_name == "helpIncrease":
         if new_value == "":
             self.move_right_button.setToolTip("Moves the motor up (while pressed)")
         else:
             self.move_right_button.setToolTip(new_value)
     elif property_name == "defaultSteps":
         if new_value != "":
             default_step_list = new_value.split()
             for default_step in default_step_list:
                 self.set_line_step(float(default_step))
             self.step_changed(None)
     elif property_name == "decimals":
         self.position_spinbox.setDecimals(new_value)
     elif property_name == "showSlider":
         self.position_slider.setVisible(new_value)
     elif property_name == "enableSliderTracking":
         self.position_slider.setTracking(new_value)
     else:
         BaseWidget.property_changed(self, property_name, old_value, new_value)
    def __init__(self, *args):

        BaseWidget.__init__(self, *args)

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.center_beam_button.setToolTip("Start center beam procedure")
        self.center_beam_button.setIcon(Icons.load_icon("QuickRealign"))
        self.measure_flux_button.setToolTip("Measure flux")
        self.measure_flux_button.setIcon(Icons.load_icon("Sun"))
    def __init__(self, parent=None, name=None, fl=0, xray_imaging_params=None):

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

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

        # Hardware objects ----------------------------------------------------
        self.beamline_setup_hwobj = None
        self.xray_imaging_hwobj = None

        # Internal variables --------------------------------------------------
        self.current_image_num = 0
        self.total_image_num = 0

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

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

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

        # Graphic elements ----------------------------------------------------
        results_gbox = QtImport.QGroupBox("Results", self)
        
        self.graphics_view_widget = QtImport.QWidget(results_gbox)
        self.results_widget = QtImport.load_ui_file(
            "xray_imaging_results_widget_layout.ui"
        )
        tools_widget = QtImport.QGroupBox(self) 
        button_widget = QtImport.QWidget(self)
        self.start_centering_button = QtImport.QPushButton(
            Icons.load_icon("VCRPlay2"), "3 Click", tools_widget
        )
        self.start_n_centering_button = QtImport.QPushButton(
            Icons.load_icon("VCRPlay"), "n Click", tools_widget
        )
        self.accept_centering_button = QtImport.QPushButton(
            Icons.load_icon("ThumbUp"), "Save", tools_widget
        )
        self.histogram_plot = TwoDimenisonalPlotWidget(self)

        self.popup_menu = QtImport.QMenu(self)
        self.popup_menu.menuAction().setIconVisibleInMenu(True)

        self.popup_menu.addAction(
            Icons.load_icon("VCRPlay2"),
            "Start 3-click centering",
            self.start_centering_clicked,
        )
        self.popup_menu.addAction(
            Icons.load_icon("VCRPlay"),
            "Start n-click centering",
            self.start_n_centering_clicked,
        )
        self.popup_menu.addAction(
            Icons.load_icon("ThumbUp"),
            "Create centering point",
            self.accept_centering_clicked,
        )

        self.popup_menu.addSeparator()
        self.measure_distance_action = self.popup_menu.addAction(
            Icons.load_icon("measure_distance"),
            "Distance and histogram",
            self.measure_distance_clicked,
        )

        # Layout --------------------------------------------------------------
        self._graphics_view_widget_vlayout = QtImport.QVBoxLayout(
            self.graphics_view_widget
        )
        self._graphics_view_widget_vlayout.setSpacing(0)
        self._graphics_view_widget_vlayout.setContentsMargins(0, 0, 0, 0)

        __button_widget_hlayout = QtImport.QHBoxLayout(button_widget)
        __button_widget_hlayout.addWidget(self.start_centering_button)
        __button_widget_hlayout.addWidget(self.start_n_centering_button)
        __button_widget_hlayout.addWidget(self.accept_centering_button)
        __button_widget_hlayout.addStretch()
        __button_widget_hlayout.setSpacing(2)
        __button_widget_hlayout.setContentsMargins(2, 2, 2, 2)

        __tools_widget_vlayout = QtImport.QVBoxLayout(tools_widget)
        __tools_widget_vlayout.addWidget(button_widget)
        __tools_widget_vlayout.addWidget(self.results_widget)
        __tools_widget_vlayout.addWidget(self.histogram_plot)
        __tools_widget_vlayout.addStretch()
        __tools_widget_vlayout.setSpacing(2)
        __tools_widget_vlayout.setContentsMargins(2, 2, 2, 2)

        __main_hlayout = QtImport.QHBoxLayout(self)
        __main_hlayout.addWidget(self.graphics_view_widget)
        __main_hlayout.addWidget(tools_widget)
        __main_hlayout.setSpacing(0)
        __main_hlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.results_widget.data_browse_button.clicked.connect(
            self.data_browse_button_clicked
        )
        self.results_widget.ff_browse_button.clicked.connect(
            self.ff_browse_button_clicked
        )
        self.results_widget.config_browse_button.clicked.connect(
            self.config_browse_button_clicked
        ) 
        self.results_widget.load_button.clicked.connect(
            self.load_button_clicked
        )
        self.results_widget.first_image_button.clicked.connect(
            self.first_image_button_clicked
        )
        self.results_widget.prev_image_button.clicked.connect(
            self.prev_image_button_clicked
        )
        self.results_widget.next_image_button.clicked.connect(
            self.next_image_button_clicked
        )
        self.results_widget.last_image_button.clicked.connect(
            self.last_image_button_clicked
        )
        self.results_widget.minus_quarter_button.clicked.connect(
            self.minus_quater_button_clicked
        )
        self.results_widget.last_image_button.clicked.connect(
            self.last_image_button_clicked
        )
        self.results_widget.plus_quarter_button.clicked.connect(
            self.plus_quater_button_clicked
        )

        self.results_widget.image_dial.valueChanged.connect(
            self.dial_value_changed
        )
        #self.results_widget.image_slider.valueChanged.connect(
        #    self.slider_value_changed
        #)
        self.results_widget.image_spinbox.valueChanged.connect(
            self.spinbox_value_changed
        )

        self.results_widget.play_button.clicked.connect(self.play_button_clicked)
        self.results_widget.stop_button.clicked.connect(self.stop_button_clicked)
        self.results_widget.repeat_cbox.stateChanged.connect(self.repeat_state_changed)
        self.results_widget.ff_apply_cbox.stateChanged.connect(
            self.ff_apply_state_changed
        )

        self.start_centering_button.clicked.connect(self.start_centering_clicked)
        self.accept_centering_button.clicked.connect(self.accept_centering_clicked)

        # Other ---------------------------------------------------------------
        self.results_widget.first_image_button.setIcon(Icons.load_icon("VCRRewind"))
        self.results_widget.prev_image_button.setIcon(Icons.load_icon("VCRPlay4"))
        self.results_widget.next_image_button.setIcon(Icons.load_icon("VCRPlay2"))
        self.results_widget.last_image_button.setIcon(
            Icons.load_icon("VCRFastForward2")
        )
        self.results_widget.play_button.setIcon(Icons.load_icon("VCRPlay"))
        self.results_widget.stop_button.setIcon(Icons.load_icon("Stop2"))

        self.start_centering_button.setFixedSize(70, 50)
        self.start_n_centering_button.setFixedSize(70, 50)
        self.accept_centering_button.setFixedSize(70, 50)
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "label":
            if new_value == "" and self.motor_hwobj is not None:
                self.label.setText("<i>" + self.motor_hwobj.username + ":</i>")
            else:
                self.label.setText(new_value)
        elif property_name == "mnemonic":
            if self.motor_hwobj is not None:
                self.disconnect(
                    self.motor_hwobj, "stateChanged", self.motor_state_changed
                )
                self.disconnect(
                    self.motor_hwobj, "newPredefinedPositions", self.fill_positions
                )
                self.disconnect(
                    self.motor_hwobj,
                    "predefinedPositionChanged",
                    self.predefined_position_changed,
                )

            self.motor_hwobj = self.get_hardware_object(new_value)

            if self.motor_hwobj is not None:
                self.connect(
                    self.motor_hwobj, "newPredefinedPositions", self.fill_positions
                )
                self.connect(self.motor_hwobj, "stateChanged", self.motor_state_changed)
                self.connect(
                    self.motor_hwobj,
                    "predefinedPositionChanged",
                    self.predefined_position_changed,
                )
                self.fill_positions()
                if self.motor_hwobj.is_ready():
                    self.predefined_position_changed(
                         self.motor_hwobj.get_current_position_name(), 0
                    )
                if self["label"] == "":
                    lbl = self.motor_hwobj.username
                    self.label.setText("<i>" + lbl + ":</i>")
                Colors.set_widget_color(
                    self.positions_combo,
                    MotorPredefPosBrick.STATE_COLORS[0],
                    QtImport.QPalette.Button,
                )
                self.motor_state_changed(self.motor_hwobj.get_state())
        elif property_name == "showMoveButtons":
            if new_value:
                self.previous_position_button.show()
                self.next_position_button.show()
            else:
                self.previous_position_button.hide()
                self.next_position_button.hide()
        elif property_name == "icons":
            icons_list = new_value.split()
            try:
                self.previous_position_button.setIcon(Icons.load_icon(icons_list[0]))
                self.next_position_button.setIcon(Icons.load_icon(icons_list[1]))
            except BaseException:
                pass
        else:
            BaseWidget.property_changed(self, property_name, old_value, new_value)
Exemple #53
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "label":
            if new_value == "" and self.motor_hwobj is not None:
                self.label.setText("<i>" + self.motor_hwobj.username + ":</i>")
            else:
                self.label.setText(new_value)
        elif property_name == "mnemonic":
            if self.motor_hwobj is not None:
                self.disconnect(self.motor_hwobj, "stateChanged",
                                self.motor_state_changed)
                self.disconnect(self.motor_hwobj, "newPredefinedPositions",
                                self.fill_positions)
                self.disconnect(
                    self.motor_hwobj,
                    "predefinedPositionChanged",
                    self.predefined_position_changed,
                )

            self.motor_hwobj = self.get_hardware_object(new_value)

            if self.motor_hwobj is not None:
                self.connect(self.motor_hwobj, "newPredefinedPositions",
                             self.fill_positions)
                self.connect(self.motor_hwobj, "stateChanged",
                             self.motor_state_changed)
                self.connect(
                    self.motor_hwobj,
                    "predefinedPositionChanged",
                    self.predefined_position_changed,
                )
                self.fill_positions()

                self.update_zoom()

                if self.motor_hwobj.is_ready():
                    self.predefined_position_changed(
                        self.motor_hwobj.get_value(), 0)
                if self["label"] == "":
                    lbl = self.motor_hwobj.user_name
                    self.label.setText("<i>" + lbl + ":</i>")
                Colors.set_widget_color(
                    self.positions_combo,
                    DigitalZoomBrick.STATE_COLORS[0],
                    QtImport.QPalette.Button,
                )
                self.motor_state_changed(self.motor_hwobj.get_state())
        elif property_name == "showMoveButtons":
            if new_value:
                self.previous_position_button.show()
                self.next_position_button.show()
            else:
                self.previous_position_button.hide()
                self.next_position_button.hide()
        elif property_name == "icons":
            icons_list = new_value.split()
            try:
                self.previous_position_button.setIcon(
                    Icons.load_icon(icons_list[0]))
                self.next_position_button.setIcon(
                    Icons.load_icon(icons_list[1]))
            except BaseException:
                pass
        else:
            BaseWidget.property_changed(self, property_name, old_value,
                                        new_value)
Exemple #54
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

        # Internal values -----------------------------------------------------
        self.cond_list = None
        self.states_list = None
        self.trans_list = None

        self.state_graph_node_list = []
        self.trans_graph_node_list = []
        self.condition_value_dict = {}

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

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

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

        # Graphic elements ----------------------------------------------------
        _cond_states_gbox = QtImport.QGroupBox(r"States \ conditions", self)
        self.splitter = QtImport.QSplitter(QtImport.Qt.Vertical, self)
        self.cond_states_table = QtImport.QTableWidget(self.splitter)
        self.log_treewidget = QtImport.QTreeWidget(self.splitter)
        self.graph_graphics_view = QtImport.QGraphicsView(self)
        self.graph_graphics_scene = QtImport.QGraphicsScene(self)

        self.check_icon = Icons.load_icon("Check")
        self.reject_icon = Icons.load_icon("Delete")

        # Layout --------------------------------------------------------------
        _cond_states_gbox_vlayout = QtImport.QVBoxLayout(_cond_states_gbox)
        _cond_states_gbox_vlayout.addWidget(self.splitter)
        _cond_states_gbox_vlayout.setSpacing(2)
        _cond_states_gbox_vlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QtImport.QHBoxLayout(self)
        _main_vlayout.addWidget(_cond_states_gbox)
        _main_vlayout.addWidget(self.graph_graphics_view)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # Other ---------------------------------------------------------------
        self.cond_states_table.verticalHeader().setDefaultSectionSize(20)
        self.cond_states_table.horizontalHeader().setDefaultSectionSize(20)
        # setSelectionMode(QtImport.QAbstractItemView::SingleSelection);
        font = self.cond_states_table.font()
        font.setPointSize(8)
        self.cond_states_table.setFont(font)

        self.splitter.setSizes([200, 20])
        self.log_treewidget.setColumnCount(6)
        self.log_treewidget.setHeaderLabels(
            ["State", "Start time", "End time", "Total time", "Previous state", "Notes"]
        )
        self.graph_graphics_view.setFixedSize(900, 600)
        self.graph_graphics_scene.setSceneRect(0, 0, 900, 600)
        self.graph_graphics_view.setScene(self.graph_graphics_scene)
        self.graph_graphics_view.setHorizontalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setVerticalScrollBarPolicy(
            QtImport.Qt.ScrollBarAlwaysOff
        )
        self.graph_graphics_view.setDragMode(QtImport.QGraphicsView.RubberBandDrag)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.Antialiasing)
        self.graph_graphics_view.setRenderHint(QtImport.QPainter.TextAntialiasing)
Exemple #55
0
    def __init__(self, *args):
        BaseWidget.__init__(self, *args)

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

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

        # Properties ----------------------------------------------------------
        self.add_property(
            "level", "combo", ("NOT SET", "INFO", "WARNING", "ERROR"), "NOT SET"
        )
        self.add_property("showDebug", "boolean", True)
        self.add_property("appearance", "combo", ("list", "tabs"), "tabs")
        self.add_property("enableFeedback", "boolean", True)
        self.add_property("emailAddresses", "string", "")
        self.add_property("fromEmailAddress", "string", "")
        self.add_property("maxLogLines", "integer", -1)
        self.add_property("autoSwitchTabs", "boolean", False)
        self.add_property("myTabLabel", "string", "")

        # Signals -------------------------------------------------------------
        self.define_signal("incUnreadMessagesSignal", ())
        self.define_signal("resetUnreadMessagesSignal", ())

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

        # Graphic elements ----------------------------------------------------
        self.tab_widget = QtImport.QTabWidget(self)

        self.details_log = CustomTreeWidget(self.tab_widget, "Errors and warnings")
        self.info_log = CustomTreeWidget(self.tab_widget, "Information")
        self.debug_log = CustomTreeWidget(self.tab_widget, "Debug")
        self.feedback_log = Submitfeedback(
            self.tab_widget, self["emailAddresses"], "Submit feedback"
        )

        self.tab_widget.addTab(
            self.details_log, Icons.load_icon("Caution"), "Errors and warnings"
        )
        self.tab_widget.addTab(self.info_log, Icons.load_icon("Inform"), "Information")
        self.tab_widget.addTab(self.debug_log, Icons.load_icon("Hammer"), "Debug")
        self.tab_widget.addTab(
            self.feedback_log, Icons.load_icon("Envelope"), "Submit feedback"
        )

        # Layout --------------------------------------------------------------
        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.tab_widget)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

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

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

        # Other ---------------------------------------------------------------
        self.tab_levels = {
            logging.NOTSET: self.info_log,
            logging.DEBUG: self.info_log,
            logging.INFO: self.info_log,
            logging.WARNING: self.info_log,
            logging.ERROR: self.info_log,
            logging.CRITICAL: self.info_log,
        }

        self.filter_level = logging.NOTSET
        # Register to GUI log handler
        GUILogHandler.GUILogHandler().register(self)
Exemple #56
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "mnemonic":
            if self.wrapper_hwobj is not None:
                self.wrapper_hwobj.duoStateChangedSignal.disconnect(
                    self.stateChanged)

            h_obj = self.get_hardware_object(new_value)
            if h_obj is not None:
                self.wrapper_hwobj = WrapperHO(h_obj)
                self.main_gbox.show()

                if self["username"] == "":
                    self["username"] = self.wrapper_hwobj.username

                help_text = self["setin"] + " the " + self["username"].lower()
                self.set_in_button.setToolTip(help_text)
                help_text = self["setout"] + " the " + self["username"].lower()
                self.set_out_button.setToolTip(help_text)
                self.main_gbox.setTitle(self["username"])
                self.wrapper_hwobj.duoStateChangedSignal.connect(
                    self.stateChanged)
                self.wrapper_hwobj.get_state()
            else:
                self.wrapper_hwobj = None
                # self.main_gbox.hide()
        elif property_name == "expertModeControlOnly":
            if new_value:
                if self.__expertMode:
                    self.buttons_widget.show()
                else:
                    self.buttons_widget.hide()
            else:
                self.buttons_widget.show()
        elif property_name == "forceNoControl":
            if new_value:
                self.buttons_widget.hide()
            else:
                self.buttons_widget.show()
        elif property_name == "icons":
            w = self.fontMetrics().width("Set out")
            icons_list = new_value.split()
            try:
                self.set_in_button.setIcon(Icons.load_icon(icons_list[0]))
            except IndexError:
                self.set_in_button.setText(self["setin"])
                # self.set_in_button.setMinimumWidth(w)
            try:
                self.set_out_button.setIcon(Icons.load_icon(icons_list[1]))
            except IndexError:
                self.set_out_button.setText(self["setout"])
                # self.set_out_button.setMinimumWidth(w)

        # elif property_name=='in':
        #    if self.wrapper_hwobj is not None:
        #        self.stateChanged(self.wrapper_hwobj.get_state())

        # elif property_name=='out':
        #    if self.wrapper_hwobj is not None:
        #        self.stateChanged(self.wrapper_hwobj.get_state())

        elif property_name == "setin":
            icons = self["icons"]
            # w=self.fontMetrics().width("Set out")
            icons_list = icons.split()
            try:
                i = icons_list[0]
            except IndexError:
                self.set_in_button.setText(new_value)
                # self.set_in_button.setMinimumWidth(w)
            help_text = new_value + " the " + self["username"].lower()
            self.set_in_button.setToolTip(help_text)
            self.set_in_button.setText(self["setin"])

        elif property_name == "setout":
            icons = self["icons"]
            # w=self.fontMetrics().width("Set out")
            icons_list = icons.split()
            try:
                i = icons_list[1]
            except IndexError:
                self.set_out_button.setText(new_value)
                # self.set_out_button.setMinimumWidth(w)
            help_text = new_value + " the " + self["username"].lower()
            self.set_out_button.setToolTip(help_text)
            self.set_out_button.setText(self["setout"])

        elif property_name == "username":
            if new_value == "":
                if self.wrapper_hwobj is not None:
                    name = self.wrapper_hwobj.username
                    if name != "":
                        self["username"] = name
                        return
            help_text = self["setin"] + " the " + new_value.lower()
            self.set_in_button.setToolTip(help_text)
            help_text = self["setout"] + " the " + new_value.lower()
            self.set_out_button.setToolTip(help_text)
            self.main_gbox.setTitle(self["username"])

        else:
            BaseWidget.property_changed(self, property_name, old_value,
                                        new_value)
Exemple #57
0
    def __init__(self, parent=None, name="task_toolbox"):

        QtImport.QWidget.__init__(self, parent)
        self.setObjectName = name

        # Internal variables --------------------------------------------------
        self.tree_brick = None
        self.previous_page_index = 0
        self.is_running = None
        self.path_conflict = False
        self.acq_conflict = False
        self.enable_collect = False
        self.create_task_widgets = {}

        # Graphic elements ----------------------------------------------------
        self.method_label = QtImport.QLabel("Collection method", self)
        self.method_label.setAlignment(QtImport.Qt.AlignCenter)

        self.tool_box = QtImport.QToolBox(self)
        self.tool_box.setObjectName("tool_box")
        # self.tool_box.setFixedWidth(600)

        self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete")
        self.char_page = CreateCharWidget(self.tool_box, "Characterise")
        self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page")
        self.energy_scan_page = CreateEnergyScanWidget(self.tool_box,
                                                       "energy_scan")
        self.xrf_spectrum_page = CreateXRFSpectrumWidget(
            self.tool_box, "xrf_spectrum")
        if HWR.beamline.gphl_workflow is not None:
            self.gphl_workflow_page = CreateGphlWorkflowWidget(
                self.tool_box, "gphl_workflow")
        else:
            self.gphl_workflow_page = None
        self.advanced_page = CreateAdvancedWidget(self.tool_box,
                                                  "advanced_scan")
        self.xray_imaging_page = CreateXrayImagingWidget(
            self.tool_box, "xray_imaging")
        self.still_scan_page = CreateStillScanWidget(self.tool_box,
                                                     "still_scan")

        self.tool_box.addItem(self.discrete_page, "Standard Collection")
        self.tool_box.addItem(self.char_page, "Characterisation")
        self.tool_box.addItem(self.helical_page, "Helical Collection")
        self.tool_box.addItem(self.energy_scan_page, "Energy Scan")
        self.tool_box.addItem(self.xrf_spectrum_page, "XRF Spectrum")
        if self.gphl_workflow_page is not None:
            self.tool_box.addItem(self.gphl_workflow_page, "GPhL Workflows")
        self.tool_box.addItem(self.advanced_page, "Advanced")
        self.tool_box.addItem(self.xray_imaging_page, "Xray Imaging")
        self.tool_box.addItem(self.still_scan_page, "Still")

        self.button_box = QtImport.QWidget(self)
        self.create_task_button = QtImport.QPushButton("  Add to queue",
                                                       self.button_box)
        self.create_task_button.setIcon(Icons.load_icon("add_row.png"))
        msg = "Add the collection method to the selected sample"
        self.create_task_button.setToolTip(msg)
        self.create_task_button.setEnabled(False)

        self.collect_now_button = QtImport.QPushButton("Collect Now",
                                                       self.button_box)
        self.collect_now_button.setIcon(Icons.load_icon("VCRPlay2.png"))
        self.collect_now_button.setToolTip(
            "Add the collection method to the queue and execute it")

        # Layout --------------------------------------------------------------
        _button_box_hlayout = QtImport.QHBoxLayout(self.button_box)
        _button_box_hlayout.addWidget(self.collect_now_button)
        _button_box_hlayout.addStretch(0)
        _button_box_hlayout.addWidget(self.create_task_button)
        _button_box_hlayout.setSpacing(0)
        _button_box_hlayout.setContentsMargins(0, 0, 0, 0)

        _main_vlayout = QtImport.QVBoxLayout(self)
        _main_vlayout.addWidget(self.method_label)
        _main_vlayout.addWidget(self.tool_box)
        _main_vlayout.addWidget(self.button_box)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(0, 0, 0, 0)

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

        # Qt signal/slot connections ------------------------------------------
        self.create_task_button.clicked.connect(self.create_task_button_click)
        self.collect_now_button.clicked.connect(self.collect_now_button_click)
        self.tool_box.currentChanged.connect(self.current_page_changed)

        for i in range(0, self.tool_box.count()):
            self.tool_box.widget(i).acqParametersConflictSignal.connect(
                self.acq_parameters_conflict_changed)
            self.tool_box.widget(i).pathTempleConflictSignal.connect(
                self.path_template_conflict_changed)

        # Other ---------------------------------------------------------------
        in_plate_mode = HWR.beamline.diffractometer.in_plate_mode()

        if (HWR.beamline.energy_scan is None or in_plate_mode
                or not HWR.beamline.tunable_wavelength):
            self.hide_task(self.energy_scan_page)
            logging.getLogger("HWR").info("Energy scan task not available")

        if HWR.beamline.xrf_spectrum is None or in_plate_mode:
            self.hide_task(self.xrf_spectrum_page)
            logging.getLogger("HWR").info("XRF spectrum task not available")

        if not HWR.beamline.imaging or in_plate_mode:
            self.hide_task(self.xray_imaging_page)
            logging.getLogger("HWR").info("Xray Imaging task not available")

        if HWR.beamline.gphl_connection and HWR.beamline.gphl_workflow:
            self.gphl_workflow_page.initialise_workflows()
        else:
            logging.getLogger("HWR").info("GPhL workflow task not available")
Exemple #58
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "mnemonic":
            hwobj_names_list = new_value.split()

            default_delta_list = self["defaultDeltas"].split()
            default_decimal_list = self["defaultDecimals"].split()
            default_step_list = self["defaultSteps"].split()

            for index, hwobj_name in enumerate(hwobj_names_list):
                temp_motor_hwobj = self.get_hardware_object(hwobj_name)
                if temp_motor_hwobj is not None:
                    temp_motor_widget = MotorSpinBoxBrick(self)
                    temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name)
                    temp_motor_widget.move_left_button.setVisible(
                        self["showMoveButtons"]
                    )
                    temp_motor_widget.move_right_button.setVisible(
                        self["showMoveButtons"]
                    )
                    temp_motor_widget.position_slider.setVisible(self["showSlider"])
                    temp_motor_widget.step_button.setVisible(self["showStep"])
                    temp_motor_widget.stop_button.setVisible(self["showStop"])

                    try:
                        temp_motor_widget.set_line_step(default_step_list[index])
                        temp_motor_widget["defaultStep"] = default_step_list[index]
                    except BaseException:
                        temp_motor_widget.set_line_step(0.001)
                        temp_motor_widget["defaultStep"] = 0.001

                    try:
                        temp_motor_widget["delta"] = default_delta_list[index]
                    except BaseException:
                        temp_motor_widget["delta"] = 0.001
                    try:
                        temp_motor_widget.set_decimals(
                            float(default_decimal_list[index])
                        )
                    except BaseException:
                        pass

                    temp_motor_widget.step_changed(None)
                    self.main_groupbox_hlayout.addWidget(temp_motor_widget)

                    self.motor_hwobj_list.append(temp_motor_hwobj)
                    self.motor_widget_list.append(temp_motor_widget)

                    temp_motor_hwobj.update_values()
                    temp_motor_widget.update_gui()

            self.enable_motors_buttons.setVisible(self["showEnableButtons"])
            self.disable_motors_buttons.setVisible(self["showEnableButtons"])
            if self["showEnableButtons"]:
                self.main_groupbox_hlayout.addWidget(self.enable_motors_buttons)
                self.main_groupbox_hlayout.addWidget(self.disable_motors_buttons)
            if len(self.motor_widget_labels):
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)
        elif property_name == "moveButtonIcons":
            icon_list = new_value.split()
            for index in range(len(icon_list) - 1):
                if index % 2 == 0:
                    self.motor_widget_list[index / 2].move_left_button.setIcon(
                        Icons.load_icon(icon_list[index])
                    )
                    self.motor_widget_list[index / 2].move_right_button.setIcon(
                        Icons.load_icon(icon_list[index + 1])
                    )
        elif property_name == "labels":
            self.motor_widget_labels = new_value.split()
            if len(self.motor_widget_list):
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)
        elif property_name == "predefinedPositions":
            self.predefined_positions_list = new_value.split()
            for predefined_position in self.predefined_positions_list:
                temp_position_button = QtImport.QPushButton(
                    predefined_position, self.main_group_box
                )
                self.main_groupbox_hlayout.addWidget(temp_position_button)
                temp_position_button.clicked.connect(
                    lambda: self.predefined_position_clicked(predefined_position)
                )
        else:
            BaseWidget.property_changed(self, property_name, old_value, new_value)
Exemple #59
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 property_changed(self, property_name, old_value, new_value):
        if property_name == "hwobj_motors_list":
            hwobj_names_list = new_value.split()

            default_delta_list = self["defaultDeltas"].split()
            default_decimal_list = self["defaultDecimals"].split()
            default_step_list = self["defaultSteps"].split()
            icon_list = self["icon_list"].split()

            for index, hwobj_name in enumerate(hwobj_names_list):
                temp_motor_hwobj = self.get_hardware_object(hwobj_name)
                if temp_motor_hwobj is not None:
                    temp_motor_widget = self.motor_widget_list[index]
                    temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name)
                    temp_motor_widget.move_left_button.setVisible(True)
                    temp_motor_widget.move_right_button.setVisible(True)
                    temp_motor_widget.position_slider.setVisible(False)
                    temp_motor_widget.step_button.setVisible(False)
                    # temp_motor_widget.stop_button.setVisible(False)

                    try:
                        temp_motor_widget.set_line_step(default_step_list[index])
                        temp_motor_widget["defaultStep"] = default_step_list[index]
                    except BaseException:
                        temp_motor_widget.set_line_step(0.001)
                        temp_motor_widget["defaultStep"] = 0.001

                    try:
                        temp_motor_widget["delta"] = default_delta_list[index]
                    except BaseException:
                        temp_motor_widget["delta"] = 0.001

                    try:
                        temp_motor_widget.set_decimals(
                            float(default_decimal_list[index])
                        )
                    except BaseException:
                        pass

                    try:
                        temp_motor_widget.move_left_button.setIcon(
                            Icons.load_icon(icon_list[index * 2])
                        )
                        temp_motor_widget.move_right_button.setIcon(
                            Icons.load_icon(icon_list[index * 2 + 1])
                        )
                    except BaseException:
                        temp_motor_widget.move_left_button.setIcon(
                            Icons.load_icon("Right2")
                        )
                        temp_motor_widget.move_right_button.setIcon(
                            Icons.load_icon("Left2")
                        )

                    temp_motor_widget.step_changed(None)
                    temp_motor_hwobj.update_values()
                    temp_motor_widget.update_gui()
        elif property_name == "hwobj_beam_focusing":
            if self.beam_focusing_hwobj is not None:
                self.disconnect(
                    self.beam_focusing_hwobj,
                    "focusingModeChanged",
                    self.focus_mode_changed,
                )
            self.beam_focusing_hwobj = self.get_hardware_object(new_value, optional=True)
            if self.beam_focusing_hwobj is not None:
                self.connect(
                    self.beam_focusing_hwobj,
                    "focusingModeChanged",
                    self.focus_mode_changed,
                )
                mode, beam_size = self.beam_focusing_hwobj.get_active_focus_mode()
                self.focus_mode_changed(mode, beam_size)
        elif property_name == "hwobj_beamline_test":
            self.beamline_test_hwobj = self.get_hardware_object(new_value, optional=True)
        elif property_name == "hwobj_diffractometer":
            if self.diffractometer_hwobj is not None:
                self.disconnect(
                    self.diffractometer_hwobj,
                    "minidiffPhaseChanged",
                    self.phase_changed,
                )

            self.diffractometer_hwobj = self.get_hardware_object(new_value)

            if self.diffractometer_hwobj is not None:
                self.connect(
                    self.diffractometer_hwobj,
                    "minidiffPhaseChanged",
                    self.phase_changed,
                )
            self.diffractometer_hwobj.update_values()
            self.update_gui()
        elif property_name == "enableCenterBeam":
            self.center_beam_button.setVisible(new_value)
        elif property_name == "enableMeasureFlux":
            self.measure_flux_button.setVisible(new_value)
        elif property_name == "compactView":
            for widget in self.motor_widget_list:
                widget.position_spinbox.setHidden(new_value)
                widget.position_slider.setHidden(new_value)
                widget.step_button.setHidden(new_value)
        else:
            BaseWidget.property_changed(self, property_name, old_value, new_value)