class StateCont(ContainerAutoSize): def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.bgFill = Fill(bgParent=self, color=COLOR_OFF) self.label = Label(parent=self, align=uiconst.CENTERLEFT, text=attributes.text, padLeft=5, padRight=5) def SetActive(self, isActive): if isActive: self.bgFill.SetRGB(*COLOR_ON) else: self.bgFill.SetRGB(*COLOR_OFF)
class AttrEntry(listentry.Generic): __guid__ = 'listentry.DgmAttrEntry' def Startup(self, *args): listentry.Generic.Startup(self, *args) self.colorcodedFill = Fill(bgParent=self, color=(0, 0, 0, 0)) def Load(self, node): listentry.Generic.Load(self, node) self.colorcodedFill.SetRGB(*node.color) def OnDblClick(self, *args): self.ShowAttributeDetailsFromServer() def GetMenu(self): n = self.sr.node ret = [('View Details (+ Server Graph)', self.ShowAttributeDetailsFromServer, ()), ('View Details (+ Client Graph)', self.ShowAttributeDetailsFromClient, ())] if eve.session.role & ROLE_PROGRAMMER: if n.attributeName == 'charge': return ret ret.append( ('Change Attribute', sm.StartService('menu').SetDogmaAttribute, (n.itemID, n.attributeName, n.actualValue))) return ret def ShowAttributeDetailsFromServer(self): n = self.sr.node n.ShowAttribute(n.attributeID, showServerSideGraph=True) def ShowAttributeDetailsFromClient(self): n = self.sr.node n.ShowAttribute(n.attributeID, showServerSideGraph=False)
class BroadcastEntry(listentry.Generic): def Startup(self, *args): listentry.Generic.Startup(self, *args) self.colorcodedFill = Fill(bgParent=self, color=(0, 0, 0, 0)) def Load(self, node): listentry.Generic.Load(self, node) if node.colorcoded: fillColor = node.colorcoded + (0.25, ) self.colorcodedFill.SetRGB(*fillColor)
class FlagIcon(Container): default_align = uiconst.TOPRIGHT default_width = 9 default_height = 9 default_idx = 0 iconTexturePathRoot = 'res:/UI/Texture/classes/FlagIcon/%s.png' def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.flagBackground = Fill(bgParent=self) self.flagBackground.opacity = 0 self.flagIcon = Sprite(parent=self, pos=(0, 0, 9, 9), name='flagIcon', state=uiconst.UI_DISABLED, align=uiconst.CENTER) def SetIconTexturePath(self, iconIdx): self.flagIcon.texturePath = self.iconTexturePathRoot % iconIdx def SetBackgroundColor(self, color, opacity=0.75): newColor = (color[0], color[1], color[2], opacity) self.flagBackground.SetRGB(*newColor) def ChangeIconVisibility(self, display): self.flagIcon.display = display def ChangeFlagPos(self, left, top, width, height): self.left = left self.top = top self.width = width self.height = height def ChangeIconPos(self, left, top, width, height): self.flagIcon.left = left self.flagIcon.top = top self.flagIcon.width = width self.flagIcon.height = height
class BroadcastSettingsEntry(listentry.Checkbox): colorList = [(1.0, 0.7, 0.0), (1.0, 0.35, 0.0), (0.75, 0.0, 0.0), (0.1, 0.6, 0.1), (0.0, 0.63, 0.57), (0.2, 0.5, 1.0), (0.0, 0.15, 0.6), (0.0, 0.0, 0.0), (0.7, 0.7, 0.7)] def Startup(self, *args): listentry.Checkbox.Startup(self, *args) colorPicker = Container(parent=self, pos=(0, 0, 27, 20), name='colorPicker', state=uiconst.UI_NORMAL, align=uiconst.CENTERRIGHT, idx=0) Sprite(parent=colorPicker, pos=(0, 0, 16, 16), name='arrow', align=uiconst.CENTERRIGHT, texturePath='res:/ui/texture/icons/38_16_229.png', color=(1, 1, 1, 0.5), state=uiconst.UI_DISABLED) self.colorCont = Container(parent=colorPicker, name='colorCont', pos=(2, 0, 10, 10), align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED) Frame(parent=self.colorCont, name='colorFrame', color=(1, 1, 1, 0.2)) self.colorFill = Fill(parent=self.colorCont, color=(0, 0, 0, 0)) colorPicker.LoadTooltipPanel = self.LoadColorTooltipPanel colorPicker.GetTooltipPointer = self.GetColorTooltipPointer colorPicker.GetTooltipDelay = self.GetTooltipDelay def Load(self, node): listentry.Checkbox.Load(self, node) if node.colorcoded: fillColor = node.colorcoded + (1, ) self.colorFill.SetRGBA(*fillColor) def GetColorTooltipPointer(self): return uiconst.POINT_LEFT_2 def GetTooltipDelay(self): return 50 def LoadColorTooltipPanel(self, tooltipPanel, *args): currentColor = self.sr.node.colorcoded tooltipPanel.state = uiconst.UI_NORMAL tooltipPanel.margin = (2, 2, 2, 2) def SetBroadcastTypeColorFromPanel(color): self.SetBroadcastTypeColor(color, tooltipPanel) colorPanel = ColorPanel(callback=SetBroadcastTypeColorFromPanel, currentColor=currentColor, colorList=self.colorList) tooltipPanel.AddLabelSmall( text=localization.GetByLabel('UI/Mail/Select Color')) tooltipPanel.AddCell(cellObject=colorPanel) def SetBroadcastTypeColor(self, color, tooltipPanel): settings.user.ui.Set('fleet_broadcastcolor_%s' % self.sr.node.cfgname, color) if color: self.colorFill.SetRGB(*color) self.colorFill.display = True else: self.colorFill.display = False self.sr.node.colorcoded = color sm.ScatterEvent('OnFleetBroadcastFilterChange') tooltipPanel.Close() def _OnResize(self): w, h = self.GetAbsoluteSize() availableWidth = w - self.sr.label.left - self.colorCont.width - 10 textwidth = self.sr.label.textwidth if textwidth > availableWidth: fadeEnd = availableWidth self.sr.label.SetRightAlphaFade(fadeEnd, maxFadeWidth=20) else: self.sr.label.SetRightAlphaFade(0, maxFadeWidth=0)