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

baseContentGroup.py (6228B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\agencyNew\contentGroups\baseContentGroup.py
      2 from eve.client.script.ui.shared.agencyNew.contentGroups import contentGroupConst
      3 from eve.client.script.ui.shared.agencyNew.contentGroups.contentGroupConst import contentGroupNameByID, contentGroupDescriptionByID, contentGroupsEnabledInWormholes
      4 from eve.client.script.ui.shared.agencyNew.ui.contentGroupPages.baseContentGroupPage import BaseContentGroupPage
      5 from eve.common.script.sys.idCheckers import IsKnownSpaceSystem
      6 import evelink
      7 from localization import GetByLabel
      8 
      9 class BaseContentGroup(object):
     10     contentGroupID = None
     11     childrenGroups = []
     12     parent = None
     13 
     14     def __init__(self, contentGroupID = None, itemID = None, parent = None):
     15         self.itemID = itemID
     16         self.parent = parent
     17         if self.contentGroupID is None:
     18             self.contentGroupID = contentGroupID
     19         self._children = []
     20         self.lastSelectedID = None
     21         self._ConstructChildrenGroups()
     22 
     23     def _ConstructChildrenGroups(self):
     24         if not self.childrenGroups:
     25             return
     26         for contentGroupID, contentGroupCls in self.childrenGroups:
     27             newGroup = contentGroupCls(contentGroupID=contentGroupID, parent=self)
     28             self._children.append(newGroup)
     29 
     30     @property
     31     def children(self):
     32         return self._children
     33 
     34     def GetChild(self, contentGroupID):
     35         for child in self.children:
     36             if child.contentGroupID == contentGroupID:
     37                 return child
     38 
     39     def GetName(self):
     40         name = contentGroupNameByID.get(self.GetNameKey(), None)
     41         if name:
     42             return GetByLabel(name)
     43 
     44     def GetInternalName(self):
     45         name = contentGroupNameByID.get(self.GetNameKey(), None)
     46         if name:
     47             return GetByLabel(name, languageID='en')
     48         return self.__class__.__name__
     49 
     50     def GetNameKey(self):
     51         return self.contentGroupID
     52 
     53     def GetDescription(self):
     54         description = contentGroupDescriptionByID.get(self.GetDescriptionKey(), None)
     55         if description:
     56             return GetByLabel(description)
     57 
     58     def GetDescriptionKey(self):
     59         return self.contentGroupID
     60 
     61     def GetNameWithLink(self, *args, **kwargs):
     62         return evelink.local_service_link(method='AgencyOpenAndShow', text=self.GetName(), contentGroupID=self.contentGroupID, itemID=self.itemID, **kwargs)
     63 
     64     def GetAncestorList(self):
     65         ret = []
     66         self.parent._GetAncestorList(ret)
     67         return ret
     68 
     69     def _GetAncestorList(self, breadcrumbs):
     70         if self.parent:
     71             self.parent._GetAncestorList(breadcrumbs)
     72         breadcrumbs.append(self)
     73 
     74     def GetID(self):
     75         return self.contentGroupID
     76 
     77     def GetParentID(self):
     78         if self.parent:
     79             return self.parent.contentGroupID
     80 
     81     def GetContentGroup(self, contentGroupID, itemID = None):
     82         if self.contentGroupID == contentGroupID and self.itemID == itemID:
     83             return self
     84         for child in self.children:
     85             contentGroup = child.GetContentGroup(contentGroupID, itemID)
     86             if contentGroup:
     87                 return contentGroup
     88 
     89     def GetDepthLevel(self):
     90         if not self.parent:
     91             return 0
     92         else:
     93             return self.parent.GetDepthLevel() + 1
     94 
     95     def GetLevel1Ancestor(self):
     96         if self.GetDepthLevel() <= 1:
     97             return self
     98         if self.parent:
     99             return self.parent.GetLevel1Ancestor()
    100 
    101     def IsNewContentAvailable(self):
    102         for child in self.children:
    103             if child.IsNewContentAvailable():
    104                 return True
    105 
    106         return False
    107 
    108     def GetContentType(self):
    109         return contentGroupConst.contentTypeByContentGroup.get(self.contentGroupID, None)
    110 
    111     def GetContentGroupHint(self):
    112         return GetByLabel(contentGroupConst.contentGroupHintByContentGroup.get(self.contentGroupID, None))
    113 
    114     def IsGroupContent(self):
    115         return self.contentGroupID in contentGroupConst.groupActivityContentGroups
    116 
    117     def GetContentPieces(self):
    118         contentProvider = self.GetContentProvider()
    119         if not contentProvider:
    120             return []
    121         return contentProvider.GetContentPieces()
    122 
    123     def GetContentProvider(self):
    124         return sm.GetService('agencyNew').GetContentProvider(self.contentGroupID)
    125 
    126     def ApplyDefaultFilters(self):
    127         contentProvider = self.GetContentProvider()
    128         if contentProvider:
    129             contentProvider.ApplyDefaultFilters()
    130 
    131     def GetChatChannelID(self):
    132         return contentGroupConst.chatChannelIDsByContentGroups.get(self.GetID(), None)
    133 
    134     def RemoveChild(self, child):
    135         if child in self.children:
    136             self.children.remove(child)
    137 
    138     def Close(self):
    139         if not self.parent:
    140             return
    141         self.parent.RemoveChild(self)
    142 
    143     def Flush(self):
    144         for child in self.children:
    145             child.Close()
    146 
    147         self._children = []
    148 
    149     def IsEnabled(self):
    150         if not IsKnownSpaceSystem(session.solarsystemid2):
    151             if self.GetID() not in contentGroupsEnabledInWormholes:
    152                 return False
    153         return True
    154 
    155     def IsVisible(self):
    156         return True
    157 
    158     def GetDisabledHint(self):
    159         return None
    160 
    161     def GetTimeRemaining(self):
    162         return None
    163 
    164     def IsBookmarkable(self):
    165         return self.contentGroupID not in contentGroupConst.contentGroupBookmarkableBlacklist
    166 
    167     def IsChildNewContentAvailable(self):
    168         for child in self.children:
    169             if child.IsNewContentAvailable() or child.IsChildNewContentAvailable():
    170                 return True
    171 
    172         return False
    173 
    174     def GetBackgroundTexture(self):
    175         return contentGroupConst.cardBackgroundByContentGroup.get(self.contentGroupID, '')
    176 
    177     @staticmethod
    178     def IsContentAvailable():
    179         return True
    180 
    181     @staticmethod
    182     def IsExternalGroup():
    183         return False
    184 
    185     @staticmethod
    186     def CanLoadAsLastActive():
    187         return True
    188 
    189     @staticmethod
    190     def CanLoadFromHistory():
    191         return True
    192 
    193     @staticmethod
    194     def GetContentPageClass():
    195         return BaseContentGroupPage
    196 
    197     @staticmethod
    198     def IsTabGroup():
    199         return False