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

officeEntry.py (4913B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\dockedUI\officeEntry.py
      2 import carbonui.const as uiconst
      3 import uthread
      4 from carbonui.control.scrollentries import SE_BaseClassCore
      5 from carbonui.primitives.container import Container
      6 from carbonui.button.group import ButtonGroup
      7 from carbonui.text.styles import TextHeader, TextBody
      8 from carbonui.text.color import TextColor
      9 from eve.client.script.ui.control.eveLabel import EveLabelSmall, EveLabelMedium
     10 from eve.client.script.ui.control.infoIcon import InfoIcon
     11 from eve.client.script.ui.shared.neocom.corporation import corpUISignals
     12 from eve.client.script.ui.shared.neocom.corporation.brand_management.color_palette.corp_color_banner import CorpColorBannerWithLogo, CornerSize, BackgroundStyle
     13 from inventorycommon.util import IsNPC
     14 from localization import GetByLabel
     15 ICON_SIZE = 64
     16 ENTRY_PAD_TOP = 6
     17 
     18 class OfficeEntry(SE_BaseClassCore):
     19     __guid__ = 'listentry.OfficeEntry'
     20     default_showHilite = False
     21 
     22     def __init__(self, **kwargs):
     23         super(OfficeEntry, self).__init__(**kwargs)
     24         self.connect_signals()
     25 
     26     def __del__(self):
     27         self.disconnect_signals()
     28 
     29     def connect_signals(self):
     30         corpUISignals.on_corporation_application_changed.connect(self.OnCorpApplicationChanged)
     31 
     32     def disconnect_signals(self):
     33         corpUISignals.on_corporation_application_changed.disconnect(self.OnCorpApplicationChanged)
     34 
     35     def Startup(self, *args):
     36         self.Flush()
     37         self.ConstructLayout()
     38 
     39     def ConstructLayout(self):
     40         self.mainCont = Container(name='mainCont', parent=self, align=uiconst.TOALL, padTop=ENTRY_PAD_TOP)
     41         self.infoIcon = InfoIcon(name='ShowInfoButton', parent=Container(name='showInfoContainer', parent=self.mainCont, align=uiconst.TORIGHT, width=16, left=5), align=uiconst.TOTOP, top=5, hint=GetByLabel('UI/Station/Lobby/CorpShowInfoButton'))
     42         self.iconContainer = Container(name='iconCont', parent=self.mainCont, align=uiconst.TOLEFT, width=84, padding=(0, 0, 0, 0))
     43         self.corpNameContainer = Container(name='corpNameCont', parent=self.mainCont, state=uiconst.UI_NORMAL, align=uiconst.TOTOP, padding=(6, 4, 0, 0), height=40)
     44         self.corpNameText = TextHeader(parent=self.corpNameContainer, align=uiconst.CENTERLEFT, color=TextColor.NORMAL, autoFadeSides=20)
     45         self.buttonCnt = Container(name='ButtonContainer', parent=self.mainCont, align=uiconst.TOLEFT, width=128, padding=(6, -12, 0, 0), state=uiconst.UI_PICKCHILDREN)
     46         self.corpBannerContainer = Container(name='bannerContainer', parent=self, align=uiconst.TOALL, padTop=ENTRY_PAD_TOP)
     47 
     48     def Load(self, node):
     49         self.sr.node = node
     50         data = node
     51         self.infoIcon.UpdateInfoLink(const.typeCorporation, data.corpID)
     52         self.corpNameText.text = data.Get('corpName', '')
     53         uthread.new(self.SetLogoIcon, data)
     54         self.MakeButtonsFromNode(node)
     55 
     56     def SetLogoIcon(self, data):
     57         if not self.destroyed:
     58             self.CorpBanner = CorpColorBannerWithLogo(parent=self.corpBannerContainer, corp_id=data.corpID, corner_size=CornerSize.Small, background_style=BackgroundStyle.Transparent, logo_parent=self.iconContainer, logo_align=uiconst.CENTER)
     59             self.CorpBanner.corp_icon.pos = (0,
     60              0,
     61              ICON_SIZE,
     62              ICON_SIZE)
     63 
     64     def GetHeight(self, *args):
     65         node, width = args
     66         lw, lh = EveLabelSmall.MeasureTextSize(text=GetByLabel('UI/Station/Lobby/CorpName'), width=width)
     67         tw, th = EveLabelMedium.MeasureTextSize(text=node.corpName, width=width)
     68         multiplier = 1
     69         height = 2
     70         height += (lh + th + 15) * multiplier
     71         height += 8
     72         if not IsNPC(node.corpID):
     73             height += 31
     74         node.height = height
     75         return node.height
     76 
     77     def MakeButtonsFromNode(self, node):
     78         self.buttonCnt.Flush()
     79         if not IsNPC(node.corpID):
     80             buttonEntries = []
     81             if session.corpid != node.corpID:
     82                 if sm.GetService('corp').GetActiveApplication(node.corpID) is not None:
     83                     applyLabel = GetByLabel('UI/Corporations/CorpApplications/ViewApplication')
     84                 else:
     85                     applyLabel = GetByLabel('UI/Corporations/CorporationWindow/Alliances/Rankings/ApplyToJoin')
     86                 buttonEntries.append((applyLabel,
     87                  sm.GetService('corp').ApplyForMembership,
     88                  (node.corpID,),
     89                  80))
     90             if len(buttonEntries) > 0:
     91                 self.buttonsGroup = ButtonGroup(btns=buttonEntries, parent=self.buttonCnt)
     92                 self.buttonsGroup.align = uiconst.CENTERLEFT
     93 
     94     def OnCorpApplicationChanged(self, corpID, applicantID, applicationID, newApplication):
     95         if applicantID == session.charid and corpID == self.sr.node.corpID:
     96             self.MakeButtonsFromNode(self.sr.node)