本文整理汇总了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)
示例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)
示例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