evermarkPanel.py (4315B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\wallet\panels\personal\evermarkPanel.py 2 import localization 3 from appConst import corpHeraldry 4 from carbonui import TextAlign, uiconst 5 from carbonui.control.tabGroup import GetTabData, TabGroup 6 from carbonui.primitives.container import Container 7 from carbonui.primitives.fill import Fill 8 from carbonui.primitives.flowcontainer import FlowContainer 9 from eve.client.script.ui.control.eveLabel import EveLabelLarge 10 from eve.client.script.ui.shared.agencyNew.contentGroups.contentGroupConst import contentGroupMissionAgentsHeraldry 11 from eve.client.script.ui.shared.agencyNew.ui.agencyWnd import AgencyWndNew 12 from eve.client.script.ui.shared.info.infoConst import TAB_STATIONS 13 from eve.client.script.ui.shared.neocom.wallet import walletConst 14 from eve.client.script.ui.shared.neocom.wallet.panels.personal.personalDonateEMPanel import PersonalDonateEMPanel 15 from eveui import Sprite 16 ACTIONS_PAD_TOP = 20 17 18 class EverMarkPanel(Container): 19 default_name = 'EverMarkPanel' 20 panelID = walletConst.PANEL_EVERMARKS 21 22 def ApplyAttributes(self, attributes): 23 super(EverMarkPanel, self).ApplyAttributes(attributes) 24 self.ConstructLayout() 25 26 def ConstructLayout(self): 27 self.overviewPanel = OverviewPanel(parent=self, state=uiconst.UI_HIDDEN) 28 self.donatePanel = PersonalDonateEMPanel(parent=self, state=uiconst.UI_HIDDEN) 29 tabs = (GetTabData(label=localization.GetByLabel('UI/Wallet/WalletWindow/TabOverview'), panel=self.overviewPanel, tabID=walletConst.PANEL_EM_BALANCE), GetTabData(label=localization.GetByLabel('UI/Wallet/WalletWindow/TabDonate'), panel=self.donatePanel, tabID=walletConst.PANEL_EM_DONATE)) 30 self.tabGroup = TabGroup(name='WalletPersonalEMTabGroup', parent=self, tabs=tabs, padBottom=16, groupID='WalletPersonalEMTabs', idx=0) 31 32 def CreateActions(self): 33 self.actions = EverMarkActions(parent=self, align=uiconst.TOTOP, top=ACTIONS_PAD_TOP) 34 35 36 class OverviewPanel(Container): 37 38 def __init__(self, **kwargs): 39 super(OverviewPanel, self).__init__(**kwargs) 40 self.CreateActions() 41 42 def CreateActions(self): 43 self.actions = EverMarkActions(parent=self, align=uiconst.TOTOP, top=ACTIONS_PAD_TOP) 44 45 46 class EverMarkActions(FlowContainer): 47 default_name = 'EvermarkActions' 48 49 def __init__(self, **kwargs): 50 super(EverMarkActions, self).__init__(centerContent=True, contentSpacing=(16, 16), **kwargs) 51 self.underlayColorHighlighted = (0.87, 0.61, 0.0, 0.2) 52 EverMarkAction(parent=self, align=uiconst.NOALIGN, texturePath='res:/ui/texture/WindowIcons/evermark_64px.png', text=localization.GetByLabel('UI/Wallet/WalletWindow/EverMarkEarn'), OnClick=self.OpenAgency, state=uiconst.UI_ACTIVE) 53 EverMarkAction(parent=self, align=uiconst.NOALIGN, texturePath='res:/ui/Texture/WindowIcons/lpstore.png', text=localization.GetByLabel('UI/Wallet/WalletWindow/EverMarkSpend'), OnClick=self.OpenCorpWindowOnStations, state=uiconst.UI_ACTIVE) 54 55 def OpenAgency(self, *args, **kwargs): 56 AgencyWndNew.OpenAndShowContentGroup(contentGroupMissionAgentsHeraldry) 57 58 def OpenCorpWindowOnStations(self, *args, **kwargs): 59 from inventorycommon import const as invconst 60 sm.GetService('info').ShowInfo(invconst.typeCorporation, corpHeraldry, selectTabType=TAB_STATIONS) 61 62 63 class EverMarkAction(Container): 64 default_height = 160 65 default_width = 128 66 contentSpacing = (16, 16) 67 underlayColorHighlighted = (0.87, 0.87, 0.87, 0.2) 68 69 def ApplyAttributes(self, attributes): 70 super(EverMarkAction, self).ApplyAttributes(attributes) 71 self.CreateUnderlay() 72 iconContainer = Container(parent=self, align=uiconst.TOTOP, height=64) 73 self.OnClick = attributes.OnClick 74 self.icon = Sprite(name='icon', parent=iconContainer, align=uiconst.CENTER, texturePath=attributes.texturePath, width=64, height=64, state=uiconst.UI_DISABLED) 75 textContainer = Container(parent=self, align=uiconst.TOALL) 76 EveLabelLarge(parent=textContainer, align=uiconst.TOALL, text=attributes.text, textAlign=TextAlign.CENTER, padding=(4, 4, 4, 4)) 77 78 def CreateUnderlay(self): 79 self.underlay = Fill(bgParent=self, color=self.underlayColorHighlighted)