def _get_dynamic_attributes(self): ctrl = self.ctrl if ctrl is None: self.warning("no controller: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) if not ctrl.is_online(): self.warning("controller offline: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) dyn_attrs = CaselessDict() std_attrs = CaselessDict() dev_class = self.get_device_class() axis_attrs = ctrl.get_axis_attributes(self.element.axis) std_attrs_lower = [attr.lower() for attr in dev_class.standard_attr_list] for attr_name, attr_info in list(axis_attrs.items()): attr_name_lower = attr_name.lower() if attr_name_lower in std_attrs_lower: data_info = DataInfo.toDataInfo(attr_name, attr_info) tg_info = dev_class.standard_attr_list[attr_name] std_attrs[attr_name] = attr_name, tg_info, data_info else: data_info = DataInfo.toDataInfo(attr_name, attr_info) name, tg_info = to_tango_attr_info(attr_name, data_info) dyn_attrs[attr_name] = name, tg_info, data_info return std_attrs, dyn_attrs
def _get_dynamic_attributes(self): ctrl = self.ctrl if ctrl is None: self.warning("no controller: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) if not ctrl.is_online(): self.warning("controller offline: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) dyn_attrs = CaselessDict() std_attrs = CaselessDict() dev_class = self.get_device_class() axis_attrs = ctrl.get_axis_attributes(self.element.axis) std_attrs_lower = [ attr.lower() for attr in dev_class.standard_attr_list ] for attr_name, attr_info in list(axis_attrs.items()): attr_name_lower = attr_name.lower() if attr_name_lower in std_attrs_lower: data_info = DataInfo.toDataInfo(attr_name, attr_info) # copy in order to leave the class attributes untouched # the downstream code can append MaxDimSize to the attr. info tg_info = deepcopy(dev_class.standard_attr_list[attr_name]) std_attrs[attr_name] = attr_name, tg_info, data_info else: data_info = DataInfo.toDataInfo(attr_name, attr_info) name, tg_info = to_tango_attr_info(attr_name, data_info) dyn_attrs[attr_name] = name, tg_info, data_info return std_attrs, dyn_attrs
def _get_dynamic_attributes(self): ctrl = self.ctrl if ctrl is None: self.warning("no controller: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) if not ctrl.is_online(): self.warning("controller offline: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) dyn_attrs = CaselessDict() std_attrs = CaselessDict() dev_class = self.get_device_class() axis_attrs = ctrl.get_axis_attributes(self.element.axis) std_attrs_lower = [attr.lower() for attr in dev_class.standard_attr_list] for attr_name, attr_info in axis_attrs.items(): attr_name_lower = attr_name.lower() if attr_name_lower in std_attrs_lower: data_info = DataInfo.toDataInfo(attr_name, attr_info) tg_info = dev_class.standard_attr_list[attr_name] std_attrs[attr_name] = attr_name, tg_info, data_info else: data_info = DataInfo.toDataInfo(attr_name, attr_info) name, tg_info = to_tango_attr_info(attr_name, data_info) dyn_attrs[attr_name] = name, tg_info, data_info return std_attrs, dyn_attrs
def get_dynamic_attributes(self): if hasattr(self, "_dynamic_attributes_cache"): return self._standard_attributes_cache, self._dynamic_attributes_cache info = self.ctrl.ctrl_info if info is None: self.warning("Controller %s doesn't have any information", self.ctrl) return PoolDevice.get_dynamic_attributes(self) self._dynamic_attributes_cache = dyn_attrs = CaselessDict() self._standard_attributes_cache = std_attrs = CaselessDict() for attr_name, attr_data in info.ctrl_attributes.items(): name, tg_info = to_tango_attr_info(attr_name, attr_data) dyn_attrs[attr_name] = attr_name, tg_info, attr_data return std_attrs, dyn_attrs
def get_dynamic_attributes(self): """Override of :class:`PoolDevice.get_dynamic_attributes`. Returns the standard dynamic and fully dynamic attributes for this device. The return is a tuple of two dictionaries: - standard attributes: caseless dictionary with key being the attribute name and value is a tuple of attribute name(str), tango information, attribute information - dynamic attributes: caseless dictionary with key being the attribute name and value is a tuple of attribute name(str), tango information, attribute information **tango information** seq< :class:`~PyTango.CmdArgType`, :class:`~PyTango.AttrDataFormat`, :class:`~PyTango.AttrWriteType` > **attribute information** attribute information as returned by the sardana controller :return: the standard dynamic and fully dynamic attributes :rtype: seq< :class:`~taurus.core.util.CaselessDict`, :class:`~taurus.core.util.CaselessDict`\> """ if hasattr(self, "_dynamic_attributes_cache"): return self._standard_attributes_cache, self._dynamic_attributes_cache ctrl = self.ctrl if ctrl is None: self.warning("no controller: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) if not ctrl.is_online(): self.warning("controller offline: dynamic attributes NOT created") return PoolDevice.get_dynamic_attributes(self) self._dynamic_attributes_cache = dyn_attrs = CaselessDict() self._standard_attributes_cache = std_attrs = CaselessDict() dev_class = self.get_device_class() axis_attrs = ctrl.get_axis_attributes(self.element.axis) std_attrs_lower = [ attr.lower() for attr in dev_class.standard_attr_list ] for attr_name, attr_info in axis_attrs.items(): attr_name_lower = attr_name.lower() if attr_name_lower in std_attrs_lower: data_info = DataInfo.toDataInfo(attr_name, attr_info) tg_info = dev_class.standard_attr_list[attr_name] std_attrs[attr_name] = attr_name, tg_info, data_info else: data_info = DataInfo.toDataInfo(attr_name, attr_info) name, tg_info = to_tango_attr_info(attr_name, data_info) dyn_attrs[attr_name] = name, tg_info, data_info return std_attrs, dyn_attrs