예제 #1
0
    def setup_docks(self):
        logger.debug('setting docks')
        self.docks['detectors'] = Dock("Detectors")
        splitter = QtWidgets.QSplitter(Qt.Vertical)
        self.docks['detectors'].addWidget(splitter)
        splitter.addWidget(self.settings_tree)
        splitter.addWidget(self.modules_manager.settings_tree)
        self.modules_manager.settings.child('modules', 'actuators').hide()
        self.modules_manager.settings.child('actuators_positions').hide()
        self.dockarea.addDock(self.docks['detectors'])

        self.docks['logger_settings'] = Dock("Logger Settings")
        self.dockarea.addDock(self.docks['logger_settings'], 'right',
                              self.docks['detectors'])

        self.statusbar.setMaximumHeight(25)
        self.status_widget = QtWidgets.QLabel('Initializing')
        self.statusbar.addPermanentWidget(self.status_widget)

        self.start_log_time = QtWidgets.QDateTimeEdit()
        self.start_log_time.setReadOnly(True)
        self.start_log_time.setToolTip('Logging started at:')
        self.statusbar.addPermanentWidget(self.start_log_time)

        self.logging_state = QLED()
        self.logging_state.setToolTip(
            'logging status: green (running), red (idle)')
        self.logging_state.clickable = False
        self.statusbar.addPermanentWidget(self.logging_state)
예제 #2
0
파일: led.py 프로젝트: CEMES-CNRS/PyMoDAQ
 def makeWidget(self):
     w = QLED()
     w.clickable = False
     w.set_as_false()
     w.sigChanged = w.value_changed
     w.value = w.get_state
     w.setValue = w.set_as
     self.hideWidget = False
     return w
