conversationwindowunderlay.py (3064B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\conversations\ui\conversationwindowunderlay.py 2 import trinity 3 from carbonui import uiconst 4 from carbonui.primitives.container import Container 5 from carbonui.primitives.frame import Frame 6 from carbonui.primitives.sprite import Sprite 7 from carbonui.uicore import uicore 8 from conversations.ui.conversationwindowstyle import has_background_settings 9 from carbonui.window.underlay import BaseWindowUnderlay 10 11 class ConversationWindowUnderlay(BaseWindowUnderlay): 12 13 def ApplyAttributes(self, attributes): 14 super(ConversationWindowUnderlay, self).ApplyAttributes(attributes) 15 self.style = None 16 17 def ApplyStyle(self, style): 18 self.style = style 19 self.Flush() 20 if not has_background_settings(self.style): 21 return 22 self.add_styled_header_bar_background() 23 self.add_styled_background_glow() 24 self.add_styled_background() 25 26 def add_styled_header_bar_background(self): 27 styled_header_bar_background_container = Container(parent=self, align=uiconst.TOALL, name='styledHeaderBarBackgroundContainer') 28 Frame(bgParent=styled_header_bar_background_container, name='styledHeaderBarBackground', texturePath=self.style.header_bar_background_texture, cornerSize=self.style.header_bar_background_corner_size) 29 30 def add_styled_background(self): 31 styled_background_container = Container(parent=self, align=uiconst.TOALL, name='styledBackgroundContainer') 32 Frame(bgParent=styled_background_container, name='styledBackground', texturePath=self.style.background_texture, cornerSize=self.style.background_corner_size) 33 BlurredBackgroundSprite(bgParent=styled_background_container, name='styledBackgroundBlur', color=self.style.background_blur_color, align=uiconst.TOALL) 34 35 def add_styled_background_glow(self): 36 outer_padding = self.style.background_glow_outer_padding 37 styled_background_glow_container = Container(parent=self, align=uiconst.TOALL, name='styledBackgroundGlowContainer', padding=-outer_padding) 38 Frame(bgParent=styled_background_glow_container, name='auraStyleBackgroundGlow', align=uiconst.TOALL, texturePath=self.style.background_glow_texture, cornerSize=self.style.background_glow_corner_size, blendMode=trinity.TR2_SBM_ADD) 39 40 41 class BlurredBackgroundSprite(Sprite): 42 __notifyevents__ = ['OnBlurredBufferCreated'] 43 default_name = 'BlurredBackgroundSprite' 44 default_state = uiconst.UI_DISABLED 45 default_spriteEffect = trinity.TR2_SFX_BLURBACKGROUND 46 47 def ApplyAttributes(self, attributes): 48 Sprite.ApplyAttributes(self, attributes) 49 sm.RegisterNotify(self) 50 if uicore.uilib.blurredBackBufferAtlas: 51 self.texture.atlasTexture = uicore.uilib.blurredBackBufferAtlas 52 trinity.device.RegisterResource(self) 53 54 def OnCreate(self, *args): 55 pass 56 57 def OnBlurredBufferCreated(self, *args): 58 if not self.destroyed: 59 self.texture.atlasTexture = uicore.uilib.blurredBackBufferAtlas