def _get_dev(dev_type): ip = get_ipapi() ret = ip.user_ns.get("_" + dev_type) if ret is not None: return ret dev_obj_name = '%s_NAME' % dev_type # TODO: For Taurus 4 compatibility dev_name = "tango://%s" % ip.user_ns[dev_obj_name] factory = Factory() dev_obj = factory.getDevice(dev_name) ip.user_ns[dev_type] = PyTango.DeviceProxy(dev_name) ip.user_ns["_" + dev_type] = dev_obj setattr(ip, '_%s' % dev_type, dev_obj) return dev_obj
def _get_dev(dev_type): spock_config = get_config().Spock taurus_dev = None taurus_dev_var = "_" + dev_type if hasattr(spock_config, taurus_dev_var): taurus_dev = getattr(spock_config, taurus_dev_var) if taurus_dev is None: # TODO: For Taurus 4 compatibility dev_name = "tango://%s" % getattr(spock_config, dev_type + '_name') factory = Factory() taurus_dev = factory.getDevice(dev_name) import PyTango dev = PyTango.DeviceProxy(dev_name) setattr(spock_config, dev_type, dev) setattr(spock_config, taurus_dev_var, taurus_dev) shell = get_shell() dev_type_upper = dev_type.upper() shell.user_ns[dev_type_upper] = dev shell.user_ns["_" + dev_type_upper] = taurus_dev return taurus_dev