def _connect_hwserver(self): print self.hwr_directory self.hwr_server = HardwareRepository.HardwareRepository( self.hwr_directory) self.hwr_server.connect() hwo_path = os.path.join(self.mxcube_dir, "HardwareObjects") sc_hwo_path = os.path.join(hwo_path, "sample_changer") if self.institute: inst_hwo_path = os.path.join(hwo_path, self.institute) HardwareRepository.add_hardware_objects_dirs( [hwo_path, inst_hwo_path, sc_hwo_path])
def __init__(self, parent=None, widget_name=""): connectable.Connectable.__init__(self) qt_import.QFrame.__init__(self, parent) self.setObjectName(widget_name) self.property_bag = property_bag.PropertyBag() self.__enabled_state = True self.__loaded_hardware_objects = [] self.__failed_to_load_hwobj = False self.__use_progress_dialog = False self._signal_slot_filters = {} self._widget_events = [] self.setWhatsThis("%s (%s)\n" % (widget_name, self.__class__.__name__)) self.add_property("fontSize", "string", str(self.font().pointSize())) self.add_property("frame", "boolean", False, comment="Draw a frame around the widget") self.add_property( "instanceAllowAlways", "boolean", False, comment="Allow to control brick in all modes", ) self.add_property( "instanceAllowConnected", "boolean", False, comment="Allow to control brick in slave mode", ) self.add_property("fixedWidth", "integer", "-1", comment="Set fixed width in pixels") self.add_property("fixedHeight", "integer", "-1", comment="Set fixed height in pixels") self.add_property("hide", "boolean", False, comment="Hide widget") dispatcher.connect( self.__hardware_object_discarded, "hardwareObjectDiscarded", HWR.get_hardware_repository(), ) self.define_slot("enable_widget", ()) self.define_slot("disable_widget", ()) # If PySide used then connect method was not overriden # This solution of redirecting methods works... self.connect = self.connect_hwobj self.disconnect = self.disconnect_hwobj
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 == "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)