Esempio n. 1
0
 def SetColor(self, color):
     underlayColor = Color(*color).SetBrightness(0.4).GetRGBA()
     self.underlay.SetFixedColor(underlayColor)
     blinkColor = Color(*color).SetSaturation(0.5).SetBrightness(0.9).GetRGBA()
     self.sr.hilite.SetRGBA(*blinkColor)
     for obj in (self.pattern, self.bg, self.arrows):
         uicore.animations.SpColorMorphTo(obj, obj.GetRGBA(), color, duration=0.3)
Esempio n. 2
0
class SystemCostIndexGauge(Gauge):
    """
    A specialized gauge used to visualize System cost index
    """
    default_color = Color(
        *industryUIConst.COLOR_SYSTEMCOSTINDEX).SetBrightness(0.5).GetRGBA()
    default_backgroundColor = Color(
        *industryUIConst.COLOR_SYSTEMCOSTINDEX).SetAlpha(0.1).GetRGBA()

    def ApplyAttributes(self, attributes):
        Gauge.ApplyAttributes(self, attributes)
        facilityData = attributes.facilityData
        activityID = attributes.activityID
        self.valueLabel = EveLabelSmallBold(parent=self,
                                            align=uiconst.CENTER,
                                            idx=0,
                                            top=1)
        for i in xrange(11):
            self.ShowMarker(i / 10.0, color=(0.5, 0.5, 0.7, i / 60.0))

        systemCostIndexes = facilityData.GetCostIndexByActivityID()
        value = systemCostIndexes.get(activityID, 0.0)
        maxValue = sm.GetService('facilitySvc').GetMaxActivityModifier(
            activityID)
        Gauge.SetValue(self, value / maxValue)
        self.valueLabel.text = '%.2f%%' % (value * 100.0)

    def GetHint(self):
        return '<b>%s</b><br>%s' % (
            localization.GetByLabel('UI/Industry/SystemCostIndex'),
            localization.GetByLabel('UI/Industry/SystemCostIndexHint'))
 def _GetHilightGlowColor(self):
     if self._colorHiliteGlow:
         return self._colorHiliteGlow
     color = Color(*self._GetHilightColor()).SetBrightness(1.0)
     if color.GetSaturation() > 0.2:
         color.SetSaturation(0.2)
     self._colorHiliteGlow = color.GetRGBA()
     return self._colorHiliteGlow
Esempio n. 4
0
 def GetSquadronAction(self, tubeFlagID):
     tubeStatus = self.shipFighterState.GetTubeStatus(tubeFlagID)
     stateText = LABEL_BY_STATE[tubeStatus.statusID]
     if session.stationid2:
         stateColor = Color(*COLOR_OPEN)
     else:
         stateColor = Color(*COLOR_BY_STATE[tubeStatus.statusID])
     stateColor.a = 0.8
     return (stateText, stateColor)
Esempio n. 5
0
 def GetPercentageLabel(self):
     percent = self.GetAsPercentage()
     if isinstance(self, industry.ProbabilityModifier) and self.reference == Reference.BLUEPRINT:
         return '%.1f%%' % (100.0 + percent)
     else:
         color = self.GetModifierColor()
         if percent > 0:
             return '<color=%s>+%.1f%%</color>' % (Color.RGBtoHex(*color), percent)
         return '<color=%s>%.1f%%</color>' % (Color.RGBtoHex(*color), percent)