예제 #3
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(636, 590)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setContentsMargins(9, 9, 9, 9)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.settings_layout = QtWidgets.QVBoxLayout()
        self.settings_layout.setObjectName("settings_layout")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout()
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.title_label = QtWidgets.QLabel(Form)
        self.title_label.setMaximumSize(QtCore.QSize(16777215, 30))
        font = QtGui.QFont()
        font.setFamily("Tahoma")
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.title_label.setFont(font)
        self.title_label.setAlignment(QtCore.Qt.AlignCenter)
        self.title_label.setObjectName("title_label")
        self.verticalLayout_4.addWidget(self.title_label)
        self.command_widget = QtWidgets.QWidget(Form)
        self.command_widget.setMaximumSize(QtCore.QSize(16777215, 30))
        self.command_widget.setObjectName("command_widget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.command_widget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.grab_pb = QtWidgets.QPushButton(self.command_widget)
        self.grab_pb.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/run2.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.grab_pb.setIcon(icon)
        self.grab_pb.setCheckable(True)
        self.grab_pb.setObjectName("grab_pb")
        self.horizontalLayout_2.addWidget(self.grab_pb)
        self.single_pb = QtWidgets.QPushButton(self.command_widget)
        self.single_pb.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/snap.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.single_pb.setIcon(icon1)
        self.single_pb.setCheckable(False)
        self.single_pb.setObjectName("single_pb")
        self.horizontalLayout_2.addWidget(self.single_pb)
        self.stop_pb = QtWidgets.QPushButton(self.command_widget)
        self.stop_pb.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/stop.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.stop_pb.setIcon(icon2)
        self.stop_pb.setCheckable(False)
        self.stop_pb.setObjectName("stop_pb")
        self.horizontalLayout_2.addWidget(self.stop_pb)
        self.save_current_pb = QtWidgets.QPushButton(self.command_widget)
        self.save_current_pb.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/SaveAs.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.save_current_pb.setIcon(icon3)
        self.save_current_pb.setObjectName("save_current_pb")
        self.horizontalLayout_2.addWidget(self.save_current_pb)
        self.save_new_pb = QtWidgets.QPushButton(self.command_widget)
        self.save_new_pb.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Snap&Save.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.save_new_pb.setIcon(icon4)
        self.save_new_pb.setObjectName("save_new_pb")
        self.horizontalLayout_2.addWidget(self.save_new_pb)
        self.load_data_pb = QtWidgets.QPushButton(self.command_widget)
        self.load_data_pb.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Open.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.load_data_pb.setIcon(icon5)
        self.load_data_pb.setObjectName("load_data_pb")
        self.horizontalLayout_2.addWidget(self.load_data_pb)
        self.settings_pb = QtWidgets.QPushButton(self.command_widget)
        self.settings_pb.setText("")
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/HLM.ico"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.settings_pb.setIcon(icon6)
        self.settings_pb.setCheckable(True)
        self.settings_pb.setObjectName("settings_pb")
        self.horizontalLayout_2.addWidget(self.settings_pb)
        self.update_com_pb = QtWidgets.QPushButton(self.command_widget)
        self.update_com_pb.setText("")
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Refresh2.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.update_com_pb.setIcon(icon7)
        self.update_com_pb.setCheckable(False)
        self.update_com_pb.setObjectName("update_com_pb")
        self.horizontalLayout_2.addWidget(self.update_com_pb)
        self.navigator_pb = QtWidgets.QPushButton(self.command_widget)
        self.navigator_pb.setText("")
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Select_24.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.navigator_pb.setIcon(icon8)
        self.navigator_pb.setObjectName("navigator_pb")
        self.horizontalLayout_2.addWidget(self.navigator_pb)
        self.log_pb = QtWidgets.QPushButton(self.command_widget)
        self.log_pb.setText("")
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/information2.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.log_pb.setIcon(icon9)
        self.log_pb.setObjectName("log_pb")
        self.horizontalLayout_2.addWidget(self.log_pb)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_4.addWidget(self.command_widget)
        self.settings_widget = QtWidgets.QWidget(Form)
        self.settings_widget.setObjectName("settings_widget")
        self.settings_layout_2 = QtWidgets.QVBoxLayout(self.settings_widget)
        self.settings_layout_2.setContentsMargins(0, 0, 0, 0)
        self.settings_layout_2.setSpacing(0)
        self.settings_layout_2.setObjectName("settings_layout_2")
        self.gridLayout_3 = QtWidgets.QGridLayout()
        self.gridLayout_3.setContentsMargins(-1, 0, -1, -1)
        self.gridLayout_3.setSpacing(6)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.label_3 = QtWidgets.QLabel(self.settings_widget)
        self.label_3.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_3.setObjectName("label_3")
        self.gridLayout_3.addWidget(self.label_3, 1, 0, 1, 3)
        self.DAQ_type_combo = QtWidgets.QComboBox(self.settings_widget)
        self.DAQ_type_combo.setObjectName("DAQ_type_combo")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.gridLayout_3.addWidget(self.DAQ_type_combo, 0, 3, 1, 3)
        self.label_4 = QtWidgets.QLabel(self.settings_widget)
        self.label_4.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_4.setObjectName("label_4")
        self.gridLayout_3.addWidget(self.label_4, 0, 0, 1, 3)
        self.Quit_pb = QtWidgets.QPushButton(self.settings_widget)
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/close2.png"),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Quit_pb.setIcon(icon10)
        self.Quit_pb.setObjectName("Quit_pb")
        self.gridLayout_3.addWidget(self.Quit_pb, 4, 0, 1, 2)
        self.Detector_type_combo = QtWidgets.QComboBox(self.settings_widget)
        self.Detector_type_combo.setObjectName("Detector_type_combo")
        self.gridLayout_3.addWidget(self.Detector_type_combo, 1, 3, 1, 3)
        self.load_settings_pb = QtWidgets.QPushButton(self.settings_widget)
        self.load_settings_pb.setIcon(icon5)
        self.load_settings_pb.setObjectName("load_settings_pb")
        self.gridLayout_3.addWidget(self.load_settings_pb, 7, 0, 3, 3)
        self.save_settings_pb = QtWidgets.QPushButton(self.settings_widget)
        self.save_settings_pb.setIcon(icon3)
        self.save_settings_pb.setObjectName("save_settings_pb")
        self.gridLayout_3.addWidget(self.save_settings_pb, 7, 3, 3, 3)
        self.take_bkg_cb = QtWidgets.QCheckBox(self.settings_widget)
        self.take_bkg_cb.setObjectName("take_bkg_cb")
        self.gridLayout_3.addWidget(self.take_bkg_cb, 5, 3, 2, 3)
        self.do_bkg_cb = QtWidgets.QCheckBox(self.settings_widget)
        self.do_bkg_cb.setObjectName("do_bkg_cb")
        self.gridLayout_3.addWidget(self.do_bkg_cb, 5, 0, 2, 3)
        self.Ini_state_LED = QLED(self.settings_widget)
        self.Ini_state_LED.setObjectName("Ini_state_LED")
        self.gridLayout_3.addWidget(self.Ini_state_LED, 4, 4, 1, 1)
        self.data_ready_led = QLED(self.settings_widget)
        self.data_ready_led.setObjectName("data_ready_led")
        self.gridLayout_3.addWidget(self.data_ready_led, 4, 5, 1, 1)
        self.IniDet_pb = QtWidgets.QPushButton(self.settings_widget)
        self.IniDet_pb.setCheckable(True)
        self.IniDet_pb.setChecked(False)
        self.IniDet_pb.setObjectName("IniDet_pb")
        self.gridLayout_3.addWidget(self.IniDet_pb, 4, 2, 1, 2)
        self.settings_layout_2.addLayout(self.gridLayout_3)
        self.verticalLayout_4.addWidget(self.settings_widget)
        self.settings_layout.addLayout(self.verticalLayout_4)
        self.gridLayout.addLayout(self.settings_layout, 0, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
예제 #4
0
class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(636, 590)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setContentsMargins(9, 9, 9, 9)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.settings_layout = QtWidgets.QVBoxLayout()
        self.settings_layout.setObjectName("settings_layout")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout()
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.title_label = QtWidgets.QLabel(Form)
        self.title_label.setMaximumSize(QtCore.QSize(16777215, 30))
        font = QtGui.QFont()
        font.setFamily("Tahoma")
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.title_label.setFont(font)
        self.title_label.setAlignment(QtCore.Qt.AlignCenter)
        self.title_label.setObjectName("title_label")
        self.verticalLayout_4.addWidget(self.title_label)
        self.command_widget = QtWidgets.QWidget(Form)
        self.command_widget.setMaximumSize(QtCore.QSize(16777215, 30))
        self.command_widget.setObjectName("command_widget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.command_widget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.grab_pb = QtWidgets.QPushButton(self.command_widget)
        self.grab_pb.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/run2.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.grab_pb.setIcon(icon)
        self.grab_pb.setCheckable(True)
        self.grab_pb.setObjectName("grab_pb")
        self.horizontalLayout_2.addWidget(self.grab_pb)
        self.single_pb = QtWidgets.QPushButton(self.command_widget)
        self.single_pb.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/snap.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.single_pb.setIcon(icon1)
        self.single_pb.setCheckable(False)
        self.single_pb.setObjectName("single_pb")
        self.horizontalLayout_2.addWidget(self.single_pb)
        self.stop_pb = QtWidgets.QPushButton(self.command_widget)
        self.stop_pb.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/stop.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.stop_pb.setIcon(icon2)
        self.stop_pb.setCheckable(False)
        self.stop_pb.setObjectName("stop_pb")
        self.horizontalLayout_2.addWidget(self.stop_pb)
        self.save_current_pb = QtWidgets.QPushButton(self.command_widget)
        self.save_current_pb.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/SaveAs.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.save_current_pb.setIcon(icon3)
        self.save_current_pb.setObjectName("save_current_pb")
        self.horizontalLayout_2.addWidget(self.save_current_pb)
        self.save_new_pb = QtWidgets.QPushButton(self.command_widget)
        self.save_new_pb.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Snap&Save.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.save_new_pb.setIcon(icon4)
        self.save_new_pb.setObjectName("save_new_pb")
        self.horizontalLayout_2.addWidget(self.save_new_pb)
        self.load_data_pb = QtWidgets.QPushButton(self.command_widget)
        self.load_data_pb.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Open.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.load_data_pb.setIcon(icon5)
        self.load_data_pb.setObjectName("load_data_pb")
        self.horizontalLayout_2.addWidget(self.load_data_pb)
        self.settings_pb = QtWidgets.QPushButton(self.command_widget)
        self.settings_pb.setText("")
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/HLM.ico"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.settings_pb.setIcon(icon6)
        self.settings_pb.setCheckable(True)
        self.settings_pb.setObjectName("settings_pb")
        self.horizontalLayout_2.addWidget(self.settings_pb)
        self.update_com_pb = QtWidgets.QPushButton(self.command_widget)
        self.update_com_pb.setText("")
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Refresh2.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.update_com_pb.setIcon(icon7)
        self.update_com_pb.setCheckable(False)
        self.update_com_pb.setObjectName("update_com_pb")
        self.horizontalLayout_2.addWidget(self.update_com_pb)
        self.navigator_pb = QtWidgets.QPushButton(self.command_widget)
        self.navigator_pb.setText("")
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Select_24.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.navigator_pb.setIcon(icon8)
        self.navigator_pb.setObjectName("navigator_pb")
        self.horizontalLayout_2.addWidget(self.navigator_pb)
        self.log_pb = QtWidgets.QPushButton(self.command_widget)
        self.log_pb.setText("")
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/information2.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.log_pb.setIcon(icon9)
        self.log_pb.setObjectName("log_pb")
        self.horizontalLayout_2.addWidget(self.log_pb)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_4.addWidget(self.command_widget)
        self.settings_widget = QtWidgets.QWidget(Form)
        self.settings_widget.setObjectName("settings_widget")
        self.settings_layout_2 = QtWidgets.QVBoxLayout(self.settings_widget)
        self.settings_layout_2.setContentsMargins(0, 0, 0, 0)
        self.settings_layout_2.setSpacing(0)
        self.settings_layout_2.setObjectName("settings_layout_2")
        self.gridLayout_3 = QtWidgets.QGridLayout()
        self.gridLayout_3.setContentsMargins(-1, 0, -1, -1)
        self.gridLayout_3.setSpacing(6)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.label_3 = QtWidgets.QLabel(self.settings_widget)
        self.label_3.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_3.setObjectName("label_3")
        self.gridLayout_3.addWidget(self.label_3, 1, 0, 1, 3)
        self.DAQ_type_combo = QtWidgets.QComboBox(self.settings_widget)
        self.DAQ_type_combo.setObjectName("DAQ_type_combo")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.DAQ_type_combo.addItem("")
        self.gridLayout_3.addWidget(self.DAQ_type_combo, 0, 3, 1, 3)
        self.label_4 = QtWidgets.QLabel(self.settings_widget)
        self.label_4.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_4.setObjectName("label_4")
        self.gridLayout_3.addWidget(self.label_4, 0, 0, 1, 3)
        self.Quit_pb = QtWidgets.QPushButton(self.settings_widget)
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/close2.png"),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Quit_pb.setIcon(icon10)
        self.Quit_pb.setObjectName("Quit_pb")
        self.gridLayout_3.addWidget(self.Quit_pb, 4, 0, 1, 2)
        self.Detector_type_combo = QtWidgets.QComboBox(self.settings_widget)
        self.Detector_type_combo.setObjectName("Detector_type_combo")
        self.gridLayout_3.addWidget(self.Detector_type_combo, 1, 3, 1, 3)
        self.load_settings_pb = QtWidgets.QPushButton(self.settings_widget)
        self.load_settings_pb.setIcon(icon5)
        self.load_settings_pb.setObjectName("load_settings_pb")
        self.gridLayout_3.addWidget(self.load_settings_pb, 7, 0, 3, 3)
        self.save_settings_pb = QtWidgets.QPushButton(self.settings_widget)
        self.save_settings_pb.setIcon(icon3)
        self.save_settings_pb.setObjectName("save_settings_pb")
        self.gridLayout_3.addWidget(self.save_settings_pb, 7, 3, 3, 3)
        self.take_bkg_cb = QtWidgets.QCheckBox(self.settings_widget)
        self.take_bkg_cb.setObjectName("take_bkg_cb")
        self.gridLayout_3.addWidget(self.take_bkg_cb, 5, 3, 2, 3)
        self.do_bkg_cb = QtWidgets.QCheckBox(self.settings_widget)
        self.do_bkg_cb.setObjectName("do_bkg_cb")
        self.gridLayout_3.addWidget(self.do_bkg_cb, 5, 0, 2, 3)
        self.Ini_state_LED = QLED(self.settings_widget)
        self.Ini_state_LED.setObjectName("Ini_state_LED")
        self.gridLayout_3.addWidget(self.Ini_state_LED, 4, 4, 1, 1)
        self.data_ready_led = QLED(self.settings_widget)
        self.data_ready_led.setObjectName("data_ready_led")
        self.gridLayout_3.addWidget(self.data_ready_led, 4, 5, 1, 1)
        self.IniDet_pb = QtWidgets.QPushButton(self.settings_widget)
        self.IniDet_pb.setCheckable(True)
        self.IniDet_pb.setChecked(False)
        self.IniDet_pb.setObjectName("IniDet_pb")
        self.gridLayout_3.addWidget(self.IniDet_pb, 4, 2, 1, 2)
        self.settings_layout_2.addLayout(self.gridLayout_3)
        self.verticalLayout_4.addWidget(self.settings_widget)
        self.settings_layout.addLayout(self.verticalLayout_4)
        self.gridLayout.addLayout(self.settings_layout, 0, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.title_label.setText(_translate("Form", "DAQ Title"))
        self.grab_pb.setToolTip(_translate("Form", "Grab"))
        self.single_pb.setToolTip(_translate("Form", "Single Grab"))
        self.stop_pb.setToolTip(_translate("Form", "Single Grab"))
        self.save_current_pb.setToolTip(_translate("Form",
                                                   "Save Current Data"))
        self.save_new_pb.setToolTip(_translate("Form", "Save New Data"))
        self.settings_pb.setToolTip(_translate("Form", "Open Settings"))
        self.update_com_pb.setToolTip(_translate("Form", "Refresh Hardware"))
        self.navigator_pb.setToolTip(
            _translate("Form", "Send current data to navigator"))
        self.log_pb.setToolTip(_translate("Form", "Show Current log file"))
        self.label_3.setText(_translate("Form", "Detector:"))
        self.DAQ_type_combo.setToolTip(_translate("Form", "Detector Type"))
        self.DAQ_type_combo.setItemText(0, _translate("Form", "DAQ0D"))
        self.DAQ_type_combo.setItemText(1, _translate("Form", "DAQ1D"))
        self.DAQ_type_combo.setItemText(2, _translate("Form", "DAQ2D"))
        self.DAQ_type_combo.setItemText(3, _translate("Form", "DAQND"))
        self.label_4.setText(_translate("Form", "DAQ type:"))
        self.Quit_pb.setToolTip(_translate("Form",
                                           "quit and close the viewer"))
        self.Quit_pb.setText(_translate("Form", "Quit"))
        self.Detector_type_combo.setToolTip(_translate("Form", "Stage Type"))
        self.load_settings_pb.setToolTip(_translate("Form", "Load settings"))
        self.load_settings_pb.setText(_translate("Form", "Sett."))
        self.save_settings_pb.setToolTip(_translate("Form", "save settings"))
        self.save_settings_pb.setText(_translate("Form", "Sett."))
        self.take_bkg_cb.setText(_translate("Form", "Take Bkg"))
        self.do_bkg_cb.setText(_translate("Form", "Do Bkg sub."))
        self.Ini_state_LED.setToolTip(
            _translate("Form", "Green when controller is initialized"))
        self.Ini_state_LED.setText(_translate("Form", "TextLabel"))
        self.data_ready_led.setToolTip(
            _translate("Form", "Green when data ready"))
        self.data_ready_led.setText(_translate("Form", "TextLabel"))
        self.IniDet_pb.setToolTip(
            _translate("Form", "To initialize the detector"))
        self.IniDet_pb.setText(_translate("Form", "Ini. Det."))
예제 #5
0
class DAQ_PID(QObject):
    """
    """
    command_pid = Signal(ThreadCommand)
    curr_points_signal = Signal(dict)
    setpoints_signal = Signal(dict)
    emit_curr_points_sig = Signal()

    models = get_models()

    params = [
        {'title': 'Models', 'name': 'models', 'type': 'group', 'expanded': True, 'visible': True, 'children': [
            {'title': 'Models class:', 'name': 'model_class', 'type': 'list',
             'limits': [d['name'] for d in models]},
            {'title': 'Model params:', 'name': 'model_params', 'type': 'group', 'children': []},
        ]},
        {'title': 'Move settings:', 'name': 'move_settings', 'expanded': True, 'type': 'group', 'visible': False,
         'children': [
             {'title': 'Units:', 'name': 'units', 'type': 'str', 'value': ''}]},
        # here only to be compatible with DAQ_Scan, the model could update it

        {'title': 'Main Settings:', 'name': 'main_settings', 'expanded': True, 'type': 'group', 'children': [
            {'title': 'Acquisition Timeout (ms):', 'name': 'timeout', 'type': 'int', 'value': 10000},
            {'title': 'epsilon', 'name': 'epsilon', 'type': 'float', 'value': 0.01,
             'tooltip': 'Precision at which move is considered as done'},
            {'title': 'PID controls:', 'name': 'pid_controls', 'type': 'group', 'children': [
                {'title': 'Sample time (ms):', 'name': 'sample_time', 'type': 'int', 'value': 10},
                {'title': 'Refresh plot time (ms):', 'name': 'refresh_plot_time', 'type': 'int', 'value': 200},
                {'title': 'Output limits:', 'name': 'output_limits', 'expanded': True, 'type': 'group', 'children': [
                    {'title': 'Output limit (min):', 'name': 'output_limit_min_enabled', 'type': 'bool',
                     'value': False},
                    {'title': 'Output limit (min):', 'name': 'output_limit_min', 'type': 'float', 'value': 0},
                    {'title': 'Output limit (max):', 'name': 'output_limit_max_enabled', 'type': 'bool',
                     'value': False},
                    {'title': 'Output limit (max:', 'name': 'output_limit_max', 'type': 'float', 'value': 100},
                ]},
                {'title': 'Auto mode:', 'name': 'auto_mode', 'type': 'bool', 'value': False, 'readonly': True},
                {'title': 'Prop. on measurement:', 'name': 'proportional_on_measurement', 'type': 'bool',
                 'value': False},
                {'title': 'PID constants:', 'name': 'pid_constants', 'type': 'group', 'children': [
                    {'title': 'Kp:', 'name': 'kp', 'type': 'float', 'value': 0.1, 'min': 0},
                    {'title': 'Ki:', 'name': 'ki', 'type': 'float', 'value': 0.01, 'min': 0},
                    {'title': 'Kd:', 'name': 'kd', 'type': 'float', 'value': 0.001, 'min': 0},
                ]},

            ]},

        ]},
    ]

    def __init__(self, dockarea):
        
        super().__init__()

        self.settings = Parameter.create(title='PID settings', name='pid_settings', type='group', children=self.params)
        self.title = 'PyMoDAQ PID'

        self.Initialized_state = False
        self.model_class = None
        self._curr_points = dict([])
        self._setpoints = dict([])

        self.modules_manager = None

        self.dock_area = dockarea
        self.check_moving = False
        self.setupUI()

        self.enable_controls_pid(False)

        self.enable_controls_pid_run(False)

        self.emit_curr_points_sig.connect(self.emit_curr_points)

    def set_module_manager(self, detector_modules, actuator_modules):
        self.modules_manager = ModulesManager(detector_modules, actuator_modules)

    def ini_PID(self):

        if self.ini_PID_action.isChecked():
            output_limits = [None, None]
            if self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                   'output_limit_min_enabled').value():
                output_limits[0] = self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                                       'output_limit_min').value()
            if self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                   'output_limit_max_enabled').value():
                output_limits[1] = self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                                       'output_limit_max').value()

            self.PIDThread = QThread()
            pid_runner = PIDRunner(self.model_class, self.modules_manager, setpoints=self.setpoints,
                                   params=dict(Kp=self.settings.child('main_settings', 'pid_controls', 'pid_constants',
                                                                      'kp').value(),
                                               Ki=self.settings.child('main_settings', 'pid_controls', 'pid_constants',
                                                                      'ki').value(),
                                               Kd=self.settings.child('main_settings', 'pid_controls', 'pid_constants',
                                                                      'kd').value(),
                                               sample_time=self.settings.child('main_settings', 'pid_controls',
                                                                               'sample_time').value() / 1000,
                                               output_limits=output_limits,
                                               auto_mode=False),
                                   )

            self.PIDThread.pid_runner = pid_runner
            pid_runner.pid_output_signal.connect(self.process_output)
            pid_runner.status_sig.connect(self.thread_status)
            self.command_pid.connect(pid_runner.queue_command)

            pid_runner.moveToThread(self.PIDThread)

            self.PIDThread.start()
            self.pid_led.set_as_true()
            self.enable_controls_pid_run(True)

        else:
            if hasattr(self, 'PIDThread'):
                if self.PIDThread.isRunning():
                    try:
                        self.PIDThread.quit()
                    except Exception:
                        pass
            self.pid_led.set_as_false()
            self.enable_controls_pid_run(False)

        self.Initialized_state = True

    def process_output(self, datas):
        self.output_viewer.show_data([[dat] for dat in datas['output']])
        self.input_viewer.show_data([[dat] for dat in datas['input']])
        self.curr_points = datas['input']

    def enable_controls_pid(self, enable=False):
        self.ini_PID_action.setEnabled(enable)
        #self.setpoint_sb.setOpts(enabled=enable)

    def enable_controls_pid_run(self, enable=False):
        self.run_action.setEnabled(enable)
        self.pause_action.setEnabled(enable)

    def setupUI(self):

        self.dock_pid = Dock('PID controller', self.dock_area)
        self.dock_area.addDock(self.dock_pid)

        widget = QtWidgets.QWidget()
        widget_toolbar = QtWidgets.QWidget()
        verlayout = QtWidgets.QVBoxLayout()
        widget.setLayout(verlayout)
        self.toolbar_layout = QtWidgets.QGridLayout()
        widget_toolbar.setLayout(self.toolbar_layout)

        iconquit = QtGui.QIcon()
        iconquit.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/close2.png"), QtGui.QIcon.Normal,
                           QtGui.QIcon.Off)
        self.quit_action = QtWidgets.QPushButton(iconquit, "Quit")
        self.quit_action.setToolTip('Quit the application')
        self.toolbar_layout.addWidget(self.quit_action, 0, 0, 1, 2)
        self.quit_action.clicked.connect(self.quit_fun)

        iconini = QtGui.QIcon()
        iconini.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/ini.png"), QtGui.QIcon.Normal,
                          QtGui.QIcon.Off)
        self.ini_model_action = QtWidgets.QPushButton(iconini, "Init Model")
        self.ini_model_action.setToolTip('Initialize the chosen model')
        self.toolbar_layout.addWidget(self.ini_model_action, 2, 0)
        self.ini_model_action.clicked.connect(self.ini_model)
        self.model_led = QLED()
        self.toolbar_layout.addWidget(self.model_led, 2, 1)

        self.ini_PID_action = QtWidgets.QPushButton(iconini, "Init PID")
        self.ini_PID_action.setToolTip('Initialize the PID loop')
        self.toolbar_layout.addWidget(self.ini_PID_action, 2, 2)
        self.ini_PID_action.setCheckable(True)
        self.ini_PID_action.clicked.connect(self.ini_PID)
        self.pid_led = QLED()
        self.toolbar_layout.addWidget(self.pid_led, 2, 3)

        self.iconrun = QtGui.QIcon()
        self.iconrun.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/run2.png"), QtGui.QIcon.Normal,
                               QtGui.QIcon.Off)
        self.icon_stop = QtGui.QIcon()
        self.icon_stop.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/stop.png"))
        self.run_action = QtWidgets.QPushButton(self.iconrun, "", None)
        self.run_action.setToolTip('Start PID loop')
        self.run_action.setCheckable(True)
        self.toolbar_layout.addWidget(self.run_action, 0, 2)
        self.run_action.clicked.connect(self.run_PID)

        iconpause = QtGui.QIcon()
        iconpause.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/pause.png"), QtGui.QIcon.Normal,
                            QtGui.QIcon.Off)
        self.pause_action = QtWidgets.QPushButton(iconpause, "", None)
        self.pause_action.setToolTip('Pause PID')
        self.pause_action.setCheckable(True)
        self.toolbar_layout.addWidget(self.pause_action, 0, 3)
        self.pause_action.setChecked(True)
        self.pause_action.clicked.connect(self.pause_PID)

        lab = QtWidgets.QLabel('Target Value:')
        self.toolbar_layout.addWidget(lab, 3, 0, 1, 2)


        lab1 = QtWidgets.QLabel('Current Value:')
        self.toolbar_layout.addWidget(lab1, 4, 0, 1, 2)


        # create main parameter tree
        self.settings_tree = ParameterTree()
        self.settings_tree.setParameters(self.settings, showTop=False)

        verlayout.addWidget(widget_toolbar)
        verlayout.addWidget(self.settings_tree)

        self.dock_output = Dock('PID output')
        widget_output = QtWidgets.QWidget()
        self.output_viewer = Viewer0D(widget_output)
        self.dock_output.addWidget(widget_output)
        self.dock_area.addDock(self.dock_output, 'right', self.dock_pid)

        self.dock_input = Dock('PID input')
        widget_input = QtWidgets.QWidget()
        self.input_viewer = Viewer0D(widget_input)
        self.dock_input.addWidget(widget_input)
        self.dock_area.addDock(self.dock_input, 'bottom', self.dock_output)

        if len(self.models) != 0:
            self.get_set_model_params(self.models[0]['name'])

        # connecting from tree
        self.settings.sigTreeStateChanged.connect(
            self.parameter_tree_changed)  # any changes on the settings will update accordingly the detector
        self.dock_pid.addWidget(widget)

    def get_set_model_params(self, model_name):
        self.settings.child('models', 'model_params').clearChildren()
        models = get_models()
        if len(models) > 0:
            model_class = find_dict_in_list_from_key_val(models, 'name', model_name)['class']
            params = getattr(model_class, 'params')
            self.settings.child('models', 'model_params').addChildren(params)

    def run_PID(self):
        if self.run_action.isChecked():
            self.run_action.setIcon(self.icon_stop)
            self.command_pid.emit(ThreadCommand('start_PID', []))
            QtWidgets.QApplication.processEvents()

            QtWidgets.QApplication.processEvents()

            self.command_pid.emit(ThreadCommand('run_PID', [self.model_class.curr_output]))
        else:
            self.run_action.setIcon(self.iconrun)
            self.command_pid.emit(ThreadCommand('stop_PID'))

            QtWidgets.QApplication.processEvents()

    def pause_PID(self):
        for setp in self.setpoints_sb:
            setp.setEnabled(not self.pause_action.isChecked())
        self.command_pid.emit(ThreadCommand('pause_PID', [self.pause_action.isChecked()]))


    def stop_moves(self, overshoot):
        """
            Foreach module of the move module object list, stop motion.

            See Also
            --------
            stop_scan,  DAQ_Move_main.daq_move.stop_Motion
        """
        self.overshoot = overshoot
        for mod in self.modules_manager.actuators:
            mod.stop_Motion()

    def set_model(self):
        model_name = self.settings.child('models', 'model_class').value()
        self.model_class = find_dict_in_list_from_key_val(self.models, 'name', model_name)['class'](self)
        self.set_setpoints_buttons()
        self.model_class.ini_model()
        self.settings.child('main_settings', 'epsilon').setValue(self.model_class.epsilon)

    def ini_model(self):
        try:
            if self.model_class is None:
                self.set_model()

            self.modules_manager.selected_actuators_name = self.model_class.actuators_name
            self.modules_manager.selected_detectors_name = self.model_class.detectors_name

            self.enable_controls_pid(True)
            self.model_led.set_as_true()
            self.ini_model_action.setEnabled(False)

        except Exception as e:
            logger.exception(str(e))

    @property
    def setpoints(self):
        return [sp.value() for sp in self.setpoints_sb]

    @setpoints.setter
    def setpoints(self, values):
        for ind, sp in enumerate(self.setpoints_sb):
            sp.setValue(values[ind])

    def setpoints_external(self, values_dict):
        for key in values_dict:
            index = self.model_class.setpoints_names.index(key)
            self.setpoints_sb[index].setValue(values_dict[key])

    @property
    def curr_points(self):
        return [sp.value() for sp in self.currpoints_sb]

    @curr_points.setter
    def curr_points(self, values):
        for ind, sp in enumerate(self.currpoints_sb):
            sp.setValue(values[ind])

    def emit_curr_points(self):
        if self.model_class is not None:
            self.curr_points_signal.emit(dict(zip(self.model_class.setpoints_names, self.curr_points)))

    def set_setpoints_buttons(self):
        self.setpoints_sb = []
        self.currpoints_sb = []
        for ind_set in range(self.model_class.Nsetpoints):

            self.setpoints_sb.append(SpinBox())
            self.setpoints_sb[-1].setMinimumHeight(40)
            font = self.setpoints_sb[-1].font()
            font.setPointSizeF(20)
            self.setpoints_sb[-1].setFont(font)
            self.setpoints_sb[-1].setDecimals(6)
            self.toolbar_layout.addWidget(self.setpoints_sb[-1], 3, 2+ind_set, 1, 1)
            self.setpoints_sb[-1].valueChanged.connect(self.update_runner_setpoints)

            self.currpoints_sb.append(SpinBox())
            self.currpoints_sb[-1].setMinimumHeight(40)
            self.currpoints_sb[-1].setReadOnly(True)
            self.currpoints_sb[-1].setDecimals(6)
            self.currpoints_sb[-1].setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
            font = self.currpoints_sb[-1].font()
            font.setPointSizeF(20)
            self.currpoints_sb[-1].setFont(font)
            self.toolbar_layout.addWidget(self.currpoints_sb[-1], 4, 2+ind_set, 1, 1)

        self.setpoints_signal.connect(self.setpoints_external)

    def quit_fun(self):
        """
        """
        try:
            try:
                self.PIDThread.exit()
            except Exception as e:
                print(e)

            areas = self.dock_area.tempAreas[:]
            for area in areas:
                area.win.close()
                QtWidgets.QApplication.processEvents()
                QThread.msleep(1000)
                QtWidgets.QApplication.processEvents()

            self.dock_area.parent().close()

        except Exception as e:
            print(e)

    def parameter_tree_changed(self, param, changes):
        """
            Foreach value changed, update :
                * Viewer in case of **DAQ_type** parameter name
                * visibility of button in case of **show_averaging** parameter name
                * visibility of naverage in case of **live_averaging** parameter name
                * scale of axis **else** (in 2D pymodaq type)

            Once done emit the update settings signal to link the commit.

            =============== =================================== ================================================================
            **Parameters**    **Type**                           **Description**
            *param*           instance of ppyqtgraph parameter   the parameter to be checked
            *changes*         tuple list                         Contain the (param,changes,info) list listing the changes made
            =============== =================================== ================================================================
        """

        for param, change, data in changes:
            path = self.settings.childPath(param)
            if change == 'childAdded':
                pass

            elif change == 'value':
                if param.name() == 'model_class':
                    self.get_set_model_params(param.value())

                elif param.name() == 'refresh_plot_time' or param.name() == 'timeout':
                    self.command_pid.emit(ThreadCommand('update_timer', [param.name(), param.value()]))

                elif param.name() == 'sample_time':
                    self.command_pid.emit(ThreadCommand('update_options', dict(sample_time=param.value())))

                elif param.name() in putils.iter_children(
                        self.settings.child('main_settings', 'pid_controls', 'output_limits'), []):


                    output_limits = convert_output_limits(
                        self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                            'output_limit_min').value(),
                        self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                           'output_limit_min_enabled').value(),
                        self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                                               'output_limit_max').value(),
                        self.settings.child('main_settings', 'pid_controls', 'output_limits',
                                           'output_limit_max_enabled').value())

                    self.command_pid.emit(ThreadCommand('update_options', dict(output_limits=output_limits)))

                elif param.name() in putils.iter_children(
                        self.settings.child('main_settings', 'pid_controls', 'pid_constants'), []):
                    Kp = self.settings.child('main_settings', 'pid_controls', 'pid_constants', 'kp').value()
                    Ki = self.settings.child('main_settings', 'pid_controls', 'pid_constants', 'ki').value()
                    Kd = self.settings.child('main_settings', 'pid_controls', 'pid_constants', 'kd').value()
                    self.command_pid.emit(ThreadCommand('update_options', dict(tunings=(Kp, Ki, Kd))))

                elif param.name() in putils.iter_children(self.settings.child('models', 'model_params'), []):
                    if self.model_class is not None:
                        self.model_class.update_settings(param)

                elif param.name() == 'detector_modules':
                    self.model_class.update_detector_names()

            elif change == 'parent':
                pass

    def update_runner_setpoints(self):
        self.command_pid.emit(ThreadCommand('update_setpoints', self.setpoints))

    @Slot(list)
    def thread_status(self, status):  # general function to get datas/infos from all threads back to the main
        """

        """
        pass
