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, qt_import.SIGNAL("levelChanged"), self.level_changed) self.disconnect(self.light_ho, qt_import.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, qt_import.SIGNAL("levelChanged"), self.level_changed) self.connect(self.light_ho, qt_import.SIGNAL("stateChanged"), self.state_changed) self.light_ho.re_emit_values() self.setToolTip( "Control of %s (light level and on/off switch." % self.light_ho.getUserName()) self.set_level_limits(self.light_ho.get_limits()) 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 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 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.force_emit_signals() 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): """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 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, "valueChanged", 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, "valueChanged", self.beamstop_distance_changed, ) 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 == "label": if new_value == "" and self.motor_hwobj is not None: self.label.setText("<i>" + self.motor_hwobj.username + ":</i>") else: self.label.setText(new_value) elif property_name == "mnemonic": if self.motor_hwobj is not None: self.disconnect(self.motor_hwobj, "stateChanged", self.motor_state_changed) self.disconnect( self.motor_hwobj, "valueChanged", self.predefined_position_changed, ) self.motor_hwobj = self.get_hardware_object(new_value) if self.motor_hwobj is not None: self.fill_positions() self.connect(self.motor_hwobj, "stateChanged", self.motor_state_changed) self.connect( self.motor_hwobj, "valueChanged", self.predefined_position_changed, ) #if self.motor_hwobj.is_ready(): # self.predefined_position_changed( # self.motor_hwobj.get_value() # ) if self["label"] == "": lbl = self.motor_hwobj.user_name self.label.setText("<i>" + lbl + ":</i>") colors.set_widget_color( self.positions_combo, colors.LIGHT_YELLOW, qt_import.QPalette.Button, ) self.motor_state_changed(self.motor_hwobj.get_state()) elif property_name == "showMoveButtons": if new_value: self.previous_position_button.show() self.next_position_button.show() else: self.previous_position_button.hide() self.next_position_button.hide() elif property_name == "icons": icons_list = new_value.split() try: self.previous_position_button.setIcon( icons.load_icon(icons_list[0])) self.next_position_button.setIcon( icons.load_icon(icons_list[1])) except BaseException: pass 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": 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 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 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): """ Defines the behaviour :param property_name: str :param old_value: value :param new_value: value :return: """ if property_name == "hwobj_ssx_control": self.ssx_control_hwobj = self.get_hardware_object(new_value) self.update_chip_config() else: BaseWidget.property_changed(self, property_name, old_value, new_value)
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 property_changed(self, property_name, old_value, new_value): """Initates the shutter hwobj""" if property_name == "hwobj_shutter": if self.shutter_hwobj is not None: self.disconnect(self.shutter_hwobj, "valueChanged", self.value_changed) else: self.shutter_hwobj = self.get_hardware_object(new_value) self.connect(self.shutter_hwobj, "valueChanged", self.value_changed) elif property_name == "title": self.main_groupbox.setTitle(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 == "defaultMode": if new_value == "keV": self.units_combobox.setCurrentIndex(0) else: self.units_combobox.setCurrentIndex(1) elif property_name == "displayStatus": self.status_label.setVisible(new_value) self.status_ledit.setVisible(new_value) elif property_name == "doBeamAlignment": self.beam_align_cbox.setEnabled(new_value) self.beam_align_cbox.setChecked(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 == "zoom": if self.multipos_hwobj is not None: self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_cal_pos_data_changed) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) if new_value is not None: self.multipos_hwobj = self.get_hardware_object(new_value) if new_value.startswith("/"): new_value = new_value[1:] self.multipos_file_xml_path = os.path.join( HWR.getHardwareRepositoryConfigPath(), new_value + ".xml") if self.multipos_hwobj is not None: self.connect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_cal_pos_data_changed) self.connect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.connect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) self.update_gui() if property_name == "vertical motor": self.v_motor_hwobj = self.get_hardware_object(new_value) name = self.v_motor_hwobj.name() self.ui_widgets_manager.delta_z_label.setText(f"Delta on {name}:") if property_name == "horizontal motor": self.h_motor_hwobj = self.get_hardware_object(new_value) name = self.h_motor_hwobj.name() self.ui_widgets_manager.delta_y_label.setText(f"Delta on {name}:") else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): if property_name == "mnemonicList": hwobj_role_list = new_value.split() self.hwobj_list = [] for hwobj_role in hwobj_role_list: hwobj = self.get_hardware_object(hwobj_role) if hwobj is not None: self.hwobj_list.append(hwobj) self.connect(self.hwobj_list[-1], "progressInit", self.init_progress) self.connect(self.hwobj_list[-1], "progressStep", self.step_progress) self.connect(self.hwobj_list[-1], "progressStop", self.stop_progress) 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_axis_camera": self.axis_camera = self.get_hardware_object(new_value) image_dimensions = self.axis_camera.get_image_dimensions() self.axis_view.setFixedSize(image_dimensions[0], image_dimensions[1]) self.connect(self.axis_camera, "imageReceived", self.axis_camera_frame_received) elif property_name == "hwobj_sc_camera": self.sc_camera = self.get_hardware_object(new_value) image_dimensions = self.sc_camera.get_image_dimensions() self.sc_view.setFixedSize(image_dimensions[0], image_dimensions[1]) self.connect(self.sc_camera, "imageReceived", self.sc_camera_frame_received) 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.multipos_hwobj is not None: # disconnect signal/slots self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_pos_cal_data_changed) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) pass if new_value is not None: self.multipos_hwobj = self.get_hardware_object(new_value) #search xml file so it handles the 'tags' # TODO : create a separate xml file for tags!! if new_value.startswith("/"): new_value = new_value[1:] self.multipos_file_xml_path = os.path.join( HWR.getHardwareRepositoryConfigPath(), new_value + ".xml") if self.multipos_hwobj is not None: self.connect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_pos_cal_data_changed) self.connect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.connect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) # self.load_zoom_positions_dict() self.load_list_of_operational_modes() self.load_default_session() self.init_interface() 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_state_machine": if self.state_machine_hwobj is not None: self.state_machine_hwobj.disconnect("stateChanged", self.state_changed) self.state_machine_hwobj.disconnect("conditionChanged", self.condition_changed) self.state_machine_hwobj = self.get_hardware_object(new_value) if self.state_machine_hwobj is not None: self.state_machine_hwobj.connect("stateChanged", self.state_changed) self.state_machine_hwobj.connect("conditionChanged", self.condition_changed) self.init_state_machine() self.init_state_graph() self.state_machine_hwobj.force_emit_signals() 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.beamline_test_hwobj is not None: self.disconnect( self.beamline_test_hwobj, "progressStep", self.update_test_progress ) self.disconnect( self.beamline_test_hwobj, "focusingModeChanged", self.update_focus_status, ) self.disconnect( self.beamline_test_hwobj, "ppuStatusChanged", self.update_ppu_status ) self.disconnect( self.beamline_test_hwobj, "testFinished", self.test_finished ) self.beamline_test_hwobj = self.get_hardware_object(new_value) if self.beamline_test_hwobj is not None: self.init_com_table() self.init_test_queue() self.connect( self.beamline_test_hwobj, "progressStep", self.update_test_progress ) self.connect( self.beamline_test_hwobj, "focusingModeChanged", self.update_focus_status, ) self.connect( self.beamline_test_hwobj, "ppuStatusChanged", self.update_ppu_status ) self.connect( self.beamline_test_hwobj, "testFinished", self.test_finished ) self.update_focus_status(None, None) # elif property_name == 'hwobj_unittest': # self.unittest_hwobj = self.get_hardware_object(new_value) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): """Defines gui and connects to hwobj based on the user defined properties""" 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.force_emit_signals() elif property_name == "lenseCount": self.crl_value_table.setColumnCount(new_value) for col_index in range(new_value): temp_item = qt_import.QTableWidgetItem("") temp_item.setFlags(qt_import.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) self.crl_lense_spinbox.setMaximum(new_value - 1) elif property_name == "caption": if new_value: self.main_gbox.setTitle(new_value) elif property_name == "style": self.crl_value_table.setVisible(new_value == "table") self.mode_combo.setEnabled(new_value == "table") self.set_according_to_energy_button.setEnabled(new_value == "table") self.crl_lense_spinbox.setVisible(new_value != "table") self.crl_lense_in_button.setVisible(new_value != "table") self.crl_lense_out_button.setVisible(new_value != "table") 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.mach_info_hwobj is not None: self.disconnect( self.mach_info_hwobj, qt_import.SIGNAL("valuesChanged"), self.set_value, ) self.mach_info_hwobj = self.get_hardware_object(new_value) if self.mach_info_hwobj is not None: self.setEnabled(True) self.connect( self.mach_info_hwobj, qt_import.SIGNAL("valuesChanged"), self.set_value, ) self.mach_info_hwobj.re_emit_values() 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 == "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 property_changed(self, property_name, old_value, new_value): if property_name == "zoom": if self.multipos_hwobj is not None: self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_cal_pos_data_changed) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.disconnect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) self.multipos_hwobj = self.get_hardware_object(new_value) # get zoom xml file path if new_value.startswith("/"): new_value = new_value[1:] self.multipos_file_xml_path = os.path.join( HWR.getHardwareRepositoryConfigPath(), new_value + ".xml") if self.multipos_hwobj is not None: self.connect(self.multipos_hwobj, "beam_pos_cal_data_changed", self.beam_cal_pos_data_changed) self.connect(self.multipos_hwobj, "beam_pos_cal_data_saved", self.beam_cal_pos_data_saved) self.connect(self.multipos_hwobj, "beam_pos_cal_data_cancelled", self.beam_cal_pos_data_cancelled) self.init_interface() 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.beam_focusing_hwobj is not None: self.disconnect( self.beam_focusing_hwobj, "focusingModeChanged", self.focus_mode_changed, ) self.beam_focusing_hwobj = self.get_hardware_object(new_value) if self.beam_focusing_hwobj is not None: self.connect( self.beam_focusing_hwobj, "focusingModeChanged", self.focus_mode_changed, ) mode, beam_size = self.beam_focusing_hwobj.get_active_focus_mode( ) self.focus_mode_changed(mode, beam_size) 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.slitbox_hwobj is not None: self.disconnect(self.slitbox_hwobj, "valueChanged", self.gap_value_changed) self.disconnect(self.slitbox_hwobj, "statusChanged", self.gap_status_changed) self.disconnect(self.slitbox_hwobj, "focusModeChanged", self.focus_mode_changed) self.disconnect(self.slitbox_hwobj, "minLimitsChanged", self.min_limits_changed) self.disconnect(self.slitbox_hwobj, "maxLimitsChanged", self.max_limits_changed) self.slitbox_hwobj = self.get_hardware_object(new_value) if self.slitbox_hwobj is not None: self.connect(self.slitbox_hwobj, "valueChanged", self.gap_value_changed) self.connect(self.slitbox_hwobj, "statusChanged", self.gap_status_changed) self.connect(self.slitbox_hwobj, "focusModeChanged", self.focus_mode_changed) self.connect(self.slitbox_hwobj, "minLimitsChanged", self.min_limits_changed) self.connect(self.slitbox_hwobj, "maxLimitsChanged", self.max_limits_changed) self.main_gbox.setEnabled(True) self.initiate_spinboxes() self.slitbox_hwobj.force_emit_signals() else: self.main_gbox.setEnabled(False) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
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_volpi_object(new_value) elif property_name == "showBar": self.power_bar.setBarVisible(new_value) if self.power_bar.dialAndBarInvible(): self.frame.setVisible(False) if new_value: self.frame.setVisible(True) elif property_name == "showDial": self.power_bar.setDialVisible(new_value) if self.power_bar.dialAndBarInvible(): self.frame.setVisible(False) if new_value: self.frame.setVisible(True) elif property_name == "showStep": self.step_button.show() elif property_name == "stepValue": self.position_spinbox.setSingleStep(int(new_value)) else: BaseWidget.property_changed(self, property_name, old_value, new_value)
def property_changed(self, property_name, old_value, new_value): """ Defines the behaviour :param property_name: str :param old_value: value :param new_value: value :return: """ if property_name == "hwobj_motors_list": hwobj_names_list = new_value.split() default_delta_list = self["defaultDeltas"].split() default_decimal_list = self["defaultDecimals"].split() default_step_list = self["defaultSteps"].split() icon_list = self["icon_list"].split() for index, hwobj_name in enumerate(hwobj_names_list): temp_motor_hwobj = self.get_hardware_object(hwobj_name) if temp_motor_hwobj is not None: temp_motor_widget = self.motor_widget_list[index] temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name) temp_motor_widget.move_left_button.setVisible(True) temp_motor_widget.move_right_button.setVisible(True) temp_motor_widget.position_slider.setVisible(False) temp_motor_widget.step_button.setVisible(False) # temp_motor_widget.stop_button.setVisible(False) try: temp_motor_widget.set_line_step( default_step_list[index]) temp_motor_widget["defaultStep"] = default_step_list[ index] except BaseException: temp_motor_widget.set_line_step(0.001) temp_motor_widget["defaultStep"] = 0.001 try: temp_motor_widget["delta"] = default_delta_list[index] except BaseException: temp_motor_widget["delta"] = 0.001 try: temp_motor_widget.set_decimals( float(default_decimal_list[index])) except BaseException: pass try: temp_motor_widget.move_left_button.setIcon( icons.load_icon(icon_list[index * 2])) temp_motor_widget.move_right_button.setIcon( icons.load_icon(icon_list[index * 2 + 1])) except BaseException: temp_motor_widget.move_left_button.setIcon( icons.load_icon("Right2")) temp_motor_widget.move_right_button.setIcon( icons.load_icon("Left2")) temp_motor_widget.step_changed(None) temp_motor_hwobj.force_emit_signals() temp_motor_widget.update_gui() elif property_name == "enableCenterBeam": self.center_beam_button.setVisible(new_value) elif property_name == "enableMeasureFlux": self.measure_flux_button.setVisible(new_value) elif property_name == "compactView": for widget in self.motor_widget_list: widget.position_spinbox.setHidden(new_value) widget.position_slider.setHidden(new_value) widget.step_button.setHidden(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.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"): self.camera_control_dialog.set_camera_hwobj( self.graphics_manager_hwobj.camera ) 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: if hasattr(self.graphics_manager_hwobj, "set_scale_visible"): # NBNB Where did this code come from? SHould probvably be removed # no known function "set_scale_visible" anywhere. TODO remove self.graphics_manager_hwobj.set_scale_visible(new_value) else: logging.getLogger().info( "No such function: sample_view.set_scale_visible()" ) 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 == "mnemonic": if self.wrapper_hwobj is not None: self.wrapper_hwobj.duoStateChangedSignal.disconnect(self.stateChanged) h_obj = self.get_hardware_object(new_value) if h_obj is not None: self.wrapper_hwobj = WrapperHO(h_obj) self.main_gbox.show() if self["username"] == "": self["username"] = self.wrapper_hwobj.username help_text = self["setin"] + " the " + self["username"].lower() self.set_in_button.setToolTip(help_text) help_text = self["setout"] + " the " + self["username"].lower() self.set_out_button.setToolTip(help_text) self.main_gbox.setTitle(self["username"]) self.wrapper_hwobj.duoStateChangedSignal.connect(self.stateChanged) self.wrapper_hwobj.get_state() else: self.wrapper_hwobj = None # self.main_gbox.hide() elif property_name == "expertModeControlOnly": if new_value: if self.__expertMode: self.buttons_widget.show() else: self.buttons_widget.hide() else: self.buttons_widget.show() elif property_name == "forceNoControl": if new_value: self.buttons_widget.hide() else: self.buttons_widget.show() elif property_name == "icons": #w = self.fontMetrics().width("Set out") icons_list = new_value.split() try: self.set_in_button.setIcon(icons.load_icon(icons_list[0])) except IndexError: self.set_in_button.setText(self["setin"]) # self.set_in_button.setMinimumWidth(w) try: self.set_out_button.setIcon(icons.load_icon(icons_list[1])) except IndexError: self.set_out_button.setText(self["setout"]) # self.set_out_button.setMinimumWidth(w) # elif property_name=='in': # if self.wrapper_hwobj is not None: # self.stateChanged(self.wrapper_hwobj.get_state()) # elif property_name=='out': # if self.wrapper_hwobj is not None: # self.stateChanged(self.wrapper_hwobj.get_state()) elif property_name == "setin": # w=self.fontMetrics().width("Set out") icons_list = self["icons"] try: i = icons_list[0] except IndexError: self.set_in_button.setText(new_value) # self.set_in_button.setMinimumWidth(w) help_text = new_value + " the " + self["username"].lower() self.set_in_button.setToolTip(help_text) self.set_in_button.setText(self["setin"]) elif property_name == "setout": # w=self.fontMetrics().width("Set out") icons_list = self["icons"].split() try: i = icons_list[1] except IndexError: self.set_out_button.setText(new_value) # self.set_out_button.setMinimumWidth(w) help_text = new_value + " the " + self["username"].lower() self.set_out_button.setToolTip(help_text) self.set_out_button.setText(self["setout"]) elif property_name == "username": if new_value == "": if self.wrapper_hwobj is not None: name = self.wrapper_hwobj.username if name != "": self["username"] = name return help_text = self["setin"] + " the " + new_value.lower() self.set_in_button.setToolTip(help_text) help_text = self["setout"] + " the " + new_value.lower() self.set_out_button.setToolTip(help_text) self.main_gbox.setTitle(self["username"]) 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.instance_server_hwobj is not None: self.disconnect( self.instance_server_hwobj, "chatMessageReceived", self.message_arrived, ) self.disconnect(self.instance_server_hwobj, "newClient", self.new_client) self.disconnect( self.instance_server_hwobj, "serverInitialized", self.server_initialized, ) self.disconnect( self.instance_server_hwobj, "clientInitialized", self.client_initialized, ) self.disconnect(self.instance_server_hwobj, "serverClosed", self.client_closed) self.disconnect(self.instance_server_hwobj, "wantsControl", self.wants_control) self.disconnect(self.instance_server_hwobj, "haveControl", self.have_control) self.disconnect(self.instance_server_hwobj, "passControl", self.pass_control) self.disconnect(self.instance_server_hwobj, "clientClosed", self.client_closed) self.disconnect(self.instance_server_hwobj, "clientChanged", self.client_changed) self.instance_server_hwobj = self.get_hardware_object(new_value) if self.instance_server_hwobj is not None: self.connect( self.instance_server_hwobj, "chatMessageReceived", self.message_arrived, ) self.connect(self.instance_server_hwobj, "newClient", self.new_client) self.connect( self.instance_server_hwobj, "serverInitialized", self.server_initialized, ) self.connect( self.instance_server_hwobj, "clientInitialized", self.client_initialized, ) self.connect(self.instance_server_hwobj, "serverClosed", self.client_closed) self.connect(self.instance_server_hwobj, "wantsControl", self.wants_control) self.connect(self.instance_server_hwobj, "haveControl", self.have_control) self.connect(self.instance_server_hwobj, "passControl", self.pass_control) self.connect(self.instance_server_hwobj, "clientClosed", self.client_closed) self.connect(self.instance_server_hwobj, "clientChanged", self.client_changed) elif property_name == "icons": icons_list = new_value.split() try: self.send_button.setIcon(icons.load_icon(icons_list[0])) except IndexError: pass else: BaseWidget.property_changed(self, property_name, old_value, new_value)