コード例 #1
0
 def toDataInfo(klass, name, info):
     info = CaselessDict(info)
     dtype = info[Type]
     dtype, dformat = to_dtype_dformat(dtype)
     default_value = info.get(DefaultValue)
     description = info.get(Description, '')
     daccess = info.get(Access, DataAccess.ReadWrite)
     daccess = to_daccess(daccess)
     memorized = info.get(Memorize, Memorized)
     maxdimsize = info.get(MaxDimSize)
     fget = info.get(FGet)
     fset = info.get(FSet)
     if default_value is not None and dtype != DataType.String:
         if type(default_value) in types.StringTypes:
             default_value = eval(default_value)
     return DataInfo(name,
                     dtype,
                     dformat=dformat,
                     access=daccess,
                     description=description,
                     default_value=default_value,
                     memorized=memorized,
                     fget=fget,
                     fset=fset,
                     maxdimsize=maxdimsize)
コード例 #2
0
 def toDataInfo(klass, name, info):
     info = CaselessDict(info)
     dtype = info[Type]
     dtype, dformat = to_dtype_dformat(dtype)
     default_value = info.get(DefaultValue)
     description = info.get(Description, '')
     daccess = info.get(Access, DataAccess.ReadWrite)
     daccess = to_daccess(daccess)
     memorized = info.get(Memorize, Memorized)
     maxdimsize = info.get(MaxDimSize)
     fget = info.get(FGet)
     fset = info.get(FSet)
     if default_value is not None and dtype != DataType.String:
         if type(default_value) in types.StringTypes:
             default_value = eval(default_value)
     return DataInfo(name, dtype, dformat=dformat, access=daccess,
                     description=description, default_value=default_value,
                     memorized=memorized, fget=fget, fset=fset,
                     maxdimsize=maxdimsize)
コード例 #3
0
ファイル: util.py プロジェクト: victorfong28/sardana
def to_tango_attr_info(attr_name, attr_info):
    if isinstance(attr_info, DataInfo):
        data_type, data_format = attr_info.dtype, attr_info.dformat
        data_access = attr_info.access
        desc = attr_info.description
        memorized = attr_info.memorized
    else:
        data_type, data_format = to_dtype_dformat(attr_info.get('type'))
        data_access = to_daccess(attr_info.get('r/w type'))
        desc = attr_info.get('description')
        memorized = attr_info.get('memorized')

    tg_type, tg_format = to_tango_type_format(data_type, data_format)
    tg_access = to_tango_access(data_access)
    tg_attr_info = [[tg_type, tg_format, tg_access]]

    extra = {}
    tg_attr_info.append(extra)

    if desc is not None and len(desc) > 0:
        extra['description'] = desc
    extra['memorized'] = memorized
    return attr_name, tg_attr_info
コード例 #4
0
ファイル: util.py プロジェクト: cmft/sardana
def to_tango_attr_info(attr_name, attr_info):
    if isinstance(attr_info, DataInfo):
        data_type, data_format = attr_info.dtype, attr_info.dformat
        data_access = attr_info.access
        desc = attr_info.description
        memorized = attr_info.memorized
    else:
        data_type, data_format = to_dtype_dformat(attr_info.get('type'))
        data_access = to_daccess(attr_info.get('r/w type'))
        desc = attr_info.get('description')
        memorized = attr_info.get('memorized')

    tg_type, tg_format = to_tango_type_format(data_type, data_format)
    tg_access = to_tango_access(data_access)
    tg_attr_info = [ [ tg_type, tg_format, tg_access ] ]

    extra = {}
    tg_attr_info.append(extra)

    if desc is not None and len(desc) > 0:
        extra['description'] = desc
    extra['memorized'] = memorized
    return attr_name, tg_attr_info