def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.slitbox_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("formatString", "formatString", "###") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("Slits", self) # h hor_label = QtImport.QLabel("Horizontal:", self.main_gbox) self.current_hor_pos_ledit = QtImport.QLineEdit(self.main_gbox) self.current_hor_pos_ledit.setAlignment(QtImport.Qt.AlignRight) boldFont = self.current_hor_pos_ledit.font() boldFont.setBold(True) self.current_hor_pos_ledit.setFont(boldFont) self.current_hor_pos_ledit.setMaximumWidth(120) self.current_hor_pos_ledit.setEnabled(False) self.hor_pos_dspinbox = QtImport.QSpinBox(self.main_gbox) # self.hor_pos_dspinbox.setMaximumWidth(120) # self.hor_pos_dspinbox.setEnabled(False) self.set_hor_gap_button = QtImport.QPushButton( Icons.load_icon("Draw"), "", self.main_gbox ) # self.set_hor_gap_button.setEnabled(False) self.set_hor_gap_button.setFixedSize(27, 27) self.stop_hor_button = QtImport.QPushButton( Icons.load_icon("Stop2"), "", self.main_gbox ) self.stop_hor_button.setEnabled(False) self.stop_hor_button.setFixedSize(27, 27) # Vertical gap ver_label = QtImport.QLabel("Vertical:", self.main_gbox) self.current_ver_pos_ledit = QtImport.QLineEdit(self.main_gbox) self.current_ver_pos_ledit.setAlignment(QtImport.Qt.AlignRight) self.current_ver_pos_ledit.setFont(boldFont) self.current_ver_pos_ledit.setMaximumWidth(120) self.current_ver_pos_ledit.setEnabled(False) self.ver_pos_dspinbox = QtImport.QSpinBox(self.main_gbox) # self.ver_pos_dspinbox.setMaximumWidth(70) # self.ver_pos_dspinbox.setEnabled(False) self.set_ver_gap_button = QtImport.QPushButton( Icons.load_icon("Draw"), "", self.main_gbox ) # self.set_ver_gap_button.setEnabled(False) self.set_ver_gap_button.setFixedSize(27, 27) self.stop_ver_button = QtImport.QPushButton( Icons.load_icon("Stop2"), "", self.main_gbox ) self.stop_ver_button.setEnabled(False) self.stop_ver_button.setFixedSize(27, 27) self.test_button = QtImport.QPushButton("Test", self.main_gbox) self.test_button.hide() # Layout -------------------------------------------------------------- _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox) _main_gbox_gridlayout.addWidget(hor_label, 0, 0) _main_gbox_gridlayout.addWidget(self.current_hor_pos_ledit, 0, 1) _main_gbox_gridlayout.addWidget(self.hor_pos_dspinbox, 0, 2) _main_gbox_gridlayout.addWidget(self.set_hor_gap_button, 0, 3) _main_gbox_gridlayout.addWidget(self.stop_hor_button, 0, 4) _main_gbox_gridlayout.addWidget(ver_label, 1, 0) _main_gbox_gridlayout.addWidget(self.current_ver_pos_ledit, 1, 1) _main_gbox_gridlayout.addWidget(self.ver_pos_dspinbox, 1, 2) _main_gbox_gridlayout.addWidget(self.set_ver_gap_button, 1, 3) _main_gbox_gridlayout.addWidget(self.stop_ver_button, 1, 4) _main_gbox_gridlayout.setSpacing(2) _main_gbox_gridlayout.setContentsMargins(0, 0, 0, 0) _main_gbox_gridlayout.addWidget(self.test_button, 0, 5) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ hor_spinbox_event = SpinBoxEvent(self.hor_pos_dspinbox) self.hor_pos_dspinbox.installEventFilter(hor_spinbox_event) hor_spinbox_event.returnPressedSignal.connect(self.change_hor_gap) self.hor_pos_dspinbox.lineEdit().textChanged.connect(self.hor_gap_edited) self.set_hor_gap_button.clicked.connect(self.change_hor_gap) self.stop_hor_button.clicked.connect(self.stop_hor_clicked) ver_spinbox_event = SpinBoxEvent(self.ver_pos_dspinbox) self.ver_pos_dspinbox.installEventFilter(ver_spinbox_event) ver_spinbox_event.returnPressedSignal.connect(self.change_ver_gap) self.ver_pos_dspinbox.lineEdit().textChanged.connect(self.ver_gap_edited) self.ver_pos_dspinbox.lineEdit().returnPressed.connect(self.change_ver_gap) self.set_ver_gap_button.clicked.connect(self.change_ver_gap) self.stop_ver_button.clicked.connect(self.stop_ver_clicked) self.test_button.clicked.connect(self.test_clicked) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- self.current_hor_pos_ledit.setToolTip("Current horizontal gap size") self.set_hor_gap_button.setToolTip("Set new horizontal gap size") self.stop_hor_button.setToolTip("Stop horizontal slits movements") self.current_ver_pos_ledit.setToolTip("Current vertical gap size") self.set_ver_gap_button.setToolTip("Set new vertical gap size") self.stop_ver_button.setToolTip("Stop vertical slits movements")
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.crl_hwobj = None # Internal values ----------------------------------------------------- self.crl_value = [] # Properties ---------------------------------------------------------- self.add_property("lenseCount", "integer", 6) self.add_property("mnemonic", "string", "") self.add_property("formatString", "formatString", "#.#") self.add_property("caption", "string", "") self.add_property( "style", "combo", ("table", "number"), "table" ) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("CRL", self) self.mode_combo = QtImport.QComboBox(self.main_gbox) self.set_according_to_energy_button = QtImport.QPushButton( "Set", self.main_gbox) self.set_out_button = QtImport.QPushButton("Out", self.main_gbox) # self.align_beam_button = QtImport.QtGui.QPushButton("Align", self.main_gbox) self.crl_widget = QtImport.QWidget(self.main_gbox) self.crl_value_table = QtImport.QTableWidget(self.crl_widget) self.crl_lense_spinbox = QtImport.QSpinBox(self.crl_widget) self.crl_lense_in_button = QtImport.QPushButton("In", self.crl_widget) self.crl_lense_out_button = QtImport.QPushButton("Out", self.crl_widget) self.move_up_button = QtImport.QPushButton("", self.main_gbox) self.move_down_button = QtImport.QPushButton("", self.main_gbox) # Layout -------------------------------------------------------------- _crl_widget_hlayout = QtImport.QHBoxLayout(self.crl_widget) _crl_widget_hlayout.addWidget(self.crl_value_table) _crl_widget_hlayout.addWidget(self.crl_lense_spinbox) _crl_widget_hlayout.addWidget(self.crl_lense_in_button) _crl_widget_hlayout.addWidget(self.crl_lense_out_button) _crl_widget_hlayout.setSpacing(2) _crl_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox) _main_gbox_gridlayout.addWidget(self.mode_combo, 0, 0) _main_gbox_gridlayout.addWidget(self.set_according_to_energy_button, 0, 1) _main_gbox_gridlayout.addWidget(self.set_out_button, 1, 1) _main_gbox_gridlayout.addWidget(self.crl_widget, 1, 0) # _main_gbox_gridlayout.addWidget(self.align_beam_button, 1, 1) _main_gbox_gridlayout.addWidget(self.move_up_button, 0, 2) _main_gbox_gridlayout.addWidget(self.move_down_button, 1, 2) _main_gbox_gridlayout.setSpacing(2) _main_gbox_gridlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.mode_combo.activated.connect(self.set_crl_mode) self.crl_value_table.itemDoubleClicked.connect( self.crl_table_item_doubleclicked ) self.set_according_to_energy_button.clicked.connect( self.set_according_to_energy ) self.set_out_button.clicked.connect(self.set_out_clicked) self.move_up_button.clicked.connect(self.move_up_clicked) self.move_down_button.clicked.connect(self.move_down_clicked) # Other --------------------------------------------------------------- self.mode_combo.setCurrentIndex(1) self.crl_value_table.setRowCount(1) self.crl_value_table.verticalHeader().hide() self.crl_value_table.horizontalHeader().hide() self.crl_value_table.setRowHeight(0, 20) self.crl_value_table.setFixedHeight(24) self.crl_value_table.setShowGrid(True) # self.set_according_to_energy_button.setIcon(Icons.load_icon("Up2")) # self.set_out_button.setIcon(Icons.load_icon("Up2")) self.move_up_button.setIcon(Icons.load_icon("Up2")) self.move_up_button.setFixedWidth(25) self.move_down_button.setIcon(Icons.load_icon("Down2")) self.move_down_button.setFixedWidth(25) self.set_according_to_energy_button.setFixedWidth(30) self.set_out_button.setFixedWidth(30) self.crl_lense_in_button.setFixedWidth(30) self.crl_lense_out_button.setFixedWidth(30)
def __init__(self, *args): """VolpiBrick constructor Arguments: :params args: """ super(VolpiBrick, self).__init__(*args) # Hardware objects ---------------------------------------------------- self.volpi_hwobj = None # hardware object # Graphic elements----------------------------------------------------- self.frame = QtImport.QGroupBox() self.frame_layout = QtImport.QVBoxLayout() self.power_bar = PowerBar([ "#5e4fa2", "#3288bd", "#66c2a5", "#abdda4", "#e6f598", "#ffffbf", "#fee08b", "#fdae61", "#f46d43", "#d53e4f", "#9e0142", "#006837", "#1a9850", "#66bd63", "#a6d96a", "#d9ef8b", "#ffffbf", "#fee08b", "#fdae61", "#f46d43", "#d73027", "#a50026" ]) self.power_bar.setMinimum(0) self.power_bar.setMaximum(100) self.power_bar.setSingleStep(1) self.power_bar.setNotchesVisible(True) self.position_spinbox = QtImport.QSpinBox() self.position_spinbox.setMinimum(0) self.position_spinbox.setMaximum(100) self.position_spinbox.setFixedSize(75, 27) self.step_button = QtImport.QPushButton() self.step_button_icon = Icons.load_icon("TileCascade2") self.step_button.setIcon(self.step_button_icon) self.step_button.setToolTip("Changes the volpi step") self.step_button.setFixedSize(27, 27) # Layout -------------------------------------------------------------- self.frame_layout.addWidget(self.power_bar) self.frame.setLayout(self.frame_layout) self.main_layout = QtImport.QHBoxLayout() self.main_layout.addWidget(self.frame, 0, QtImport.Qt.AlignCenter) self.main_layout.addWidget(self.position_spinbox) self.main_layout.addWidget(self.step_button) self.setLayout(self.main_layout) # Qt signal/slot connections ----------------------------------------- self.power_bar.value_changed.connect(self.value_changed) self.position_spinbox.valueChanged.connect(self.value_changed) self.step_button.clicked.connect(self.open_step_editor) # define properties self.add_property("mnemonic", "string", "") self.add_property("showBar", "boolean", False) self.add_property("showDial", "boolean", False) self.add_property("showStep", "boolean", True) self.add_property("stepValue", "string", 5) # Internal values ----------------------------------------------------- self.step_editor = None self.move_step = 1 # slots ------------------------------------------- self.define_slot("zoom_changed", ())