예제 #6
0
    def setupUI(self):

        self.dock_pid = Dock('PID controller', self.dock_area)
        self.dock_area.addDock(self.dock_pid)

        widget = QtWidgets.QWidget()
        widget_toolbar = QtWidgets.QWidget()
        verlayout = QtWidgets.QVBoxLayout()
        widget.setLayout(verlayout)
        self.toolbar_layout = QtWidgets.QGridLayout()
        widget_toolbar.setLayout(self.toolbar_layout)

        iconquit = QtGui.QIcon()
        iconquit.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/close2.png"), QtGui.QIcon.Normal,
                           QtGui.QIcon.Off)
        self.quit_action = QtWidgets.QPushButton(iconquit, "Quit")
        self.quit_action.setToolTip('Quit the application')
        self.toolbar_layout.addWidget(self.quit_action, 0, 0, 1, 2)
        self.quit_action.clicked.connect(self.quit_fun)

        iconini = QtGui.QIcon()
        iconini.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/ini.png"), QtGui.QIcon.Normal,
                          QtGui.QIcon.Off)
        self.ini_model_action = QtWidgets.QPushButton(iconini, "Init Model")
        self.ini_model_action.setToolTip('Initialize the chosen model')
        self.toolbar_layout.addWidget(self.ini_model_action, 2, 0)
        self.ini_model_action.clicked.connect(self.ini_model)
        self.model_led = QLED()
        self.toolbar_layout.addWidget(self.model_led, 2, 1)

        self.ini_PID_action = QtWidgets.QPushButton(iconini, "Init PID")
        self.ini_PID_action.setToolTip('Initialize the PID loop')
        self.toolbar_layout.addWidget(self.ini_PID_action, 2, 2)
        self.ini_PID_action.setCheckable(True)
        self.ini_PID_action.clicked.connect(self.ini_PID)
        self.pid_led = QLED()
        self.toolbar_layout.addWidget(self.pid_led, 2, 3)

        self.iconrun = QtGui.QIcon()
        self.iconrun.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/run2.png"), QtGui.QIcon.Normal,
                               QtGui.QIcon.Off)
        self.icon_stop = QtGui.QIcon()
        self.icon_stop.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/stop.png"))
        self.run_action = QtWidgets.QPushButton(self.iconrun, "", None)
        self.run_action.setToolTip('Start PID loop')
        self.run_action.setCheckable(True)
        self.toolbar_layout.addWidget(self.run_action, 0, 2)
        self.run_action.clicked.connect(self.run_PID)

        iconpause = QtGui.QIcon()
        iconpause.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/pause.png"), QtGui.QIcon.Normal,
                            QtGui.QIcon.Off)
        self.pause_action = QtWidgets.QPushButton(iconpause, "", None)
        self.pause_action.setToolTip('Pause PID')
        self.pause_action.setCheckable(True)
        self.toolbar_layout.addWidget(self.pause_action, 0, 3)
        self.pause_action.setChecked(True)
        self.pause_action.clicked.connect(self.pause_PID)

        lab = QtWidgets.QLabel('Target Value:')
        self.toolbar_layout.addWidget(lab, 3, 0, 1, 2)


        lab1 = QtWidgets.QLabel('Current Value:')
        self.toolbar_layout.addWidget(lab1, 4, 0, 1, 2)


        # create main parameter tree
        self.settings_tree = ParameterTree()
        self.settings_tree.setParameters(self.settings, showTop=False)

        verlayout.addWidget(widget_toolbar)
        verlayout.addWidget(self.settings_tree)

        self.dock_output = Dock('PID output')
        widget_output = QtWidgets.QWidget()
        self.output_viewer = Viewer0D(widget_output)
        self.dock_output.addWidget(widget_output)
        self.dock_area.addDock(self.dock_output, 'right', self.dock_pid)

        self.dock_input = Dock('PID input')
        widget_input = QtWidgets.QWidget()
        self.input_viewer = Viewer0D(widget_input)
        self.dock_input.addWidget(widget_input)
        self.dock_area.addDock(self.dock_input, 'bottom', self.dock_output)

        if len(self.models) != 0:
            self.get_set_model_params(self.models[0]['name'])

        # connecting from tree
        self.settings.sigTreeStateChanged.connect(
            self.parameter_tree_changed)  # any changes on the settings will update accordingly the detector
        self.dock_pid.addWidget(widget)
