当前位置: 首页>>代码示例>>Python>>正文


Python ShotgunORM.onEntitySchemaInfoCreate方法代码示例

本文整理汇总了Python中ShotgunORM.onEntitySchemaInfoCreate方法的典型用法代码示例。如果您正苦于以下问题:Python ShotgunORM.onEntitySchemaInfoCreate方法的具体用法?Python ShotgunORM.onEntitySchemaInfoCreate怎么用?Python ShotgunORM.onEntitySchemaInfoCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShotgunORM的用法示例。


在下文中一共展示了ShotgunORM.onEntitySchemaInfoCreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fromSg

# 需要导入模块: import ShotgunORM [as 别名]
# 或者: from ShotgunORM import onEntitySchemaInfoCreate [as 别名]
  def fromSg(cls, sgSchema, sgEntityName, sgEntityLabel, sgFieldSchemas):
    '''
    From the passed Shotgun schema info a new SgEntitySchemaInfo is returned.
    '''

    fieldInfos = {}
    fieldInfosUnsupported = {}

    for fieldName, schemaData in sgFieldSchemas.items():
      if fieldName.startswith('step_'):
        continue

      fieldInfo = ShotgunORM.SgFieldSchemaInfo.fromSg(sgEntityName, sgEntityLabel, fieldName, schemaData)

      # Skip fields that have an unsupported return type!
      if fieldInfo.returnType() == ShotgunORM.SgField.RETURN_TYPE_UNSUPPORTED:
        ShotgunORM.LoggerSchema.warn(
          'ignoring unsupported return type "%s", %s.%s' % (
            fieldInfo.returnTypeName(),
            sgEntityName, fieldInfo.name()
          )
        )

        fieldInfosUnsupported[fieldName] = fieldInfo
      else:
        fieldInfos[fieldName] = fieldInfo

    result = cls(sgSchema, sgEntityName, sgEntityLabel, fieldInfos, fieldInfosUnsupported)

    try:
      ShotgunORM.onEntitySchemaInfoCreate(result)
    except Exception, e:
      ShotgunORM.LoggerORM.warn(e)
开发者ID:YKdvd,项目名称:python-shotgunorm,代码行数:35,代码来源:SgEntity.py

示例2: fromXML

# 需要导入模块: import ShotgunORM [as 别名]
# 或者: from ShotgunORM import onEntitySchemaInfoCreate [as 别名]
  def fromXML(cls, sgSchema, sgXmlElement):
    '''
    From the passed XML data a new SgEntitySchemaInfo is returned.
    '''

    if sgXmlElement.tag != 'SgEntity':
      raise RuntimeError('invalid tag "%s"' % sgXmlElement.tag)

    entityFieldInfos = {}
    entityFieldInfosUnsupported = {}

    fields = sgXmlElement.find('fields')

    if fields == None:
      raise RuntimeError('could not find fields element')

    entityName = sgXmlElement.attrib.get('name')
    entityLabel = sgXmlElement.attrib.get('label')

    for field in fields:
      # Skip fields that have an unsupported return type!
      fieldInfo = ShotgunORM.SgFieldSchemaInfo.fromXML(entityName, entityLabel, field)

      if fieldInfo.returnType() == ShotgunORM.SgField.RETURN_TYPE_UNSUPPORTED:
        ShotgunORM.LoggerEntity.warning('field %s.%s ignored because of return type unsupported' % (fieldInfo.name(), entityName))

        entityFieldInfosUnsupported[fieldInfo.name()] = fieldInfo
      else:
        entityFieldInfos[fieldInfo.name()] = fieldInfo

    result = cls(
      sgSchema,
      entityName,
      entityLabel,
      entityFieldInfos,
      entityFieldInfosUnsupported
    )

    try:
      ShotgunORM.onEntitySchemaInfoCreate(result)
    except Exception, e:
      ShotgunORM.LoggerORM.warn(e)
开发者ID:Kif11,项目名称:python-shotgunorm,代码行数:44,代码来源:SgEntity.py

示例3: _entityFix

# 需要导入模块: import ShotgunORM [as 别名]
# 或者: from ShotgunORM import onEntitySchemaInfoCreate [as 别名]
def _entityFix(schema, schemaData):
  '''
  Returns Entities that dont exist in the API but fields return them as values.

  * Currently returns *

    1: Banner Entity
    2: AppWelcome Entity
  '''

  idInfoData = ShotgunORM.SgFieldSchemaInfo.createSchemaData(
    'Banner',
    'id',
    ShotgunORM.SgField.RETURN_TYPE_INT,
    editable=False,
    doc='Entity ID',
    label='Id'
  )

  nameInfoData = ShotgunORM.SgFieldSchemaInfo.createSchemaData(
    'Banner',
    'name',
    ShotgunORM.SgField.RETURN_TYPE_TEXT,
    editable=False,
    label='Name'
  )

  bannerFieldInfos = {
    'name': ShotgunORM.SgFieldSchemaInfo(nameInfoData),
    'id': ShotgunORM.SgFieldSchemaInfo(idInfoData)
  }

  BannerEntity = ShotgunORM.SgEntitySchemaInfo(
    schema,
    'Banner',
    'Banner',
    bannerFieldInfos,
    {}
  )

  ShotgunORM.onEntitySchemaInfoCreate(BannerEntity)

  idInfoData = ShotgunORM.SgFieldSchemaInfo.createSchemaData(
    'AppWelcome',
    'id',
    ShotgunORM.SgField.RETURN_TYPE_INT,
    doc='Entity ID',
    editable=False,
    label='Id'
  )

  nameInfoData = ShotgunORM.SgFieldSchemaInfo.createSchemaData(
    'AppWelcome',
    'name',
    ShotgunORM.SgField.RETURN_TYPE_TEXT,
    editable=False,
    label='Name'
  )

  appwelcomeFieldInfos = {
    'name': ShotgunORM.SgFieldSchemaInfo(nameInfoData),
    'id': ShotgunORM.SgFieldSchemaInfo(idInfoData)
  }

  AppWelcomeEntity = ShotgunORM.SgEntitySchemaInfo(
    schema,
    'AppWelcome',
    'AppWelcome',
    appwelcomeFieldInfos,
    {}
  )

  ShotgunORM.onEntitySchemaInfoCreate(AppWelcomeEntity)

  schemaData['AppWelcome'] = AppWelcomeEntity
  schemaData['Banner'] = BannerEntity
开发者ID:ndunsworth,项目名称:python-shotgunorm,代码行数:78,代码来源:SgSchema.py


注:本文中的ShotgunORM.onEntitySchemaInfoCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。