NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

ui_annotations.py (1573B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\achievement_system\client\model\definition\category\ui_annotations.py
      2 from achievement_system.client.api.error import UnsupportedTypeError
      3 from itertoolsext.Enum import Enum
      4 CUSTOM_UI_CLASS_TEMPLATE_KEY = 'custom_ui_class'
      5 OVERVIEW_FEATURE_PRIORITY_KEY = 'overview_feature_priority'
      6 CAMPAIGN_FACTION_STYLE_KEY = 'campaign_faction_style'
      7 
      8 @Enum
      9 
     10 class CustomUiClassType(object):
     11     MILITARY_CAMPAIGNS = 'MILITARY_CAMPAIGNS'
     12 
     13 
     14 @Enum
     15 
     16 class CampaignFactionStyle(object):
     17     AMARR = 'AMARR'
     18     CALDARI = 'CALDARI'
     19     GALLENTE = 'GALLENTE'
     20     MINMATAR = 'MINMATAR'
     21 
     22 
     23 def get_custom_ui_class_from_annotation(annotation_value):
     24     if annotation_value is None:
     25         return
     26     if annotation_value == 'military_campaigns':
     27         return CustomUiClassType.MILITARY_CAMPAIGNS
     28     raise UnsupportedTypeError
     29 
     30 
     31 def get_campaign_faction_style_from_annotation(annotation_value):
     32     if annotation_value is None:
     33         return
     34     if annotation_value == 'amarr':
     35         return CampaignFactionStyle.AMARR
     36     if annotation_value == 'caldari':
     37         return CampaignFactionStyle.CALDARI
     38     if annotation_value == 'gallente':
     39         return CampaignFactionStyle.GALLENTE
     40     if annotation_value == 'minmatar':
     41         return CampaignFactionStyle.MINMATAR
     42     raise UnsupportedTypeError
     43 
     44 
     45 def get_overview_feature_priority_from_annotation(annotation_value):
     46     if annotation_value is None:
     47         return 0
     48     try:
     49         return int(annotation_value)
     50     except ValueError:
     51         return 0