예제 #7
0
class DAQ_Logger(CustomApp):
    """
    Main class initializing a DAQ_Logger module
    """
    command_DAQ_signal = Signal(list)
    status_signal = Signal(str)

    params = [
        {
            'title': 'Log Type:',
            'name': 'log_type',
            'type': 'str',
            'value': '',
            'readonly': True
        },
    ]

    def __init__(self, dockarea=None, dashboard=None):
        """

        Parameters
        ----------
        dockarea: (dockarea) instance of the modified pyqtgraph Dockarea (see daq_utils)
        dashboard: (DashBoard) instance of the pymodaq dashboard
        """

        super().__init__(dockarea, dashboard)

        self.wait_time = 1000

        self.logger_thread = None
        self.logger = None  # should be a reference either to self.h5saver or self.dblogger depending the choice of the user

    def setup_actions(self):
        '''
        subclass method from ActionManager
        '''
        logger.debug('setting actions')
        self.add_action('quit',
                        'Quit',
                        'close2',
                        "Quit program",
                        toolbar=self.toolbar)
        self.toolbar.addSeparator()
        self.add_action('start',
                        'Start Logging',
                        'run2',
                        "Start the logging",
                        checkable=True,
                        toolbar=self.toolbar)
        self.add_action('stop',
                        'Stop',
                        'stop',
                        'Stop/pause logging',
                        checkable=False,
                        toolbar=self.toolbar)

        log_type_combo = QtWidgets.QComboBox()
        log_type_combo.addItems(LOG_TYPES)
        log_type_combo.currentTextChanged.connect(self.set_log_type)
        self._actions['log_type'] = self.toolbar.addWidget(log_type_combo)
        self.toolbar.addSeparator()
        self.add_action('grab_all',
                        'Grab All',
                        'run_all',
                        "Grab all selected detectors",
                        checkable=True,
                        toolbar=self.toolbar)
        self.add_action('infos',
                        'Log infos',
                        'information2',
                        "Show log file",
                        checkable=False,
                        toolbar=self.toolbar)

        logger.debug('actions set')

    def setup_docks(self):
        logger.debug('setting docks')
        self.docks['detectors'] = Dock("Detectors")
        splitter = QtWidgets.QSplitter(Qt.Vertical)
        self.docks['detectors'].addWidget(splitter)
        splitter.addWidget(self.settings_tree)
        splitter.addWidget(self.modules_manager.settings_tree)
        self.modules_manager.settings.child('modules', 'actuators').hide()
        self.modules_manager.settings.child('actuators_positions').hide()
        self.dockarea.addDock(self.docks['detectors'])

        self.docks['logger_settings'] = Dock("Logger Settings")
        self.dockarea.addDock(self.docks['logger_settings'], 'right',
                              self.docks['detectors'])

        self.statusbar.setMaximumHeight(25)
        self.status_widget = QtWidgets.QLabel('Initializing')
        self.statusbar.addPermanentWidget(self.status_widget)

        self.start_log_time = QtWidgets.QDateTimeEdit()
        self.start_log_time.setReadOnly(True)
        self.start_log_time.setToolTip('Logging started at:')
        self.statusbar.addPermanentWidget(self.start_log_time)

        self.logging_state = QLED()
        self.logging_state.setToolTip(
            'logging status: green (running), red (idle)')
        self.logging_state.clickable = False
        self.statusbar.addPermanentWidget(self.logging_state)

    def connect_things(self):
        self.status_signal[str].connect(self.dashboard.add_status)
        self._actions['quit'].connect(self.quit_fun)

        self._actions['start'].connect(self.start_logging)
        self._actions['stop'].connect(self.stop_logging)
        self._actions['grab_all'].connect(self.start_all)

        self._actions['infos'].connect(self.dashboard.show_log)

    def setup_menu(self):
        """
        """
        file_menu = self.mainwindow.menuBar().addMenu('File')
        self.affect_to('infos', file_menu)

    def value_changed(self, param):
        if param.name() == 'log_type':
            self.set_logger(param.value())

    def set_logger(self, logger_interface):
        if self.logger is not None:
            self.logger.close()
            self.docks['logger_settings'].removeWidgets()

        if logger_interface == 'H5 File':
            self.logger = H5Logger()
        elif logger_interface == 'SQL DataBase':
            self.logger = DataBaseLogger(self.dashboard.preset_file.stem)
        else:
            return

        self.docks['logger_settings'].addWidget(self.logger.settings_tree)

    def quit_fun(self):
        """
            Quit the current instance of DAQ_scan and close on cascade move and detector modules.

            See Also
            --------
            quit_fun
        """
        try:
            self.logger.close()
        except Exception as e:
            logger.exception(str(e))

        self.dockarea.close()

    def set_continuous_save(self):
        """
            Set a continous save file using the base path located file with
            a header-name containing date as a string.

            See Also
            --------
            daq_utils.set_current_scan_path
        """
        self.do_continuous_save = True
        self.logger.settings.child(('N_saved')).show()
        self.logger.settings.child(('N_saved')).setValue(0)

        settings_str = b'<All_settings>'
        settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
            self.dashboard.settings)
        settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
            self.dashboard.preset_manager.preset_params)
        if self.dashboard.settings.child('loaded_files',
                                         'overshoot_file').value() != '':
            settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
                self.dashboard.overshoot_manager.overshoot_params)
        if self.dashboard.settings.child('loaded_files',
                                         'roi_file').value() != '':
            settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
                self.dashboard.roi_saver.roi_presets)
        settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
            self.settings)
        settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
            self.logger.settings)
        settings_str += b'</All_settings>'

        if not self.logger.init_logger(settings_str):
            return False
        logger.addHandler(self.logger.get_handler())
        return True

    def set_logging(self):
        """

        """
        status = self.set_continuous_save()
        if status:
            det_modules_log = self.modules_manager.detectors_all
            if det_modules_log != []:
                # check if the modules are initialized
                for module in det_modules_log:
                    if not module.initialized_state:
                        logger.error(
                            f'module {module.title} is not initialized')
                        return False

                # create the detectors in the chosen logger
                for det in det_modules_log:
                    settings_str = b'<All_settings>'
                    settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
                        det.settings)
                    for viewer in det.ui.viewers:
                        if hasattr(viewer, 'roi_manager'):
                            settings_str += pymodaq.daq_utils.parameter.ioxml.parameter_to_xml_string(
                                viewer.roi_manager.settings)
                    settings_str += b'</All_settings>'

                    self.logger.add_detector(det.title, settings_str)

                self._actions['start'].setEnabled(True)
                self._actions['stop'].setEnabled(True)
                return True
            else:
                self.update_status(
                    'Cannot start logging... No detectors selected')
                self._actions['start'].setEnabled(False)
                self._actions['stop'].setEnabled(True)
                return False

        else:
            self.update_status('Cannot start logging... check connections')
            self._actions['start'].setEnabled(False)
            self._actions['stop'].setEnabled(True)
            return False

    def start_all(self):
        preset_items_det = self.modules_manager.detectors
        for det in preset_items_det:
            det.ui.grab_pb.click()

    def set_log_type(self, log_type):
        self.settings.child('log_type').setValue(log_type)

    def start_logging(self):
        """
            Start a logging.
        """
        self.status_widget.setText('Starting logging')

        self.overshoot = False
        res = self.set_logging()

        # mandatory to deal with multithreads
        if self.logger_thread is not None:
            self.command_DAQ_signal.disconnect()
            if self.logger_thread.isRunning():
                self.logger_thread.exit()
                while not self.logger_thread.isFinished():
                    QThread.msleep(100)
                self.logger_thread = None

        self.logger_thread = QThread()

        log_acquisition = DAQ_Logging(self.settings, self.logger,
                                      self.modules_manager)

        log_acquisition.moveToThread(self.logger_thread)

        self.command_DAQ_signal[list].connect(log_acquisition.queue_command)
        log_acquisition.status_sig[list].connect(self.thread_status)

        self.logger_thread.log_acquisition = log_acquisition
        self.logger_thread.start()

        self._actions['start'].setEnabled(False)
        QtWidgets.QApplication.processEvents()
        self.logging_state.set_as_false()

        self.command_DAQ_signal.emit(["start_logging"])
        self.status_widget.setText('Running acquisition')

    def stop_logging(self):
        """
            Emit the command_DAQ signal "stop_acquisiion".

            See Also
            --------
            set_ini_positions
        """
        preset_items_det = self.modules_manager.detectors
        for det in preset_items_det:
            det.stop()
        self.command_DAQ_signal.emit(["stop_acquisition"])

        if not self.dashboard.overshoot:
            status = 'Data Logging has been stopped by user'
        else:
            status = 'Data Logging has been stopped due to overshoot'

        self.update_status(status)
        self._actions['start'].setEnabled(True)

    @Slot(list)
    def thread_status(
        self, status
    ):  # general function to get datas/infos from all threads back to the main
        """
            | General function to get datas/infos from all threads back to the main.
            |

            Switch the status with :
                * *"Update status"* : Update the status bar with the status attribute txt message
                * *"Update_scan_index"* : Set the value of the User Interface - indice_scan_sb attribute.
                * *"Scan_done"* : Save the scan and init the positions
                * *"Timeout"* : Set the "Timeout occured" in the User Interface-log message

            See Also
            --------
            update_status, save_scan, set_ini_positions
        """
        if status[0] == "Update_Status":
            self.update_status(status[1], wait_time=self.wait_time)

        elif status[0] == "Timeout":
            self.status_widget.setText('Timeout occurred')

    def update_status(self, txt, wait_time=0):
        """
            Show the txt message in the status bar with a delay of wait_time ms.

            =============== =========== =======================
            **Parameters**    **Type**    **Description**
            *txt*             string      The message to show
            *wait_time*       int         the delay of showing
            *log_type*        string      the type of the log
            =============== =========== =======================
        """
        try:
            self.statusbar.showMessage(txt, wait_time)
            logger.info(txt)
        except Exception as e:
            logger.exception(str(e))
