def __init__(self, parent, realtime_plot=False): QtImport.QWidget.__init__(self, parent) self.snapshot_gbox = QtImport.QGroupBox("Snapshot", self) self.animation_gbox = QtImport.QGroupBox("Animation", self) self.snapshot_label = QtImport.QLabel(self.snapshot_gbox) self.animation_label = QtImport.QLabel(self.animation_gbox) # Layout -------------------------------------------------------------- _snaphot_gbox_hlayout = QtImport.QHBoxLayout(self.snapshot_gbox) _snaphot_gbox_hlayout.addWidget(self.snapshot_label) _snaphot_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _animation_gbox_hlayout = QtImport.QHBoxLayout(self.animation_gbox) _animation_gbox_hlayout.addWidget(self.animation_label) _animation_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.snapshot_gbox) _main_vlayout.addWidget(self.animation_gbox) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout.addStretch(0) self.animation_gbox.setHidden(True)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.motor_hwobj_list = [] self.motor_widget_list = [] self.motor_widget_labels = [] self.predefined_positions_list = [] self.positions = None # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("labels", "string", "") self.add_property("moveButtonIcons", "string", "") self.add_property("alignment", "combo", ("vertical", "horizontal"), "vertical") self.add_property("defaultSteps", "string", "") self.add_property("defaultDeltas", "string", "") self.add_property("defaultDecimals", "string", "") self.add_property("predefinedPositions", "string", "") 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("showEnableButtons", "boolean", False) self.add_property("inExpertMode", "boolean", False) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_group_box = QtImport.QGroupBox(self) self.enable_motors_buttons = QtImport.QPushButton("Enable", self.main_group_box) self.disable_motors_buttons = QtImport.QPushButton( "Disable", self.main_group_box ) # Layout -------------------------------------------------------------- if self["alignment"] == "horizontal": self.main_groupbox_hlayout = QtImport.QHBoxLayout(self.main_group_box) else: self.main_groupbox_hlayout = QtImport.QVBoxLayout(self.main_group_box) self.main_groupbox_hlayout.setSpacing(2) self.main_groupbox_hlayout.setContentsMargins(0, 0, 0, 0) self.main_hlayout = QtImport.QHBoxLayout(self) self.main_hlayout.addWidget(self.main_group_box) self.main_hlayout.setSpacing(2) self.main_hlayout.setContentsMargins(2, 2, 2, 2) # Size Policy --------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.enable_motors_buttons.clicked.connect(self.enable_motors) self.disable_motors_buttons.clicked.connect(self.disable_motors)
def __init__(self, parent=None, name=None, flags=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(flags)) if not name: self.setObjectName("RadiationDamageWidgetLayout") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.rad_damage_cbx = QtImport.QCheckBox(self) _label_widget = QtImport.QWidget(self) self.burn_osc_start_label = QtImport.QLabel(_label_widget) self.burn_osc_start_ledit = QtImport.QLineEdit(_label_widget) self.burn_osc_start_ledit.setMinimumSize(50, 0) self.burn_osc_start_ledit.setMaximumSize(50, 32767) _value_widget = QtImport.QWidget(self) self.burn_osc_interval_label = QtImport.QLabel(_value_widget) self.burn_osc_interval_ledit = QtImport.QLineEdit(_value_widget) self.burn_osc_interval_ledit.setMinimumSize(50, 0) self.burn_osc_interval_ledit.setMaximumSize(50, 32767) # Layout -------------------------------------------------------------- _label_widget_hlayout = QtImport.QHBoxLayout(self) _label_widget_hlayout.addWidget(self.burn_osc_start_label) _label_widget_hlayout.addWidget(self.burn_osc_start_ledit) _label_widget_hlayout.addStretch(0) _label_widget_hlayout.setSpacing(0) _label_widget_hlayout.setContentsMargins(0, 0, 0, 0) _label_widget.setLayout(_label_widget_hlayout) _value_hlayout = QtImport.QHBoxLayout(self) _value_hlayout.addWidget(self.burn_osc_interval_label) _value_hlayout.addWidget(self.burn_osc_interval_ledit) _value_hlayout.addStretch(0) _value_hlayout.setSpacing(0) _value_hlayout.setContentsMargins(0, 0, 0, 0) _value_widget.setLayout(_value_hlayout) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.rad_damage_cbx) _main_vlayout.addWidget(_label_widget) _main_vlayout.addWidget(_value_widget) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) self.setLayout(_main_vlayout) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.languageChange()
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 __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)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.max_log_lines = -1 self.test_mode = False # Properties ---------------------------------------------------------- self.add_property("maxLogLines", "integer", -1) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self._status_bar_widget = LogBarWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(self._status_bar_widget) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- GUILogHandler.GUILogHandler().register(self)
def __init__(self, parent=None, name=None, fl=0): QtImport.QDialog.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- # AsyncResult to return values self._async_result = None # Layout QtImport.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.setWindowTitle("GPhL Workflow parameters") # Info box self.info_gbox = QtImport.QGroupBox("Info", self) QtImport.QVBoxLayout(self.info_gbox) main_layout.addWidget(self.info_gbox) self.info_text = QtImport.QTextEdit(self.info_gbox) self.info_text.setFont(QtImport.QFont("Courier")) self.info_text.setReadOnly(True) self.info_gbox.layout().addWidget(self.info_text) # Special parameter box self.cplx_gbox = QtImport.QGroupBox("Indexing solution", self) QtImport.QVBoxLayout(self.cplx_gbox) main_layout.addWidget(self.cplx_gbox) self.cplx_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.cplx_widget = None # Parameter box self.parameter_gbox = QtImport.QGroupBox("Parameters", self) main_layout.addWidget(self.parameter_gbox) self.parameter_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.params_widget = None # Button bar button_layout = QtImport.QHBoxLayout(None) hspacer = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = QtImport.QPushButton("Continue", self) button_layout.addWidget(self.continue_button) self.cancel_button = QtImport.QPushButton("Abort", self) button_layout.addWidget(self.cancel_button) main_layout.addLayout(button_layout) self.continue_button.clicked.connect(self.continue_button_click) self.cancel_button.clicked.connect(self.cancel_button_click) self.resize( QtImport.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("useImageTracking", "boolean", True) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("populate_dc_parameter_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = QtImport.QToolBox(self) self.parameters_widget = DCParametersWidget(self, "parameters_widget") self.results_static_view = QtImport.QTextBrowser(self.tool_box) self.image_tracking_widget = ImageTrackingWidget(self.tool_box) self.advance_results_widget = AdvancedResultsWidget(self.tool_box) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "Parameters") self.tool_box.addItem(self.image_tracking_widget, "Results - ADXV control") self.tool_box.addItem(self.results_static_view, "Results - Summary") self.tool_box.addItem(self.advance_results_widget, "Results - Parallel processing") # Layout -------------------------------------------------------------- _main_vlayout = QtImport.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget)
def __init__(self, parent=None): QtImport.QWidget.__init__(self, parent) self.setObjectName("advanced_results_widget") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.hit_map_widget = HitMapWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(self.hit_map_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- if HWR.beamline.online_processing is not None: HWR.beamline.online_processing.connect("processingStarted", self.processing_started) HWR.beamline.online_processing.connect( "processingResultsUpdate", self.update_processing_results) else: self.setEnabled(False)
def __init__(self, parent, realtime_plot=False): QtImport.QWidget.__init__(self, parent) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self.__current_location = [0, 0] # Graphic elements ---------------------------------------------------- self.plate_navigator_table = QtImport.QTableWidget(self) self.plate_navigator_cell = QtImport.QGraphicsView(self) # Layout -------------------------------------------------------------- _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(self.plate_navigator_table) _main_hlayout.addWidget(self.plate_navigator_cell) _main_hlayout.addStretch() _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # self.plate_navigator_cell.setSizePolicy # Qt signal/slot connections ------------------------------------------ self.plate_navigator_table.itemDoubleClicked.\ connect(self.navigation_table_double_clicked) # Other --------------------------------------------------------------- self.navigation_graphicsscene = QtImport.QGraphicsScene(self) self.plate_navigator_cell.setScene(self.navigation_graphicsscene) self.navigation_item = NavigationItem(self) # self.navigation_item.mouseDoubleClickedSignal.connect(\ # self.navigation_item_double_clicked) self.navigation_graphicsscene.addItem(self.navigation_item) self.navigation_graphicsscene.update() self.plate_navigator_cell.setEnabled(False) #font = self.plate_navigator_table.font() # font.setPointSize(8) # self.plate_navigator_table.setFont(font) self.plate_navigator_table.setEditTriggers( QtImport.QAbstractItemView.NoEditTriggers) self.plate_navigator_table.setHorizontalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_table.setVerticalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setHorizontalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setVerticalScrollBarPolicy( QtImport.Qt.ScrollBarAlwaysOff) if HWR.beamline.plate_manipulator is not None: self.init_plate_view()
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)
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=None, name=None, fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) self.selected_element = None self.selected_edge = "L3" # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- if PYMCA_IMPORTED: self.periodic_table = CustomPeriodicTable(self) else: self.periodic_elements_combo = QtImport.QComboBox(self) self.periodic_elements_combo.setFixedWidth(100) self.edge_widget = QtImport.QWidget(self) edge_label = QtImport.QLabel("Edge:", self.edge_widget) self.edge_combo = QtImport.QComboBox(self.edge_widget) # Layout -------------------------------------------------------------- _edge_hlayout = QtImport.QHBoxLayout(self.edge_widget) if not PYMCA_IMPORTED: _edge_hlayout.addWidget(self.periodic_elements_combo) _edge_hlayout.addWidget(edge_label) _edge_hlayout.addWidget(self.edge_combo) _edge_hlayout.addStretch(0) _edge_hlayout.setSpacing(2) _edge_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) if PYMCA_IMPORTED: _main_vlayout.addWidget(self.periodic_table, QtImport.Qt.AlignHCenter) _main_vlayout.addWidget(self.edge_widget) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ if PYMCA_IMPORTED: self.periodic_table.edgeSelectedSignal.connect(self.edge_selected) else: self.periodic_elements_combo.activated.connect( self.element_combo_activated) self.edge_combo.addItem("K") self.edge_combo.activated.connect(self.edge_combo_activated) self.edge_combo.setEnabled(False)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("icons", "string", "") self.add_property("myTabLabel", "string", "") # Signals ------------------------------------------------------------ self.define_signal("incoming_unread_messages", ()) self.define_signal("reset_unread_message", ()) # Slots --------------------------------------------------------------- self.define_slot("tabSelected", ()) self.define_slot("sessionSelected", ()) # Hardware objects ---------------------------------------------------- self.instance_server_hwobj = None # Internal values ----------------------------------------------------- self.session_id = None self.nickname = "" self.role = BaseWidget.INSTANCE_ROLE_UNKNOWN # Graphic elements ---------------------------------------------------- self.conversation_textedit = QtImport.QTextEdit(self) self.conversation_textedit.setReadOnly(True) _controls_widget = QtImport.QWidget(self) _say_label = QtImport.QLabel("Say:", _controls_widget) self.message_ledit = QtImport.QLineEdit(_controls_widget) self.send_button = QtImport.QPushButton("Send", _controls_widget) self.send_button.setEnabled(False) # Layout -------------------------------------------------------------- _controls_widget_hlayout = QtImport.QHBoxLayout(_controls_widget) _controls_widget_hlayout.addWidget(_say_label) _controls_widget_hlayout.addWidget(self.message_ledit) _controls_widget_hlayout.addWidget(self.send_button) _controls_widget_hlayout.setSpacing(2) _controls_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.conversation_textedit) _main_vlayout.addWidget(_controls_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ self.send_button.clicked.connect(self.send_current_message) self.message_ledit.returnPressed.connect(self.send_current_message) self.message_ledit.textChanged.connect(self.message_changed)
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"))
def __init__(self, parent=None, name="parameter_widget"): QtImport.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Internal variables -------------------------------------------------- self._data_collection = None self._tree_view_item = None self._acquisition_mib = None # Graphic elements ---------------------------------------------------- _dc_parameters_widget = QtImport.QWidget(self) self._data_path_widget = DataPathWidget(_dc_parameters_widget) self._acq_widget = AcquisitionWidget(_dc_parameters_widget, layout="horizontal") self._processing_widget = ProcessingWidget(_dc_parameters_widget) # Layout -------------------------------------------------------------- _dc_parameters_widget_layout = QtImport.QVBoxLayout( _dc_parameters_widget) _dc_parameters_widget_layout.addWidget(self._data_path_widget) _dc_parameters_widget_layout.addWidget(self._acq_widget) _dc_parameters_widget_layout.addWidget(self._processing_widget) _dc_parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _dc_parameters_widget_layout.setSpacing(2) _dc_parameters_widget_layout.addStretch(10) _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(_dc_parameters_widget) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.setSpacing(2) _main_hlayout.addStretch(0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self._data_path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change) self._data_path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change) self._acq_widget.madEnergySelectedSignal.connect( self.mad_energy_selected) self._acq_widget.acqParametersChangedSignal.connect( self.acq_parameters_changed)
def __init__(self, parent=None, name="log_bar_widget", fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) self.text_edit = QtImport.QTextEdit(self) self.text_edit.setAcceptRichText(True) self.text_edit.setReadOnly(True) self.text_edit.setFontWeight(QtImport.QFont.Bold) _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(self.text_edit) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(0, 0, 0, 0)
def __init__(self, parent=None, name="advanced_parameters_widget"): QtImport.QWidget.__init__(self, parent) # Internal values ----------------------------------------------------- self._data_collection = None self._tree_view_item = None self._acquisition_mib = None # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _dc_parameters_widget = QtImport.QWidget(self) self._data_path_widget = DataPathWidget(_dc_parameters_widget) self._acq_widget = AcquisitionWidget(_dc_parameters_widget, layout="horizontal") # Layout -------------------------------------------------------------- _dc_parameters_widget_layout = QtImport.QVBoxLayout( _dc_parameters_widget) _dc_parameters_widget_layout.addWidget(self._data_path_widget) _dc_parameters_widget_layout.addWidget(self._acq_widget) _dc_parameters_widget_layout.setSpacing(2) _dc_parameters_widget_layout.addStretch(10) _dc_parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _main_hlayout = QtImport.QHBoxLayout(self) _main_hlayout.addWidget(_dc_parameters_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(2, 2, 2, 2) _main_hlayout.addStretch(0) # Qt signal/slot connections ------------------------------------------ # self._acq_widget.acqParametersChangedSignal.\ # connect(self.acq_parameters_changed) # self._data_path_widget.pathTemplateChangedSignal.\ # connect(self.acq_parameters_changed) self._acq_widget.madEnergySelectedSignal.connect( self.mad_energy_selected) # Ohter --------------------------------------------------------------- self._acq_widget.use_osc_start(False) self._acq_widget.acq_widget_layout.mad_cbox.hide() self._acq_widget.acq_widget_layout.energies_combo.hide() self._acq_widget.acq_widget_layout.shutterless_cbx.hide()
def __init__(self, *args): BaseWidget.__init__(self, *args) self.logger = logging.getLogger("GUI Alba Actuator") self.logger.info("__init__()") self.on_color = Colors.color_to_hexa(Colors.LIGHT_GREEN) self.off_color = Colors.color_to_hexa(Colors.LIGHT_GRAY) self.fault_color = Colors.color_to_hexa(Colors.LIGHT_RED) self.unknown_color = Colors.color_to_hexa(Colors.DARK_GRAY) # Hardware objects ---------------------------------------------------- self.light_ho = None self.state = None self.level = None self.icons = None self.level_limits = [None, None] # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("icons", "string", "") # Graphic elements ---------------------------------------------------- self.widget = QtImport.load_ui_file("alba_lightcontrol.ui") QtImport.QHBoxLayout(self) self.layout().addWidget(self.widget) self.layout().setContentsMargins(0, 0, 0, 0) self.widget.layout().setContentsMargins(0, 0, 0, 0) self.widget.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.widget.button.clicked.connect(self.do_switch) self.widget.slider.valueChanged.connect(self.do_set_level) # SizePolicies -------------------------------------------------------- self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.MinimumExpanding) # Defaults self.set_icons("BulbCheck,BulbDelete") # Other --------------------------------------------------------------- self.setToolTip("Control of light (set level and on/off switch.") self.update()
def __init__(self, parent, brick): QtImport.QGroupBox.__init__(self, "State", parent) BaseWidget.__init__(self, parent) # Graphic elements ---------------------------------------------------- # self.contents_widget = QGroupBox("Sample Changer State", self) self._parent = brick self.status_label = QtImport.QLabel("") self.status_label.setAlignment(QtImport.Qt.AlignCenter) # Layout -------------------------------------------------------------- _layout = QtImport.QHBoxLayout(self) _layout.addWidget(self.status_label) _layout.setSpacing(2) _layout.setContentsMargins(6, 6, 6, 10)
def build_operations_widget(self): self.buttons_layout = QtImport.QHBoxLayout() self.operation_buttons_layout = QtImport.QVBoxLayout() self.load_button = QtImport.QPushButton("Load", self) self.unload_button = QtImport.QPushButton("Unload", self) self.abort_button = QtImport.QPushButton("Abort", self) self.load_button.clicked.connect(self.load_selected_sample) self.unload_button.clicked.connect(self.unload_selected_sample) self.abort_button.clicked.connect(self.abort_mounting) self.buttons_layout.addWidget(self.load_button) self.buttons_layout.addWidget(self.unload_button) self.operation_buttons_layout.addLayout(self.buttons_layout) self.operation_buttons_layout.addWidget(self.abort_button) self.operations_widget.setLayout(self.operation_buttons_layout)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.exporter_client_hwobj = None # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.info_widget = QtImport.QWidget(self) self.info_address_ledit = QtImport.QLineEdit(self.info_widget) self.info_refresh_button = QtImport.QPushButton( "Refresh", self.info_widget) self.method_table = QtImport.QTableWidget(self) self.property_table = QtImport.QTableWidget(self) # Layout -------------------------------------------------------------- _info_widget_hlayout = QtImport.QHBoxLayout(self.info_widget) _info_widget_hlayout.addWidget(self.info_address_ledit) _info_widget_hlayout.addWidget(self.info_refresh_button) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.info_widget) _main_vlayout.addWidget(self.method_table) _main_vlayout.addWidget(self.property_table) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.method_table.setColumnCount(2) self.method_table.setHorizontalHeaderLabels( ["Type", "Method (Parameters)"]) self.property_table.setColumnCount(4) self.property_table.setHorizontalHeaderLabels( ["Type", "Property", "Access", "Value"]) self.setFixedWidth(600)
def __init__(self, parent=None): """" Constructor of MotorSlider :param parent: sliders parent widget """ super(MotorSlider, self).__init__(parent) self.values_format = "%+8.4f" #"{0:8.4f}" # slider params: self.slider = QtImport.QSlider() self.slider.setEnabled(False) self.slider.setTickInterval(10) self.slider.setTickPosition(QtImport.QSlider.TicksBothSides) self.slider.setOrientation(QtImport.Qt.Horizontal) # extra controls min_value_text = self.values_format % self.slider.minimum() max_value_text = self.values_format % self.slider.maximum() current_value_text = self.values_format % self.slider.value() self.min_label = QtImport.QLabel(min_value_text) self.max_label = QtImport.QLabel(max_value_text) self.current_label = QtImport.QLabel(current_value_text) # layouts self.main_v_layout = QtImport.QVBoxLayout() self.labels_h_layout = QtImport.QHBoxLayout() self.labels_h_layout.addWidget(self.min_label) self.labels_h_layout.addStretch() self.labels_h_layout.addWidget(self.current_label) self.labels_h_layout.addStretch() self.labels_h_layout.addWidget(self.max_label) self.main_v_layout.addLayout(self.labels_h_layout) self.main_v_layout.addWidget(self.slider) self.setLayout(self.main_v_layout) # stylesheets self.slider.setStyleSheet(self.stylesheet1) self.slider.valueChanged.connect(self.value_changed)
def __init__(self, parent=None, name=None, flags=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(flags)) if not name: self.setObjectName("SADWidgetLayout") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.optimised_sad_cbx = QtImport.QCheckBox("Optimised SAD", self) self.automatic_resolution_radio = QtImport.QRadioButton(self) _optimal_sad_widget = QtImport.QWidget(self) self.optimal_sad_radio = QtImport.QRadioButton( "Optimal SAD for given resolution:", _optimal_sad_widget ) self.sad_bgroup = QtImport.QButtonGroup(self) self.sad_bgroup.addButton(self.automatic_resolution_radio) self.sad_bgroup.addButton(self.optimal_sad_radio) self.sad_resolution_ledit = QtImport.QLineEdit(_optimal_sad_widget) self.sad_resolution_ledit.setMinimumSize(50, 0) self.sad_resolution_ledit.setMaximumSize(50, 32767) # Layout -------------------------------------------------------------- _optimal_sad_widget_hlayout = QtImport.QHBoxLayout(_optimal_sad_widget) _optimal_sad_widget_hlayout.addWidget(self.optimal_sad_radio) _optimal_sad_widget_hlayout.addWidget(self.sad_resolution_ledit) _optimal_sad_widget_hlayout.setSpacing(0) _optimal_sad_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.optimised_sad_cbx) _main_vlayout.addWidget(self.automatic_resolution_radio) _main_vlayout.addWidget(_optimal_sad_widget) _main_vlayout.addStretch(0) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) self.automatic_resolution_radio.setText( self.trUtf8( "\x52\x65\x73\x6f\x6c\x75\x74\x69\x6f\x6e\x20\x73\x65\x6c\x65\x63\x74\x65\x64\x20\x61\x75\x74\x6f\x6d\x61\x74\x69\x63\x61\x6c\x6c\x79\x2c\x20\x72\x6f\x74\x61\x74\x69\x6f\x6e\x20\x69\x6e\x74\x65\x72\x76\x61\x6c\x3a\x20\x33\x36\x30\xc2\xb0" ) )
def __init__(self, parent, row, col, filename, file_filter): QtImport.QWidget.__init__(self) self.file_filter = file_filter self.parent = parent self.col = col self.row = row self.cmdBrowse = QtImport.QPushButton("Browse", self.parent.viewport()) main_layout = QtImport.QHBoxLayout() main_layout.addWidget(self.cmdBrowse) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(main_layout) self.cmdBrowse.clicked.connect(self.browse_clicked) self.set_filename(filename)
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)
def __init__(self, parent, options): QtImport.QWidget.__init__(self, parent) # do not allow qt to stretch us vertically policy = self.sizePolicy() policy.setVerticalPolicy(QtImport.QSizePolicy.Fixed) self.setSizePolicy(policy) QtImport.QHBoxLayout(self) self.__name = options["variableName"] self.filepath = QtImport.QLineEdit(self) self.filepath.setAlignment(QtImport.Qt.AlignLeft) if "defaultValue" in options: self.filepath.setText(options["defaultValue"]) self.open_dialog_btn = QtImport.QPushButton("...", self) self.open_dialog_btn.clicked.connect(self.open_file_dialog) self.layout().addWidget(self.filepath) self.layout().addWidget(self.open_dialog_btn)
def __init__(self, parent, row, col, color): QtImport.QWidget.__init__(self, parent) self.col = col self.row = row self.parent = parent self.change_color_button = QtImport.QPushButton("Color...", parent) self.reset_color_button = QtImport.QPushButton("reset", parent) main_layout = QtImport.QHBoxLayout(self) main_layout.addWidget(self.change_color_button) main_layout.addWidget(self.reset_color_button) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) self.change_color_button.clicked.connect(self.change_color_clicked) self.reset_color_button.clicked.connect(self.reset_color_clicked) self.set_color(color)
def __init__(self, *args): QtImport.QDialog.__init__(self, *args) layout = QtImport.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.widget = QtImport.load_ui_file("catscommand_dialog.ui") layout.addWidget(self.widget) self.btSend = self.widget.buttonBox.addButton( "Send", QtImport.QDialogButtonBox.ApplyRole) self.btSend.clicked.connect(self.send_command) self.widget.cbCommand.clear() self.widget.cbCommand.insertItems(0, self.cmds) self.widget.cbCommand.activated.connect(self.command_selected) self.widget.buttonBox.rejected.connect(self.rejected)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self._data_collection = None # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- self.define_slot("populate_advanced_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = QtImport.QToolBox(self) self.parameters_widget = AdvancedParametersWidget(self) self.results_widget = AdvancedResultsWidget(self) self.line_parameters_widget = AdvancedParametersWidget(self) self.line_results_widget = AdvancedResultsWidget(self) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "2D Heat map: Parameters") self.tool_box.addItem(self.results_widget, "2D Heat map: Results") self.tool_box.addItem(self.line_parameters_widget, "Line scan: Parameters") self.tool_box.addItem(self.line_results_widget, "Line scan: Results") # Layout -------------------------------------------------------------- _main_vlayout = QtImport.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.connect(HWR.beamline.sample_view, "gridClicked", self.grid_clicked )