當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。