예제 #8
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(298, 702)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        Form.setMinimumSize(QtCore.QSize(0, 0))
        Form.setBaseSize(QtCore.QSize(200, 300))
        self.gridLayout_3 = QtWidgets.QGridLayout(Form)
        self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_3.setSpacing(6)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.splitter = QtWidgets.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.verticalLayoutWidget = QtWidgets.QWidget(self.splitter)
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.horizontalLayout.setSpacing(0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.groupBox_main = QtWidgets.QGroupBox(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.groupBox_main.sizePolicy().hasHeightForWidth())
        self.groupBox_main.setSizePolicy(sizePolicy)
        self.groupBox_main.setMinimumSize(QtCore.QSize(0, 0))
        self.groupBox_main.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.groupBox_main.setBaseSize(QtCore.QSize(0, 0))
        self.groupBox_main.setTitle("")
        self.groupBox_main.setFlat(False)
        self.groupBox_main.setObjectName("groupBox_main")
        self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_main)
        self.gridLayout_9.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_9.setObjectName("gridLayout_9")
        self.gridLayout_2 = QtWidgets.QGridLayout()
        self.gridLayout_2.setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_main)
        self.label_2.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.label_2.setObjectName("label_2")
        self.gridLayout_2.addWidget(self.label_2, 2, 0, 1, 1)
        self.Move_Done_LED = QLED(self.groupBox_main)
        self.Move_Done_LED.setObjectName("Move_Done_LED")
        self.gridLayout_2.addWidget(self.Move_Done_LED, 6, 1, 1, 1)
        self.IniStage_pb = QtWidgets.QPushButton(self.groupBox_main)
        self.IniStage_pb.setCheckable(True)
        self.IniStage_pb.setChecked(False)
        self.IniStage_pb.setObjectName("IniStage_pb")
        self.gridLayout_2.addWidget(self.IniStage_pb, 4, 0, 1, 1)
        self.Ini_state_LED = QLED(self.groupBox_main)
        self.Ini_state_LED.setObjectName("Ini_state_LED")
        self.gridLayout_2.addWidget(self.Ini_state_LED, 4, 1, 1, 1)
        self.Current_position_sb = QtWidgets.QDoubleSpinBox(self.groupBox_main)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.Current_position_sb.setFont(font)
        self.Current_position_sb.setLocale(
            QtCore.QLocale(QtCore.QLocale.English,
                           QtCore.QLocale.UnitedStates))
        self.Current_position_sb.setReadOnly(True)
        self.Current_position_sb.setButtonSymbols(
            QtWidgets.QAbstractSpinBox.NoButtons)
        self.Current_position_sb.setDecimals(6)
        self.Current_position_sb.setMinimum(-10000000.0)
        self.Current_position_sb.setMaximum(10000000.0)
        self.Current_position_sb.setObjectName("Current_position_sb")
        self.gridLayout_2.addWidget(self.Current_position_sb, 7, 0, 1, 2)
        self.Stage_type_combo = QtWidgets.QComboBox(self.groupBox_main)
        self.Stage_type_combo.setObjectName("Stage_type_combo")
        self.gridLayout_2.addWidget(self.Stage_type_combo, 2, 1, 1, 1)
        self.title_label = QtWidgets.QLabel(self.groupBox_main)
        font = QtGui.QFont()
        font.setFamily("Tahoma")
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.title_label.setFont(font)
        self.title_label.setAlignment(QtCore.Qt.AlignCenter)
        self.title_label.setObjectName("title_label")
        self.gridLayout_2.addWidget(self.title_label, 0, 0, 1, 2)
        self.Quit_pb = QtWidgets.QPushButton(self.groupBox_main)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/close2.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Quit_pb.setIcon(icon)
        self.Quit_pb.setObjectName("Quit_pb")
        self.gridLayout_2.addWidget(self.Quit_pb, 5, 0, 1, 2)
        self.label_4 = QtWidgets.QLabel(self.groupBox_main)
        self.label_4.setObjectName("label_4")
        self.gridLayout_2.addWidget(self.label_4, 6, 0, 1, 1)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.Abs_position_sb_bis = SpinBox(self.groupBox_main)
        self.Abs_position_sb_bis.setLocale(
            QtCore.QLocale(QtCore.QLocale.English,
                           QtCore.QLocale.UnitedStates))
        self.Abs_position_sb_bis.setDecimals(6)
        self.Abs_position_sb_bis.setMinimum(-100000000.0)
        self.Abs_position_sb_bis.setMaximum(100000000.0)
        self.Abs_position_sb_bis.setObjectName("Abs_position_sb_bis")
        self.horizontalLayout_2.addWidget(self.Abs_position_sb_bis)
        self.Moveto_pb_bis = QtWidgets.QPushButton(self.groupBox_main)
        self.Moveto_pb_bis.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/go_to_1.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Moveto_pb_bis.setIcon(icon1)
        self.Moveto_pb_bis.setObjectName("Moveto_pb_bis")
        self.horizontalLayout_2.addWidget(self.Moveto_pb_bis)
        self.Moveto_pb_bis_2 = QtWidgets.QPushButton(self.groupBox_main)
        self.Moveto_pb_bis_2.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/go_to_2.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Moveto_pb_bis_2.setIcon(icon2)
        self.Moveto_pb_bis_2.setObjectName("Moveto_pb_bis_2")
        self.horizontalLayout_2.addWidget(self.Moveto_pb_bis_2)
        self.fine_tuning_pb = QtWidgets.QPushButton(self.groupBox_main)
        self.fine_tuning_pb.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Add_Step.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.fine_tuning_pb.setIcon(icon3)
        self.fine_tuning_pb.setCheckable(True)
        self.fine_tuning_pb.setObjectName("fine_tuning_pb")
        self.horizontalLayout_2.addWidget(self.fine_tuning_pb)
        self.parameters_pb = QtWidgets.QPushButton(self.groupBox_main)
        self.parameters_pb.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Settings.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.parameters_pb.setIcon(icon4)
        self.parameters_pb.setCheckable(True)
        self.parameters_pb.setObjectName("parameters_pb")
        self.horizontalLayout_2.addWidget(self.parameters_pb)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 2)
        self.gridLayout_9.addLayout(self.gridLayout_2, 0, 0, 1, 1)
        self.horizontalLayout.addWidget(self.groupBox_main)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.groupBox = QtWidgets.QGroupBox(self.verticalLayoutWidget)
        self.groupBox.setTitle("")
        self.groupBox.setFlat(False)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout_buttons = QtWidgets.QGridLayout()
        self.gridLayout_buttons.setContentsMargins(-1, 0, -1, -1)
        self.gridLayout_buttons.setObjectName("gridLayout_buttons")
        self.Move_Abs_pb = QtWidgets.QPushButton(self.groupBox)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Move.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Move_Abs_pb.setIcon(icon5)
        self.Move_Abs_pb.setObjectName("Move_Abs_pb")
        self.gridLayout_buttons.addWidget(self.Move_Abs_pb, 4, 1, 2, 1)
        self.label_3 = QtWidgets.QLabel(self.groupBox)
        self.label_3.setObjectName("label_3")
        self.gridLayout_buttons.addWidget(self.label_3, 7, 0, 1, 1)
        self.Move_Rel_minus_pb = QtWidgets.QPushButton(self.groupBox)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/MoveDown.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Move_Rel_minus_pb.setIcon(icon6)
        self.Move_Rel_minus_pb.setObjectName("Move_Rel_minus_pb")
        self.gridLayout_buttons.addWidget(self.Move_Rel_minus_pb, 8, 1, 1, 1)
        self.Move_Rel_plus_pb = QtWidgets.QPushButton(self.groupBox)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/MoveUp.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Move_Rel_plus_pb.setIcon(icon7)
        self.Move_Rel_plus_pb.setObjectName("Move_Rel_plus_pb")
        self.gridLayout_buttons.addWidget(self.Move_Rel_plus_pb, 7, 1, 1, 1)
        self.Stop_pb = QtWidgets.QPushButton(self.groupBox)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/stop.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Stop_pb.setIcon(icon8)
        self.Stop_pb.setObjectName("Stop_pb")
        self.gridLayout_buttons.addWidget(self.Stop_pb, 11, 0, 1, 1)
        self.Abs_position_sb = SpinBox(self.groupBox)
        self.Abs_position_sb.setLocale(
            QtCore.QLocale(QtCore.QLocale.English,
                           QtCore.QLocale.UnitedStates))
        self.Abs_position_sb.setDecimals(6)
        self.Abs_position_sb.setMinimum(-100000000.0)
        self.Abs_position_sb.setMaximum(100000000.0)
        self.Abs_position_sb.setObjectName("Abs_position_sb")
        self.gridLayout_buttons.addWidget(self.Abs_position_sb, 5, 0, 1, 1)
        self.Rel_position_sb = SpinBox(self.groupBox)
        self.Rel_position_sb.setLocale(
            QtCore.QLocale(QtCore.QLocale.English,
                           QtCore.QLocale.UnitedStates))
        self.Rel_position_sb.setDecimals(6)
        self.Rel_position_sb.setMinimum(-10000000.0)
        self.Rel_position_sb.setMaximum(1000000.0)
        self.Rel_position_sb.setObjectName("Rel_position_sb")
        self.gridLayout_buttons.addWidget(self.Rel_position_sb, 8, 0, 1, 1)
        self.Get_position_pb = QtWidgets.QPushButton(self.groupBox)
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Help_32.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Get_position_pb.setIcon(icon9)
        self.Get_position_pb.setObjectName("Get_position_pb")
        self.gridLayout_buttons.addWidget(self.Get_position_pb, 11, 1, 1, 1)
        self.Find_Home_pb = QtWidgets.QPushButton(self.groupBox)
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/home2.png"),
                         QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Find_Home_pb.setIcon(icon10)
        self.Find_Home_pb.setObjectName("Find_Home_pb")
        self.gridLayout_buttons.addWidget(self.Find_Home_pb, 3, 1, 1, 1)
        self.label_5 = QtWidgets.QLabel(self.groupBox)
        self.label_5.setObjectName("label_5")
        self.gridLayout_buttons.addWidget(self.label_5, 3, 0, 1, 1)
        self.gridLayout.addLayout(self.gridLayout_buttons, 0, 0, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem1, 0, 1, 1, 1)
        self.horizontalLayout_3.addWidget(self.groupBox)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        spacerItem2 = QtWidgets.QSpacerItem(20, 40,
                                            QtWidgets.QSizePolicy.Minimum,
                                            QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem2)
        self.StatusBarLayout = QtWidgets.QHBoxLayout()
        self.StatusBarLayout.setSizeConstraint(
            QtWidgets.QLayout.SetMinimumSize)
        self.StatusBarLayout.setObjectName("StatusBarLayout")
        self.verticalLayout.addLayout(self.StatusBarLayout)
        self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.splitter)
        self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(
            self.verticalLayoutWidget_2)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.gridLayout_3.addWidget(self.splitter, 0, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)