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

lpStoreWindow.py (3411B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\station\loyaltyPointStore\lpStoreWindow.py
      2 from carbonui import uiconst
      3 from carbonui.control.window import Window
      4 from carbonui.primitives.container import Container
      5 from carbonui.control.tabGroup import TabGroup
      6 from carbonui.primitives.sprite import Sprite
      7 from cosmetics.common.cosmeticsConst import IsEmblemProviderCorp
      8 from eve.client.script.ui.station.loyaltyPointStore.lpStoreConst import FACTION_BACKGROUNDS
      9 from eve.client.script.ui.station.loyaltyPointStore.lpStoreFiltersWindow import LPStoreFiltersWindow
     10 from eve.client.script.ui.station.loyaltyPointStore.lpStorePanel import LPStorePanel
     11 from eve.client.script.ui.station.loyaltyPointStore.paragonLpStorePanel import ParagonLPStorePanel
     12 from eve.common.lib.appConst import corpHeraldry
     13 from npcs.npccorporations import get_corporation_faction_id
     14 
     15 class LPStoreWindow(Window):
     16     __guid__ = 'form.LPStore'
     17     default_windowID = 'lpstore'
     18     default_width = 837
     19     default_height = 580
     20     default_captionLabelPath = 'Tooltips/StationServices/LPStore'
     21     default_descriptionLabelPath = 'Tooltips/StationServices/LPStore_description'
     22     default_iconNum = 'res:/ui/Texture/WindowIcons/lpstore.png'
     23 
     24     def ApplyAttributes(self, attributes):
     25         super(LPStoreWindow, self).ApplyAttributes(attributes)
     26         self.corpIDs = attributes.corpIDs
     27         self.ConstructLayout()
     28         self.ConstructTabs()
     29         self.SetMinSize((self.default_width, 430))
     30 
     31     def SetFactionFlavour(self, factionID):
     32         if factionID in FACTION_BACKGROUNDS:
     33             self.factionFlavourSprite.SetTexturePath(FACTION_BACKGROUNDS[factionID])
     34             self.factionFlavourSprite.Show()
     35         else:
     36             self.factionFlavourSprite.Hide()
     37 
     38     def ConstructLayout(self):
     39         self.factionFlavourSprite = Sprite(parent=self.sr.underlay, align=uiconst.TOPLEFT, width=825, height=832, texturePath='')
     40 
     41     def ConstructTabs(self):
     42         self.panels = []
     43         if not self.corpIDs:
     44             return
     45         tabParent = Container(name='tabParent', parent=self.sr.main, align=uiconst.TOALL)
     46         self.tabGroups = TabGroup(name='tabparent', parent=tabParent, idx=0, groupID='lpStoreTab', callback=self._OnTabChanged)
     47         for corpID in self.corpIDs:
     48             if not IsEmblemProviderCorp(corpID):
     49                 panel = LPStorePanel(corpID=corpID, parent=tabParent, lpStoreWindow=self)
     50             else:
     51                 panel = ParagonLPStorePanel(corpID=corpID, parent=tabParent, lpStoreWindow=self, errorScreenPadding=self.sr.main.padding)
     52             self.panels.append(panel)
     53             corpName = cfg.eveowners.Get(corpID).ownerName
     54             self.tabGroups.AddTab(corpName, panel, tabParent)
     55 
     56         self.tabGroups.AutoSelect()
     57 
     58     def RefreshIfNotAlready(self):
     59         for t in self.panels:
     60             t.RefreshIfNotAlready()
     61 
     62     def RefreshOffers(self):
     63         for t in self.panels:
     64             t.RefreshOffers()
     65 
     66     def Refresh(self):
     67         for t in self.panels:
     68             t.Refresh()
     69 
     70     def _OnTabChanged(self, newTab, oldTab):
     71         panel = self.tabGroups.GetSelectedPanel()
     72         if panel and panel.corpID == corpHeraldry:
     73             self.factionFlavourSprite.Hide()
     74             LPStoreFiltersWindow.CloseIfOpen()
     75         else:
     76             self.SetFactionFlavour(get_corporation_faction_id(panel.corpID))