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


Python Entity.get_icon方法代码示例

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


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

示例1: get_subject_type_fields

# 需要导入模块: from opencontext_py.apps.entities.entity.models import Entity [as 别名]
# 或者: from opencontext_py.apps.entities.entity.models.Entity import get_icon [as 别名]
 def get_subject_type_fields(self, field_num_list=False):
     """ Gets a list of subject-type field objects,
         limited by a list of field_num if not false
     """
     self.get_examples = True
     if field_num_list is not False:
         imp_fields = ImportField.objects\
                                 .filter(source_id=self.source_id,
                                         field_type__in=self.DEFAULT_SUBJECT_TYPE_FIELDS,
                                         field_num__in=field_num_list)
     else:
         imp_fields = ImportField.objects\
                                 .filter(source_id=self.source_id,
                                         field_type__in=self.DEFAULT_SUBJECT_TYPE_FIELDS)
     for field_obj in imp_fields:
         if field_obj.field_type == 'media':
             self.has_media_field = True
         if field_obj.field_type == 'documents':
             self.has_doc_field = True
         if field_obj.field_type == 'complex-description':
             self.has_complex_des_field = True
         field_obj.examples = self.get_example_entities(field_obj.field_num,
                                                        field_obj.value_prefix)
         field_obj.ex_csv = ', '.join(field_obj.examples)
         if len(field_obj.field_value_cat) > 0:
             ent = Entity()
             ent.get_icon = True
             found = ent.dereference(field_obj.field_value_cat)
             if found:
                 field_obj.field_value_cat_label = ent.label
                 field_obj.field_value_cat_icon = ent.icon
         else:
             field_obj.field_value_cat_icon = False
             field_obj.field_value_cat_label = ''
         self.fields.append(field_obj)
开发者ID:ekansa,项目名称:open-context-py,代码行数:37,代码来源:templating.py

示例2: make_dict_from_field_obj

# 需要导入模块: from opencontext_py.apps.entities.entity.models import Entity [as 别名]
# 或者: from opencontext_py.apps.entities.entity.models.Entity import get_icon [as 别名]
 def make_dict_from_field_obj(self, field_obj):
     """ returns an ordered dict for a field_obj """
     field_dict = LastUpdatedOrderedDict()
     field_dict['field_num'] = field_obj.field_num
     field_dict['label'] = field_obj.label
     field_dict['ref_name'] = field_obj.ref_name
     field_dict['field_type'] = field_obj.field_type
     field_dict['field_data_type'] = field_obj.field_data_type
     field_dict['field_value_cat'] = field_obj.field_value_cat
     field_dict['obs_num'] = field_obj.obs_num
     field_dict['value_prefix'] = field_obj.value_prefix
     field_dict['unique_count'] = field_obj.unique_count
     field_dict['f_uuid'] = field_obj.f_uuid
     if self.get_examples:
         field_dict['examples'] = self.get_example_entities(field_obj.field_num,
                                                            field_obj.value_prefix)
         field_dict['ex_csv'] = ', '.join(field_dict['examples'])
         if len(field_obj.field_value_cat) > 0:
             ent = Entity()
             ent.get_icon = True
             found = ent.dereference(field_obj.field_value_cat)
             if found:
                 field_dict['field_value_cat_label'] = ent.label
                 field_dict['field_value_cat_icon'] = ent.icon
     return field_dict
开发者ID:ekansa,项目名称:open-context-py,代码行数:27,代码来源:templating.py

示例3: get_cache_entity

# 需要导入模块: from opencontext_py.apps.entities.entity.models import Entity [as 别名]
# 或者: from opencontext_py.apps.entities.entity.models.Entity import get_icon [as 别名]
 def get_cache_entity(self, identifier, get_icon=False):
     """ gets an entity either from memory or
         from the database, if from the database, 
         cache the entity in memory to make lookups faster
     """
     output = False
     if identifier in self.mem_entities:
         # found in memory
         output = self.mem_entities[identifier]
     else:
         ent = Entity()
         ent.get_icon = get_icon
         found = ent.dereference(identifier)
         if found:
             self.mem_entities[identifier] = ent
             output = ent
     return output
开发者ID:ekansa,项目名称:open-context-py,代码行数:19,代码来源:templating.py

示例4: add_child_entity

# 需要导入模块: from opencontext_py.apps.entities.entity.models import Entity [as 别名]
# 或者: from opencontext_py.apps.entities.entity.models.Entity import get_icon [as 别名]
 def add_child_entity(self, child_id, children_dict):
     """ creates a child entity dictionary object if found
        in the dictionary object of children and
        if the child entity can be dereferenced
     """
     active_child = False
     if child_id in children_dict:
         active_child = LastUpdatedOrderedDict()
         ent = Entity()
         ent.get_icon = True
         found = ent.dereference(child_id)
         if found:
             active_child['label'] = ent.label
             active_child['id'] = child_id
             active_child['icon'] = ent.icon
             if children_dict[child_id] is not False:
                 active_child['children'] = []
                 for child_child_id in children_dict[child_id]:
                     child_child = self.add_child_entity(child_child_id,
                                                         children_dict)
                     if child_child is not False:
                         active_child['children'].append(child_child)
                 active_child['children'] = self.sort_children_by_label(active_child['children'])
     return active_child
开发者ID:ekansa,项目名称:open-context-py,代码行数:26,代码来源:templating.py


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