예제 #1
0
    def InitCapacitor(self):
        self.initialized = 0
        self.lastSetCapacitor = None
        self.AnimateCapacitorOut(self.children[:], 0.5)
        self.powerCells = []
        maxCap = self.controller.GetCapacitorCapacityMax()
        numcol = min(18, int(maxCap / 50))
        rotstep = 360.0 / max(1, numcol)
        colWidth = max(12, min(16, numcol and int(192 / numcol)))
        newColumns = []
        for i in range(numcol):
            powerColumn = Transform(parent=self,
                                    name='powerColumn',
                                    pos=(0, 0, colWidth, 56),
                                    align=uiconst.CENTER,
                                    state=uiconst.UI_DISABLED,
                                    rotation=DegToRad(i * -rotstep),
                                    idx=0)
            newColumns.append(powerColumn)
            for ci in xrange(4):
                newcell = Sprite(
                    parent=powerColumn,
                    name='pmark',
                    pos=(0, ci * 5, 10 - ci * 2, 7),
                    align=uiconst.CENTERTOP,
                    state=uiconst.UI_DISABLED,
                    texturePath=
                    'res:/UI/Texture/classes/ShipUI/capacitorCell_2.png',
                    color=(0, 0, 0, 0))
                self.powerCells.insert(0, newcell)

        self.AnimateCapacitorIn(newColumns, 1.0)
        self.initialized = 1
예제 #2
0
 def AddPowerColumn(self, parent, colIdx, rotStep, colWidth, colHeight):
     rotation = DegToRad(colIdx * -rotStep)
     powerColumn = Transform(parent=parent,
                             name='powerColumn',
                             pos=(0, 0, colWidth, colHeight),
                             align=uiconst.CENTER,
                             state=uiconst.UI_DISABLED,
                             rotation=rotation,
                             idx=0)
     return powerColumn
예제 #3
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.scanSvc = sm.GetService('scanSvc')
     self.busy = False
     self.scanresult = []
     self.scanangle = DegToRad(90)
     self.scope = 'inflight'
     self.SetTopparentHeight(0)
     self.SetWndIcon(None)
     self.HideMainIcon()
     directionBox = Container(name='direction', parent=self.sr.main, align=uiconst.TOALL, left=const.defaultPadding, width=const.defaultPadding, top=const.defaultPadding, height=const.defaultPadding)
     self.SetupDScanUI(directionBox)
예제 #4
0
 def UpdateSpeedThread(self):
     while not self.destroyed:
         blue.synchro.Sleep(20)
         try:
             if not self.controller.IsLoaded():
                 continue
             if not (self.controller.GetBall()
                     and self.controller.GetBall().ballpark):
                 continue
             speedPortion = self.controller.GetSpeedPortion()
             self.speedNeedle.SetRotation(
                 DegToRad(45.0 + 90.0 * speedPortion))
             if self.controller.IsInWarp():
                 fmtSpeed = GetByLabel('UI/Inflight/WarpSpeedNotification',
                                       warpingMessage=GetByLabel(
                                           'UI/Inflight/Scanner/Warping'))
             else:
                 fmtSpeed = self.controller.GetSpeedFormatted()
             self.speedLabel.text = fmtSpeed
         except Exception as e:
             log.LogException(e)
             sys.exc_clear()
예제 #5
0
 def __init__(self, probeID, probe, parent, scanner):
     """
     Construct and load all graphic elements and resources
     probeID: id of probe
     probe: probe data KeyVal struct
     parent: parent EveTransform to attach probe control to
     """
     scanSvc = sm.GetService('scanSvc')
     BaseProbeControl.__init__(self, probeID, parent)
     sphereBracket = Bracket()
     sphereBracket.align = uiconst.NOALIGN
     sphereBracket.width = sphereBracket.height = 2
     sphereBracket.state = uiconst.UI_DISABLED
     sphereBracket.name = '__probeSphereBracket'
     sphereBracket.trackTransform = self.locator
     sphereBracket.probeID = probeID
     sphereBracket.positionProbeID = probeID
     uicore.layer.systemMapBrackets.children.insert(0, sphereBracket)
     sphere = trinity.Load('res:/dx9/model/UI/Scanbubble.red')
     sphere.name = 'Scanbubble'
     sphere.children[0].scaling = (2.0, 2.0, 2.0)
     sphere.children[0].children[0].scaling = (-50.0, 50.0, 50.0)
     sphere.children[0].children[1].scaling = (50.0, 50.0, 50.0)
     sphere.children[0].children[2].scaling = (50.0, 50.0, 50.0)
     sphere.children[0].curveSets[1].curves[0].keys[1].time = 0.0625
     sphere.children[0].curveSets[1].curves[0].Sort()
     self.locator.children.append(sphere)
     cal = trinity.EveTransform()
     cal.name = 'cameraAlignedLocation'
     cal.modifier = TR2TM_LOOK_AT_CAMERA
     sphere.children.append(cal)
     tracker = trinity.EveTransform()
     tracker.name = 'pr_%d' % probe.probeID
     val = math.sin(DegToRad(45.0)) * 0.2
     translation = (val, val, 0.0)
     tracker.translation = translation
     cal.children.append(tracker)
     bracket = ProbeBracket()
     bracket.name = '__probeSphereBracket'
     bracket.align = uiconst.NOALIGN
     bracket.state = uiconst.UI_HIDDEN
     bracket.width = bracket.height = 16
     bracket.dock = False
     bracket.minDispRange = 0.0
     bracket.maxDispRange = 1e+32
     bracket.inflight = False
     bracket.color = None
     bracket.invisible = False
     bracket.fadeColor = False
     bracket.showLabel = 2
     bracket.probe = probe
     bracket.probeID = probeID
     bracket.displayName = scanSvc.GetProbeLabel(probeID)
     bracket.showDistance = 0
     bracket.noIcon = True
     bracket.Startup(probeID, probe.typeID, None)
     bracket.trackTransform = tracker
     uicore.layer.systemMapBrackets.children.insert(0, bracket)
     bracket.ShowLabel()
     bracket.label.OnClick = None
     bracket.label.state = uiconst.UI_HIDDEN
     intersection = trinity.Load('res:/Model/UI/probeIntersection.red')
     intersection.display = False
     intersection.scaling = (2.0, 2.0, 2.0)
     sphere.children.append(intersection)
     self.bracket = bracket
     self.scanRanges = scanSvc.GetScanRangeStepsByTypeID(probe.typeID)
     self.intersection = intersection
     self.sphere = sphere
     self.cameraAlignedLocation = cal
     self.probeID = probeID
     self.scanrangeCircles = None
     self._highlighted = True
     self.HighlightBorder(0)
