def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.controller = attributes.controller self.btnID = attributes.Get('btnID', None) self.panel = attributes.Get('panel', None) self.colorSelected = attributes.Get('colorSelected', self.default_colorSelected) label = attributes.Get('label', None) iconPath = attributes.Get('iconPath', None) iconSize = attributes.Get('iconSize', None) iconSize = iconSize or self.default_iconSize self.hint = attributes.Get('hint', None) self.isSelected = False self.isDisabled = attributes.Get('isDisabled', False) if iconPath: self.icon = GlowSprite(parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=iconSize, height=iconSize, texturePath=iconPath, iconOpacity=0.75, color=Color.WHITE) self.label = None else: self.label = LabelUnderlay(text=label, parent=self, align=uiconst.CENTER, fontsize=10) self.icon = None self.selectedBG = RaisedUnderlay(bgParent=self, color=self.colorSelected, isGlowEdgeRotated=True) if self.isDisabled: self.SetDisabled()
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) self.btnData = attributes.btnData self.btnNum = attributes.btnNum self.width = attributes.width self._isDraggable = attributes.get('isDraggable', self.default_isDraggable) self._openNeocomPanel = None self.height = self.width self.top = self.height * self.btnNum self.panel = None self.blinkThread = None self.realTop = self.top self.dragEventCookie = None self.disableClick = False self.iconSize = self.height - 2 * self.PADVERTICAL self.iconTransform = uiprimitives.Transform(name='iconTransform', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5)) self.iconLabelCont = None if self.btnData.id == 'map_beta': Sprite(parent=self.iconTransform, align=uiconst.TOPLEFT, pos=(0, 0, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED) self.icon = GlowSprite(parent=self.iconTransform, name='icon', state=uiconst.UI_DISABLED, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, iconOpacity=1.0) self.UpdateIcon() PAD = 1 self.blinkSprite = SpriteUnderlay(bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonBlink.png', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.activeFrame = FrameUnderlay(bgParent=self, name='hoverFill', texturePath='res:/UI/Texture/classes/Neocom/buttonActive.png', cornerSize=5, state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.CheckIfActive() self.dropFrame = uicontrols.Frame(parent=self, name='hoverFrame', color=util.Color.GetGrayRGBA(1.0, 0.5), state=uiconst.UI_HIDDEN) sm.RegisterNotify(self)
def Prepare_Triangle_(self, *args): self.triangle = GlowSprite( parent=self, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, idx=0, texturePath='res:/UI/Texture/Icons/1_16_14.png', pos=(0, 0, 16, 16))
def AddIcon(self, parent, iconOpacity, iconPath, iconSize): self.icon = GlowSprite(parent=parent, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=iconSize, height=iconSize, texturePath=iconPath, iconOpacity=iconOpacity, color=Color.GRAY6)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.achievementGroupID = attributes.achievementGroupID self.hexGridPosition = attributes.hexGridPosition self.nameLabel = InfoPanelLabel(parent=self.parent, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, idx=0) self.stateSprite = GlowSprite(parent=self, pos=(0, 0, 20, 20), align=uiconst.CENTER, state=uiconst.UI_DISABLED) self.activeEffectSprite = SpriteThemeColored(parent=self, state=uiconst.UI_DISABLED, spriteEffect=trinity.TR2_SFX_MODULATE, blendMode=trinity.TR2_SBM_ADDX2, texturePath='res:/UI/Texture/classes/Achievements/hexPingGlow.png', textureSecondaryPath='res:/UI/Texture/classes/Achievements/hexPingMask.png', pos=(0, 0, 300, 300), align=uiconst.CENTER, opacity=0.0) self.activeStateSprite = SpriteThemeColored(parent=self, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Achievements/hexActive.png', pos=(0, 0, 200, 200), align=uiconst.CENTER, opacity=0.0, blendMode=trinity.TR2_SBM_ADDX2, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.backgroundSprite = SpriteThemeColored(bgParent=self, texturePath='res:/UI/Texture/classes/Achievements/hexBackIncomplete.png', colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.5) self.UpdateGroupState()
def ConstructIcon(self): self.icon = GlowSprite(name='icon', parent=self, align=uiconst.CENTERTOP, width=self.iconSize, height=self.iconSize, texturePath=self.texturePath, state=uiconst.UI_DISABLED, color=self.iconColor, rotation=self.rotation)
def ConstructIcon(self): self.icon = GlowSprite(name='icon', parent=self, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, texturePath=self.texturePath, state=uiconst.UI_DISABLED, color=self.iconColor, iconOpacity=0.5, gradientStrength=0.5, rotation=self.rotation)
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.btnData = attributes.btnData if hasattr(self.btnData, 'panelEntryHeight'): self.height = self.btnData.panelEntryHeight self.blinkThread = None self._openNeocomPanel = None self.main = uiprimitives.Container(parent=self, name='main') self.hoverBG = uicontrols.Frame( bgParent=self.main, texturePath='res:/UI/Texture/classes/Neocom/panelEntryBG.png', opacity=0.0) if self.btnData.id == 'map_beta' and IsMapBetaEnabled(): Sprite(parent=self.main, align=uiconst.TOPLEFT, pos=(10, 2, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED) size = self.height - 4 self.icon = GlowSprite(parent=self.main, name='icon', state=uiconst.UI_DISABLED, texturePath=self.GetIconPath(), pos=(10, 2, size, size), iconOpacity=0.75) self.label = uicontrols.Label(parent=self.main, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, text=self.GetLabel(), autowidth=True, autoheight=True, left=self.icon.left + self.icon.width + 8) if settings.char.ui.Get('neocomAlign', uiconst.TOLEFT) == uiconst.TOLEFT: rotation = 0.0 else: rotation = math.pi self.expanderIcon = uicontrols.Icon(parent=self, name='expanderIcon', align=uiconst.CENTERRIGHT, left=10, icon='ui_38_16_228', rotation=rotation) self.SetExpanderState() self.blinkSprite = uiprimitives.Sprite( bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/panelEntryBG.png', state=uiconst.UI_HIDDEN, opacity=1.0)
def Prepare_(self): self.sr.label = LabelUnderlay( parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=1.0, fontsize=10) self.glowLabel = LabelUnderlay(name='glowLabel', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, opacity=0.0, color=self.color, fontsize=10) self.glowLabel.renderObject.spriteEffect = trinity.TR2_SFX_BLUR if self.iconPath is not None: if self.iconSize: width = self.iconSize height = self.iconSize else: width = height = min(self.width, self.height) self.icon = GlowSprite(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTER, pos=(0, 0, width, height), texturePath=self.iconPath, color=self.color, iconOpacity=0.75) self.sr.label.state = uiconst.UI_HIDDEN self.width = width + 4 self.height = height + 4 else: self.icon = None self.sr.hilite = Fill(bgParent=self, color=(0.7, 0.7, 0.7, 0.5), state=uiconst.UI_HIDDEN) self.sr.activeframe = FrameUnderlay( parent=self, name='activeline', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.1) self.underlay = RaisedUnderlay(name='backgroundFrame', bgParent=self, state=uiconst.UI_DISABLED, color=self.color)
def ApplyAttributes(self, attributes): LayoutGrid.ApplyAttributes(self, attributes) EveLabelSmall(text=GetByLabel('Achievements/UI/active'), parent=self, align=uiconst.CENTERRIGHT) activeEffectSprite = SpriteThemeColored(parent=self, state=uiconst.UI_DISABLED, blendMode=trinity.TR2_SBM_ADDX2, texturePath='res:/UI/Texture/classes/Achievements/iconActiveLegend.png', pos=(0, 0, 20, 20)) iconMap = [(GetByLabel('Achievements/UI/incomplete'), 'res:/UI/Texture/classes/Achievements/iconIncomplete.png'), (GetByLabel('Achievements/UI/partial'), 'res:/UI/Texture/classes/Achievements/iconPartial.png'), (GetByLabel('Achievements/UI/complete'), 'res:/UI/Texture/classes/Achievements/iconComplete.png')] for label, texturePath in iconMap: EveLabelSmall(text=label, parent=self, align=uiconst.CENTERRIGHT) GlowSprite(texturePath=texturePath, parent=self, pos=(0, 0, 20, 20))
def Prepare_(self, icon=None): opacity = 0.2 if self.disabled else 1.0 self.icon = GlowSprite(parent=self, align=uiconst.TOALL, texturePath=icon, state=uiconst.UI_DISABLED, opacity=opacity, iconOpacity=1.0) self.sr.fill = uiprimitives.Fill(parent=self, state=uiconst.UI_HIDDEN)
def ApplyAttributes(self, attributes): if attributes.isCapital: attributes.texturePath = 'res:/ui/Texture/classes/Sov/CapitalStarSelection20.png' attributes.hint = GetByLabel('UI/Sovereignty/CurrentCapital') else: attributes.texturePath = 'res:/UI/Texture/classes/Sov/selectCapitalButton20.png' attributes.hint = GetByLabel('UI/Sovereignty/SetAsCapital') GlowSprite.ApplyAttributes(self, attributes) self.isCapital = attributes.isCapital self.solarSystemID = attributes.solarSystemID
def Prepare_Expander_(self): self.sr.expanderParent = Container(parent=self.sr.content, align=uiconst.TORIGHT, pos=(0, 0, 16, 0), idx=0, state=uiconst.UI_DISABLED, name='__expanderParent') self.sr.expander = GlowSprite( parent=self.sr.expanderParent, align=uiconst.CENTER, texturePath='res:/UI/Texture/Icons/1_16_129.png', pos=(1, -1, 16, 16))
def Prepare_(self): self.sr.label = LabelThemeColored( parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=OPACITY_LABEL_IDLE, fontsize=10) if self.iconPath is not None: if self.iconSize: width = self.iconSize height = self.iconSize else: width = height = min(self.width, self.height) self.icon = GlowSprite(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTER, pos=(0, 0, width, height), texturePath=self.iconPath, color=self.color, iconOpacity=0.75) self.sr.label.state = uiconst.UI_HIDDEN self.width = width + 4 self.height = height + 4 else: self.icon = None self.sr.hilite = Fill(bgParent=self, color=(0.7, 0.7, 0.7, 0.5), state=uiconst.UI_HIDDEN) self.sr.activeframe = FrameThemeColored( parent=self, name='activeline', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.1) self.underlay = RaisedUnderlay(name='backgroundFrame', bgParent=self, state=uiconst.UI_DISABLED, color=self.color)
def ApplyAttributes(self, attributes): TextButton.ApplyAttributes(self, attributes) size = attributes.iconSize self.icon = GlowSprite(texturePath=attributes.texturePath, width=size, height=size, parent=self, state=uiconst.UI_DISABLED, iconOpacity=0.5, gradientStrength=0.5) self.label.left += self.icon.width + 2 self.width += self.icon.width + 2 self.height = max(self.height, self.icon.height)
def Startup(self, *etc): self.sr.expander = GlowSprite(parent=self, pos=(3, 0, 16, 16), name='expander', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/expanderDown.png', align=uiconst.CENTERLEFT) self.sr.expander.OnClick = self.Toggle self.sr.icon = uicontrols.Icon(parent=self, pos=(4, 0, 16, 16), name='icon', state=uiconst.UI_DISABLED, icon='ui_22_32_28', align=uiconst.CENTERLEFT, ignoreSize=True) self.sr.labelClipper = uiprimitives.Container(parent=self, name='labelClipper', align=uiconst.TOALL, pos=(0, 0, const.defaultPadding, 0), clipChildren=1) self.sr.labelClipper.OnClick = self.OnClick self.sr.labelClipper.GetMenu = self.GetMenu self.sr.label = uicontrols.EveLabelMedium(text='', parent=self.sr.labelClipper, left=5, state=uiconst.UI_DISABLED, maxLines=1, align=uiconst.CENTERLEFT) if self.sr.node.sublevel > 0: self.sr.fill = None else: self.sr.fill = FillThemeColored(parent=self, padding=(1, 0, 1, 1), colorType=uiconst.COLORTYPE_UIHEADER, opacity=0.15) mainLinePar = uiprimitives.Container(parent=self, name='mainLinePar', align=uiconst.TOALL, idx=0, pos=(0, 0, 0, 0), state=uiconst.UI_DISABLED)
def ApplyAttributes(self, attributes): WrapperButton.ApplyAttributes(self, attributes) self.btnData = attributes.btnData GlowSprite(parent=self, name='EVEMenuIcon', align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Icons/79_64_11.png', width=20, height=20, idx=0) SpriteThemeColored( bgParent=self, align=uiconst.TOALL, texturePath='res:/UI/Texture/classes/Neocom/panelEntryBG.png', colorType=uiconst.COLORTYPE_UIHILIGHT)
def ApplyAttributes(self, attributes): LayoutGrid.ApplyAttributes(self, attributes) iconMap = [ (GetByLabel('Achievements/UI/active'), 'res:/UI/Texture/classes/Achievements/iconActiveLegend.png'), (GetByLabel('Achievements/UI/incomplete'), 'res:/UI/Texture/classes/Achievements/iconIncomplete.png'), (GetByLabel('Achievements/UI/partial'), 'res:/UI/Texture/classes/Achievements/iconPartial.png'), (GetByLabel('Achievements/UI/complete'), 'res:/UI/Texture/classes/Achievements/iconComplete.png') ] for label, texturePath in iconMap: EveLabelSmall(text=label, parent=self, align=uiconst.CENTERRIGHT) GlowSprite(texturePath=texturePath, parent=self, pos=(0, 0, 20, 20))
def Prepare_Layout(self): self.sr.headerParent = uiprimitives.Container( parent=self.sr.maincontainer, name='headerParent', align=uiconst.TOTOP, pos=(0, 0, 0, 22)) self.sr.topParent = uiprimitives.Container( parent=self.sr.maincontainer, name='topParent', align=uiconst.TOTOP, clipChildren=True) self.sr.mainIcon = GlowSprite(parent=self.sr.topParent, name='mainicon', pos=(0, 0, 64, 64), state=uiconst.UI_HIDDEN) self.sr.main = uiprimitives.Container(parent=self.sr.maincontainer, name='main', align=uiconst.TOALL) self.SetTopparentHeight(self.topParentHeight)
class DeltaContainer(ButtonIcon): __guid__ = 'uicls.DeltaContainer' default_height = 24 def ApplyAttributes(self, attributes): ButtonIcon.ApplyAttributes(self, attributes) delta = attributes.delta self.deltaText = Label(parent=self, align=uiconst.CENTER, fontsize=9, top=2) self.UpdateDelta(delta) def ConstructIcon(self): self.icon = GlowSprite(name='icon', parent=self, align=uiconst.CENTERTOP, width=self.iconSize, height=self.iconSize, texturePath=self.texturePath, state=uiconst.UI_DISABLED, color=self.iconColor, rotation=self.rotation) def UpdateDelta(self, delta): deltaText = self.GetDeltaText(delta) if delta > 0: self.deltaText.text = deltaText self.deltaText.align = uiconst.CENTERBOTTOM self.icon.align = uiconst.CENTERTOP texturePath = 'res:/UI/Texture/classes/MultiSell/up.png' elif delta < 0: self.deltaText.text = deltaText self.deltaText.align = uiconst.CENTERTOP self.icon.align = uiconst.CENTERBOTTOM texturePath = 'res:/UI/Texture/classes/MultiSell/down.png' else: self.icon.align = uiconst.CENTER self.deltaText.text = '' texturePath = 'res:/UI/Texture/classes/MultiSell/equal.png' self.icon.SetTexturePath(texturePath) def GetDeltaText(self, delta): if delta < 0: color = '<color=0xffff5050>' else: color = '<color=0xff00ff00>' if abs(delta) < 1.0: showFraction = 1 else: showFraction = 0 deltaText = '%s%s</color>' % (color, GetByLabel('UI/Common/Percentage', percentage=FmtAmt(delta * 100, showFraction=showFraction))) return deltaText
def Startup(self, *etc): self.sr.expander = GlowSprite(parent=self, pos=(3, 0, 16, 16), name='expander', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/expanderDown.png', align=uiconst.CENTERLEFT) self.sr.expander.OnClick = self.Toggle self.sr.icon = uicontrols.Icon(parent=self, pos=(4, 0, 16, 16), name='icon', state=uiconst.UI_DISABLED, icon='ui_22_32_28', align=uiconst.CENTERLEFT, ignoreSize=True) self.sr.labelClipper = uiprimitives.Container(parent=self, name='labelClipper', align=uiconst.TOALL, pos=(0, 0, const.defaultPadding, 0), clipChildren=1) self.sr.labelClipper.OnClick = self.OnClick self.sr.labelClipper.GetMenu = self.GetMenu self.sr.label = uicontrols.EveLabelMedium(text='', parent=self.sr.labelClipper, left=5, state=uiconst.UI_DISABLED, maxLines=1, align=uiconst.CENTERLEFT) if self.sr.node.sublevel > 0: self.sr.fill = None else: self.sr.fill = FillUnderlay(parent=self, padding=(1, 0, 1, 1), colorType=uiconst.COLORTYPE_UIHEADER, opacity=0.15) mainLinePar = uiprimitives.Container(parent=self, name='mainLinePar', align=uiconst.TOALL, idx=0, pos=(0, 0, 0, 0), state=uiconst.UI_DISABLED) bottomLineContainer = uiprimitives.Container(parent=mainLinePar, name='bottomLineContainer', align=uiconst.TOBOTTOM, height=16) self.sr.bottomLineLeft = uiprimitives.Container(parent=bottomLineContainer, align=uiconst.TOLEFT) uiprimitives.Line(parent=self.sr.bottomLineLeft, align=uiconst.TOBOTTOM, color=uiconst.ENTRY_LINE_COLOR) self.sr.bottomLineArrow = uicontrols.Icon(icon='ui_73_16_39', parent=bottomLineContainer, align=uiconst.TOLEFT, state=uiconst.UI_NORMAL, color=uiconst.ENTRY_LINE_COLOR, top=15) uiprimitives.Line(parent=uiprimitives.Container(parent=bottomLineContainer), align=uiconst.TOBOTTOM, color=uiconst.ENTRY_LINE_COLOR)
def Startup(self, width, height, iconMargin=0, iconOpacity=0.75): self.sr.icon = GlowSprite(parent=self, pos=(0, 0, 0, 0), padding=(iconMargin, iconMargin, iconMargin, iconMargin), name='icon', state=uiconst.UI_DISABLED, align=uiconst.TOALL, filter=True, iconOpacity=iconOpacity) self.sr.hilite = Fill(bgParent=self, color=(0.7, 0.7, 0.7, 0.0), state=uiconst.UI_HIDDEN) self.setfocus = 0 self.killfocus = 0 self.width = width self.height = height self.sr.smallcaption = None self.sr.caption = None self.sr.activeHilite = Frame(bgParent=self, color=(1, 1, 1, 0.3), state=uiconst.UI_HIDDEN) self.AdjustSizeAndPosition(width, height) self.underlay = RaisedUnderlay(name='backgroundFrame', bgParent=self)
class ToggleButtonGroupButton(Container): OPACITY_SELECTED = 1.0 OPACITY_HOVER = 0.125 TEXT_TOPMARGIN = 4 default_padRight = 1 default_align = uiconst.TOLEFT_PROP default_state = uiconst.UI_NORMAL default_iconSize = 32 default_colorSelected = None default_iconOpacity = 1.0 default_showBg = True def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.controller = attributes.controller self.btnID = attributes.Get('btnID', None) self.panel = attributes.Get('panel', None) self.colorSelected = attributes.Get('colorSelected', self.default_colorSelected) label = attributes.Get('label', None) iconPath = attributes.Get('iconPath', None) iconSize = attributes.Get('iconSize', None) iconSize = iconSize or self.default_iconSize iconOpacity = attributes.get('iconOpacity', self.default_iconOpacity) self.hint = attributes.Get('hint', None) self.isSelected = False self.isDisabled = attributes.Get('isDisabled', False) self.showBg = attributes.Get('showBg', self.default_showBg) self.ConstructLayout(iconOpacity, iconPath, iconSize, label) self.selectedBG = RaisedUnderlay(bgParent=self, color=self.colorSelected, isGlowEdgeRotated=True) if not self.showBg: self.selectedBG.display = False if self.isDisabled: self.SetDisabled() def ConstructLayout(self, iconOpacity, iconPath, iconSize, label): if iconPath: self.AddIcon(self, iconOpacity, iconPath, iconSize) self.label = None else: clipper = Container(parent=self, clipChildren=True) self.AddLabel(clipper, label) self.icon = None def AddIcon(self, parent, iconOpacity, iconPath, iconSize): self.icon = GlowSprite(parent=parent, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=iconSize, height=iconSize, texturePath=iconPath, iconOpacity=iconOpacity, color=Color.GRAY6) def AddLabel(self, parent, label): self.label = LabelThemeColored(text=label, parent=parent, align=uiconst.CENTER, fontsize=EVE_SMALL_FONTSIZE) def GetAutoHeight(self): if self.label: return self.label.textheight + self.TEXT_TOPMARGIN * 2 if self.icon: return self.icon.height return 0 def SetDisabled(self): self.isDisabled = True if self.icon: self.icon.opacity = 0.1 if self.label: self.label.opacity = 0.1 if self.showBg: self.selectedBG.SetDisabled() def SetEnabled(self): self.isDisabled = False if self.showBg: self.selectedBG.SetEnabled() def OnMouseEnter(self, *args): if not self.isSelected and not self.isDisabled: self.selectedBG.OnMouseEnter() if self.icon: self.icon.OnMouseEnter() else: uicore.animations.FadeTo(self.label, self.label.opacity, OPACITY_LABEL_HOVER, duration=uiconst.TIME_ENTRY) def OnMouseExit(self, *args): if self.isDisabled: return if not self.isSelected: self.selectedBG.OnMouseExit() if self.icon: self.icon.OnMouseExit() elif not self.isSelected: uicore.animations.FadeTo(self.label, self.label.opacity, OPACITY_LABEL_IDLE, duration=uiconst.TIME_EXIT) def OnMouseDown(self, *args): if self.isDisabled: return if self.icon: self.icon.OnMouseDown() self.selectedBG.OnMouseDown() def OnMouseUp(self, *args): if self.isDisabled: return if self.icon: self.icon.OnMouseUp() self.selectedBG.OnMouseUp() def SetSelected(self, animate=True): self.isSelected = True if not self.showBg: self.selectedBG.display = True self.selectedBG.Select() if self.label: self.label.opacity = OPACITY_LABEL_HOVER if self.icon: self.icon.OnMouseExit() def SetDeselected(self, animate=True): self.isSelected = False if self.label: self.label.opacity = 1.0 if self.isDisabled: return if not self.showBg: self.selectedBG.display = False self.selectedBG.Deselect() def IsSelected(self): return self.isSelected def OnClick(self, *args): if not self.isDisabled: self.controller.Select(self)
class ButtonBase(uiprimitives.Container): """ An abstract button that others inherit from """ __guid__ = 'neocom.ButtonBase' __notifyevents__ = ['ProcessNeocomBlinkPulse'] default_name = 'ButtonBase' default_state = uiconst.UI_NORMAL default_align = uiconst.TOPLEFT default_isDraggable = True PADHORIZONTAL = 6 PADVERTICAL = 4 ACTIVEFILL_DEFAULTALPHA = 0.5 ACTIVEFILL_HOVERALPHA = 0.8 def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) self.btnData = attributes.btnData self.btnNum = attributes.btnNum self.width = attributes.width self._isDraggable = attributes.get('isDraggable', self.default_isDraggable) self._openNeocomPanel = None self.height = self.width self.top = self.height * self.btnNum self.panel = None self.blinkThread = None self.realTop = self.top self.dragEventCookie = None self.disableClick = False self.iconSize = self.height - 2 * self.PADVERTICAL self.iconTransform = uiprimitives.Transform(name='iconTransform', parent=self, align=uiconst.TOALL, scalingCenter=(0.5, 0.5)) self.iconLabelCont = None if self.btnData.id == 'map_beta': Sprite(parent=self.iconTransform, align=uiconst.TOPLEFT, pos=(0, 0, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED) self.icon = GlowSprite(parent=self.iconTransform, name='icon', state=uiconst.UI_DISABLED, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, iconOpacity=1.0) self.UpdateIcon() PAD = 1 self.blinkSprite = SpriteThemeColored( bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/buttonBlink.png', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.activeFrame = FrameThemeColored( bgParent=self, name='hoverFill', texturePath='res:/UI/Texture/classes/Neocom/buttonActive.png', cornerSize=5, state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.CheckIfActive() self.dropFrame = uicontrols.Frame(parent=self, name='hoverFrame', color=util.Color.GetGrayRGBA( 1.0, 0.5), state=uiconst.UI_HIDDEN) sm.RegisterNotify(self) def UpdateIcon(self): texturePath = self._GetPathFromIconNum(self.btnData.iconPath) self.icon.SetTexturePath(texturePath) def CheckIfActive(self): if self.btnData.isActive: self.activeFrame.Show() else: self.activeFrame.Hide() def GetIconPath(self): return self._GetPathFromIconNum(self.btnData.iconPath) def _GetPathFromIconNum(self, iconNum): if iconNum.startswith('res:/'): return iconNum parts = iconNum.split('_') if len(parts) == 2: sheet, iconNum = parts iconSize = uix.GetIconSize(sheet) return 'res:/ui/texture/icons/%s_%s_%s.png' % ( int(sheet), int(iconSize), int(iconNum)) elif len(parts) == 4: root, sheet, iconSize, iconNum = parts if root == 'ui': root = 'icons' return 'res:/ui/texture/%s/%s_%s_%s.png' % ( root, int(sheet), int(iconSize), int(iconNum)) else: return neocomCommon.ICONPATH_DEFAULT def IsDraggable(self): return self._isDraggable def SetDraggable(self, isDraggable): self._isDraggable = isDraggable def GetMenu(self): return self.btnData.GetMenu() def LoadTooltipPanel(self, tooltipPanel, *args): isOpen = self._openNeocomPanel and not self._openNeocomPanel.destroyed if isOpen: return tooltipPanel.LoadGeneric3ColumnTemplate() blinkHintStr = None if getattr(self.btnData, 'cmdName', None): cmd = uicore.cmd.commandMap.GetCommandByName(self.btnData.cmdName) tooltipPanel.AddCommandTooltip(cmd) blinkHintStr = self.btnData.blinkHint else: label = None if self.IsSingleWindow(): wnd = self.GetWindow() if not wnd.destroyed: label = wnd.GetCaption() elif self.btnData.children: label = self.btnData.children[0].wnd.GetNeocomGroupLabel() mainStr = label or self.btnData.label tooltipPanel.AddLabelMedium(text=mainStr) self.LoadTooltipPanelDetails(tooltipPanel, self.btnData) if blinkHintStr: tooltipPanel.AddLabelMedium(text=blinkHintStr, width=200, colSpan=tooltipPanel.columns) def LoadTooltipPanelDetails(cls, tooltipPanel, btnData): if btnData.id == 'wallet': showFractions = settings.char.ui.Get('walletShowCents', False) personalWealth = util.FmtISK( sm.GetService('wallet').GetWealth(), showFractions) tooltipPanel.AddLabelValue( label=localization.GetByLabel('Tooltips/Neocom/Balance'), value=personalWealth) canAccess = sm.GetService( 'wallet').HaveReadAccessToCorpWalletDivision( session.corpAccountKey) if canAccess: corpWealth = util.FmtISK( sm.GetService('wallet').GetCorpWealthCached1Min( session.corpAccountKey), showFractions) tooltipPanel.AddLabelValue(label=localization.GetByLabel( 'Tooltips/Neocom/CorporationBalance'), value=corpWealth) def GetTooltipPointer(self): return uiconst.POINT_LEFT_2 def IsSingleWindow(self): return False def OnMouseEnter(self, *args): self.btnData.SetBlinkingOff() self.icon.OnMouseEnter() def OnMouseExit(self, *args): self.icon.OnMouseExit() def OnMouseDown(self, *args): if not self.IsDraggable(): return if not uicore.uilib.leftbtn: return self.isDragging = False self.mouseDownY = uicore.uilib.y if self.dragEventCookie is not None: uicore.event.UnregisterForTriuiEvents(self.dragEventCookie) self.dragEventCookie = uicore.event.RegisterForTriuiEvents( uiconst.UI_MOUSEMOVE, self.OnDrag) uicore.animations.Tr2DScaleTo(self.iconTransform, self.iconTransform.scale, (0.95, 0.95), duration=0.1) self.icon.OnMouseDown() def OnMouseUp(self, *args): if uicore.uilib.mouseOver == self: uicore.animations.Tr2DScaleTo(self.iconTransform, self.iconTransform.scale, (1.0, 1.0), duration=0.1) if self.dragEventCookie is not None: uicore.event.UnregisterForTriuiEvents(self.dragEventCookie) self.dragEventCookie = None self.icon.OnMouseUp() def OnDragEnd(self, *args): uicore.event.UnregisterForTriuiEvents(self.dragEventCookie) self.dragEventCookie = None self.isDragging = False sm.GetService('neocom').OnButtonDragEnd(self) self.CheckIfActive() def OnDrag(self, *args): if math.fabs(self.mouseDownY - uicore.uilib.y) > 5 or self.isDragging: if not self.isDragging: uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnDragEnd) self.disableClick = True self.isDragging = True sm.GetService('neocom').OnButtonDragged(self) return True def OnClick(self, *args): if not self or self.destroyed: return self.btnData.CheckContinueBlinking() if not self.disableClick: self.OnClickCommand() if not self or self.destroyed: return self.disableClick = False if self.dragEventCookie: uicore.event.UnregisterForTriuiEvents(self.dragEventCookie) def OnDblClick(self, *args): """ Swallow double click event so that we don't get two OnClick events """ pass def OnClickCommand(self): """ Overridden by subclasses """ pass def OnSwitched(self): uicore.effect.MorphUIMassSpringDamper(item=self, attrname='opacity', float=1, newVal=1.0, minVal=0, maxVal=2.0, dampRatio=0.45, frequency=15.0, initSpeed=0, maxTime=4.0, callback=None, initVal=0.0) self.isDragging = False self.disableClick = False def GetDragData(self, *args): if self.btnData.isDraggable: return [self.btnData] def BlinkOnce(self, duration=0.7): self.blinkSprite.Show() uicore.animations.SpSwoopBlink(self.blinkSprite, rotation=math.pi * 0.75, duration=duration) def ProcessNeocomBlinkPulse(self): if self.btnData.isBlinking: self.BlinkOnce() def OnDropData(self, source, dropData): if not sm.GetService('neocom').IsValidDropData(dropData): return index = self.btnData.parent.children.index(self.btnData) sm.GetService('neocom').OnBtnDataDropped(dropData[0], index) def OnDragEnter(self, panelEntry, dropData): if not sm.GetService('neocom').IsValidDropData(dropData): return sm.GetService('neocom').OnButtonDragEnter(self.btnData, dropData[0]) uthread.new(self.ShowPanelOnMouseHoverThread) def OnDragExit(self, *args): sm.GetService('neocom').OnButtonDragExit(self.btnData, args) def ToggleNeocomPanel(self): isOpen = self._openNeocomPanel and not self._openNeocomPanel.destroyed sm.GetService('neocom').CloseAllPanels() if isOpen: self._openNeocomPanel = None else: self._openNeocomPanel = sm.GetService('neocom').ShowPanel( triggerCont=self, panelClass=self.GetPanelClass(), panelAlign=neocomCommon.PANEL_SHOWONSIDE, parent=uicore.layer.abovemain, btnData=self.btnData) RefreshTooltipForOwner(self) def ShowPanelOnMouseHoverThread(self): if len(self.btnData.children) <= 1: return blue.pyos.synchro.Sleep(500) if not self or self.destroyed: return if uicore.uilib.mouseOver == self: self.ToggleNeocomPanel() def GetPanelClass(self): return neocomPanels.PanelGroup def SetAsActive(self): self.btnData.isActive = True self.activeFrame.state = uiconst.UI_DISABLED def SetAsInactive(self): self.btnData.isActive = False self.activeFrame.state = uiconst.UI_HIDDEN
class PanelEntryBase(uiprimitives.Container): __guid__ = 'neocom.PanelEntryBase' __notifyevents__ = ['ProcessNeocomBlinkPulse'] isDragObject = True default_state = uiconst.UI_NORMAL default_align = uiconst.TOTOP default_icon = None default_height = 42 def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.btnData = attributes.btnData if hasattr(self.btnData, 'panelEntryHeight'): self.height = self.btnData.panelEntryHeight self.blinkThread = None self._openNeocomPanel = None self.main = uiprimitives.Container(parent=self, name='main') self.hoverBG = uicontrols.Frame( bgParent=self.main, texturePath='res:/UI/Texture/classes/Neocom/panelEntryBG.png', opacity=0.0) if self.btnData.id == 'map_beta' and IsMapBetaEnabled(): Sprite(parent=self.main, align=uiconst.TOPLEFT, pos=(10, 2, 11, 29), texturePath='res:/UI/Texture/Shared/betaTag.png', state=uiconst.UI_DISABLED) size = self.height - 4 self.icon = GlowSprite(parent=self.main, name='icon', state=uiconst.UI_DISABLED, texturePath=self.GetIconPath(), pos=(10, 2, size, size), iconOpacity=0.75) self.label = uicontrols.Label(parent=self.main, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, text=self.GetLabel(), autowidth=True, autoheight=True, left=self.icon.left + self.icon.width + 8) if settings.char.ui.Get('neocomAlign', uiconst.TOLEFT) == uiconst.TOLEFT: rotation = 0.0 else: rotation = math.pi self.expanderIcon = uicontrols.Icon(parent=self, name='expanderIcon', align=uiconst.CENTERRIGHT, left=10, icon='ui_38_16_228', rotation=rotation) self.SetExpanderState() self.blinkSprite = uiprimitives.Sprite( bgParent=self, name='blinkSprite', texturePath='res:/UI/Texture/classes/Neocom/panelEntryBG.png', state=uiconst.UI_HIDDEN, opacity=1.0) def GetIconPath(self): return self.btnData.iconPath or neocomCommon.ICONPATH_DEFAULT def PrepareDrag(self, dragContainer, dragSource): dragContainer.width = dragContainer.height = 48 icon = uicontrols.Icon(parent=dragContainer, name='icon', state=uiconst.UI_DISABLED, icon=self.GetIconPath(), size=48, ignoreSize=True) Frame(parent=dragContainer, name='baseFrame', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/buttonDOT.png', color=(1.0, 1.0, 1.0, 1.0), cornerSize=8, spriteEffect=trinity.TR2_SFX_DOT, blendMode=trinity.TR2_SBM_ADD) Frame(parent=dragContainer, offset=-9, cornerSize=13, name='shadow', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/bigButtonShadow.png') return (0, 0) def HasOpenPanel(self): return self._openNeocomPanel is not None and not self._openNeocomPanel.destroyed def SetExpanderState(self): self.HideExpander() def ShowExpander(self): self.expanderIcon.state = uiconst.UI_DISABLED def HideExpander(self): self.expanderIcon.state = uiconst.UI_HIDDEN def OnClick(self, *args): self.btnData.CheckContinueBlinking() self.OnClickCommand() sm.GetService('neocom').CloseAllPanels() def OnClickCommand(self): pass def GetLabel(self): label = None if self.btnData.cmdName: cmd = uicore.cmd.commandMap.GetCommandByName(self.btnData.cmdName) if cmd and cmd.callback: label = cmd.GetName() return label or self.btnData.label def GetRequiredWidth(self): return self.label.width + self.icon.width + 35 def GetMenu(self): return self.btnData.GetMenu() def LoadTooltipPanel(self, tooltipPanel, *args): tooltipPanel.LoadGeneric3ColumnTemplate() if getattr(self.btnData, 'cmdName', None): cmd = uicore.cmd.commandMap.GetCommandByName(self.btnData.cmdName) tooltipPanel.AddCommandTooltip(cmd) ButtonBase.LoadTooltipPanelDetails(self, tooltipPanel, self.btnData) def GetTooltipPointer(self): return uiconst.POINT_LEFT_2 def OnMouseEnter(self, *args): sm.GetService('neocom').CloseChildrenPanels(self.btnData.parent) uicore.animations.FadeIn(self.hoverBG, duration=0.3) self.icon.OnMouseEnter() def OnMouseExit(self, *args): uicore.animations.FadeOut(self.hoverBG, duration=0.3) self.icon.OnMouseExit() def GetDragData(self, *args): if self.btnData.isDraggable: return [self.btnData] def BlinkOnce(self): self.blinkSprite.Show() uicore.animations.SpSwoopBlink(self.blinkSprite, rotation=math.pi, duration=1.0) def ProcessNeocomBlinkPulse(self): if self.btnData.isBlinking: self.BlinkOnce()
class AchievementTreeSlot(Container): default_align = uiconst.TOPLEFT default_state = uiconst.UI_NORMAL default_pickRadius = -1 nameLabel = None tooltipPanel = None localScale = 1.0 def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.achievementGroupID = attributes.achievementGroupID self.hexGridPosition = attributes.hexGridPosition self.nameLabel = InfoPanelLabel(parent=self.parent, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, idx=0) self.stateSprite = GlowSprite(parent=self, pos=(0, 0, 20, 20), align=uiconst.CENTER, state=uiconst.UI_DISABLED) self.activeEffectSprite = SpriteThemeColored( parent=self, state=uiconst.UI_DISABLED, spriteEffect=trinity.TR2_SFX_MODULATE, blendMode=trinity.TR2_SBM_ADDX2, texturePath='res:/UI/Texture/classes/Achievements/hexPingGlow.png', textureSecondaryPath= 'res:/UI/Texture/classes/Achievements/hexPingMask.png', pos=(0, 0, 300, 300), align=uiconst.CENTER, opacity=0.0) self.activeStateSprite = SpriteThemeColored( parent=self, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/Achievements/hexActive.png', pos=(0, 0, 200, 200), align=uiconst.CENTER, opacity=0.0, blendMode=trinity.TR2_SBM_ADDX2, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) self.backgroundSprite = SpriteThemeColored( bgParent=self, texturePath= 'res:/UI/Texture/classes/Achievements/hexBackIncomplete.png', colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.5) self.UpdateGroupState() def Close(self, *args, **kwds): if self.nameLabel and not self.nameLabel.destroyed: self.nameLabel.LoadTooltipPanel = None self.nameLabel.GetTooltipPosition = None return Container.Close(self, *args, **kwds) def GetTooltipPosition(self, *args, **kwds): return self.GetAbsolute() def UpdateGroupState(self): activeGroupID = sm.GetService( 'achievementSvc').GetActiveAchievementGroupID() groupData = GetAchievementGroup(self.achievementGroupID) totalNum = len(groupData.GetAchievementTasks()) completed = len( [x for x in groupData.GetAchievementTasks() if x.completed]) if totalNum == completed: self.stateSprite.SetTexturePath( 'res:/UI/Texture/classes/Achievements/iconComplete.png') self.progressState = STATE_COMPLETED self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/Achievements/hexBackComplete.png' elif completed: if activeGroupID == self.achievementGroupID: self.stateSprite.SetTexturePath( 'res:/UI/Texture/classes/Achievements/iconPartialActive.png' ) else: self.stateSprite.SetTexturePath( 'res:/UI/Texture/classes/Achievements/iconPartial.png') self.progressState = STATE_INPROGRESS self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/Achievements/hexBackComplete.png' else: if activeGroupID == self.achievementGroupID: self.stateSprite.SetTexturePath( 'res:/UI/Texture/classes/Achievements/iconIncompleteActive.png' ) else: self.stateSprite.SetTexturePath( 'res:/UI/Texture/classes/Achievements/iconIncomplete.png') self.progressState = STATE_INCOMPLETE self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/Achievements/hexBackIncomplete.png' self.nameLabel.text = groupData.groupName if activeGroupID == self.achievementGroupID: self.activeEffectSprite.display = True self.activeStateSprite.display = True uicore.animations.FadeTo(self.activeEffectSprite, startVal=0.7, endVal=0.2, duration=0.5) r, g, b, a = sm.GetService('uiColor').GetUIColor( uiconst.COLORTYPE_UIHILIGHT) uicore.animations.MorphVector2(self.activeEffectSprite, 'scale', startVal=(2.5, 2.5), endVal=(0.0, 0.0), duration=0.33) uicore.animations.SpColorMorphTo(self.activeStateSprite, startColor=(0, 0, 0, 0), endColor=(r, g, b, 1.0), duration=0.3, curveType=uiconst.ANIM_OVERSHOT, callback=self.PulseActive) else: uicore.animations.FadeOut(self.activeStateSprite, duration=0.125) uicore.animations.FadeOut(self.activeEffectSprite, duration=0.125) if self.tooltipPanel: tooltipPanel = self.tooltipPanel() if tooltipPanel and not tooltipPanel.destroyed: tooltipPanel.Flush() self.LoadTooltipPanel(tooltipPanel) def PulseActive(self): r, g, b, a = sm.GetService('uiColor').GetUIColor( uiconst.COLORTYPE_UIHILIGHT) uicore.animations.SpColorMorphTo(self.activeStateSprite, startColor=(r, g, b, 1.0), endColor=(r * 0.8, g * 0.8, b * 0.8, 1.0), duration=1.5, curveType=uiconst.ANIM_WAVE, loops=uiconst.ANIM_REPEAT) def UpdateLabelPosition(self): if not self.nameLabel: return if self.localScale < 1.0: self.nameLabel.fontsize = fontConst.EVE_MEDIUM_FONTSIZE else: self.nameLabel.fontsize = fontConst.EVE_LARGE_FONTSIZE self.nameLabel.left = self.left + self.width / 2 + 14 self.nameLabel.top = self.top + (self.height - self.nameLabel.textheight) / 2 def SetLocalScale(self, localScale): self.localScale = localScale self.activeEffectSprite.width = self.activeEffectSprite.height = 300 * localScale self.activeStateSprite.width = self.activeStateSprite.height = 200 * localScale def OnClick(self, *args): sm.GetService('achievementSvc').SetActiveAchievementGroupID( self.achievementGroupID) def OnMouseEnter(self, *args): uicore.animations.FadeTo(self.backgroundSprite, startVal=self.backgroundSprite.opacity, endVal=1.0, duration=0.2, curveType=uiconst.ANIM_OVERSHOT) self.moTimer = AutoTimer(10, self.CheckMouseOver) if not SLOT_SHOW_MOUSEOVER_INFO: self.mouseEnterDelay = AutoTimer(100, self.CheckMouseEnter) def CheckMouseEnter(self, *args): self.mouseEnterDelay = None if uicore.uilib.mouseOver is self: sm.ScatterEvent('OnAchievementTreeMouseOver', self.achievementGroupID) def CheckMouseOver(self): if uicore.uilib.mouseOver is self: return if uicore.uilib.mouseOver.IsUnder(self): return if self.nameLabel and uicore.uilib.mouseOver is self.nameLabel: return self.moTimer = None uicore.animations.FadeTo(self.backgroundSprite, startVal=self.backgroundSprite.opacity, endVal=0.5, duration=0.1) def GetBounds(self): return (self.left, self.top, self.left + self.width, self.top + self.height) def LoadTooltipPanel(self, tooltipPanel, *args, **kwds): if not SLOT_SHOW_MOUSEOVER_INFO: return tooltipPanel.columns = 1 tooltipPanel.margin = (10, 5, 10, 3) tooltipPanel.state = uiconst.UI_NORMAL groupData = GetAchievementGroup(self.achievementGroupID) if groupData: AchievementGroupEntry(parent=tooltipPanel, groupInfo=groupData, align=uiconst.TOPLEFT, width=240) def GetTooltipPosition(self, *args): return self.GetAbsolute() def GetTooltipPositionFallbacks(self, *args): return [] def GetTooltipPointer(self, *args): return uiconst.POINT_TOP_2 @apply def pos(): fget = Container.pos.fget def fset(self, value): Container.pos.fset(self, value) self.UpdateLabelPosition() return property(**locals()) @apply def left(): fget = Container.left.fget def fset(self, value): Container.left.fset(self, value) self.UpdateLabelPosition() return property(**locals()) @apply def top(): fget = Container.top.fget def fset(self, value): Container.top.fset(self, value) self.UpdateLabelPosition() return property(**locals())
class MenuEntryViewCore(Container): __guid__ = 'uicls.MenuEntryViewCore' LABELVERTICALPADDING = 2 LABELHORIZONTALPADDING = 8 default_fontsize = 10 default_fontStyle = None default_fontFamily = None default_fontPath = None def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.fontStyle = attributes.get('fontStyle', self.default_fontStyle) self.fontFamily = attributes.get('fontFamily', self.default_fontFamily) self.fontPath = attributes.get('fontPath', self.default_fontPath) self.fontsize = attributes.get('fontsize', self.default_fontsize) self.cursor = 1 self.clicked = 0 self.submenu = None self.submenuview = None self.sr.hilite = None self.Prepare() def Prepare(self, *args): self.Prepare_Triangle_() self.Prepare_Label_() self.sr.label.OnMouseDown = self.OnMouseDown self.sr.label.OnMouseUp = self.OnMouseUp def Prepare_Triangle_(self, *args): self.triangle = GlowSprite( parent=self, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, idx=0, texturePath='res:/UI/Texture/Icons/1_16_14.png', pos=(0, 0, 16, 16)) def Prepare_Label_(self, *args): label = Label(parent=self, pos=(8, 1, 0, 0), align=uiconst.CENTERLEFT, letterspace=1, fontStyle=self.fontStyle, fontFamily=self.fontFamily, fontPath=self.fontPath, fontsize=self.fontsize, state=uiconst.UI_DISABLED) self.sr.label = label def Prepare_Hilite_(self, *args): self.sr.hilite = ListEntryUnderlay(parent=self) def Setup(self, entry, size, menu, identifier): text = entry.caption self.sr.label.fontsize = size self.sr.label.text = text self.menu = menu menuIconSize = menu.iconSize icon = None if menuIconSize: icon = Sprite(parent=self, pos=(0, 0, menuIconSize, menuIconSize), align=uiconst.RELATIVE, idx=0, state=uiconst.UI_DISABLED, name='icon') icon.LoadIcon(entry.icon or 'ui_1_16_101', ignoreSize=True) self.sr.label.left += menuIconSize self.id = identifier if not entry.enabled: if icon: icon.SetAlpha(0.5) self.sr.label.SetRGB(1.0, 1.0, 1.0, 0.5) if isinstance(entry.value, basestring): self.sr.label.text += ' (' + entry.value + ')' self.width = self.sr.label.textwidth + self.sr.label.left + self.LABELHORIZONTALPADDING self.height = max(menuIconSize, self.sr.label.textheight + self.LABELVERTICALPADDING) if not entry.enabled: self.state = uiconst.UI_DISABLED if isinstance(entry.value, (list, tuple)): self.triangle.state = uiconst.UI_DISABLED self.submenu = entry.value def _OnClose(self): if self.submenuview is not None and not self.submenuview.destroyed: self.submenuview.Close() self.submenuview = None self.menu = None self.submenu = None self.expandTimer = None self.collapseTimer = None Container._OnClose(self) def OnMouseDown(self, *etc): uthread.new(self.MouseDown) def MouseDown(self): if not self.destroyed and self.submenu: self.Expand() def OnMouseUp(self, *etc): if not self.submenu and uicore.uilib.mouseOver in (self, self.sr.label): self.menu.ActivateEntry(self.id) uthread.new(CloseContextMenus) def OnMouseEnter(self, *args): uicore.Message('ContextMenuEnter') if self.sr.hilite is None: self.Prepare_Hilite_() self.sr.hilite.ShowHilite() self.expandTimer = AutoTimer(10, self.ExpandMenu) if self.triangle.display: self.triangle.OnMouseEnter() def ExpandMenu(self): for each in self.parent.children: if each != self and getattr(each, 'submenuview', None): each.Collapse() self.expandTimer = None if uicore.uilib.mouseOver in (self, self.sr.label) and self.submenu: self.Expand() def OnMouseExit(self, *args): if self.sr.hilite: self.sr.hilite.HideHilite() if self.triangle.display: self.triangle.OnMouseExit() def toggle(self): if self.submenuview: self.Collapse() else: self.Expand() def Collapse(self): self.collapseTimer = None if self.submenuview and self.submenuview.destroyed: self.submenuview = None elif self.submenuview: self.submenuview.Collapse() self.submenuview = None def Expand(self): if not self.submenuview: for each in self.parent.children: if each != self and getattr(each, 'submenuview', None): each.Collapse() if self.submenu[0] == 'isDynamic': menu = CreateMenuView( CreateMenuFromList(apply(self.submenu[1], self.submenu[2])), self.parent) else: menu = CreateMenuView(CreateMenuFromList(self.submenu), self.parent) if not menu: return w = uicore.desktop.width h = uicore.desktop.height aL, aT, aW, aH = self.GetAbsolute() menu.top = max(0, min(h - menu.height, aT)) if aL + aW + menu.width <= w: menu.left = aL + aW + 2 else: aL, aT, aW, aH = self.GetAbsolute() menu.left = aL - menu.width + 5 uicore.layer.menu.children.insert(0, menu) if self.destroyed: CloseContextMenus() return self.submenuview = menu
def Initialize(self, wnd, panelName=None, subPanelName=None): self.subPanelName = subPanelName while eve.session.mutating: blue.pyos.BeNice() wnd.ShowLoad() uix.Flush(wnd.sr.main) self.toparea = uiprimitives.Container(parent=wnd.sr.main, name='corptop', pos=(0, 0, 0, 54), align=uiconst.TOTOP, state=uiconst.UI_NORMAL) GlowSprite( parent=self.toparea, name='simplepic', pos=(4, 0, 64, 64), texturePath='res:/ui/Texture/WindowIcons/sanctionableactions.png') self.panelHome = None self.members = None self.recruitment = None self.wars = None self.standings = None self.votes = None self.sanctionable = None self.accounts = None self.auditing = None self.membertracking = None self.findmember = None self.titles = None self.autoKicks = None self.alliances = None tabpanels = [] homeHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/AboutThisCorp') warsHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/CorpWarsHint') standingsHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/CorpStandingsHint') votesHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/CorpVotesHint') sanctionableActionsHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/CorpSanctionableActionsHint') accountsHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/CorpAccountsHint') alliancesHint = localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/AlliancesHint') self.panelHome = form.CorpUIHome(name='corp_home', parent=wnd.sr.main, state=uiconst.UI_PICKCHILDREN) tabpanels.append([ localization.GetByLabel('UI/Corporations/BaseCorporationUI/Home'), self.panelHome, self, 'home', None, homeHint ]) self.panels['home'] = [self.panelHome] self.recruitment = form.CorpRecruitment(name='recruitmentpar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.recruitment) tabpanels.append([ uiutil.FixedTabName( 'UI/Corporations/BaseCorporationUI/Recruitment'), self.recruitment, self, 'recruitment', None, None ]) self.panels['recruitment'] = [self.recruitment] membersTabEntries = [] self.panels['members'] = [] if not util.IsNPC(eve.session.corpid): self.membertracking = form.CorpMemberTracking( name='membertrackingpar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.membertracking) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/MemberList'), self.membertracking, self.membertracking, 'main' ]) self.panels['members'].append(self.membertracking) grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther = self.corp.GetMyGrantableRoles( ) hasGrantableRoles = grantableRoles | grantableRolesAtHQ | grantableRolesAtBase | grantableRolesAtOther if session.corprole & const.corpRolePersonnelManager | hasGrantableRoles: self.findmember = form.CorpFindMembersInRole( name='findmember', parent=wnd.sr.main, left=const.defaultPadding, width=const.defaultPadding) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/FindMemberInRole'), self.findmember, self.findmember, 'findmember' ]) self.panels['members'].append(self.findmember) if self.IsOldRolesEnabled(): self.members = form.CorpMembers(name='members', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.members) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/RoleManagement' ), self.members, self.members, 'roles' ]) self.panels['members'].append(self.members) if self.IsNewRolesEnabled(): self.newRoles = form.CorpRolesNew( name='corpRolesNew', pos=(0, 0, 0, 0), corp=sm.GetService('corp').GetCorporation()) wnd.sr.main.children.append(self.newRoles) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/RoleManagement' ), self.newRoles, self.newRoles, 'newRoles' ]) self.panels['members'].append(self.newRoles) if const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector: self.autoKicks = CorpAutoKicks(name='autoKicks', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.autoKicks) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/AutoKickManagement' ), self.autoKicks, self.autoKicks, 'autoKicks', None, localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/AutoKickDescription' ) ]) self.panels['members'].append(self.autoKicks) if const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector: self.titles = form.CorpTitles(name='titles', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.titles) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/TitleManagement'), self.titles, self.titles, 'titles' ]) self.panels['members'].append(self.titles) if eve.session.corprole & const.corpRoleAuditor == const.corpRoleAuditor: self.auditing = form.CorpAuditing(name='auditingpar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.auditing) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Auditing'), self.auditing, self.auditing, 'main' ]) self.panels['members'].append(self.auditing) self.decorations = form.CorpDecorations(name='decorations', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.decorations) membersTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Decorations'), self.decorations, self.decorations, 'decorations' ]) self.panels['members'].append(self.decorations) wnd.sr.membersTabs = uicontrols.TabGroup(name='tabparent', parent=wnd.sr.main, idx=0) wnd.sr.membersTabs.Startup(membersTabEntries, 'corpmembersstab', autoselecttab=0) tabpanels.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Members'), None, self, 'members', wnd.sr.membersTabs ]) if not util.IsNPC(session.corpid): self.standings = form.CorpStandings(name='standingspar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.standings) tabpanels.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Standings'), self.standings, self, 'standings', None, standingsHint ]) self.panels['standings'] = [self.standings] politicsTabEntries = [] self.panels['politics'] = [] if self.corp.CanViewVotes(eve.session.corpid): self.votes = form.CorpVotes(name='votespar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.votes) politicsTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Votes'), self.votes, self.votes, 'votes', None, votesHint ]) self.panels['politics'].append(self.votes) self.sanctionable = form.CorpSanctionableActions( name='sanctionablepar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.sanctionable) politicsTabEntries.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/SanctionableActions'), self.sanctionable, self.sanctionable, 'sanctionable', None, sanctionableActionsHint ]) self.panels['politics'].append(self.sanctionable) self.wars = form.CorpWars(name='warspar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.wars) tabpanels.append([ localization.GetByLabel('UI/Corporations/BaseCorporationUI/Wars'), self.wars, self, 'wars', None, warsHint ]) self.panels['wars'] = [self.wars] if len(self.panels['politics']): wnd.sr.politicsTabs = uicontrols.TabGroup(name='tabparent', parent=wnd.sr.main, idx=0) wnd.sr.politicsTabs.Startup(politicsTabEntries, 'corppoliticsstab', autoselecttab=0) tabpanels.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Politics'), None, self, 'politics', wnd.sr.politicsTabs ]) if const.corpRoleAccountant & eve.session.corprole != 0 or self.corp.UserIsCEO( ): self.accounts = form.CorpAccounts(name='accountspar', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.accounts) tabpanels.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Assets'), self.accounts, self, 'accounts', None, accountsHint ]) self.panels['accounts'] = [self.accounts] self.alliances = form.Alliances(name='alliances', pos=(0, 0, 0, 0)) wnd.sr.main.children.append(self.alliances) tabpanels.append([ localization.GetByLabel( 'UI/Corporations/BaseCorporationUI/Alliances'), self.alliances, self, 'alliances', None, alliancesHint ]) self.panels['alliances'] = [self.alliances] wnd.sr.maintabs = uicontrols.TabGroup(name='tabparent', parent=wnd.sr.main) wnd.sr.maintabs.Startup(tabpanels, 'corporationpanel', UIIDPrefix='corporationTab', autoselecttab=False) if panelName: wnd.sr.maintabs.ShowPanelByName(panelName) else: wnd.sr.maintabs.AutoSelect() if wnd is None or wnd.destroyed: self.ResetWindow() return uiutil.SetOrder(wnd.sr.maintabs, 0) wnd.HideLoad() wnd.state = uiconst.UI_NORMAL uthread.new(sm.StartService('wallet').AskSetWalletDivision)
class ButtonIcon(Container): __guid__ = 'uicontrols.ButtonIcon' OPACITY_IDLE = 0.0 OPACITY_INACTIVE = 0.0 OPACITY_MOUSEHOVER = 1.1 OPACITY_MOUSECLICK = 2.5 OPACITY_SELECTED = 0.5 COLOR_DEFAULT = (1, 1, 1, 1.0) OPACITY_GLOW_IDLE = 0.0 OPACITY_GLOW_MOUSEHOVER = 0.3 OPACITY_GLOW_MOUSECLICK = 0.6 default_func = None default_args = None default_width = 32 default_height = 32 default_align = uiconst.TOPLEFT default_state = uiconst.UI_NORMAL default_texturePath = None default_isActive = True default_iconSize = 16 default_rotation = 0 default_noBgSize = 1 default_iconColor = None default_colorSelected = None default_isHoverBGUsed = None default_isSelectedBgUsed = False default_hoverTexture = None default_downTexture = None default_showGlow = True def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.func = attributes.get('func', self.default_func) self.args = attributes.get('args', self.default_args) self.isActive = attributes.get('isActive', True) self.texturePath = attributes.get('texturePath', self.default_texturePath) self.iconSize = attributes.get('iconSize', self.default_iconSize) self.iconColor = attributes.get('iconColor', self.default_iconColor) self.isHoverBGUsed = attributes.Get('isHoverBGUsed', self.default_isHoverBGUsed) self.isSelectedBgUsed = attributes.Get('isSelectedBgUsed', self.default_isSelectedBgUsed) self.colorSelected = attributes.Get('colorSelected', self.default_colorSelected) self.rotation = attributes.Get('rotation', self.default_rotation) self.hoverTexture = attributes.Get('hoverTexture', self.default_hoverTexture) self.downTexture = attributes.Get('downTexture', self.default_downTexture) self.showGlow = attributes.Get('showGlow', self.default_showGlow) if self.isHoverBGUsed is None: if self.iconSize < self.default_noBgSize: self.isHoverBGUsed = True else: self.isHoverBGUsed = False self.isSelected = False self.enabled = True self.ConstructIcon() self.glowIcon = None width, height = self.GetAbsoluteSize() size = min(width, height) bgCont = Container(name='bgCont', parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, width=size, height=size) self.bgContainer = bgCont self.selectedBG = None self.ConstructBackground() if self.isSelectedBgUsed: self.ConstructSelectedBackground() self.blinkBg = None self.SetActive(self.isActive, animate=False) def ConstructBackground(self): self.mouseEnterBG = SpriteThemeColored( name='mouseEnterBG', bgParent=self.bgContainer, texturePath='res:/UI/Texture/classes/ButtonIcon/mouseEnter.png', opacity=0.0, color=self.colorSelected) self.mouseDownBG = SpriteThemeColored( name='mouseEnterBG', bgParent=self.bgContainer, texturePath='res:/UI/Texture/classes/ButtonIcon/mouseDown.png', opacity=0.0, color=self.colorSelected) def ConstructIcon(self): self.icon = GlowSprite(name='icon', parent=self, align=uiconst.CENTER, width=self.iconSize, height=self.iconSize, texturePath=self.texturePath, state=uiconst.UI_DISABLED, color=self.iconColor, iconOpacity=0.5, gradientStrength=0.5, rotation=self.rotation) def SetTexturePath(self, texturePath): self.icon.SetTexturePath(texturePath) def SetColor(self, color): self.mouseEnterBG.SetFixedColor(color) self.mouseDownBG.SetFixedColor(color) def ConstructBlinkBackground(self): if self.blinkBg: return self.blinkBg = SpriteThemeColored( name='blinkBG', bgParent=self.bgContainer, texturePath='res:/UI/Texture/classes/ButtonIcon/mouseEnter.png', opacity=0.0) def ConstructSelectedBackground(self): if self.selectedBG: return self.selectedBG = FillThemeColored( name='selectedBG', bgParent=self.bgContainer, colorType=uiconst.COLORTYPE_UIHILIGHT, idx=0, color=self.colorSelected) self.UpdateSelectedColor() def AccessIcon(self): return self.icon def AccessBackground(self): return self.bgContainer def Disable(self, opacity=0.5): self.opacity = opacity self.enabled = 0 if self.mouseEnterBG: self.mouseEnterBG.StopAnimations() self.mouseEnterBG.opacity = 0.0 def Enable(self): self.opacity = 1.0 self.enabled = 1 def SetRotation(self, value): self.icon.SetRotation(value) def UpdateIconState(self, animate=True): texturePath = None if uicore.uilib.mouseOver == self: if uicore.uilib.leftbtn: glowAmount = self.OPACITY_MOUSECLICK texturePath = self.downTexture else: glowAmount = self.OPACITY_MOUSEHOVER texturePath = self.hoverTexture elif self.isActive: glowAmount = self.OPACITY_IDLE texturePath = self.texturePath else: glowAmount = self.OPACITY_INACTIVE texturePath = self.texturePath if isinstance(self.icon, GlowSprite): if self.downTexture: self.SetTexturePath(texturePath) if self.showGlow: if animate: uicore.animations.MorphScalar(self.icon, 'glowAmount', self.icon.glowAmount, glowAmount, duration=0.2) else: self.icon.glowAmount = glowAmount def SetActive(self, isActive, animate=True): self.UpdateIconState(animate) @telemetry.ZONE_METHOD def SetSelected(self): if self.isSelected: return self.isSelected = True self.UpdateSelectedColor() self.UpdateIconState() @telemetry.ZONE_METHOD def SetDeselected(self): if not self.isSelected: return self.isSelected = False self.UpdateSelectedColor() self.UpdateIconState() def UpdateSelectedColor(self): if self.isSelected: if self.selectedBG: self.selectedBG.opacity = self.OPACITY_SELECTED iconColor = GetIconColor(self.colorSelected) else: iconColor = self.colorSelected else: if self.selectedBG: self.selectedBG.opacity = 0.0 iconColor = self.COLOR_DEFAULT self.icon.SetRGBA(*iconColor) def Blink(self, duration=0.8, loops=1): self.ConstructBlinkBackground() uicore.animations.FadeTo(self.blinkBg, 0.0, 0.9, duration=duration, curveType=uiconst.ANIM_WAVE, loops=loops) def StopBlink(self): if self.blinkBg: uicore.animations.FadeOut(self.blinkBg, 0.3) def OnClick(self, *args): if not self.func or not self.enabled: return if audioConst.BTNCLICK_DEFAULT: uicore.Message(audioConst.BTNCLICK_DEFAULT) if type(self.args) == tuple: self.func(*self.args) elif self.args: self.func(self.args) else: self.func() def OnMouseEnter(self, *args): self.StopBlink() if not self.enabled: return self.UpdateIconState() if self.isHoverBGUsed: uicore.animations.FadeIn(self.mouseEnterBG, 0.5, duration=0.2) def OnMouseExit(self, *args): self.SetActive(self.isActive) self.UpdateIconState() if self.isHoverBGUsed: uicore.animations.FadeOut(self.mouseEnterBG, duration=0.2) def OnMouseDown(self, *args): if not self.enabled: return self.SetActive(self.isActive) if self.isHoverBGUsed: uicore.animations.FadeTo(self.mouseDownBG, self.mouseDownBG.opacity, 1.0, duration=0.1) uicore.animations.FadeOut(self.mouseEnterBG, duration=0.1) self.UpdateIconState() def OnMouseUp(self, *args): if self.isHoverBGUsed: uicore.animations.FadeOut(self.mouseDownBG, duration=0.1) if not self.enabled: return self.UpdateIconState() if uicore.uilib.mouseOver == self: if self.isHoverBGUsed: uicore.animations.FadeIn(self.mouseEnterBG, 0.5, duration=0.1) def OnEndDrag(self, *args): if uicore.uilib.mouseOver != self: uicore.animations.FadeOut(self.mouseEnterBG, duration=0.2) elif self.isHoverBGUsed: uicore.animations.FadeIn(self.mouseEnterBG, duration=0.1) uicore.animations.FadeOut(self.mouseDownBG, duration=0.1)
class Button(ButtonCore): __guid__ = 'uicontrols.Button' default_alwaysLite = False default_iconSize = 32 default_icon = None default_color = None def ApplyAttributes(self, attributes): self.color = attributes.get('color', self.default_color) self.iconPath = attributes.get('icon', self.default_icon) self.iconSize = attributes.get('iconSize', self.default_iconSize) args = attributes.get('args', None) ButtonCore.ApplyAttributes(self, attributes) if args == 'self': self.args = self def Prepare_(self): self.sr.label = LabelThemeColored( parent=self, align=uiconst.CENTER, state=uiconst.UI_DISABLED, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=OPACITY_LABEL_IDLE, fontsize=10) if self.iconPath is not None: if self.iconSize: width = self.iconSize height = self.iconSize else: width = height = min(self.width, self.height) self.icon = GlowSprite(parent=self, state=uiconst.UI_DISABLED, align=uiconst.CENTER, pos=(0, 0, width, height), texturePath=self.iconPath, color=self.color, iconOpacity=0.75) self.sr.label.state = uiconst.UI_HIDDEN self.width = width + 4 self.height = height + 4 else: self.icon = None self.sr.hilite = Fill(bgParent=self, color=(0.7, 0.7, 0.7, 0.5), state=uiconst.UI_HIDDEN) self.sr.activeframe = FrameThemeColored( parent=self, name='activeline', state=uiconst.UI_HIDDEN, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.1) self.underlay = RaisedUnderlay(name='backgroundFrame', bgParent=self, state=uiconst.UI_DISABLED, color=self.color) def Update_Size_(self): if self.iconPath is None: self.width = min( 256, self.fixedwidth or max(40, self.sr.label.width + 20)) self.height = self.fixedheight or max( 18, min(32, self.sr.label.textheight + 4)) def SetLabel_(self, label): if not self or self.destroyed: return text = self.text = label self.sr.label.text = text self.Update_Size_() def OnSetFocus(self, *args): if self.disabled: return if self and not self.destroyed and self.parent and self.parent.name == 'inlines': if self.parent.parent and self.parent.parent.sr.node: browser = uiutil.GetBrowser(self) if browser: uthread.new(browser.ShowObject, self) if self and not self.destroyed and self.sr and self.sr.activeframe: self.sr.activeframe.state = uiconst.UI_DISABLED btns = self.GetDefaultBtnsInSameWnd() if btns: self.SetWndDefaultFrameState(btns, 0) def OnMouseEnter(self, *args): self.Blink(False) if not self.disabled: self.underlay.OnMouseEnter() if self.icon: self.icon.OnMouseEnter() else: uicore.animations.FadeTo(self.sr.label, self.sr.label.opacity, OPACITY_LABEL_HOVER, duration=uiconst.TIME_ENTRY) def OnMouseExit(self, *args): self.underlay.OnMouseExit() if self.icon: self.icon.OnMouseExit() else: uicore.animations.FadeTo(self.sr.label, self.sr.label.opacity, OPACITY_LABEL_IDLE, duration=uiconst.TIME_EXIT) def OnMouseDown(self, *args): if self.disabled: return if self.mousedownfunc: if type(self.args) == tuple: self.mousedownfunc(*self.args) else: self.mousedownfunc(self.args or self) self.underlay.OnMouseDown() if self.icon: self.icon.OnMouseDown() else: uicore.animations.FadeTo(self.sr.label, self.sr.label.opacity, OPACITY_LABEL_MOUSEDOWN, duration=0.3) def OnMouseUp(self, *args): if self.mouseupfunc: if type(self.args) == tuple: self.mouseupfunc(*self.args) else: self.mouseupfunc(self.args or self) if not self.disabled: self.underlay.OnMouseUp() if self.icon: self.icon.OnMouseUp() else: uicore.animations.FadeTo(self.sr.label, self.sr.label.opacity, OPACITY_LABEL_HOVER) def Confirm(self, *args): ButtonCore.Confirm(self) self.underlay.Blink() def SetColor(self, color): self.underlay.SetFixedColor(color) def Disable(self): ButtonCore.Disable(self) self.underlay.SetDisabled() def Enable(self): ButtonCore.Enable(self) self.underlay.SetEnabled() def Blink(self, on_off=1, blinks=1000, time=800): self.blinking = on_off if on_off: self.underlay.Blink(blinks) else: self.underlay.StopBlink()