skinBrowser.py (6640B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\cosmetics\ship\pages\store\skinBrowser.py 2 import carbonui.text.styles 3 from eve.client.script.ui.cosmetics.ship.pages.store.sections.activeShip import ViewAllSkinsActiveShipSectionContainer, ActiveShipSectionContainer 4 import carbonui 5 from carbonui import Align 6 from carbonui.control.scrollContainer import ScrollContainer 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 from carbonui.uianimations import animations 9 from cosmetics.client.shipSkinTradingSvc import get_ship_skin_trading_svc 10 from cosmetics.client.ships.feature_flag import are_skin_hub_offers_enabled 11 from cosmetics.client.ships.skins.live_data import current_skin_design 12 from cosmetics.client.ships.skins.static_data.store_section import StoreSection 13 from eve.client.script.ui.cosmetics.ship.pages.store import storeSettings 14 from eve.client.script.ui.cosmetics.ship.pages.store.sections.allListings import ViewAllSkinsSectionContainer, ViewLinkedListingAndAllSkinsSectionContainer, AllSkinsSectionContainer 15 from eve.client.script.ui.cosmetics.ship.pages.store.sections.alliance import AllianceListingsSectionContainer, ViewAllAllianceSkinsSectionContainer 16 from eve.client.script.ui.cosmetics.ship.pages.store.sections.corp import CorpListingsSectionContainer, ViewAllCorpSkinsSectionContainer 17 from eve.client.script.ui.cosmetics.ship.pages.store.sections.emphasizedShip import ViewAllSkinsEmphasizedShipSectionContainer, EmphasizedShipSectionContainer 18 from eve.client.script.ui.cosmetics.ship.pages.store.sections.myListings import ListedByMeSectionContainer, ViewAllSkinsListedByMeSectionContainer 19 from eve.client.script.ui.cosmetics.ship.pages.store.sections.targetedAtMe import StoreViewAllSkinListingsTargetedAtMeSectionContainer, StoreSkinListingsTargetedAtMeSectionContainer 20 from localization import GetByLabel 21 22 class OffersDisabledPanel(ContainerAutoSize): 23 default_padTop = 128 24 25 def __init__(self, **kw): 26 super(OffersDisabledPanel, self).__init__(**kw) 27 textCont = ContainerAutoSize(parent=self, align=Align.CENTERTOP, width=450) 28 carbonui.text.styles.TextHeader(parent=textCont, align=Align.TOTOP, padTop=32, text=GetByLabel('UI/Personalization/ShipSkins/SKINR/Store/SKINOffersDisabled')) 29 30 31 class SkinBrowser(ScrollContainer): 32 __notifyevents__ = ['OnSessionChanged'] 33 34 def __init__(self, **kw): 35 super(SkinBrowser, self).__init__(**kw) 36 self.is_loaded = False 37 sm.RegisterNotify(self) 38 39 def Close(self, *args): 40 try: 41 sm.UnregisterNotify(self) 42 finally: 43 super(SkinBrowser, self).Close() 44 45 def LoadPanel(self, section_id = None, linked_listing = None): 46 self.Flush() 47 self.opacity = 0.0 48 self.StopAnimations() 49 if not are_skin_hub_offers_enabled(): 50 OffersDisabledPanel(parent=self, align=Align.TOTOP) 51 elif section_id == StoreSection.SKINS_ALL: 52 self.construct_view_all_skins_section() 53 elif section_id == StoreSection.SKINS_ACTIVE_SHIP: 54 self.construct_view_all_for_active_ship_section() 55 elif section_id == StoreSection.SKINS_EMPHASIZED_SHIP: 56 self.construct_view_all_for_emphasized_ship_section() 57 elif section_id == StoreSection.SKINS_MY_LISTINGS: 58 self.construct_view_all_my_listings_sections() 59 elif section_id == StoreSection.SKINS_LINKED_LISTING_AND_ALL: 60 self.construct_linked_listing_and_view_all_skins_sections(linked_listing) 61 elif section_id == StoreSection.SKINS_CORP: 62 self.construct_view_all_corp_section() 63 elif section_id == StoreSection.SKINS_ALLIANCE: 64 self.construct_view_all_alliance_section() 65 elif section_id == StoreSection.SKINS_TARGETED_AT_ME: 66 self.construct_targeted_at_me_section() 67 else: 68 self.construct_landing_page() 69 self.appear() 70 71 def construct_targeted_at_me_section(self): 72 self.Flush() 73 StoreViewAllSkinListingsTargetedAtMeSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 74 75 def construct_view_all_for_active_ship_section(self): 76 self.Flush() 77 ViewAllSkinsActiveShipSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 78 79 def construct_view_all_for_emphasized_ship_section(self): 80 self.Flush() 81 ViewAllSkinsEmphasizedShipSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 82 83 def construct_view_all_my_listings_sections(self): 84 self.Flush() 85 ViewAllSkinsListedByMeSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 86 87 def construct_view_all_skins_section(self): 88 self.Flush() 89 ViewAllSkinsSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 90 91 def construct_linked_listing_and_view_all_skins_sections(self, linked_listing = None): 92 self.Flush() 93 ViewLinkedListingAndAllSkinsSectionContainer(parent=self, align=Align.TOTOP, padTop=32, linked_listing=linked_listing) 94 95 def construct_view_all_corp_section(self): 96 self.Flush() 97 ViewAllCorpSkinsSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 98 99 def construct_view_all_alliance_section(self): 100 self.Flush() 101 ViewAllAllianceSkinsSectionContainer(parent=self, align=Align.TOTOP, padTop=32) 102 103 def construct_landing_page(self): 104 self.Flush() 105 emphasized_ship_id = storeSettings.emphasized_ship_type_id.get() 106 if emphasized_ship_id and emphasized_ship_id != current_skin_design.get_default_ship_type_id(): 107 EmphasizedShipSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 108 ActiveShipSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 109 AllSkinsSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 110 CorpListingsSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 111 if session.allianceid: 112 AllianceListingsSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 113 StoreSkinListingsTargetedAtMeSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 114 if get_ship_skin_trading_svc().get_owned_listings(): 115 ListedByMeSectionContainer(parent=self, align=Align.TOTOP, single_row=True, padTop=32) 116 117 def appear(self): 118 animations.FadeTo(self, 0.0, 1.0, duration=0.3) 119 120 def OnSessionChanged(self, isRemote, session, change): 121 if 'corprole' in change or 'corpid' in change or 'allianceid' in change: 122 self.LoadPanel()