Esempio n. 6
0
 def GetPercentageLabel(self):
     percent = self.GetAsPercentage()
     color = self.GetModifierColor()
     if percent > 0:
         return '<color=%s>+%.1f%%</color>' % (Color.RGBtoHex(*color),
                                               percent)
     else:
         return '<color=%s>%.1f%%</color>' % (Color.RGBtoHex(*color),
                                              percent)
    def Load(self):
        self.Flush()
        toggleButtonCont = Container(name='btnGroupCont',
                                     parent=self,
                                     align=uiconst.TOTOP,
                                     height=45)
        btnGroup = ToggleButtonGroup(parent=toggleButtonCont,
                                     align=uiconst.CENTER,
                                     height=toggleButtonCont.height,
                                     width=330,
                                     padding=(10, 4, 10, 3),
                                     callback=self.LoadMasteryLevel)
        for level, iconPath in BUTTONS:
            hint = localization.GetByLabel(
                'UI/InfoWindow/MasteryLevelButtonHint', level=level)
            if level == 5:
                color = Color(*shipTreeConst.COLOR_MASTERED).SetBrightness(
                    0.2).GetRGBA()
            else:
                color = Color(
                    *shipTreeConst.COLOR_BG).SetBrightness(0.35).GetRGBA()
            btnGroup.AddButton(btnID=level,
                               iconPath=iconPath,
                               iconSize=45,
                               hint=hint,
                               colorSelected=color)

        self.masteryHeader = Container(name='masteryHeader',
                                       parent=self,
                                       align=uiconst.TOTOP,
                                       height=25)
        self.settingsMenu = uicls.UtilMenu(
            menuAlign=uiconst.TOPLEFT,
            parent=self.masteryHeader,
            align=uiconst.BOTTOMLEFT,
            left=4,
            GetUtilMenu=self.GetSettingsMenu,
            texturePath='res:/UI/Texture/SettingsCogwheel.png',
            width=16,
            height=16,
            iconSize=18)
        self.masteryTimeLabel = EveLabelMediumBold(name='masteryTimeLabel',
                                                   parent=self.masteryHeader,
                                                   align=uiconst.BOTTOMLEFT,
                                                   left=24)
        self.masteryScroll = Scroll(name='masteryScroll',
                                    parent=self,
                                    padding=const.defaultPadding)
        level = sm.GetService('certificates').GetCurrCharMasteryLevel(
            self.typeID)
        level = max(level, 1)
        btnGroup.SelectByID(level)
Esempio n. 8
0
 def UpdateState(self, *args):
     activityType = industryUIConst.GetActivityType(self.jobData.activityID)
     changed = self.activityType != activityType
     self.activityType = activityType
     if changed:
         uicore.animations.FadeOut(self, sleep=True, duration=0.1)
         if self.activityType == industryUIConst.MANUFACTURING:
             self.countCaption.text = localization.GetByLabel(
                 'UI/Industry/ManufacturingJobs')
         else:
             self.countCaption.text = localization.GetByLabel(
                 'UI/Industry/ScienceJobs')
     color = Color.RGBtoHex(
         *industryUIConst.GetActivityColor(self.activityType))
     self.countLabel.text = '%s / <color=%s>%s</color>' % (
         self.jobData.used_slots, color, self.jobData.max_slots)
     skillLabel = industryUIConst.GetControlRangeLabel(
         self.jobData.max_distance)
     self.rangeLabel.text = '<color=%s>%s' % (color, skillLabel)
     if changed:
         uicore.animations.FadeIn(self, duration=0.3)
     if self.jobData and self.jobData.HasError(industry.Error.SLOTS_FULL):
         self.slotsErrorFrame.Show()
     else:
         self.slotsErrorFrame.Hide()
     if self.jobData and self.jobData.HasError(
             industry.Error.FACILITY_DISTANCE):
         self.rangeErrorFrame.Show()
     else:
         self.rangeErrorFrame.Hide()
 def GetLabelText(self):
     if self._cachedLabel is None:
         securityStatus, color = sm.GetService('map').GetSecurityStatus(
             self.markerID, True)
         self._cachedLabel = '%s <color=%s>%s</color>' % (
             cfg.evelocations.Get(self.markerID).name,
             Color.RGBtoHex(color.r, color.g, color.b), securityStatus)
     return self._cachedLabel
