def SetSelected(self, isSelected, isChildSelected = False): self.isSelected = isSelected if isSelected or self.selectedBG: self.CheckConstructSelectedBG() self.selectedBG.display = isSelected self.UpdateLabel() if isChildSelected: if not self.childSelectedBG: self.childSelectedBG = GradientThemeColored(bgParent=self.spacerCont, rotation=0, alphaData=[(0, 0.5), (1.0, 0.0)], padBottom=1, colorType=uiconst.COLORTYPE_UIHILIGHT) else: self.childSelectedBG.Show() elif self.childSelectedBG: self.childSelectedBG.Hide() if isSelected and self.parentEntry: self.parentEntry.ExpandFromRoot()
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.SetTopparentHeight(0) self.preSelectedItems = attributes.selectedItems self.outputPrice = 0 self.outputItemsCount = 0 mainCont = Container(name='mainCont', parent=self.sr.main, padding=const.defaultPadding) bottomCont = Container(name='bottomCont', parent=mainCont, align=uiconst.TOBOTTOM, height=36) reprocessingCont = Container(name='reprocessingCont', parent=mainCont, align=uiconst.TOALL) inputCont = Container(name='inputCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.48) centerCont = Container(name='centerCont', parent=reprocessingCont, align=uiconst.TOLEFT_PROP, width=0.02) outputCont = Container(name='outputCont', parent=reprocessingCont, align=uiconst.TORIGHT_PROP, width=0.48) self.inputInfoCont = ReprocessInputContainer(name='inputInfo', parent=inputCont, dropFunc=self.AddItemByDrag, removeFunc=self.RemoveItem) self.outputInfoCont = ReprocessOutputContainer(name='outputInfo', parent=outputCont) self.loadingOverlay = Container(parent=self.inputInfoCont, idx=0) Fill(bgParent=self.loadingOverlay, color=(0.0, 0.0, 0.0, 0.3)) LoadingWheel(name='loadingWheel', parent=self.loadingOverlay, align=uiconst.CENTER, width=80, height=80) self.loadingOverlay.opacity = 0.0 self.controller = CreateReprocessingWindowController(self, self.inputInfoCont, self.outputInfoCont, sm.GetService('invCache'), sm.GetService('reprocessing'), GetActiveShip) self.inputInfoCont.captionLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/InputMaterials') self.outputInfoCont.captionLabel.text = GetByLabel('UI/Reprocessing/ReprocessingWindow/OutputResults') btnCont = Container(name='buttonCont', parent=bottomCont, align=uiconst.TOBOTTOM, height=36, idx=0, padding=(-4, 3, -4, -2)) GradientThemeColored(bgParent=btnCont) self.reprocessButton = Button(parent=btnCont, label=GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessButton'), func=self.ReprocessItems, align=uiconst.CENTER, fixedheight=28) self.cancelButton = Button(parent=btnCont, label=GetByLabel('UI/Common/Buttons/Cancel'), func=self.Cancel, align=uiconst.CENTERRIGHT, left=8) self.DisableReprocessButton(disable=True) if self.preSelectedItems: start_tasklet(self.AddPreselectedItems, self.preSelectedItems)
def ConstructLayout(self): self.topFill = uiprimitives.Container(parent=self, name='topFill', align=uiconst.TOTOP, height=30) BlurredSceneUnderlay(bgParent=self.topFill) self.topBG = uiprimitives.Sprite(parent=self.topFill, align=uiconst.TOALL, texturePath='res:/UI/Texture/classes/Neocom/eveButtonBg.png', blendMode=trinity.TR2_SBM_ADD) self.main = uiprimitives.Container(name='main', parent=self, padTop=3) self.bgFill = FillThemeColored(parent=self, align=uiconst.TOTOP, colorType=uiconst.COLORTYPE_UIBASE, opacity=0.8) GradientThemeColored(parent=self, align=uiconst.TOALL, colorType=uiconst.COLORTYPE_UIBASE, rgbData=[(0.0, (1.0, 1.0, 1.0))], alphaData=[(0.0, 0.8), (0.4, 0.3), (1.0, 0.1)], rotation=-pi / 2) BlurredSceneUnderlay(bgParent=self, isPinned=True, opacity=0.8)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self._value = 0.0 GradientThemeColored(bgParent=self, rotation=-math.pi / 2, rgbData=[(0, Color.WHITE[:3]), (0.5, Color.GRAY5[:3])], alphaData=[(0.3, 1.0)], colorType=uiconst.COLORTYPE_UIHILIGHT)
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.factionalWarStatus = None self.topCont = uiprimitives.Container(name='topCont', parent=self.sr.main, align=uiconst.TOTOP, height=140, clipChildren=True, padRight=4) self.tabgroup = uicontrols.TabGroup(parent=self.sr.main, align=uiconst.TOTOP) self.bottomCont = uiprimitives.Container(name='buttonParent', align=uiconst.TOBOTTOM, height=28, parent=self.sr.main) GradientThemeColored(bgParent=self.bottomCont) self.warzonePanel = uiprimitives.Container(name='warzonePanel', parent=self.sr.main, padding=const.defaultPadding, state=uiconst.UI_HIDDEN) self.statisticsPanel = uiprimitives.Container(name='statisticsPanel', parent=self.sr.main, padding=const.defaultPadding, state=uiconst.UI_HIDDEN) self.rulesPanel = uiprimitives.Container(name='rulesPanel', parent=self.sr.main, padding=const.defaultPadding, state=uiconst.UI_HIDDEN) uthread.new(self.LoadTabPanels)
def Layout(self): if self.skin.licensed: colorType = uiconst.COLORTYPE_UIHEADER else: colorType = uiconst.COLORTYPE_UIBASECONTRAST FillThemeColored(bgParent=self, padLeft=self.SKIN_ICON_SIZE / 2, colorType=colorType) self.iconGlow = Sprite( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=-5, width=self.SKIN_ICON_SIZE, height=self.SKIN_ICON_SIZE, texturePath='res:/UI/Texture/classes/skins/skin-icon-glow.png', opacity=0.0) Sprite(parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=-5, width=self.SKIN_ICON_SIZE, height=self.SKIN_ICON_SIZE, texturePath=self.skin.iconTexturePath) self.iconShadow = Sprite( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=0, left=28, width=38, height=54, texturePath='res:/UI/Texture/classes/skins/icon-shadow.png') if self.skin.licensed: color = (0.9, 0.9, 0.9, 1.0) top = 6 else: color = (0.4, 0.4, 0.4, 1.0) top = 4 title = EveCaptionSmall(parent=self, left=self.SKIN_ICON_SIZE + 6, top=top, text=self.skin.name, color=color) title.SetRightAlphaFade(fadeEnd=ENTRY_DEFAULT_WIDTH - title.left - 4, maxFadeWidth=12) if self.skin.licensed: duration = SkinDurationLabel(parent=self, left=self.SKIN_ICON_SIZE + 6, top=title.top + title.height, skin=self.skin) duration.SetRightAlphaFade(fadeEnd=ENTRY_DEFAULT_WIDTH - duration.left - 4, maxFadeWidth=12) else: buttonCont = FlowContainer(parent=self, align=uiconst.TOPLEFT, top=title.top + title.height + 2, left=self.SKIN_ICON_SIZE + 7, width=200, contentSpacing=(4, 0)) SkinMaterialBuyButtonIsk(parent=buttonCont, align=uiconst.NOALIGN, typeID=self.controller.typeID, materialID=self.skin.materialID, logContext=self._logContext) SkinMaterialBuyButtonAur(parent=buttonCont, align=uiconst.NOALIGN, typeID=self.controller.typeID, materialID=self.skin.materialID, logContext=self._logContext) self.pendingIcon = Sprite( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=self.height / 2 - 16 / 2, left=ENTRY_DEFAULT_WIDTH + 2, width=16, height=16, texturePath='res:/UI/Texture/classes/skins/pending.png', opacity=0.0) animations.MorphScalar(self.pendingIcon, 'rotation', startVal=0.0, endVal=-2 * math.pi, duration=1.0, curveType=uiconst.ANIM_LINEAR, loops=uiconst.ANIM_REPEAT) self.appliedIcon = Sprite( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=self.height / 2 - 16 / 2, left=ENTRY_DEFAULT_WIDTH + 2, width=16, height=16, texturePath='res:/UI/Texture/classes/skins/applied.png', opacity=0.0) self.previewedIcon = Sprite( parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, top=self.height / 2 - 16 / 2, left=ENTRY_DEFAULT_WIDTH + 2, width=16, height=16, texturePath='res:/UI/Texture/classes/skins/previewed.png', opacity=0.0) self.stateIconLight = GradientThemeColored( parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, rotation=0, alphaData=[(0.0, 0.0), (0.25, 0.01), (0.5, 0.1), (0.6, 0.2), (0.7, 0.4), (0.8, 0.8), (0.9, 1.0)], colorType=uiconst.COLORTYPE_UIHILIGHTGLOW, opacity=0.0) if self.skin.licensed: colorType = uiconst.COLORTYPE_UIHILIGHT else: colorType = uiconst.COLORTYPE_UIHEADER self.selectionGradient = GradientThemeColored( parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, rotation=0, alphaData=[(0.0, 0.0), (0.9, 1.0)], colorType=colorType, opacity=0.0) self.blinkFill = FillThemeColored( bgParent=self, colorType=uiconst.COLORTYPE_UIHILIGHT, padLeft=self.SKIN_ICON_SIZE / 2, opacity=0.0)
class TreeViewEntry(ContainerAutoSize): default_name = 'TreeViewEntry' default_align = uiconst.TOTOP default_state = uiconst.UI_NORMAL default_settingsID = '' LEFTPUSH = 10 default_height = 22 isDragObject = True noAccessColor = (0.33, 0.33, 0.33, 1.0) iconColor = util.Color.WHITE @telemetry.ZONE_METHOD def ApplyAttributes(self, attributes): ContainerAutoSize.ApplyAttributes(self, attributes) self.level = attributes.get('level', 0) self.data = attributes.get('data') self.eventListener = attributes.get('eventListener', None) self.parentEntry = attributes.get('parentEntry', None) self.settingsID = attributes.get('settingsID', self.default_settingsID) self.defaultExpanded = attributes.get('defaultExpanded', self.level < 1) self.childrenInitialized = False self.isToggling = False self.canAccess = True self.isSelected = False self.childSelectedBG = False self.icon = None self.childCont = None self.topRightCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=self.default_height) self.topRightCont.GetDragData = self.GetDragData left = self.GetSpacerContWidth() if self.data.IsRemovable(): removeBtn = Sprite( texturePath='res:/UI/Texture/icons/73_16_210.png', parent=self.topRightCont, align=uiconst.CENTERLEFT, width=16, height=16, left=left, hint=localization.GetByLabel('UI/Common/Buttons/Close')) left += 20 removeBtn.OnClick = self.Remove icon = self.data.GetIcon() if icon: iconSize = self.height - 2 self.icon = Icon(icon=icon, parent=self.topRightCont, pos=(left, 0, iconSize, iconSize), align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, ignoreSize=True) left += iconSize self.label = Label(parent=self.topRightCont, align=uiconst.CENTERLEFT, text=self.data.GetLabel(), left=left + 4) self.UpdateLabel() self.hoverBG = None self.selectedBG = None self.blinkBG = None if self.data.HasChildren(): self.spacerCont = Container(name='spacerCont', parent=self.topRightCont, align=uiconst.TOLEFT, width=self.GetSpacerContWidth()) self.toggleBtn = Container(name='toggleBtn', parent=self.spacerCont, align=uiconst.CENTERRIGHT, width=16, height=16, state=uiconst.UI_HIDDEN) self.toggleBtn.OnClick = self.OnToggleBtnClick self.toggleBtn.OnDblClick = lambda: None self.toggleBtnSprite = Sprite( bgParent=self.toggleBtn, texturePath='res:/UI/Texture/classes/Neocom/arrowDown.png', rotation=pi / 2, padding=(4, 4, 5, 5)) expandChildren = False if not self.data.IsForceCollapsed(): toggleSettingsDict = settings.user.ui.Get( 'invTreeViewEntryToggle_%s' % self.settingsID, {}) expandChildren = toggleSettingsDict.get( self.data.GetID(), self.defaultExpanded) self.ConstructChildren() else: self.toggleBtn.state = uiconst.UI_NORMAL self.ShowChildCont(expandChildren, animate=False) else: self.ShowChildCont(False, animate=False) if self.eventListener and hasattr(self.eventListener, 'RegisterID'): self.eventListener.RegisterID(self, self.data.GetID()) def GetSpacerContWidth(self): return (1 + self.level) * self.LEFTPUSH + 8 def Close(self): try: if self.eventListener and hasattr(self.eventListener, 'UnregisterID'): self.eventListener.UnregisterID(self.data.GetID()) if self.parentEntry and self.data in self.parentEntry.data._children: self.parentEntry.data._children.remove(self.data) finally: ContainerAutoSize.Close(self) @telemetry.ZONE_METHOD def ConstructChildren(self): self.childrenInitialized = True children = self.data.GetChildren() if self.destroyed: return if self.childCont is None: self.childCont = ContainerAutoSize(parent=self, name='childCont', align=uiconst.TOTOP, clipChildren=True, state=uiconst.UI_HIDDEN) if children: for child in children: cls = self.GetTreeViewEntryClassByTreeData(child) child = cls(parent=self.childCont, parentEntry=self, level=self.level + 1, eventListener=self.eventListener, data=child, settingsID=self.settingsID, state=uiconst.UI_HIDDEN) child.UpdateLabel() if self.childCont.children: self.childCont.children[-1].padBottom = 5 self.toggleBtn.state = uiconst.UI_NORMAL def GetTreeViewEntryClassByTreeData(self, treeData): """ Can be overridden to return custom tree view entry classes """ return TreeViewEntry def ShowChildCont(self, show=True, animate=True): if self.childCont is None or self.childCont.display == show or not self.data.HasChildren( ): return for child in self.childCont.children: child.display = show self.isToggling = True if animate: if show: self.childCont.display = True uicore.animations.Tr2DRotateTo(self.toggleBtnSprite, pi / 2, 0.0, duration=0.15) self.childCont.DisableAutoSize() _, height = self.childCont.GetAutoSize() uicore.animations.FadeIn(self.childCont, duration=0.3) uicore.animations.MorphScalar(self.childCont, 'height', self.childCont.height, height, duration=0.15, sleep=True) self.childCont.EnableAutoSize() else: uicore.animations.Tr2DRotateTo(self.toggleBtnSprite, 0.0, pi / 2, duration=0.15) self.childCont.DisableAutoSize() uicore.animations.FadeOut(self.childCont, duration=0.15) uicore.animations.MorphScalar(self.childCont, 'height', self.childCont.height, 0, duration=0.15, sleep=True) self.childCont.display = False self.toggleBtn.Enable() else: self.childCont.display = show if show: self.toggleBtnSprite.rotation = 0.0 self.childCont.opacity = 1.0 else: self.toggleBtnSprite.rotation = pi / 2 self.childCont.DisableAutoSize() self.childCont.opacity = 0.0 self.isToggling = False def UpdateSelectedState(self, selectedIDs): invID = self.data.GetID() isSelected = selectedIDs[-1] == invID isChildSelected = not isSelected and invID in selectedIDs self.SetSelected(isSelected, isChildSelected) def SetSelected(self, isSelected, isChildSelected=False): self.isSelected = isSelected if isSelected or self.selectedBG: self.CheckConstructSelectedBG() self.selectedBG.display = isSelected self.UpdateLabel() if isChildSelected: if not self.childSelectedBG: self.childSelectedBG = GradientThemeColored( bgParent=self.spacerCont, rotation=0, alphaData=[(0, 0.5), (1.0, 0.0)], padBottom=1, colorType=uiconst.COLORTYPE_UIHILIGHT) else: self.childSelectedBG.Show() elif self.childSelectedBG: self.childSelectedBG.Hide() if isSelected and self.parentEntry: self.parentEntry.ExpandFromRoot() @telemetry.ZONE_METHOD def UpdateLabel(self): if self.isSelected and self.canAccess: self.label.color = util.Color.WHITE elif self.canAccess: self.label.color = Label.default_color else: self.label.color = self.noAccessColor if session.role & (service.ROLE_GML | service.ROLE_WORLDMOD): if settings.user.ui.Get('invPrimingDebugMode', False) and hasattr( self.data, 'invController') and self.data.invController.IsPrimed(): self.label.color = util.Color.RED def ExpandFromRoot(self): """ Make sure a selected item is visible in the tree """ self.ToggleChildren(forceShow=True) if self.parentEntry: self.parentEntry.ExpandFromRoot() def OnClick(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewClick'): self.eventListener.OnTreeViewClick(self, *args) def OnDblClick(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDblClick'): self.eventListener.OnTreeViewDblClick(self, *args) def OnToggleBtnClick(self, *args): if not self.isToggling: self.ToggleChildren() def ToggleChildren(self, forceShow=False): show = forceShow or self.childCont is None or not self.childCont.display toggleSettingsDict = settings.user.ui.Get( 'invTreeViewEntryToggle_%s' % self.settingsID, {}) toggleSettingsDict[self.data.GetID()] = show settings.user.ui.Set('invTreeViewEntryToggle_%s' % self.settingsID, toggleSettingsDict) if not self.data.HasChildren(): return if not self.childrenInitialized: self.ConstructChildren() self.ShowChildCont(show) def GetMenu(self): m = self.data.GetMenu() if session.role & service.ROLE_PROGRAMMER: idString = repr(self.data.GetID()) m.append((idString, blue.pyos.SetClipboardData, (idString, ))) if self.data.IsRemovable(): m.append(None) m.append((localization.GetByLabel('UI/Common/Buttons/Close'), self.Remove, ())) return m def GetHint(self): return self.data.GetHint() def GetFullPathLabelList(self): labelTuple = [self.data.GetLabel()] if self.parentEntry: labelTuple = self.parentEntry.GetFullPathLabelList() + labelTuple return labelTuple def Remove(self, *args): self.eventListener.RemoveTreeEntry(self, byUser=True) def OnMouseDown(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseDown'): self.eventListener.OnTreeViewMouseDown(self, *args) def OnMouseUp(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseUp'): self.eventListener.OnTreeViewMouseUp(self, *args) def CheckConstructHoverBG(self): if self.hoverBG is None: self.hoverBG = ListEntryUnderlay(bgParent=self.topRightCont) def CheckConstructSelectedBG(self): if self.selectedBG is None: self.selectedBG = FillThemeColored( bgParent=self.topRightCont, colorType=uiconst.COLORTYPE_UIHILIGHT, state=uiconst.UI_HIDDEN, opacity=0.5) def CheckConstructBlinkBG(self): if self.blinkBG is None: self.blinkBG = Fill(bgParent=self.topRightCont, color=(1.0, 1.0, 1.0, 0.0)) def OnMouseEnter(self, *args): self.CheckConstructHoverBG() self.hoverBG.ShowHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseEnter'): self.eventListener.OnTreeViewMouseEnter(self, *args) def OnMouseExit(self, *args): self.CheckConstructHoverBG() self.hoverBG.HideHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseExit'): self.eventListener.OnTreeViewMouseExit(self, *args) def OnDropData(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDropData'): self.eventListener.OnTreeViewDropData(self, *args) def OnDragEnter(self, dragObj, nodes): self.CheckConstructHoverBG() self.hoverBG.ShowHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDragEnter'): self.eventListener.OnTreeViewDragEnter(self, dragObj, nodes) def GetDragData(self): if self.data.IsDraggable(): self.eventListener.OnTreeViewGetDragData(self) return [self.data] def OnDragExit(self, *args): self.CheckConstructHoverBG() self.hoverBG.HideHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDragExit'): self.eventListener.OnTreeViewDragExit(self, *args) def Blink(self): self.CheckConstructBlinkBG() uicore.animations.FadeTo(self.blinkBG, 0.0, 0.25, duration=0.25, curveType=uiconst.ANIM_WAVE, loops=2) @telemetry.ZONE_METHOD def SetAccessability(self, canAccess): self.canAccess = canAccess if self.icon: self.icon.color = self.iconColor if canAccess else util.Color( *self.iconColor).SetAlpha(0.5).GetRGBA() self.UpdateLabel()