예제 #6
0
 def SetupDScanUI(self, directionBox):
     directionSettingsBox = Container(name='direction', parent=directionBox, align=uiconst.TOTOP, height=70, clipChildren=True, padLeft=2)
     self.sr.dirscroll = Scroll(name='dirscroll', parent=directionBox)
     self.sr.dirscroll.sr.id = 'scanner_dirscroll'
     presetGrid = LayoutGrid(parent=directionSettingsBox, columns=2, state=uiconst.UI_PICKCHILDREN, align=uiconst.TOPLEFT, left=0, top=3)
     paddingBtwElements = 8
     checked = settings.user.ui.Get('scannerusesoverviewsettings', 0)
     self.sr.useoverview = Checkbox(text=GetByLabel('UI/Inflight/Scanner/UsePreset'), parent=presetGrid, configName='', retval=0, checked=checked, left=0, align=uiconst.TOPLEFT, callback=self.UseOverviewChanged, width=320, wrapLabel=False)
     presetSelected = settings.user.ui.Get('scanner_presetInUse', None)
     presetOptions = self.GetPresetOptions()
     self.presetsCombo = Combo(label='', parent=presetGrid, options=presetOptions, name='comboTabOverview', select=presetSelected, align=uiconst.TOPLEFT, width=120, left=10, callback=self.OnProfileInUseChanged)
     if not checked:
         self.presetsCombo.Disable()
         self.presetsCombo.opacity = 0.5
         self.sr.useoverview.sr.label.opacity = 0.5
     self.rangeCont = Container(parent=directionSettingsBox, name='rangeCont', align=uiconst.TOTOP, height=24, top=self.sr.useoverview.height)
     self.angleCont = Container(parent=directionSettingsBox, name='rangeCont', align=uiconst.TOTOP, height=24)
     textLeft = 2
     rangeText = GetByLabel('UI/Inflight/Scanner/Range')
     rangeLabel = EveLabelSmall(text=rangeText, parent=self.rangeCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, left=textLeft)
     angleText = GetByLabel('UI/Inflight/Scanner/Angle')
     angleLabel = EveLabelSmall(text=angleText, parent=self.angleCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, left=textLeft)
     innerLeft = max(rangeLabel.textwidth, angleLabel.textwidth) + paddingBtwElements + textLeft
     innerRangeCont = Container(parent=self.rangeCont, align=uiconst.TOALL, padLeft=innerLeft)
     innderAngleCont = Container(parent=self.angleCont, align=uiconst.TOALL, padLeft=innerLeft)
     maxAuRange = 14.3
     startingKmValue = settings.user.ui.Get('dir_scanrange', const.AU * maxAuRange)
     startingAuValue = ConvertKmToAu(startingKmValue)
     distanceSliderCont = Container(name='distanceSliderCont', parent=innerRangeCont, align=uiconst.CENTERLEFT, state=uiconst.UI_PICKCHILDREN, pos=(0, -1, 100, 18))
     smallestAU = ConvertKmToAu(1000000)
     self.distanceSlider = Slider(name='distanceSlider', parent=distanceSliderCont, sliderID='distanceSlider', minValue=0, maxValue=maxAuRange, endsliderfunc=self.EndSetDistanceSliderValue, onsetvaluefunc=self.OnSetDistanceSliderValue, increments=[smallestAU,
      1,
      5,
      10,
      maxAuRange], height=20, barHeight=10)
     self.distanceSlider.label.display = False
     self.distanceSlider.SetValue(startingAuValue, updateHandle=True, useIncrements=False)
     left = distanceSliderCont.width + paddingBtwElements
     maxAuRangeInKm = ConvertAuToKm(maxAuRange)
     self.dir_rangeinput = SinglelineEdit(name='dir_rangeinput', parent=innerRangeCont, ints=(0, maxAuRangeInKm), setvalue=startingKmValue, align=uiconst.CENTERLEFT, pos=(left,
      0,
      90,
      0), maxLength=len(str(maxAuRangeInKm)) + 1, OnReturn=self.DirectionSearch)
     self.dir_rangeinput.OnChar = self.OnKmChar
     self.dir_rangeinput.OnMouseWheel = self.OnMouseWheelKm
     self.dir_rangeinput.ChangeNumericValue = self.ChangeNumericValueKm
     kmText = GetByLabel('UI/Inflight/Scanner/UnitKMAndSeparator')
     left = self.dir_rangeinput.left + self.dir_rangeinput.width + paddingBtwElements / 2
     kmLabel = EveLabelSmall(text=kmText, parent=innerRangeCont, align=uiconst.CENTERLEFT, pos=(left,
      0,
      0,
      0), state=uiconst.UI_DISABLED)
     left = kmLabel.left + kmLabel.textwidth + paddingBtwElements
     self.dir_rangeinputAu = SinglelineEdit(name='dir_rangeinputAu', parent=innerRangeCont, setvalue=startingAuValue, floats=(0, maxAuRange, 1), align=uiconst.CENTERLEFT, pos=(left,
      0,
      45,
      0), maxLength=4, OnReturn=self.DirectionSearch)
     self.dir_rangeinputAu.OnChar = self.OnAuChar
     self.dir_rangeinputAu.OnMouseWheel = self.OnMouseWheelAu
     self.dir_rangeinputAu.ChangeNumericValue = self.ChangeNumericValueAu
     auText = GetByLabel('UI/Inflight/Scanner/UnitAU')
     left = self.dir_rangeinputAu.left + self.dir_rangeinputAu.width + paddingBtwElements / 2
     auLabel = EveLabelSmall(text=auText, parent=innerRangeCont, align=uiconst.CENTERLEFT, pos=(left,
      0,
      0,
      0), state=uiconst.UI_DISABLED)
     angleSliderCont = Container(name='sliderCont', parent=innderAngleCont, align=uiconst.CENTERLEFT, state=uiconst.UI_PICKCHILDREN, pos=(0, -1, 100, 18))
     self.angleSliderLabel = EveLabelSmall(text='', parent=innderAngleCont, align=uiconst.CENTERLEFT, pos=(0, 0, 0, 0), state=uiconst.UI_DISABLED)
     startingAngle = settings.user.ui.Get('scan_angleSlider', 360)
     startingAngle = max(0, min(startingAngle, 360))
     self.degreeCone = PieCircle(parent=innderAngleCont, left=0, align=uiconst.CENTERLEFT, setValue=startingAngle)
     self.degreeCone.opacity = 0.3
     self.scanangle = DegToRad(startingAngle)
     angleSlider = Slider(name='angleSlider', parent=angleSliderCont, sliderID='angleSlider', startVal=startingAngle, minValue=5, maxValue=360, increments=[5,
      15,
      30,
      60,
      90,
      180,
      360], isEvenIncrementsSlider=True, endsliderfunc=self.EndSetAngleSliderValue, height=20, barHeight=10, setlabelfunc=self.UpdateAngleSliderLabel)
     left = angleSliderCont.width + paddingBtwElements
     self.angleSliderLabel.left = left + 5
     self.degreeCone.left = left + 35
     buttonText = GetByLabel('UI/Inflight/Scanner/Scan')
     scanButton = Button(parent=innderAngleCont, label=buttonText, align=uiconst.CENTERLEFT, pos=(4, 0, 0, 0), func=self.DirectionSearch)
     scanButton.left = auLabel.left + auLabel.textwidth - scanButton.width
예제 #7
0
 def EndSetAngleSliderValue(self, slider):
     angleValue = slider.GetValue()
     self.degreeCone.SetDegree(angleValue)
     self.SetMapAngle(DegToRad(angleValue))
     settings.user.ui.Set('scan_angleSlider', angleValue)
     uthread.new(self.DirectionSearch)
예제 #8
0
 def UpdateHiHeatGauge(self, value, *args):
     rotation = DegToRad(ANGLE_HI_START - 56.0 * value)
     uicore.animations.MorphScalar(self.hiHeatGauge, 'rotation', self.hiHeatGauge.rotation, rotation, duration=0.5)
     textureIndex = self.GetHeatGaugeTextureIndex(value)
     self.heatHiUnderlay.LoadTexture(HI_HEAT_GAUGE_TEXTURES[textureIndex])
예제 #9
0
 def ConstructHeatGauge(self, deg):
     miniGauge = Transform(parent=self, name='heatGauge', pos=(-1, 40, 83, 12), align=uiconst.CENTER, rotation=DegToRad(deg), idx=0)
     Sprite(parent=miniGauge, name='needle', pos=(0, 0, 12, 12), align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/heatGaugeNeedle.png')
     return miniGauge