Esempio n. 10
0
 def ReconstructGauge(self):
     if self.gauge:
         self.gauge.Close()
         self.gauge = None
     if not self.jobData:
         return
     color = GetJobColor(self.jobData)
     h, s, b = Color(*color).GetHSB()
     colorEnd = Color(*color).SetBrightness(b * 0.5).GetRGBA()
     self.gauge = BlueprintGaugeCircular(name='gauge',
                                         parent=self,
                                         align=uiconst.CENTER,
                                         radius=64,
                                         lineWidth=4,
                                         colorStart=color,
                                         colorEnd=colorEnd,
                                         jobData=self.jobData)
Esempio n. 11
0
 def AnimFadeBgGradient(self):
     if self.jobData.activityID == industry.MANUFACTURING:
         color = industryUIConst.COLOR_MANUFACTURING
         color = Color(*color).SetAlpha(0.2).GetRGBA()
     else:
         color = industryUIConst.COLOR_SCIENCE
         color = Color(*color).SetAlpha(0.5).GetRGBA()
     uicore.animations.Tr2DScaleTo(self.bgTransform,
                                   self.bgTransform.scale, (1.0, 1.0),
                                   duration=0.3)
     if self.jobData.status == industry.STATUS_READY:
         opacity = 1.2
     else:
         opacity = 0.3
     uicore.animations.SpColorMorphTo(self.bgGradient,
                                      endColor=color,
                                      duration=0.9)
     uicore.animations.FadeTo(self.bgTransform,
                              self.bgTransform.opacity,
                              opacity,
                              duration=0.3,
                              sleep=True)
     if self.jobData.status == industry.STATUS_DELIVERED:
         uicore.animations.FadeTo(self.bgTransform,
                                  self.bgTransform.opacity,
                                  1.2,
                                  duration=2.5)
     elif self.jobData.status >= industry.STATUS_READY:
         uicore.animations.FadeTo(self.bgTransform,
                                  self.bgTransform.opacity,
                                  1.8,
                                  duration=2.5,
                                  curveType=ANIM_WAVE,
                                  loops=uiconst.ANIM_REPEAT)
     else:
         uicore.animations.Tr2DScaleTo(self.bgTransform, (1.0, 1.0),
                                       (0.985, 0.985),
                                       duration=5.0,
                                       curveType=ANIM_WAVE,
                                       loops=uiconst.ANIM_REPEAT)
         uicore.animations.FadeTo(self.bgTransform,
                                  0.3,
                                  1.0,
                                  duration=5.0,
                                  curveType=ANIM_WAVE,
                                  loops=uiconst.ANIM_REPEAT)
 def ApplyAttributes(self, attributes):
     ContainerAutoSize.ApplyAttributes(self, attributes)
     label = attributes.label
     maxValue = attributes.Get('maxValue', 1.0)
     self.colorCallback = attributes.colorCallback
     self.color = Color(*attributes.color)
     self.initialized = False
     Label(parent=self, align=uiconst.TOTOP, text=label, fontsize=20, left=14)
     Button(parent=self, left=4, top=4, align=uiconst.TOPRIGHT, label='Copy to Clipboard', func=self.CopyToClipboard)
     self.r = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=self.color.r, maxValue=maxValue, label='R', callback=self.OnRChange)
     self.g = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=self.color.g, maxValue=maxValue, label='G', callback=self.OnGChange, padTop=PADTOP)
     self.b = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=self.color.b, maxValue=maxValue, label='B', callback=self.OnBChange, padTop=PADTOP)
     h, s, b = self.color.GetHSB()
     self.h = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=h, maxValue=1.0, label='H', callback=self.OnHChange, padTop=PADTOP + 14)
     self.s = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=s, maxValue=1.0, label='S', callback=self.OnSChange, padTop=PADTOP)
     self.br = ValueSelector(parent=self, align=uiconst.TOTOP, height=18, value=b, maxValue=maxValue, label='B', callback=self.OnBrChange, padTop=PADTOP)
     self.initialized = True
