logoGroups.py (4163B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fittingScreen\cosmetics\logoGroups.py 2 import evelink 3 import localization 4 from carbonui import const as uiconst 5 from carbonui.primitives.containerAutoSize import ContainerAutoSize 6 from eve.client.script.ui.control.eveLabel import EveLabelMedium 7 from eve.client.script.ui.control.infoNotice import InfoNotice 8 from eve.client.script.ui.shared.agencyNew.contentGroups import contentGroupConst as agencyContentGroupConst 9 from eve.client.script.ui.shared.fittingScreen.cosmetics.logoEntries import AllianceLogoEntry, CorporationLogoEntry, FRAME_PADDING 10 from localization import GetByLabel 11 12 class LogoGroup(ContainerAutoSize): 13 default_labelText = '' 14 default_padLeft = 8 15 default_padRight = 16 16 default_padBottom = 18 17 18 def ApplyAttributes(self, attributes): 19 super(LogoGroup, self).ApplyAttributes(attributes) 20 self.labelText = attributes.get('labelText', self.default_labelText) 21 self._errorCallback = attributes.errorCallback 22 self.ConstructLayout() 23 24 def ConstructLayout(self): 25 self.label = EveLabelMedium(name='label', parent=self, align=uiconst.TOTOP, text=self.labelText, padding=(FRAME_PADDING, 26 0, 27 FRAME_PADDING, 28 10), opacity=0.7) 29 self.notice = InfoNotice(name='notice', parent=self, align=uiconst.TOTOP, padding=(FRAME_PADDING, 30 0, 31 FRAME_PADDING, 32 0), display=False) 33 self.entryContainer = ContainerAutoSize(name='entryContainer', parent=self, align=uiconst.TOTOP, padding=(FRAME_PADDING, 34 0, 35 FRAME_PADDING, 36 0)) 37 38 def UpdateLayout(self, logoData): 39 pass 40 41 def _GetEmblemNotPurchasedText(self): 42 link = evelink.local_service_link(text=localization.GetByLabel('UI/Agents/ParagonAgent'), method='AgencyOpenAndShow', contentGroupID=agencyContentGroupConst.contentGroupMissionAgentsHeraldry) 43 return GetByLabel('UI/ShipCosmetics/EmblemNotPurchased', link=link) 44 45 46 class AllianceLogoGroup(LogoGroup): 47 default_labelText = GetByLabel('UI/ShipCosmetics/AvailableAllianceEmblems') 48 49 def ConstructLayout(self): 50 super(AllianceLogoGroup, self).ConstructLayout() 51 self.entry = AllianceLogoEntry(parent=self.entryContainer, align=uiconst.TOTOP, errorCallback=self._errorCallback) 52 53 def UpdateLayout(self, logoData): 54 super(AllianceLogoGroup, self).UpdateLayout(logoData) 55 self.notice.display = self.UpdateNotice(logoData) 56 self.entry.logoData = logoData 57 58 def UpdateNotice(self, logoData): 59 if not logoData.existence.alliance: 60 self.notice.labelText = GetByLabel('UI/ShipCosmetics/EmblemNotReleased') 61 return True 62 if session.allianceid: 63 if not logoData.eligibility.alliance: 64 self.notice.labelText = self._GetEmblemNotPurchasedText() 65 return True 66 else: 67 if logoData.eligibility.alliance: 68 self.notice.labelText = GetByLabel('UI/ShipCosmetics/EmblemNoAllianceEligible') 69 else: 70 self.notice.labelText = GetByLabel('UI/ShipCosmetics/EmblemNoAllianceNotEligible') 71 return True 72 return False 73 74 75 class CorporationLogoGroup(LogoGroup): 76 default_labelText = (GetByLabel('UI/ShipCosmetics/AvailableCorporationEmblems'),) 77 78 def ConstructLayout(self): 79 super(CorporationLogoGroup, self).ConstructLayout() 80 self.entry = CorporationLogoEntry(parent=self.entryContainer, align=uiconst.TOTOP, errorCallback=self._errorCallback) 81 82 def UpdateLayout(self, logoData): 83 super(CorporationLogoGroup, self).UpdateLayout(logoData) 84 self.notice.display = self.UpdateNotice(logoData) 85 self.entry.logoData = logoData 86 87 def UpdateNotice(self, logoData): 88 if not logoData.existence.corporation: 89 self.notice.labelText = GetByLabel('UI/ShipCosmetics/EmblemNotReleased') 90 return True 91 if not logoData.eligibility.corporation: 92 self.notice.labelText = self._GetEmblemNotPurchasedText() 93 return True 94 return False