Beispiel #1
0
 def __init__(self, attributeConst, cX, cY, isleftSide = False):
     self.isleftSide = isleftSide
     self.attribute = cfg.dgmattribs.Get(attributeConst)
     self.cX = cX
     self.cY = cY
     self.slots = []
     self.step = 3.0 / GetScaleFactor()
Beispiel #2
0
 def UpdateFitting(self):
     if not self.controller.SlotExists() and not self.controller.GetModule(
     ):
         self.DisableSlot()
         return
     self.EnableSlot()
     self.SetDragState()
     self.PrepareUtilButtons()
     iconSize = int(self.SLOT_SIZE * GetScaleFactor())
     self.flagIcon.SetSize(iconSize, iconSize)
     if self.controller.GetModule():
         self.flagIcon.LoadIconByTypeID(self.controller.GetModule().typeID,
                                        ignoreSize=True)
     else:
         slotIcon = 'res:/UI/Texture/classes/Fitting/stationServiceSlot.png'
         self.flagIcon.LoadIcon(slotIcon, ignoreSize=True)
     if self.controller.GetModule():
         self.tooltipPanelClassInfo = TooltipModuleWrapper()
         modulehint = evetypes.GetName(self.controller.GetModuleTypeID())
         if not self.controller.SlotExists():
             modulehint = GetByLabel('UI/Fitting/SlotDoesNotExist')
         self.hint = modulehint
     else:
         self.tooltipPanelClassInfo = None
         self.hint = self._emptyHint
     self.Hilite(0)
     self.UpdateOnlineDisplay()
Beispiel #3
0
    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        self.controller = attributes.controller
        self.slotsByFlagID = {}
        scaleFactor = GetScaleFactor()
        slotWidth = int(round(44.0 * scaleFactor))
        slotHeight = int(round(44.0 * scaleFactor))
        label = EveLabelMedium(parent=self,
                               text=GetByLabel('UI/Fitting/StructureServices'),
                               align=uiconst.TOBOTTOM)
        top = label.textheight + 2
        width = 0
        for i, flagID in enumerate(invConst.serviceSlotFlags):
            left = i * (slotWidth + 4)
            slot = FittingServiceSlot(
                name='%s' % flagID,
                parent=self,
                pos=(left, top, slotWidth, slotHeight),
                controller=self.controller.GetSlotController(flagID))
            self.slotsByFlagID[flagID] = slot
            width += slotWidth + 4

        self.width = width
        self.height = slotHeight + label.textheight + 100
        self.controller.on_slots_with_menu_changed.connect(
            self.OnSlotsWithMenuChanged)
Beispiel #4
0
 def AddIcon(self, parent, iconNum, tooltipCallback):
     angle = 306
     iconRad = int(310 * GetScaleFactor())
     left, top, cos, sin = self.GetPositionNumbers(angle, iconRad, offset=16)
     icon = Icon(name='%s_Icon' % self.attribute.attributeName, icon=iconNum, parent=parent, state=UI_NORMAL, hint=self.attribute.displayName, pos=(left,
      top,
      32,
      32), ignoreSize=True)
     icon.LoadTooltipPanel = tooltipCallback
Beispiel #5
0
 def AddSceneContainer(self):
     size = 550 * GetScaleFactor()
     self.sceneContainerParent = ShipSceneParent(
         parent=self,
         align=uiconst.CENTER,
         width=size,
         height=size,
         shipID=self.controller.GetItemID(),
         controller=self.controller)
     self.sceneContainer = self.sceneContainerParent.sceneContainer
     self.sceneNavigation = self.sceneContainerParent.sceneNavigation
Beispiel #6
0
 def __init__(self, controller, slotClass = None):
     self.controller = controller
     scaleFactor = GetScaleFactor()
     self.width = int(round(44.0 * scaleFactor))
     self.height = int(round(54.0 * scaleFactor))
     self.rad = int(239 * scaleFactor)
     self.center = GetBaseShapeSize() / 2
     if slotClass:
         self.slotClass = slotClass
     else:
         self.slotClass = FittingSlot