def AddItemRow(panel, materialData):
    panel.AddCell(MaterialIconAndLabel(materialData=materialData), cellPadding=(0, 0, 0, 3))
    available = FormatNumeric(materialData.available, useGrouping=True)
    quantity = FormatNumeric(materialData.quantity, useGrouping=True)
    color = industryUIConst.COLOR_NOTREADY if materialData.errors else industryUIConst.COLOR_READY
    colorHex = Color.RGBtoHex(*color)
    label = EveLabelMedium(align=uiconst.CENTERRIGHT, text='<color=%s>%s / %s' % (colorHex, available, quantity))
    panel.AddCell(label, cellPadding=(8, 0, 0, 3))
Esempio n. 14
0
 def GetLineColor(isReady, isOptionSelected):
     if not isOptionSelected:
         color = COLOR_OPTIONAL_NOTREADY
     elif isReady:
         color = COLOR_READY
     else:
         color = COLOR_NOTREADY
     color = Color(*color).SetAlpha(OPACITY_LINES).GetRGBA()
     return color
 def GetColor(self):
     if not self.jobData or self.jobData.status == industry.STATUS_DELIVERED:
         return Color.GRAY2
     if self.jobData.errors or self.isStopPending:
         return industryUIConst.COLOR_RED
     color = industryUIConst.GetJobColor(self.jobData)
     if self.jobData and self.jobData.status == industry.STATUS_UNSUBMITTED:
         color = Color(*color).SetAlpha(0.5).GetRGBA()
     return color
Esempio n. 16
0
 def ApplyAttributes(self, attributes):
     ToggleButtonGroupButton.ApplyAttributes(self, attributes)
     self.activityID = attributes.activityID
     color = Color(*self.colorSelected).SetBrightness(0.75).GetRGBA()
     self.errorFrame = ErrorFrame(bgParent=self,
                                  state=uiconst.UI_HIDDEN,
                                  color=color,
                                  padding=1,
                                  idx=0)
Esempio n. 17
0
 def GetJobStateLabel(self):
     if self.status <= industry.STATUS_READY:
         return self.GetJobTimeLeftLabel()
     elif self.status == industry.STATUS_DELIVERED:
         if self.activityID == industry.INVENTION:
             if self.successfulRuns == 0:
                 return '<color=red>%s' % localization.GetByLabel('UI/Industry/JobFailed')
             else:
                 return localization.GetByLabel('UI/Industry/PartiallySucceeded', numSucceeded=self.successfulRuns, numTotal=self.runs)
         return localization.GetByLabel('UI/Industry/Succeeded')
     elif self.status == industry.STATUS_CANCELLED:
         color = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY)
         return '<color=%s>%s' % (color, localization.GetByLabel('UI/Industry/Cancelled'))
     elif self.status == industry.STATUS_REVERTED:
         color = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY)
         return '<color=%s>%s' % (color, localization.GetByLabel('UI/Industry/Reverted'))
     else:
         return ''
Esempio n. 18
0
 def UpdateStatusUI(self, tubeStatus):
     stateText = LABEL_BY_STATE[tubeStatus.statusID]
     self.tubeStatusLabel.text = GetByLabel(stateText)
     if self.ShouldShowStationUI():
         stateColor = Color(*COLOR_OPEN)
     else:
         stateColor = Color(*COLOR_BY_STATE[tubeStatus.statusID])
     self.leftTube.SetRGBA(*stateColor.GetRGBA())
     self.rightTube.SetRGBA(*stateColor.GetRGBA())
     stateColor.a = 0.8
     self.tubeStatusLabel.SetTextColor(stateColor.GetRGBA())
