def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.use_dialog = False # Properties ---------------------------------------------------------- self.add_property("mnemonicList", "string", "") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.progress_type_label = QtImport.QLabel("", self) self.progress_bar = QtImport.QProgressBar(self) # $self.progress_bar.setCenterIndicator(True) self.progress_bar.setMinimum(0) main_layout = QtImport.QVBoxLayout(self) main_layout.addWidget(self.progress_type_label) main_layout.addWidget(self.progress_bar) main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(2) self.setEnabled(False) new_palette = QtImport.QPalette() new_palette.setColor(QtImport.QPalette.Highlight, Colors.DARK_GREEN) self.progress_bar.setPalette(new_palette)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.light_ho is not None: self.disconnect( self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed ) self.disconnect( self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed ) self.light_ho = self.get_hardware_object(new_value) if self.light_ho is not None: self.setEnabled(True) self.connect( self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed ) self.connect( self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed ) self.light_ho.update_values() self.setToolTip( "Control of %s (light level and on/off switch." % self.light_ho.getUserName() ) self.set_level_limits(self.light_ho.getLimits()) self.set_label(self.light_ho.getUserName()) else: self.setEnabled(False) elif property_name == "icons": self.set_icons(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): """Main init""" BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.graphics_initialized = None self.value_label_list = [] # Properties (name, type, default value, comment)---------------------- self.add_property( "maxPlotPoints", "integer", 100, comment="Maximal number of plot points" ) # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- # Layout -------------------------------------------------------------- self.main_vlayout = QtImport.QVBoxLayout(self) self.main_vlayout.setSpacing(1) self.main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- self.setToolTip("Main information about the beamline")
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.target_menu = None self.image_scale_list = [] # Properties ---------------------------------------------------------- self.add_property( "targetMenu", "combo", ("menuBar", "toolBar", "both"), "menuBar" ) self.add_property("beamDefiner", "boolean", False) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.tools_menu = None self.measure_distance_action = None self.measure_angle_action = None self.measure_area_action = None self.define_beam_action = None self.move_beam_mark_manual_action = None self.move_beam_mark_auto_action = None self.display_beam_size_action = None self.display_grid_action = None self.magnification_action = None self.image_scale_menu = None
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.actuator_hwo is not None: self.disconnect( self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed ) self.actuator_hwo = self.get_hardware_object(new_value) if self.actuator_hwo is not None: self.setEnabled(True) self.connect( self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed ) self.actuator_hwo.update_values() logging.getLogger("HWR").info( "User Name is: %s" % self.actuator_hwo.getUserName() ) self.widget.actuatorBox.setTitle(self.actuator_hwo.getUserName()) else: self.setEnabled(False) elif property_name == "in_cmd_name": self.widget.cmdInButton.setText(new_value) elif property_name == "out_cmd_name": self.widget.cmdOutButton.setText(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.crl_hwobj: self.disconnect(self.crl_hwobj, "crlModeChanged", self.crl_mode_changed) self.disconnect( self.crl_hwobj, "crlValueChanged", self.crl_value_changed ) self.crl_hwobj = self.get_hardware_object(new_value) if self.crl_hwobj: crl_modes = self.crl_hwobj.get_modes() for crl_mode in crl_modes: self.mode_combo.addItem(crl_mode) self.connect(self.crl_hwobj, "crlModeChanged", self.crl_mode_changed) self.connect(self.crl_hwobj, "crlValueChanged", self.crl_value_changed) self.crl_hwobj.update_values() elif property_name == "lenseCount": self.crl_value_table.setColumnCount(new_value) for col_index in range(new_value): temp_item = QtImport.QTableWidgetItem("") temp_item.setFlags(QtImport.Qt.ItemIsEnabled) temp_item.setBackground(Colors.LIGHT_GRAY) self.crl_value_table.setItem(0, col_index, temp_item) self.crl_value_table.setColumnWidth(col_index, 20) self.crl_value.append(0) self.crl_value_table.setFixedWidth(20 * new_value + 6) elif property_name == "caption": if new_value: self.main_gbox.setTitle(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): """Defines behaviour of the brick""" if property_name == "mnemonic": self.tools_hwobj = self.get_hardware_object(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.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 property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.light_ho is not None: self.disconnect(self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed) self.disconnect(self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed) self.light_ho = self.get_hardware_object(new_value) if self.light_ho is not None: self.setEnabled(True) self.connect(self.light_ho, QtImport.SIGNAL("levelChanged"), self.level_changed) self.connect(self.light_ho, QtImport.SIGNAL("stateChanged"), self.state_changed) self.light_ho.update_values() self.setToolTip( "Control of %s (light level and on/off switch." % self.light_ho.getUserName()) self.set_level_limits(self.light_ho.getLimits()) self.set_label(self.light_ho.getUserName()) else: self.setEnabled(False) elif property_name == "icons": self.set_icons(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.target_menu = None self.image_scale_list = [] # Properties ---------------------------------------------------------- self.add_property("targetMenu", "combo", ("menuBar", "toolBar", "both"), "menuBar") self.add_property("beamDefiner", "boolean", False) # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.tools_menu = None self.measure_distance_action = None self.measure_angle_action = None self.measure_area_action = None self.define_beam_action = None self.move_beam_mark_manual_action = None self.move_beam_mark_auto_action = None self.display_beam_size_action = None self.display_grid_action = None self.magnification_action = None self.image_scale_menu = None
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.actuator_hwo is not None: self.disconnect( self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed, ) self.actuator_hwo = self.get_hardware_object(new_value) if self.actuator_hwo is not None: self.setEnabled(True) self.connect( self.actuator_hwo, QtImport.SIGNAL("stateChanged"), self.state_changed, ) self.actuator_hwo.re_emit_values() logging.getLogger("HWR").info( "User Name is: %s" % self.actuator_hwo.getUserName() ) self.widget.actuatorBox.setTitle(self.actuator_hwo.getUserName()) else: self.setEnabled(False) elif property_name == "in_cmd_name": self.widget.cmdInButton.setText(new_value) elif property_name == "out_cmd_name": self.widget.cmdOutButton.setText(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.image_tracking_hwobj is not None: self.disconnect( self.image_tracking_hwobj, "imageTrackingStateChanged", self.image_tracking_state_changed, ) self.disconnect(self.image_tracking_hwobj, "stateChanged", self.state_changed) self.image_tracking_hwobj = self.get_hardware_object(new_value) if self.image_tracking_hwobj is not None: self.image_tracking_cbox.blockSignals(True) self.image_tracking_cbox.setChecked( self.image_tracking_hwobj.is_tracking_enabled() == True) self.image_tracking_cbox.blockSignals(False) self.connect( self.image_tracking_hwobj, "imageTrackingStateChanged", self.image_tracking_state_changed, ) self.connect(self.image_tracking_hwobj, "stateChanged", self.state_changed) self.image_tracking_hwobj.re_emit_values() self.setEnabled(True) else: self.setEnabled(False) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.image_tracking_hwobj is not None: self.disconnect( self.image_tracking_hwobj, "imageTrackingStateChanged", self.image_tracking_state_changed, ) self.disconnect( self.image_tracking_hwobj, "stateChanged", self.state_changed ) self.image_tracking_hwobj = self.get_hardware_object(new_value) if self.image_tracking_hwobj is not None: self.image_tracking_cbox.blockSignals(True) self.image_tracking_cbox.setChecked( self.image_tracking_hwobj.is_tracking_enabled() == True ) self.image_tracking_cbox.blockSignals(False) self.connect( self.image_tracking_hwobj, "imageTrackingStateChanged", self.image_tracking_state_changed, ) self.connect( self.image_tracking_hwobj, "stateChanged", self.state_changed ) self.image_tracking_hwobj.update_values() self.setEnabled(True) else: self.setEnabled(False) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.beamstop_hwobj is not None: self.disconnect(self.beamstop_hwobj, "deviceReady", self.connected) self.disconnect( self.beamstop_hwobj, "deviceNotReady", self.disconnected ) self.disconnect( self.beamstop_hwobj, "beamstopDistanceChanged", self.beamstop_distance_changed, ) self.beamstop_hwobj = self.get_hardware_object(new_value) if self.beamstop_hwobj is not None: self.connect(self.beamstop_hwobj, "deviceReady", self.connected) self.connect(self.beamstop_hwobj, "deviceNotReady", self.disconnected) self.connect( self.beamstop_hwobj, "beamstopDistanceChanged", self.beamstop_distance_changed, ) if self.beamstop_hwobj.isReady(): self.connected() self.beamstop_hwobj.update_values() else: self.disconnected() else: self.disconnected() else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "codes": self.set_codes(new_value) elif property_name == "localLogin": self.local_login_hwobj = self.get_hardware_object(new_value, optional=True) elif property_name == "instanceServer": if self.instance_server_hwobj is not None: self.disconnect(self.instance_server_hwobj, "passControl", self.pass_control) self.disconnect(self.instance_server_hwobj, "haveControl", self.have_control) self.instance_server_hwobj = self.get_hardware_object( new_value, optional=True) if self.instance_server_hwobj is not None: self.connect(self.instance_server_hwobj, "passControl", self.pass_control) self.connect(self.instance_server_hwobj, "haveControl", self.have_control) elif property_name == "icons": icons_list = new_value.split() try: self.login_button.setIcon(Icons.load_icon(icons_list[0])) except IndexError: pass try: self.logout_button.setIcon(Icons.load_icon(icons_list[1])) except IndexError: pass elif property_name == "secondaryProposals": self.secondary_proposals = new_value.split() else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): """Main init""" BaseWidget.__init__(self, *args) # Internal values ----------------------------------------------------- self.graphics_initialized = None self.value_label_list = [] # Properties (name, type, default value, comment)---------------------- self.add_property("maxPlotPoints", "integer", 100, comment="Maximal number of plot points") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- # Layout -------------------------------------------------------------- self.main_vlayout = QtImport.QVBoxLayout(self) self.main_vlayout.setSpacing(1) self.main_vlayout.setContentsMargins(2, 2, 2, 2) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- self.setToolTip("Main information about the beamline")
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # 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)
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 property_changed(self, property_name, old_value, new_value): """Property changed in GUI designer and when launching app.""" if property_name == "mnemonic": self.set_turret_object(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
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 property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.beamstop_hwobj is not None: self.disconnect(self.beamstop_hwobj, "deviceReady", self.connected) self.disconnect(self.beamstop_hwobj, "deviceNotReady", self.disconnected) self.disconnect( self.beamstop_hwobj, "beamstopDistanceChanged", self.beamstop_distance_changed, ) self.beamstop_hwobj = self.get_hardware_object(new_value) if self.beamstop_hwobj is not None: self.connect(self.beamstop_hwobj, "deviceReady", self.connected) self.connect(self.beamstop_hwobj, "deviceNotReady", self.disconnected) self.connect( self.beamstop_hwobj, "beamstopDistanceChanged", self.beamstop_distance_changed, ) if self.beamstop_hwobj.isReady(): self.connected() self.beamstop_hwobj.update_values() else: self.disconnected() else: self.disconnected() else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _main_groupbox = QtImport.QGroupBox("Detector status", self) self.status_label = QtImport.QLabel("<b>unknown status</b>", _main_groupbox) self.frame_rate_label = QtImport.QLabel(" Frame rate : ", _main_groupbox) self.temperature_label = QtImport.QLabel(" Temperature:", _main_groupbox) self.humidity_label = QtImport.QLabel(" Humidity: ", _main_groupbox) # Layout -------------------------------------------------------------- _main_groupbox_vlayout = QtImport.QVBoxLayout(_main_groupbox) _main_groupbox_vlayout.addWidget(self.status_label) _main_groupbox_vlayout.addWidget(self.frame_rate_label) _main_groupbox_vlayout.addWidget(self.temperature_label) _main_groupbox_vlayout.addWidget(self.humidity_label) _main_groupbox_vlayout.setSpacing(2) _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4) main_layout = QtImport.QVBoxLayout(self) main_layout.addWidget(_main_groupbox) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) # SizePolicies ------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ # Other --------------------------------------------------------------- Colors.set_widget_color( self.status_label, DetectorStatusBrick.DETECTOR_STATES["uninitialized"] ) Colors.set_widget_color( self.temperature_label, DetectorStatusBrick.STATES["unknown"] ) Colors.set_widget_color( self.humidity_label, DetectorStatusBrick.STATES["unknown"] ) Colors.set_widget_color(self.frame_rate_label, DetectorStatusBrick.STATES["OK"]) self.status_label.setMinimumHeight(20) self.status_label.setAlignment(QtImport.Qt.AlignCenter) self.temperature_label.setMinimumHeight(20) self.humidity_label.setMinimumHeight(20) self.frame_rate_label.setMinimumHeight(20) self.connect(api.detector, "temperatureChanged", self.temperature_changed) self.connect(api.detector, "humidityChanged", self.humidity_changed) self.connect(api.detector, "statusChanged", self.status_changed) self.connect(api.detector, "frameRateChanged", self.frame_rate_changed)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("formatString", "formatString", "###.##") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Transmission", self) current_label = QtImport.QLabel("Current:", self.group_box) current_label.setFixedWidth(75) self.transmission_ledit = QtImport.QLineEdit(self.group_box) self.transmission_ledit.setReadOnly(True) set_to_label = QtImport.QLabel("Set to:", self.group_box) self.new_value_ledit = QtImport.QLineEdit(self.group_box) # Layout -------------------------------------------------------------- _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(current_label, 0, 0) _group_box_gridlayout.addWidget(self.transmission_ledit, 0, 1) _group_box_gridlayout.addWidget(set_to_label, 1, 0) _group_box_gridlayout.addWidget(self.new_value_ledit, 1, 1) _group_box_gridlayout.setSpacing(0) _group_box_gridlayout.setContentsMargins(1, 1, 1, 1) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 2, 2) _main_vlayout.addWidget(self.group_box) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- self._update_ledit_color(Colors.LIGHT_GREEN) self.validator = QtImport.QDoubleValidator(0, 100, 2, self.new_value_ledit) self.new_value_ledit.setToolTip("Transmission limits 0 : 100 %") self.instance_synchronize("transmission_ledit", "new_value_ledit") if HWR.beamline.transmission is not None: # Qt signal/slot connections ------------------------------------------ self.new_value_ledit.returnPressed.connect( self.current_value_changed) self.new_value_ledit.textChanged.connect(self.input_field_changed) self.connect(HWR.beamline.transmission, "stateChanged", self._state_changed) self.connect(HWR.beamline.transmission, "valueChanged", self._value_changed) self.connected() else: self.disconnected()
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": self.exporter_client_hwobj = self.get_hardware_object(new_value) if self.exporter_client_hwobj is not None: self.init_tables() else: BaseWidget.property_changed(self, property_name, old_value, new_value)
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 property_changed(self, property_name, old_value, new_value): if property_name == "level": self.filter_level = logging.NOTSET if new_value == "INFO": self.filter_level = logging.INFO elif new_value == "WARNING": self.filter_level = logging.WARNING elif new_value == "ERROR": self.filter_level = logging.ERROR elif property_name == "showDebug": if self["appearance"] == "tabs": if not new_value: self.tab_widget.removeTab(self.tab_widget.indexOf(self.debug_log)) elif property_name == "emailAddresses": self.feedback_log.email_addresses = new_value elif property_name == "fromEmailAddress": self.feedback_log.from_email_address = new_value elif property_name == "enableFeedback": if self["appearance"] == "tabs": if not new_value: self.tab_widget.removeTab( self.tab_widget.indexOf(self.feedback_log) ) elif property_name == "appearance": if new_value == "list": self.tab_levels = { logging.NOTSET: self.info_log, logging.DEBUG: self.info_log, logging.INFO: self.info_log, logging.WARNING: self.info_log, logging.ERROR: self.info_log, logging.CRITICAL: self.info_log, } self.tab_widget.removeTab(self.tab_widget.indexOf(self.details_log)) self.tab_widget.removeTab(self.tab_widget.indexOf(self.debug_log)) elif new_value == "tabs": self.tab_levels = { logging.NOTSET: self.details_log, logging.DEBUG: self.debug_log, logging.INFO: self.info_log, logging.WARNING: self.details_log, logging.ERROR: self.details_log, logging.CRITICAL: self.details_log, } elif property_name == "maxLogLines": self.details_log.set_max_log_lines(new_value) self.info_log.set_max_log_lines(new_value) self.debug_log.set_max_log_lines(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "targetMenu": self.target_menu = new_value # elif property_name == 'cameraControls': # self.camera_control_action.setEnabled(new_value) # elif property_name == 'beamDefiner': # self.define_beam_action.setEnabled(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
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): 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, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- self.num_cols = None self.num_rows = None self.num_drops = None self.current_location = None self.plate_content = None self.xtal_map = None # Properties ---------------------------------------------------------- self.add_property("icons", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.plate_navigator_widget = PlateNavigatorWidget(self) self.crims_widget = QtImport.load_ui_file( "plate_crims_widget_layout.ui") # Layout -------------------------------------------------------------- _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.plate_navigator_widget) _main_vlayout.addWidget(self.crims_widget) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # Qt signal/slot connections ------------------------------------------ self.crims_widget.search_button.clicked.connect( self.search_button_clicked) self.crims_widget.move_button.clicked.connect( self.move_to_xtal_clicked) self.crims_widget.abort_button.clicked.connect(self.abort_clicked) self.crims_widget.xtal_treewidget.currentItemChanged.connect( self.xtal_treewidget_current_item_changed) # Other --------------------------------------------------------------- self.xtal_image_graphicsscene = QtImport.QGraphicsScene(self) self.crims_widget.xtal_image_graphicsview.setScene( self.xtal_image_graphicsscene) self.xtal_image_pixmap = QtImport.QPixmap() self.xtal_image_graphics_pixmap = QtImport.QGraphicsPixmapItem() self.xtal_image_graphicsscene.addItem(self.xtal_image_graphics_pixmap) if HWR.beamline.plate_manipulator is not None: self.connect( HWR.beamline.plate_manipulator, SampleChanger.INFO_CHANGED_EVENT, self.plate_navigator_widget.refresh_plate_location, )
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beam_info_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("formatString", "formatString", "#.#") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("Beam size", self) hor_label = QtImport.QLabel("Horizontal:", self.main_gbox) self.hor_size_ledit = QtImport.QLineEdit(self.main_gbox) self.hor_size_ledit.setMaximumWidth(120) self.hor_size_ledit.setEnabled(False) self.hor_size_ledit.setAlignment(QtImport.Qt.AlignRight) ver_label = QtImport.QLabel("Vertical:", self.main_gbox) self.ver_size_ledit = QtImport.QLineEdit(self.main_gbox) self.ver_size_ledit.setMaximumWidth(120) self.ver_size_ledit.setEnabled(False) self.ver_size_ledit.setAlignment(QtImport.Qt.AlignRight) bold_font = self.hor_size_ledit.font() bold_font.setBold(True) self.hor_size_ledit.setFont(bold_font) self.ver_size_ledit.setFont(bold_font) # Layout -------------------------------------------------------------- _main_gbox_gridlayout = QtImport.QGridLayout(self.main_gbox) _main_gbox_gridlayout.addWidget(hor_label, 0, 0) _main_gbox_gridlayout.addWidget(self.hor_size_ledit, 0, 1) _main_gbox_gridlayout.addWidget(ver_label, 1, 0) _main_gbox_gridlayout.addWidget(self.ver_size_ledit, 1, 1) _main_gbox_gridlayout.setRowStretch(2, 10) _main_gbox_gridlayout.setSpacing(2) _main_gbox_gridlayout.setContentsMargins(0, 0, 0, 0) _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 ------------------------------------------ # Other --------------------------------------------------------------- self.connect(api.beam_info, "beamInfoChanged", self.beam_info_changed)
def __init__(self, *args): BaseWidget.__init__(self, *args) self.dc_group_widget = DCGroupWidget(self) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.dc_group_widget) # Qt-Slots self.define_slot("populate_dc_group_widget", ({}))
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): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_gbox = QtImport.QGroupBox("Aperture", self) self.aperture_diameter_combo = QtImport.QComboBox(self.main_gbox) self.aperture_diameter_combo.setMinimumWidth(100) self.aperture_position_combo = QtImport.QComboBox(self.main_gbox) self.aperture_position_combo.setMinimumWidth(100) # Layout -------------------------------------------------------------- _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_gbox) _main_gbox_vlayout.addWidget(self.aperture_diameter_combo) _main_gbox_vlayout.addWidget(self.aperture_position_combo) _main_gbox_vlayout.addStretch() _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_gbox) _main_vlayout.setSpacing(0) # _main_vlayout.addSpacing(0) _main_vlayout.setContentsMargins(2, 2, 2, 2) # Qt signal/slot connections ------------------------------------------ self.aperture_diameter_combo.activated.connect(self.change_diameter) self.aperture_position_combo.activated.connect(self.change_position) # SizePolicies -------------------------------------------------------- # Other --------------------------------------------------------------- Colors.set_widget_color(self.aperture_diameter_combo, Colors.LIGHT_GREEN, QtImport.QPalette.Button) Colors.set_widget_color(self.aperture_position_combo, Colors.LIGHT_GREEN, QtImport.QPalette.Button) self.aperture_diameter_combo.setMinimumWidth(100) self.aperture_position_combo.setMinimumWidth(100) self.init_aperture() self.connect(HWR.beamline.beam.aperture, "diameterIndexChanged", self.diameter_changed) self.connect(HWR.beamline.beam.aperture, "valueChanged", self.position_changed)
def __init__(self, *args): BaseWidget.__init__(self, *args) self.define_slot("populate_xrf_widget", ({})) self.xrf_spectrum_widget = XRFSpectrumParametersWidget(self) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.xrf_spectrum_widget) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("formatString", "formatString", "###.##") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.group_box = QtImport.QGroupBox("Transmission", self) current_label = QtImport.QLabel("Current:", self.group_box) current_label.setFixedWidth(75) self.transmission_ledit = QtImport.QLineEdit(self.group_box) self.transmission_ledit.setReadOnly(True) set_to_label = QtImport.QLabel("Set to:", self.group_box) self.new_value_ledit = QtImport.QLineEdit(self.group_box) # Layout -------------------------------------------------------------- _group_box_gridlayout = QtImport.QGridLayout(self.group_box) _group_box_gridlayout.addWidget(current_label, 0, 0) _group_box_gridlayout.addWidget(self.transmission_ledit, 0, 1) _group_box_gridlayout.addWidget(set_to_label, 1, 0) _group_box_gridlayout.addWidget(self.new_value_ledit, 1, 1) _group_box_gridlayout.setSpacing(0) _group_box_gridlayout.setContentsMargins(1, 1, 1, 1) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 2, 2) _main_vlayout.addWidget(self.group_box) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.new_value_ledit.returnPressed.connect(self.current_value_changed) self.new_value_ledit.textChanged.connect(self.input_field_changed) # Other --------------------------------------------------------------- Colors.set_widget_color( self.new_value_ledit, Colors.LINE_EDIT_ACTIVE, QtImport.QPalette.Base ) self.new_value_validator = QtImport.QDoubleValidator( 0, 100, 2, self.new_value_ledit ) self.new_value_ledit.setToolTip("Transmission limits 0 : 100 %") self.instance_synchronize("transmission_ledit", "new_value_ledit")
def finalize(self): """Finalize gui load""" BaseWidget.set_run_mode(False) # call .stop() for each brick self.hardware_repository.close() QtImport.QApplication.sendPostedEvents() QtImport.QApplication.processEvents() self.save_size()
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, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.tools_hwobj = None self.action_dict = {} # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "")
def __init__(self, *args): BaseWidget.__init__(self, *args) # Layout self.energy_scan_widget = EnergyScanParametersWidget(self) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.energy_scan_widget) # Qt-Slots self.define_slot("populate_parameter_widget", ({}))
def property_changed(self, property_name, old_value, new_value): if property_name == "showStop": if new_value: self.stop_button.show() else: self.stop_button.hide() elif property_name == "defaultStep": if new_value != "": self.set_line_step(float(new_value)) self.step_changed(None) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonic": if self.graphics_manager_hwobj is not None: self.disconnect( self.graphics_manager_hwobj, "mouseMoved", self.mouse_moved ) self.disconnect( self.graphics_manager_hwobj, "imageScaleChanged", self.image_scaled ) self.disconnect( self.graphics_manager_hwobj, "infoMsg", self.set_info_msg ) self.graphics_manager_hwobj = self.get_hardware_object(new_value) if self.graphics_manager_hwobj is not None: self.connect( self.graphics_manager_hwobj, "mouseMoved", self.mouse_moved ) self.connect( self.graphics_manager_hwobj, "imageScaleChanged", self.image_scaled ) self.connect(self.graphics_manager_hwobj, "infoMsg", self.set_info_msg) self.graphics_view = self.graphics_manager_hwobj.get_graphics_view() # self.graphics_camera_frame = self.graphics_manager_hwobj.get_camera_frame() self.main_layout.addWidget(self.graphics_view) self.main_layout.addWidget(self.info_widget) self.set_fixed_size() self.init_image_scale_list() if hasattr(self.graphics_manager_hwobj, "camera_hwobj"): self.camera_control_dialog.set_camera_hwobj( self.graphics_manager_hwobj.camera_hwobj ) elif property_name == "fixedSize": try: fixed_size = list(map(int, new_value.split())) if len(fixed_size) == 2: self.fixed_size = fixed_size self.set_fixed_size() except BaseException: pass elif property_name == "displayBeam": self.display_beam = new_value elif property_name == "displayScale": self.display_scale = new_value if self.graphics_manager_hwobj is not None: self.graphics_manager_hwobj.set_scale_visible(new_value) elif property_name == "beamDefiner": self.define_beam_action.setEnabled(new_value) elif property_name == "cameraControls": self.camera_control_action.setEnabled(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "hwobj_flux": if self.flux_hwobj is not None: self.disconnect(self.flux_hwobj, "fluxChanged", self.flux_changed) self.flux_hwobj = self.get_hardware_object(new_value) if self.flux_hwobj is not None: self.connect(self.flux_hwobj, "fluxChanged", self.flux_changed) self.flux_changed(self.flux_hwobj.get_flux_info()) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.image_tracking_hwobj = None # Internal values ----------------------------------------------------- # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "/image-tracking") # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- _main_groupbox = QtImport.QGroupBox("Image tracking", self) self.state_label = QtImport.QLabel("<b> </b>", _main_groupbox) self.image_tracking_cbox = QtImport.QCheckBox( "Enable Adxv image tracking", _main_groupbox ) self.filter_frames_cbox = QtImport.QCheckBox( "Filter frames based on Dozor score", _main_groupbox ) self.spot_list_cbox = QtImport.QCheckBox( "Indicate spots in ADxV", _main_groupbox ) # Layout -------------------------------------------------------------- _main_groupbox_vlayout = QtImport.QVBoxLayout(_main_groupbox) _main_groupbox_vlayout.addWidget(self.state_label) _main_groupbox_vlayout.addWidget(self.image_tracking_cbox) _main_groupbox_vlayout.addWidget(self.filter_frames_cbox) _main_groupbox_vlayout.addWidget(self.spot_list_cbox) _main_groupbox_vlayout.setSpacing(2) _main_groupbox_vlayout.setContentsMargins(4, 4, 4, 4) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(_main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.image_tracking_cbox.toggled.connect(self.image_tracking_cbox_toggled) self.filter_frames_cbox.toggled.connect(self.filter_frames_cbox_toggled) self.spot_list_cbox.toggled.connect(self.spot_list_cbox_toggled) # Other --------------------------------------------------------------- self.state_label.setAlignment(QtImport.Qt.AlignCenter) self.state_label.setFixedHeight(24) self.state_changed("unknown")
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, *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 property_changed(self, property_name, old_value, new_value): if property_name == "enableAutoFocus": self.auto_focus_button.setVisible(new_value) elif property_name == "enableRefreshCamera": self.refresh_camera_button.setVisible(new_value) elif property_name == "enableVisualAlign": self.visual_align_button.setVisible(new_value) elif property_name == "enableAutoCenter": self.auto_center_button.setVisible(new_value) elif property_name == "enableRealignBeam": self.realign_button.setVisible(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def __init__(self, *args): BaseWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.plate_manipulator_hwobj = None # Internal values ----------------------------------------------------- self.num_cols = None self.num_rows = None self.num_drops = None self.current_location = None self.plate_content = None self.xtal_map = None # Properties ---------------------------------------------------------- self.add_property("mnemonic", "string", "") self.add_property("icons", "string", "") # Signals ------------------------------------------------------------- # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.plate_navigator_widget = PlateNavigatorWidget(self) self.crims_widget = QtImport.load_ui_file("plate_crims_widget_layout.ui") # Layout -------------------------------------------------------------- _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.plate_navigator_widget) _main_vlayout.addWidget(self.crims_widget) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # Qt signal/slot connections ------------------------------------------ self.crims_widget.search_button.clicked.connect(self.search_button_clicked) self.crims_widget.move_button.clicked.connect(self.move_to_xtal_clicked) self.crims_widget.abort_button.clicked.connect(self.abort_clicked) self.crims_widget.xtal_treewidget.currentItemChanged.connect( self.xtal_treewidget_current_item_changed ) # Other --------------------------------------------------------------- self.xtal_image_graphicsscene = QtImport.QGraphicsScene(self) self.crims_widget.xtal_image_graphicsview.setScene( self.xtal_image_graphicsscene ) self.xtal_image_pixmap = QtImport.QPixmap() self.xtal_image_graphics_pixmap = QtImport.QGraphicsPixmapItem() self.xtal_image_graphicsscene.addItem(self.xtal_image_graphics_pixmap)
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, *args): BaseWidget.__init__(self, *args) # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- # Internal values ----------------------------------------------------- # Graphic elements ---------------------------------------------------- self.main_groupbox = QtImport.QGroupBox("Door interlock", self) self.main_groupbox.setAlignment(QtImport.Qt.AlignCenter) self.state_label = QtImport.QLabel("<b>unknown</b>", self.main_groupbox) Colors.set_widget_color(self.state_label, self.STATES["unknown"]) self.state_label.setAlignment(QtImport.Qt.AlignCenter) self.state_label.setFixedHeight(24) self.unlock_door_button = QtImport.QPushButton( Icons.load_icon("EnterHutch"), "Unlock", self.main_groupbox ) # Layout -------------------------------------------------------------- _main_gbox_vlayout = QtImport.QVBoxLayout(self.main_groupbox) _main_gbox_vlayout.addWidget(self.state_label) _main_gbox_vlayout.addWidget(self.unlock_door_button) _main_gbox_vlayout.setSpacing(2) _main_gbox_vlayout.setContentsMargins(4, 4, 4, 4) _main_vlayout = QtImport.QVBoxLayout(self) _main_vlayout.addWidget(self.main_groupbox) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.unlock_door_button.clicked.connect(self.unlock_doors) # Other --------------------------------------------------------------- self.state_label.setToolTip("Shows the current door state") self.unlock_door_button.setToolTip("Unlocks the doors") self.connect( api.door_interlock, "doorInterlockStateChanged", self.state_changed ) api.door_interlock.update_values()