NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

schedulingElements.py (2723B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\moonmining\schedulingElements.py
      2 from carbonui.fontconst import STYLE_HEADER
      3 from carbonui.primitives.container import Container
      4 from carbonui.primitives.fill import Fill
      5 from carbonui.primitives.frame import Frame
      6 from carbonui.util.color import Color
      7 from eve.client.script.ui.control.eveLabel import EveLabelLargeUpper, Label
      8 import carbonui.const as uiconst
      9 
     10 class StatusCont(Container):
     11     default_align = uiconst.CENTER
     12     default_height = 30
     13 
     14     def ApplyAttributes(self, attributes):
     15         Container.ApplyAttributes(self, attributes)
     16         color = attributes.color
     17         text = attributes.text or ''
     18         self.frame = Frame(bgParent=self)
     19         self.fill = Fill(bgParent=self)
     20         self.label = Label(name='statusLabel', parent=self, align=uiconst.CENTER, fontsize=14, uppercase=True, fontstyle=STYLE_HEADER)
     21         self.SetLabelText(text)
     22         self.SetWidth(self.GetMaxWidth())
     23         self.SetColors(color)
     24 
     25     def SetColors(self, color):
     26         self.frame.SetRGBA(*(color[:3] + (0.3,)))
     27         self.fill.SetRGBA(*(color[:3] + (0.1,)))
     28         textColor = GetTextColor(color)
     29         self.label.SetRGBA(*textColor)
     30 
     31     def GetMaxWidth(self):
     32         return self.label.textwidth + 100
     33 
     34     def SetWidth(self, width):
     35         self.width = width
     36 
     37     def GetLabelText(self):
     38         return self.label.text
     39 
     40     def SetLabelText(self, text):
     41         self.label.text = text
     42 
     43 
     44 class HeaderStatus(Container):
     45     default_width = 200
     46     default_height = 30
     47 
     48     def ApplyAttributes(self, attributes):
     49         Container.ApplyAttributes(self, attributes)
     50         color = attributes.color
     51         text = attributes.text
     52         self.label = EveLabelLargeUpper(name='headerStatusLabel', parent=self, align=uiconst.CENTER, text=text, bold=True)
     53         self.edges = Frame(parent=self, texturePath='res:/UI/Texture/classes/Moonmining/headerFrame1.png', cornerSize=7)
     54         Frame(parent=self, texturePath='res:/UI/Texture/classes/Moonmining/headerFrame2.png', cornerSize=7, color=(0.75, 0.75, 0.75, 0.1))
     55         self.fill = Fill(bgParent=self, padding=1)
     56         self.SetColors(color)
     57 
     58     def SetColors(self, color):
     59         self.edges.SetRGBA(*(color[:3] + (0.5,)))
     60         self.fill.SetRGBA(*(color[:3] + (0.05,)))
     61         textColor = GetTextColor(color)
     62         self.label.SetRGBA(*textColor)
     63 
     64     def SetLabelText(self, text):
     65         self.label.text = text
     66 
     67 
     68 def GetTextColor(color, maximumSaturation = 0.3):
     69     c = Color(*color)
     70     currentSaturation = c.GetSaturation()
     71     if currentSaturation < maximumSaturation:
     72         return color
     73     return c.SetSaturation(maximumSaturation).GetRGBA()