def __init__(self, parent, realtime_plot=False): qt_import.QWidget.__init__(self, parent) self.snapshot_gbox = qt_import.QGroupBox("Snapshot", self) self.animation_gbox = qt_import.QGroupBox("Animation", self) self.snapshot_label = qt_import.QLabel(self.snapshot_gbox) self.animation_label = qt_import.QLabel(self.animation_gbox) # Layout -------------------------------------------------------------- _snaphot_gbox_hlayout = qt_import.QHBoxLayout(self.snapshot_gbox) _snaphot_gbox_hlayout.addWidget(self.snapshot_label) _snaphot_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _animation_gbox_hlayout = qt_import.QHBoxLayout(self.animation_gbox) _animation_gbox_hlayout.addWidget(self.animation_label) _animation_gbox_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = qt_import.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, parent=None, name=None, flags=0): qt_import.QWidget.__init__(self, parent, qt_import.Qt.WindowFlags(flags)) if not name: self.setObjectName("RadiationDamageWidgetLayout") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.rad_damage_cbx = qt_import.QCheckBox(self) _label_widget = qt_import.QWidget(self) self.burn_osc_start_label = qt_import.QLabel(_label_widget) self.burn_osc_start_ledit = qt_import.QLineEdit(_label_widget) self.burn_osc_start_ledit.setMinimumSize(50, 0) self.burn_osc_start_ledit.setMaximumSize(50, 32767) _value_widget = qt_import.QWidget(self) self.burn_osc_interval_label = qt_import.QLabel(_value_widget) self.burn_osc_interval_ledit = qt_import.QLineEdit(_value_widget) self.burn_osc_interval_ledit.setMinimumSize(50, 0) self.burn_osc_interval_ledit.setMaximumSize(50, 32767) # Layout -------------------------------------------------------------- _label_widget_hlayout = qt_import.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 = qt_import.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 = qt_import.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 = qt_import.QGroupBox(self) self.label = qt_import.QLabel("motor:", _main_gbox) self.positions_combo = qt_import.QComboBox(self) self.previous_position_button = qt_import.QPushButton(_main_gbox) self.next_position_button = qt_import.QPushButton(_main_gbox) # Layout -------------------------------------------------------------- _main_gbox_hlayout = qt_import.QHBoxLayout(_main_gbox) _main_gbox_hlayout.addWidget(self.label) _main_gbox_hlayout.addWidget(self.positions_combo) _main_gbox_hlayout.addWidget(self.previous_position_button) _main_gbox_hlayout.addWidget(self.next_position_button) _main_gbox_hlayout.setSpacing(2) _main_gbox_hlayout.setContentsMargins(2, 2, 2, 2) _main_hlayout = qt_import.QHBoxLayout(self) _main_hlayout.addWidget(_main_gbox) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(0, 0, 0, 0) # Size Policy --------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.positions_combo.activated.connect(self.position_selected) self.previous_position_button.clicked.connect( self.select_previous_position) self.next_position_button.clicked.connect(self.select_next_position) # Other --------------------------------------------------------------- self.positions_combo.setFixedHeight(27) self.positions_combo.setToolTip( "Moves the motor to a predefined position") self.previous_position_button.setIcon(icons.load_icon("Minus2")) self.previous_position_button.setFixedSize(27, 27) self.next_position_button.setIcon(icons.load_icon("Plus2")) self.next_position_button.setFixedSize(27, 27)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- #self.add_property("useImageTracking", "boolean", True) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- self.define_slot("populate_ssx_parameter_widget", ({})) # Graphic elements ---------------------------------------------------- self.tool_box = qt_import.QToolBox(self) self.parameters_widget = DCParametersWidget(self, "parameters_widget") #self.image_tracking_widget = ImageTrackingWidget(self.tool_box) self.advance_results_widget = AdvancedResultsWidget(self.tool_box) self.snapshot_widget = SnapshotWidget(self) self.tool_box.addItem(self.parameters_widget, "Parameters") #self.tool_box.addItem(self.results_static_view, "Results - Summary") #self.tool_box.addItem( # self.advance_results_widget, "Results - online processing" #) # Layout -------------------------------------------------------------- _main_vlayout = qt_import.QHBoxLayout(self) _main_vlayout.addWidget(self.tool_box) _main_vlayout.addWidget(self.snapshot_widget)
def __init__(self, parent=None): qt_import.QWidget.__init__(self, parent) self.setObjectName("online_processing_results_widget") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.hit_map_widget = HitMapWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = qt_import.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, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.max_log_lines = -1 self.test_mode = False # Properties ---------------------------------------------------------- self.add_property("maxLogLines", "integer", -1) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self._status_bar_widget = LogBarWidget(self) # Layout -------------------------------------------------------------- _main_hlayout = qt_import.QHBoxLayout(self) _main_hlayout.addWidget(self._status_bar_widget) _main_hlayout.setSpacing(0) _main_hlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- gui_log_handler.GUILogHandler().register(self)
def __init__(self, parent=None, name=None, fl=0): qt_import.QDialog.__init__(self, parent, qt_import.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- # AsyncResult to return values self._async_result = None # Layout qt_import.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.setWindowTitle("GPhL Workflow parameters") # Info box self.info_gbox = qt_import.QGroupBox("Info", self) qt_import.QVBoxLayout(self.info_gbox) main_layout.addWidget(self.info_gbox) self.info_text = qt_import.QTextEdit(self.info_gbox) self.info_text.setFont(qt_import.QFont("Courier")) self.info_text.setReadOnly(True) self.info_gbox.layout().addWidget(self.info_text) # Special parameter box self.cplx_gbox = qt_import.QGroupBox("Indexing solution", self) qt_import.QVBoxLayout(self.cplx_gbox) main_layout.addWidget(self.cplx_gbox) self.cplx_gbox.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.cplx_widget = None # Parameter box self.parameter_gbox = qt_import.QGroupBox("Parameters", self) main_layout.addWidget(self.parameter_gbox) self.parameter_gbox.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.params_widget = None # Button bar button_layout = qt_import.QHBoxLayout(None) hspacer = qt_import.QSpacerItem(1, 20, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = qt_import.QPushButton("Continue", self) button_layout.addWidget(self.continue_button) self.cancel_button = qt_import.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( qt_import.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
def __init__(self, parent=None): qt_import.QWidget.__init__(self, parent) self.curves_dict = {} self.visible_curve = None self.view_box = CustomViewBox() self.one_dim_plot = pg.PlotWidget(viewBox=self.view_box) self.two_dim_plot = pg.ImageView() self.one_dim_plot.showGrid(x=True, y=True) self.two_dim_plot.ui.histogram.hide() self.two_dim_plot.ui.roiBtn.hide() self.two_dim_plot.ui.menuBtn.hide() self.two_dim_plot.setFixedWidth(400) hlayout = qt_import.QHBoxLayout(self) hlayout.addWidget(self.one_dim_plot) hlayout.addWidget(self.two_dim_plot) colors = [(0, 0, 0), (255, 0, 0), (255, 255, 0), (255, 255, 255)] cmap = pg.ColorMap(pos=np.linspace(0.0, 1.0, 4), color=colors) self.two_dim_plot.setColorMap(cmap) self.one_dim_plot.scene().sigMouseMoved.connect(self.one_dim_plot_mouse_moved) self.two_dim_plot.scene.sigMouseMoved.connect(self.two_dim_plot_mouse_moved)
def __init__(self, *args): qt_import.QWidget.__init__(self, *args) self.value_plot = None self.title_label = qt_import.QLabel(self) self.value_widget = qt_import.QWidget(self) self.value_label = qt_import.QLabel(self.value_widget) self.value_label.setAlignment(qt_import.Qt.AlignCenter) self.history_button = qt_import.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 = qt_import.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 = qt_import.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, 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 = qt_import.QLabel("go to ", self) self.text_move = qt_import.QLineEdit("", self) self.cmd_move = qt_import.QPushButton("", self) self.cmd_move.setCheckable(True) self.cmd_go_back = qt_import.QPushButton("", self) self.cmd_stop = qt_import.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 = qt_import.QHBoxLayout(self) hboxlayout.insertSpacerItem( 0, qt_import.QSpacerItem(0, 0, qt_import.QSizePolicy.Expanding, qt_import.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, qt_import.QSpacerItem(0, 0, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Fixed)) self.setLayout(hboxlayout)
def __init__(self, parent, realtime_plot=False): qt_import.QWidget.__init__(self, parent) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self.__current_location = [0, 0] # Graphic elements ---------------------------------------------------- self.plate_navigator_table = qt_import.QTableWidget(self) self.plate_navigator_cell = qt_import.QGraphicsView(self) # Layout -------------------------------------------------------------- _main_hlayout = qt_import.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 = qt_import.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( qt_import.QAbstractItemView.NoEditTriggers) self.plate_navigator_table.setHorizontalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.plate_navigator_table.setVerticalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setHorizontalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) self.plate_navigator_cell.setVerticalScrollBarPolicy( qt_import.Qt.ScrollBarAlwaysOff) if HWR.beamline.plate_manipulator is not None: self.init_plate_view()
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- self.add_property("title", "string", "Shutter") self.add_property("hwobj_shutter", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- self.shutter_hwobj = None # Internal values ----------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = qt_import.QGroupBox("Shutter", self) self.main_groupbox.setAlignment(qt_import.Qt.AlignCenter) self.state_label = qt_import.QLabel("<b>unknown</b>", self.main_groupbox) self.state_label.setAlignment(qt_import.Qt.AlignCenter) self.state_label.setFixedHeight(24) colors.set_widget_color(self.state_label, colors.LIGHT_GRAY) _button_widget = qt_import.QWidget(self.main_groupbox) self.open_button = qt_import.QPushButton( icons.load_icon("ShutterOpen"), "Open", _button_widget) self.close_button = qt_import.QPushButton( icons.load_icon("ShutterClose"), "Close", _button_widget) # Layout -------------------------------------------------------------- _button_widget_hlayout = qt_import.QHBoxLayout(_button_widget) _button_widget_hlayout.addWidget(self.open_button) _button_widget_hlayout.addWidget(self.close_button) _button_widget_hlayout.setSpacing(2) _button_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_gbox_vlayout = qt_import.QVBoxLayout(self.main_groupbox) _main_gbox_vlayout.addWidget(self.state_label) _main_gbox_vlayout.addWidget(_button_widget) _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout = qt_import.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.open_button.clicked.connect(self.open_button_clicked) self.close_button.clicked.connect(self.close_button_clicked)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("icons", "string", "") self.add_property("myTabLabel", "string", "") # Signals ------------------------------------------------------------ self.define_signal("incoming_unread_messages", ()) self.define_signal("reset_unread_message", ()) # Slots --------------------------------------------------------------- self.define_slot("tabSelected", ()) self.define_slot("sessionSelected", ()) # Hardware objects ---------------------------------------------------- self.instance_server_hwobj = None # Internal values ----------------------------------------------------- self.session_id = None self.nickname = "" self.role = BaseWidget.INSTANCE_ROLE_UNKNOWN # Graphic elements ---------------------------------------------------- self.conversation_textedit = qt_import.QTextEdit(self) self.conversation_textedit.setReadOnly(True) _controls_widget = qt_import.QWidget(self) _say_label = qt_import.QLabel("Say:", _controls_widget) self.message_ledit = qt_import.QLineEdit(_controls_widget) self.send_button = qt_import.QPushButton("Send", _controls_widget) self.send_button.setEnabled(False) # Layout -------------------------------------------------------------- _controls_widget_hlayout = qt_import.QHBoxLayout(_controls_widget) _controls_widget_hlayout.addWidget(_say_label) _controls_widget_hlayout.addWidget(self.message_ledit) _controls_widget_hlayout.addWidget(self.send_button) _controls_widget_hlayout.setSpacing(2) _controls_widget_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = qt_import.QVBoxLayout(self) _main_vlayout.addWidget(self.conversation_textedit) _main_vlayout.addWidget(_controls_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ self.send_button.clicked.connect(self.send_current_message) self.message_ledit.returnPressed.connect(self.send_current_message) self.message_ledit.textChanged.connect(self.message_changed)
def __init__(self, parent=None, name=None, fl=0): qt_import.QWidget.__init__(self, parent, qt_import.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 = qt_import.QComboBox(self) self.periodic_elements_combo.setFixedWidth(100) self.edge_widget = qt_import.QWidget(self) edge_label = qt_import.QLabel("Edge:", self.edge_widget) self.edge_combo = qt_import.QComboBox(self.edge_widget) # Layout -------------------------------------------------------------- _edge_hlayout = qt_import.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 = qt_import.QVBoxLayout(self) if PYMCA_IMPORTED: _main_vlayout.addWidget(self.periodic_table, qt_import.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, parent): qt_import.QDialog.__init__(self, parent) # Graphic elements----------------------------------------------------- # self.main_gbox = QtGui.QGroupBox('Motor step', self) # box2 = QtGui.QWidget(self) self.grid = qt_import.QWidget(self) label1 = qt_import.QLabel("Current:", self) self.current_step = qt_import.QLineEdit(self) self.current_step.setEnabled(False) label2 = qt_import.QLabel("Set to:", self) self.new_step = qt_import.QLineEdit(self) self.new_step.setAlignment(qt_import.Qt.AlignRight) self.new_step.setValidator(qt_import.QDoubleValidator(self)) self.button_box = qt_import.QWidget(self) self.apply_button = qt_import.QPushButton("Apply", self.button_box) self.close_button = qt_import.QPushButton("Dismiss", self.button_box) # Layout -------------------------------------------------------------- self.button_box_layout = qt_import.QHBoxLayout(self.button_box) self.button_box_layout.addWidget(self.apply_button) self.button_box_layout.addWidget(self.close_button) self.grid_layout = qt_import.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 = qt_import.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(qt_import.QSizePolicy.Fixed, qt_import.QSizePolicy.Fixed) self.setSizePolicy(qt_import.QSizePolicy.Minimum, qt_import.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="log_bar_widget", fl=0): qt_import.QWidget.__init__(self, parent, qt_import.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) self.text_edit = qt_import.QTextEdit(self) self.text_edit.setAcceptRichText(True) self.text_edit.setReadOnly(True) self.text_edit.setFontWeight(qt_import.QFont.Bold) _main_hlayout = qt_import.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"): qt_import.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 = qt_import.QWidget(self) self._data_path_widget = DataPathWidget(_dc_parameters_widget) self._acq_widget = AcquisitionWidget(_dc_parameters_widget, layout="horizontal") # Layout -------------------------------------------------------------- _dc_parameters_widget_layout = qt_import.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 = qt_import.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 = qt_import.load_ui_file("alba_lightcontrol.ui") qt_import.QHBoxLayout(self) self.layout().addWidget(self.widget) self.layout().setContentsMargins(0, 0, 0, 0) self.widget.layout().setContentsMargins(0, 0, 0, 0) self.widget.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.widget.button.clicked.connect(self.do_switch) self.widget.slider.valueChanged.connect(self.do_set_level) # SizePolicies -------------------------------------------------------- self.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.MinimumExpanding) # Defaults self.set_icons("BulbCheck,BulbDelete") # Other --------------------------------------------------------------- self.setToolTip("Control of light (set level and on/off switch.") self.update()
def __init__(self, parent, brick): qt_import.QGroupBox.__init__(self, "State", parent) BaseWidget.__init__(self, parent) # Graphic elements ---------------------------------------------------- # self.contents_widget = QGroupBox("Sample Changer State", self) self._parent = brick self.status_label = qt_import.QLabel("") self.status_label.setAlignment(qt_import.Qt.AlignCenter) # Layout -------------------------------------------------------------- _layout = qt_import.QHBoxLayout(self) _layout.addWidget(self.status_label) _layout.setSpacing(2) _layout.setContentsMargins(6, 6, 6, 10)
def build_operations_widget(self): self.buttons_layout = qt_import.QHBoxLayout() self.operation_buttons_layout = qt_import.QVBoxLayout() self.load_button = qt_import.QPushButton("Load", self) self.unload_button = qt_import.QPushButton("Unload", self) self.abort_button = qt_import.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 = qt_import.QWidget(self) self.info_address_ledit = qt_import.QLineEdit(self.info_widget) self.info_refresh_button = qt_import.QPushButton( "Refresh", self.info_widget) self.method_table = qt_import.QTableWidget(self) self.property_table = qt_import.QTableWidget(self) # Layout -------------------------------------------------------------- _info_widget_hlayout = qt_import.QHBoxLayout(self.info_widget) _info_widget_hlayout.addWidget(self.info_address_ledit) _info_widget_hlayout.addWidget(self.info_refresh_button) _main_vlayout = qt_import.QVBoxLayout(self) _main_vlayout.addWidget(self.info_widget) _main_vlayout.addWidget(self.method_table) _main_vlayout.addWidget(self.property_table) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- self.method_table.setColumnCount(2) self.method_table.setHorizontalHeaderLabels( ["Type", "Method (Parameters)"]) self.property_table.setColumnCount(4) self.property_table.setHorizontalHeaderLabels( ["Type", "Property", "Access", "Value"]) self.setFixedWidth(600)
def __init__(self, parent=None, name=None, flags=0): qt_import.QWidget.__init__(self, parent, qt_import.Qt.WindowFlags(flags)) if not name: self.setObjectName("SADWidgetLayout") # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Graphic elements ---------------------------------------------------- self.optimised_sad_cbx = qt_import.QCheckBox("Optimised SAD", self) self.automatic_resolution_radio = qt_import.QRadioButton(self) _optimal_sad_widget = qt_import.QWidget(self) self.optimal_sad_radio = qt_import.QRadioButton( "Optimal SAD for given resolution:", _optimal_sad_widget) self.sad_bgroup = qt_import.QButtonGroup(self) self.sad_bgroup.addButton(self.automatic_resolution_radio) self.sad_bgroup.addButton(self.optimal_sad_radio) self.sad_resolution_ledit = qt_import.QLineEdit(_optimal_sad_widget) self.sad_resolution_ledit.setMinimumSize(50, 0) self.sad_resolution_ledit.setMaximumSize(50, 32767) # Layout -------------------------------------------------------------- _optimal_sad_widget_hlayout = qt_import.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 = qt_import.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=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 = qt_import.QSlider() self.slider.setEnabled(False) self.slider.setTickInterval(10) self.slider.setTickPosition(qt_import.QSlider.TicksBothSides) self.slider.setOrientation(qt_import.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 = qt_import.QLabel(min_value_text) self.max_label = qt_import.QLabel(max_value_text) self.current_label = qt_import.QLabel(current_value_text) # layouts self.main_v_layout = qt_import.QVBoxLayout() self.labels_h_layout = qt_import.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, row, col, filename, file_filter): qt_import.QWidget.__init__(self) self.file_filter = file_filter self.parent = parent self.col = col self.row = row self.cmdBrowse = qt_import.QPushButton("Browse", self.parent.viewport()) main_layout = qt_import.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, row, col, color): qt_import.QWidget.__init__(self, parent) self.col = col self.row = row self.parent = parent self.change_color_button = qt_import.QPushButton("Color...", parent) self.reset_color_button = qt_import.QPushButton("reset", parent) main_layout = qt_import.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): qt_import.QDialog.__init__(self, *args) layout = qt_import.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.widget = qt_import.load_ui_file("catscommand_dialog.ui") layout.addWidget(self.widget) self.btSend = self.widget.buttonBox.addButton( "Send", qt_import.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, parent, options): qt_import.QWidget.__init__(self, parent) # do not allow qt to stretch us vertically policy = self.sizePolicy() policy.setVerticalPolicy(qt_import.QSizePolicy.Fixed) self.setSizePolicy(policy) qt_import.QHBoxLayout(self) self.__name = options["variableName"] self.filepath = qt_import.QLineEdit(self) self.filepath.setAlignment(qt_import.Qt.AlignLeft) if "defaultValue" in options: self.filepath.setText(options["defaultValue"]) self.open_dialog_btn = qt_import.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): qt_import.QWidget.__init__(self, parent) self.home_url = None self.navigation_bar = qt_import.QWidget(self) self.url_ledit = qt_import.QLineEdit(self.navigation_bar) self.url_ledit.setReadOnly(True) self.home_button = qt_import.QPushButton(self.navigation_bar) self.back_button = qt_import.QPushButton(self.navigation_bar) self.forward_button = qt_import.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 = qt_import.QWebView(self) # self.web_page_viewer.settings().setObjectCacheCapacities(0, 0, 0) #else: self.web_page_viewer = qt_import.QTextBrowser(self) _navigation_bar_hlayout = qt_import.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 = qt_import.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(qt_import.QSizePolicy.Expanding, qt_import.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=None): qt_import.QWidget.__init__(self, parent) self.ok_button = qt_import.QToolButton(parent) self.ok_button.setAutoRaise(True) self.ok_button.setIcon(icons.load_icon("button_ok_small")) self.cancel_button = qt_import.QToolButton(parent) self.cancel_button.setAutoRaise(True) self.cancel_button.setIcon(icons.load_icon("button_cancel_small")) self.reset_button = qt_import.QToolButton(parent) self.reset_button.setIcon(icons.load_icon("button_default_small")) self.reset_button.setAutoRaise(True) self.setEnabled(False) _main_layout = qt_import.QHBoxLayout(self) _main_layout.addWidget(self.ok_button) _main_layout.addWidget(self.cancel_button) _main_layout.addWidget(self.reset_button) _main_layout.setSpacing(0) _main_layout.setContentsMargins(0, 0, 0, 0)
def __init__(self, parent, options): qt_import.QWidget.__init__(self, parent) logging.debug("making message with options %r", options) qt_import.QHBoxLayout(self) icon = qt_import.QLabel(self) icon.setSizePolicy(qt_import.QSizePolicy.Fixed, qt_import.QSizePolicy.Fixed) # all the following stuff is there to get the standard icon # for our level directly from qt mapping = { "warning": qt_import.QMessageBox.Warning, "info": qt_import.QMessageBox.Information, "error": qt_import.QMessageBox.Critical, } level = mapping.get(options["level"]) if level is not None: icon.setPixmap(qt_import.QMessageBox.standardIcon(level)) text = qt_import.QLabel(options["text"], self) self.layout().addWidget(icon) self.layout().addWidget(text)