Esempio n. 19
0
 def Reconstruct(self):
     if self.gauge:
         self.gauge.Close()
     self.gauge = self.ConstructLine(self.colorStart, self.colorEnd)
     self.gauge.end = self.value
     if self.colorBg is None:
         self.colorBg = Color(*self.colorStart).SetBrightness(0.2).GetRGBA()
     if self.bgGauge:
         self.bgGauge.Close()
     self.bgGauge = self.ConstructLine(self.colorBg, self.colorBg)
 def OnUpdate(self, remaining):
     color = Color.RGBtoHex(*self.timerData.color)
     if remaining:
         self.time.text = FormatTimeInterval(remaining, color, color)
         self.text.text = localization.GetByLabel(self.timerData.tooltip)
     if getattr(self.parentTimer, 'fatigueRatio', None):
         time = FormatTimeInterval(
             long(remaining * self.parentTimer.fatigueRatio), color, color)
         self.next.text = localization.GetByLabel(
             'UI/Crimewatch/Timers/JumpFatigueNextActivation', time=time)
Esempio n. 21
0
 def _UpdateMainText(self):
     injectorType = invconst.typeSkillInjector
     points = sm.GetService('skills').GetSkillPointAmountFromInjectors(
         injectorType, quantity=1)
     color = Color.RGBtoHex(1.0, 0.8, 0.0, 1.0)
     text = localization.GetByLabel(
         'UI/SkillTrading/InjectorBannerMainText',
         injector=injectorType,
         points=points,
         color=color)
     self.mainLabel.SetText(text)
 def SetValue(self, value):
     if self.value * (value or 1) < 0.0:
         self.gauge.SetValueInstantly(0.0)
     self.value = value
     if value < 0:
         self.gauge.SetGaugeAlign(uiconst.TORIGHT_PROP)
         self.gauge.SetValue(float(value) / self.MINVAL)
         self.gauge.SetColor(COLOR_NOTREADY)
     else:
         self.gauge.SetGaugeAlign(uiconst.TOLEFT_PROP)
         self.gauge.SetValue(float(value) / self.MAXVAL)
         self.gauge.SetColor(COLOR_READY)
     if not self.valueLabel:
         return
     if value < 0:
         self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_NOTREADY), value)
     elif value == 0:
         self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_FRAME), value)
     else:
         self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_READY), value)
Esempio n. 23
0
 def GetLabel(self):
     color = (1.0, 1.0, 1.0, 0.8)
     if self.skill.points != self.skill.unmodifiedPoints:
         color = COLOR_MODIFIED
     text = localization.GetByLabel('UI/SkillTrading/SkillEntryLabel',
                                    typeID=self.typeID,
                                    level=self.skill.level,
                                    rank=self.skill.rank,
                                    points=self.skill.points,
                                    color=Color.RGBtoHex(*color))
     return text
Esempio n. 24
0
def SetOverlayButtonActiveState(button, isActive):
    if isActive:
        color = (0.1, 1.0, 0.1, 1.0)
        hint = localization.GetByLabel(
            'UI/Inflight/Scanner/DisableSensorOverlay')
    else:
        color = Color.GetGrayRGBA(1.0, 0.5)
        hint = localization.GetByLabel(
            'UI/Inflight/Scanner/EnableSensorOverlay')
    button.icon.SetRGB(*color)
    button.hint = hint
Esempio n. 25
0
 def GetHint(self, *args):
     hint = '<b>%s</b><br>%s' % (
         localization.GetByLabel(
             industryUIConst.ACTIVITY_NAMES[self.activityID]),
         localization.GetByLabel(
             industryUIConst.ACTIVITY_HINTS[self.activityID]))
     if self.errorFrame.display:
         colorHex = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY)
         hint += '<br><b><color=%s>%s</color></b>' % (
             colorHex,
             localization.GetByLabel('UI/Industry/ActivityNotSupported'))
     return hint