Beispiel #7
0
 def AddMarkers(self, parent):
     markerRad = int(280 * GetScaleFactor())
     angle = 310.0 - self.step * 7.5
     for i in xrange(8):
         left, top, cos, sin = self.GetPositionNumbers(angle, markerRad, offset=8)
         icon = MarkerIcon(name='%s_%s_Marker' % (i, self.attribute.attributeName), parent=parent, state=UI_NORMAL, pos=(left,
          top,
          16,
          16), hint=self.attribute.displayName, idx=0)
         icon.display = False
         self.slots.insert(0, icon)
         angle += self.step
Beispiel #8
0
 def ApplyAttributes(self, attributes):
     uiprimitives.Container.ApplyAttributes(self, attributes)
     self.scaleFactor = GetScaleFactor()
     self.baseShapeSize = GetBaseShapeSize()
     self.width = self.baseShapeSize
     self.height = self.baseShapeSize
     overlay = uiprimitives.Sprite(
         parent=self,
         name='overlay',
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         texturePath=
         'res:/UI/Texture/classes/Fitting/fittingbase_overlay.png',
         color=(1.0, 1.0, 1.0, 0.39))
     radius = int(self.baseShapeSize * 0.885 / 2)
     self.calibrationGauge = CalibrationGauge(parent=self, radius=radius)
     self.powerGauge = PowergridGauge(parent=self, radius=radius)
     self.cpuGauge = CPUGauge(parent=self, radius=radius)
     baseDOT = uiprimitives.Sprite(
         parent=self,
         name='baseDOT',
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         texturePath=
         'res:/UI/Texture/classes/Fitting/fittingbase_dotproduct.png',
         spriteEffect=trinity.TR2_SFX_DOT,
         blendMode=trinity.TR2_SBM_ADD)
     self.sr.baseColor = SpriteThemeColored(
         parent=self,
         name='baseColor',
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         texturePath=
         'res:/UI/Texture/classes/Fitting/fittingbase_basecircle.png',
         colorType=uiconst.COLORTYPE_UIBASE)
     self.sr.baseShape = uiprimitives.Sprite(
         parent=self,
         name='baseShape',
         align=uiconst.TOALL,
         state=uiconst.UI_DISABLED,
         texturePath='res:/UI/Texture/classes/Fitting/fittingbase.png',
         color=(0.0, 0.0, 0.0, 0.86))
Beispiel #9
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.controller = attributes.controller
     self.controller.on_new_itemID.connect(self.OnNewShipLoaded)
     self.sceneContainer = ShipSceneContainer(align=uiconst.TOALL,
                                              parent=self,
                                              state=uiconst.UI_DISABLED,
                                              controller=self.controller)
     self.SetScene()
     self.sceneContainer.LoadShipModel()
     scaleFactor = GetScaleFactor()
     self.sceneNavigation = SceneContainerBaseNavigation(
         parent=self,
         align=uiconst.TOALL,
         pos=(0, 0, 0, 0),
         idx=0,
         state=uiconst.UI_NORMAL,
         pickRadius=225 * scaleFactor)
     self.sceneNavigation.Startup(self.sceneContainer)
     self.sceneNavigation.OnDropData = self.OnDropData
     self.sceneNavigation.GetMenu = self.GetShipMenu
Beispiel #10
0
 def UpdateFitting(self):
     if self.destroyed:
         return
     if not self.controller.SlotExists() and not self.controller.GetModule(
     ):
         if self.controller.IsSubsystemSlot(
         ) and self.controller.parentController.HasStance():
             self.HideSlot()
         else:
             self.DisableSlot()
         self.HideChargeIndicator()
         self.RemoveUtilButtons()
         return
     self.EnableSlot()
     self.SetDragState()
     if self.controller.GetCharge():
         chargeQty = self.controller.GetChargeQuantity()
         if self.controller.GetModule() is None:
             portion = 1.0
         else:
             cap = self.controller.GetChargeCapacity()
             if cap.capacity == 0:
                 portion = 1.0
             else:
                 portion = cap.used / cap.capacity
         step = max(0, min(4, int(portion * 5.0)))
         self.ConstructChargeIndicator()
         self.chargeIndicator.rectTop = 10 * step
         self.chargeIndicator.state = uiconst.UI_NORMAL
         self.chargeIndicator.hint = '%s %d%%' % (evetypes.GetName(
             self.controller.GetCharge().typeID), portion * 100)
     elif not self.controller.GetModule():
         self.HideUtilButtons(1)
         self.HideChargeIndicator()
     elif self.controller.IsChargeable():
         self.ConstructChargeIndicator()
         self.chargeIndicator.rectTop = 0
         self.chargeIndicator.state = uiconst.UI_NORMAL
         self.chargeIndicator.hint = localization.GetByLabel(
             'UI/Fitting/NoCharge')
     else:
         self.HideChargeIndicator()
     if self.controller.GetModule():
         self.tooltipPanelClassInfo = TooltipModuleWrapper()
         modulehint = evetypes.GetName(self.controller.GetModuleTypeID())
         if self.controller.GetCharge():
             modulehint += '<br>%s' % localization.GetByLabel(
                 'UI/Fitting/ChargeQuantity',
                 charge=self.controller.GetCharge().typeID,
                 chargeQuantity=chargeQty)
         if not self.controller.SlotExists():
             modulehint = localization.GetByLabel(
                 'UI/Fitting/SlotDoesNotExist')
         self.hint = modulehint
     else:
         self.tooltipPanelClassInfo = None
         self.hint = self._emptyHint
         tooltipName = self._emptyTooltip
         if tooltipName:
             SetFittingTooltipInfo(targetObject=self,
                                   tooltipName=tooltipName,
                                   includeDesc=False)
     self.PrepareUtilButtons()
     iconSize = int(48 * GetScaleFactor())
     self.flagIcon.SetSize(iconSize, iconSize)
     if self.controller.GetCharge() or self.controller.GetModule():
         self.flagIcon.LoadIconByTypeID(
             (self.controller.GetCharge()
              or self.controller.GetModule()).typeID,
             ignoreSize=True)
         self.flagIcon.rotation = -self.GetRotation()
     else:
         rev = 0
         slotIcon = {
             const.flagSubSystemSlot0: 'res:/UI/Texture/Icons/81_64_9.png',
             const.flagSubSystemSlot1: 'res:/UI/Texture/Icons/81_64_10.png',
             const.flagSubSystemSlot2: 'res:/UI/Texture/Icons/81_64_11.png',
             const.flagSubSystemSlot3: 'res:/UI/Texture/Icons/81_64_12.png',
             const.flagSubSystemSlot4: 'res:/UI/Texture/Icons/81_64_13.png'
         }.get(self.controller.GetFlagID(), None)
         if slotIcon is None:
             slotIcon = {
                 const.effectLoPower: 'res:/UI/Texture/Icons/81_64_5.png',
                 const.effectMedPower: 'res:/UI/Texture/Icons/81_64_6.png',
                 const.effectHiPower: 'res:/UI/Texture/Icons/81_64_7.png',
                 const.effectRigSlot: 'res:/UI/Texture/Icons/81_64_8.png'
             }.get(self.controller.GetPowerType(), None)
         else:
             rev = 1
         if slotIcon is not None:
             self.flagIcon.LoadIcon(slotIcon, ignoreSize=True)
         if rev:
             self.flagIcon.rotation = mathUtil.DegToRad(180.0)
         else:
             self.flagIcon.rotation = 0.0
     self.SetGroup()
     self.UpdateOnlineDisplay()
     self.Hilite(0)