Esempio n. 26
0
 def Reconstruct(self):
     if self.gauge:
         self.gauge.Close()
     self.gauge = self.ConstructLine(self.colorStart, self.colorEnd)
     self.gauge.end = self.value
     self.gauge.name = 'gaugeLine'
     if self.colorBg is None:
         self.colorBg = Color(*self.colorStart).SetBrightness(0.2).GetRGBA()
     if self.bgGauge:
         self.bgGauge.Close()
     self.bgGauge = self.ConstructLine(self.colorBg, self.colorBg)
     self.bgGauge.end = self.bgPortion
     self.bgGauge.name = 'backgroundLine'
 def UpdateState(self):
     if self.jobData:
         self.outcomeLabel.text = self.jobData.GetProductLabel()
         self.UpdateCopyInfo()
         if self.jobData.activityID == industry.INVENTION:
             self.probabilityLabel.Show()
             color = Color.RGBtoHex(*GetJobColor(self.jobData))
             self.probabilityLabel.text = localization.GetByLabel('UI/Industry/SuccessProbabilityPerRun', probability=self.jobData.probability * 100, color=color)
         else:
             self.probabilityLabel.Hide()
     else:
         self.outcomeLabel.text = ''
         self.probabilityLabel.Hide()
    def UpdateState(self):
        uicore.animations.FadeIn(self.sr.label)
        color = self.GetColor()
        underlayColor = Color(*color).SetBrightness(0.4).GetRGBA()
        self.underlay.SetFixedColor(underlayColor)
        blinkColor = Color(
            *color).SetSaturation(0.5).SetBrightness(0.9).GetRGBA()
        self.sr.hilite.SetRGBA(*blinkColor)
        for obj in (self.pattern, self.bg, self.arrows):
            uicore.animations.SpColorMorphTo(obj,
                                             obj.GetRGBA(),
                                             color,
                                             duration=0.3)

        self.UpdateLabel()
        if not self.jobData:
            return
        if self.jobData.errors:
            self.errorFrame.Show()
            self.HideArrows()
        else:
            self.errorFrame.Hide()
            self.arrows.Show()
        if self.jobData.status == industry.STATUS_INSTALLED:
            if not self.oldJobData or self.oldJobData.status != industry.STATUS_INSTALLED:
                self.AnimateArrows()
        elif self.jobData.status == industry.STATUS_DELIVERED:
            self.HideArrows()
        else:
            self.StopAnimateArrows()
        if self.jobData.status == industry.STATUS_READY:
            self.Blink(time=3000)
        else:
            self.Blink(False)
        if self.jobData and self.jobData.status > industry.STATUS_READY:
            self.Disable()
        else:
            self.Enable()
Esempio n. 29
0
 def GetSolarSystemText(node):
     solarSystemID = node['solarSystemID']
     solarsystemName = cfg.evelocations.Get(solarSystemID).name
     linkInfo = ('showinfo', invConst.groupSolarSystem, solarSystemID)
     solarsystemLink = GetByLabel(
         'UI/Contracts/ContractsWindow/ShowInfoLink',
         showInfoName=solarsystemName,
         info=linkInfo)
     securityStatus, color = sm.GetService('map').GetSecurityStatus(
         solarSystemID, getColor=True)
     text = '%s <color=%s>%s</color>' % (
         solarsystemLink, Color.RGBtoHex(color.r, color.g,
                                         color.b), securityStatus)
     return text
    def UpdateState(self, numFilledSegments, isReady = True, isOptional = False, isOptionSelected = True, animate = True):
        isEverythingReady = numFilledSegments == self.numSegments
        baseColor = IndustryLineTrace.GetLineColor(isReady, isOptionSelected)
        for i, segment in enumerate(self.segments):
            if isEverythingReady:
                opacity = OPACITY_LINES
            else:
                isFilled = i < numFilledSegments
                opacity = OPACITY_LINES if not isFilled else OPACITY_SEGMENTINCOMPLETE
            color = Color(*baseColor).SetAlpha(opacity).GetRGBA()
            if animate:
                uicore.animations.SpColorMorphTo(segment, segment.GetRGBA(), color, duration=0.3)
            else:
                segment.SetRGBA(*color)

        self.UpdateIcon(isReady, isOptional)