Beispiel #1
0
 def ConstructPanelExpanderBtn(self):
     if self.IsLeftPanelExpanded():
         texturePath = 'res:/UI/Texture/Icons/73_16_196.png'
         tooltipName = 'CollapseSidePane'
     else:
         texturePath = 'res:/UI/Texture/Icons/73_16_195.png'
         tooltipName = 'ExpandSidePane'
     self.toggleLeftBtn = ButtonIcon(texturePath=texturePath,
                                     parent=self.overlayCont,
                                     align=uiconst.CENTERLEFT,
                                     pos=(2, 0, 16, 16),
                                     func=self.ToggleLeftPanel)
     SetFittingTooltipInfo(self.toggleLeftBtn,
                           tooltipName=tooltipName,
                           includeDesc=False)
     if self.IsRightPanelExpanded():
         texturePath = 'res:/UI/Texture/Icons/73_16_195.png'
         tooltipName = 'CollapseSidePane'
     else:
         texturePath = 'res:/UI/Texture/Icons/73_16_196.png'
         tooltipName = 'ExpandSidePane'
     self.toggleRightBtn = ButtonIcon(texturePath=texturePath,
                                      parent=self.overlayCont,
                                      align=uiconst.CENTERRIGHT,
                                      pos=(2, 0, 16, 16),
                                      func=self.ToggleRight)
     SetFittingTooltipInfo(self.toggleRightBtn,
                           tooltipName=tooltipName,
                           includeDesc=False)
Beispiel #2
0
 def ConstructInventoryIcons(self):
     cargoDroneCont = ContainerAutoSize(name='cargoDroneCont',
                                        parent=self.overlayCont,
                                        align=uiconst.BOTTOMLEFT,
                                        width=110,
                                        left=const.defaultPadding,
                                        top=4)
     if IsControllingStructure():
         cargoSlot = CargoStructureAmmoBay(name='structureCargoSlot',
                                           parent=cargoDroneCont,
                                           align=uiconst.TOTOP,
                                           height=32,
                                           controller=self.controller)
         SetFittingTooltipInfo(cargoSlot, 'StructureAmmoHold')
     else:
         cargoSlot = CargoCargoSlots(name='cargoSlot',
                                     parent=cargoDroneCont,
                                     align=uiconst.TOTOP,
                                     height=32,
                                     controller=self.controller)
         SetFittingTooltipInfo(cargoSlot, 'CargoHold')
     self.fighterAndDroneCont = Container(name='fighterAndDroneCont',
                                          parent=cargoDroneCont,
                                          align=uiconst.TOTOP,
                                          height=32)
     self.ContructDroneAndFighterIcons()
Beispiel #3
0
 def ConstructPowerAndCpuLabels(self):
     powerGridAndCpuCont = LayoutGrid(parent=self.overlayCont,
                                      columns=1,
                                      state=uiconst.UI_PICKCHILDREN,
                                      align=uiconst.BOTTOMRIGHT,
                                      top=10,
                                      left=10)
     cpu_statustextHeader = EveLabelMediumBold(
         text=GetByLabel('UI/Fitting/FittingWindow/CPUStatusHeader'),
         name='cpu_statustextHeader',
         state=uiconst.UI_NORMAL,
         align=uiconst.TOPRIGHT)
     SetFittingTooltipInfo(targetObject=cpu_statustextHeader,
                           tooltipName='CPU')
     powerGridAndCpuCont.AddCell(cpu_statustextHeader)
     self.cpu_statustext = EveLabelMedium(text='',
                                          name='cpu_statustext',
                                          state=uiconst.UI_NORMAL,
                                          align=uiconst.TOPRIGHT)
     SetFittingTooltipInfo(targetObject=self.cpu_statustext,
                           tooltipName='CPU')
     powerGridAndCpuCont.AddCell(self.cpu_statustext)
     powerGridAndCpuCont.AddCell(cellObject=Container(
         name='spacer', align=uiconst.TOTOP, height=10))
     power_statustextHeader = EveLabelMediumBold(
         text=GetByLabel('UI/Fitting/FittingWindow/PowergridHeader'),
         name='power_statustextHeader',
         state=uiconst.UI_NORMAL,
         align=uiconst.TOPRIGHT)
     SetFittingTooltipInfo(targetObject=power_statustextHeader,
                           tooltipName='PowerGrid')
     powerGridAndCpuCont.AddCell(power_statustextHeader)
     self.power_statustext = EveLabelMedium(text='',
                                            name='power_statustext',
                                            state=uiconst.UI_NORMAL,
                                            align=uiconst.TOPRIGHT)
     powerGridAndCpuCont.AddCell(self.power_statustext)
     SetFittingTooltipInfo(targetObject=self.power_statustext,
                           tooltipName='PowerGrid')
     self.calibration_statustext = EveLabelMedium(
         text='',
         parent=self.overlayCont,
         name='calibrationstatustext',
         pos=(8, 50, 0, 0),
         idx=0,
         state=uiconst.UI_NORMAL)
     SetFittingTooltipInfo(targetObject=self.calibration_statustext,
                           tooltipName='Calibration')
Beispiel #4
0
    def LoadPanel(self, initialLoad=False):
        self.Flush()
        self.ResetStatsDicts()
        self.display = True
        parentGrid = self.GetValueParentGrid(columns=len(self.damageStats))
        for dps, texturePath, hintPath, tooltipName in self.damageStats:
            hint = GetByLabel(hintPath)
            c = self.GetValueCont(self.iconSize)
            parentGrid.AddCell(cellObject=c)
            icon = Sprite(texturePath=texturePath,
                          parent=c,
                          align=uiconst.CENTERLEFT,
                          pos=(0, 0, self.iconSize, self.iconSize),
                          state=uiconst.UI_DISABLED)
            SetFittingTooltipInfo(targetObject=c, tooltipName=tooltipName)
            c.hint = hint
            label = EveLabelMedium(text='',
                                   parent=c,
                                   state=uiconst.UI_DISABLED,
                                   align=uiconst.CENTERLEFT)
            self.statsLabelsByIdentifier[dps] = label
            self.statsIconsByIdentifier[dps] = icon
            self.statsContsByIdentifier[dps] = c

        BaseMenuPanel.FinalizePanelLoading(self, initialLoad)
Beispiel #5
0
 def ContructDroneAndFighterIcons(self):
     self.fighterAndDroneCont.Flush()
     if self.controller.HasFighterBay():
         slot = CargoFighterSlots(name='fighterSlot',
                                  parent=self.fighterAndDroneCont,
                                  align=uiconst.TOTOP,
                                  height=32,
                                  controller=self.controller)
         SetFittingTooltipInfo(slot, 'FighterBay')
     else:
         slot = CargoDroneSlots(name='droneSlot',
                                parent=self.fighterAndDroneCont,
                                align=uiconst.TOTOP,
                                height=32,
                                controller=self.controller)
         SetFittingTooltipInfo(slot, 'DroneBay')
     self.fighterOrDroneSlot = slot
Beispiel #6
0
 def AddColumnHeaderIcons(self, tRow):
     step = (PANEL_WIDTH - self.col1Width) / 4
     left = self.col1Width
     for attributeID, tooltipName in resAttributeIDs:
         attribute = cfg.dgmattribs.Get(attributeID)
         icon = Icon(graphicID=attribute.iconID,
                     parent=tRow,
                     pos=(left + (step - 32) / 2 + 4, 0, 32, 32),
                     idx=0,
                     hint=attribute.displayName)
         SetFittingTooltipInfo(icon,
                               tooltipName=tooltipName,
                               includeDesc=True)
         left += step
Beispiel #7
0
 def AddAlignTimeUI(self, parentGrid):
     iconSize = 32
     alignID, texturePath, tooltipName = self.alignTimeInfo
     c = self.GetValueCont(iconSize)
     parentGrid.AddCell(cellObject=c)
     icon = Sprite(texturePath=texturePath,
                   parent=c,
                   align=uiconst.CENTERLEFT,
                   pos=(0, 0, iconSize, iconSize),
                   state=uiconst.UI_DISABLED)
     SetFittingTooltipInfo(targetObject=c, tooltipName=tooltipName)
     label = EveLabelMedium(text='',
                            parent=c,
                            state=uiconst.UI_DISABLED,
                            align=uiconst.CENTERLEFT)
     self.statsLabelsByIdentifier[alignID] = label
     self.statsIconsByIdentifier[alignID] = icon
     self.statsContsByIdentifier[alignID] = c
Beispiel #8
0
 def AddBestRepairPicker(self, tRow):
     self.bestRepairPickerPanel = None
     bestPar = Container(name='bestPar',
                         parent=tRow,
                         align=uiconst.TOPLEFT,
                         height=32,
                         width=self.col1Width,
                         state=uiconst.UI_NORMAL)
     bestPar.OnClick = self.ExpandBestRepair
     SetFittingTooltipInfo(targetObject=bestPar,
                           tooltipName='ActiveDefenses')
     expandIcon = Icon(name='expandIcon',
                       icon='ui_38_16_229',
                       parent=bestPar,
                       state=uiconst.UI_DISABLED,
                       align=uiconst.BOTTOMRIGHT)
     numPar = Container(name='numPar',
                        parent=bestPar,
                        pos=(4, 17, 11, 11),
                        align=uiconst.TOPLEFT,
                        state=uiconst.UI_DISABLED)
     numLabel = EveLabelMedium(text='',
                               parent=numPar,
                               atop=-1,
                               state=uiconst.UI_DISABLED,
                               align=uiconst.CENTER,
                               shadowOffset=(0, 0))
     Fill(parent=numPar, color=BAR_COLORS[1])
     self.activeBestRepairNumLabel = numLabel
     icon = Icon(parent=bestPar,
                 state=uiconst.UI_DISABLED,
                 width=32,
                 height=32)
     statusLabel = Label(name='statusLabel',
                         text='',
                         parent=bestPar,
                         left=icon.left + icon.width,
                         state=uiconst.UI_DISABLED,
                         align=uiconst.CENTERLEFT)
     self.activeBestRepairLabel = statusLabel
     self.activeBestRepairParent = bestPar
     self.activeBestRepairIcon = icon
Beispiel #9
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)
Beispiel #10
0
    def ApplyAttributes(self, attributes):
        Container.ApplyAttributes(self, attributes)
        self.fittingSvc = sm.GetService('fittingSvc')
        self.configName = attributes.configName
        self.controller = attributes.controller
        self.ChangeSignalConnection()
        self.loaded = False
        padding = 0
        self.ammoShowingForType = None
        btnCont = FlowContainer(parent=self,
                                align=uiconst.TOBOTTOM,
                                contentAlignment=CONTENT_ALIGN_RIGHT,
                                padTop=4,
                                padRight=0,
                                contentSpacing=uiconst.BUTTONGROUPMARGIN)
        self.fitBtn = Button(parent=btnCont,
                             label='Fit Ship',
                             func=self.FitShip,
                             align=uiconst.NOALIGN)
        self.builtShipBtn = Button(
            parent=btnCont,
            label=GetByLabel('UI/Fitting/FittingWindow/BuildShip'),
            func=self.BuildShip,
            align=uiconst.NOALIGN)
        self.saveBtn = Button(
            parent=btnCont,
            label=GetByLabel('UI/Fitting/FittingWindow/SaveFitAs'),
            func=self.SaveFitting,
            align=uiconst.NOALIGN)
        SetFittingTooltipInfo(targetObject=self.saveBtn,
                              tooltipName='SaveFitting',
                              includeDesc=False)
        self.AdjustButtons()
        self.btnGroup = ToggleButtonGroup(name='fittingToggleBtnGroup',
                                          parent=self,
                                          align=uiconst.TOTOP,
                                          callback=self.BrowserSelected,
                                          height=40,
                                          idx=-1)
        self.AddExportImportMenu()
        self.AddSearchFields()
        self.AddFilterCont()
        self.hwBrowserBtns = self.AddHardwareSelcetionCont()
        self.AddFittingFilterButtons()
        self.hardwareFilterBtns = self.AddHardwareFilterButtons()
        self.AddChargeFilterButtons()
        self.browserBtns = {}
        self.moduleChargeButtons = {}
        for btnID, labelPath, iconPath, dblClickCallback in (
            (BROWSE_FITTINGS, 'UI/Fitting/FittingWindow/ShipAndFittings',
             'res:/UI/Texture/classes/Fitting/tabFittings.png',
             self.LoadFittingSetup),
            (BROWSE_HARDWARE, 'UI/Fitting/FittingWindow/Hardware',
             'res:/UI/Texture/classes/Fitting/tabHardware.png', None)):
            btn = self.btnGroup.AddButton(btnID,
                                          GetByLabel(labelPath),
                                          iconPath=iconPath,
                                          btnClass=ToggleButtonGhost)
            self.browserBtns[btnID] = btn
            if dblClickCallback:
                btn.OnDblClick = dblClickCallback

        self.scroll = Scroll(parent=self,
                             align=uiconst.TOALL,
                             padding=(padding, 2, padding, 0))
        self.scroll.sr.content.OnDropData = self.OnDropData
        sm.RegisterNotify(self)
Beispiel #11
0
 def SetFitting(self, invItem, shell=None, putOnline=0):
     if self.destroyed:
         return
     lg.Info('fitting', 'SetFitting', self.flag, invItem
             and cfg.invtypes.Get(invItem.typeID).Group().name)
     if invItem is None:
         self.DisableDrag()
     else:
         self.EnableDrag()
     self.shell = shell or self.shell
     if invItem and self.IsCharge(invItem.typeID):
         self.charge = invItem
         chargeQty = self.shell.GetQuantity(invItem.itemID)
         if self.module is None:
             portion = 1.0
         else:
             cap = self.shell.GetCapacity(self.module.locationID,
                                          const.attributeCapacity,
                                          self.flag)
             if cap.capacity == 0:
                 portion = 1.0
             else:
                 portion = cap.used / cap.capacity
         step = max(0, min(4, int(portion * 5.0)))
         self.sr.chargeIndicator.rectTop = 10 * step
         self.sr.chargeIndicator.state = uiconst.UI_NORMAL
         self.sr.chargeIndicator.hint = '%s %d%%' % (cfg.invtypes.Get(
             self.charge.typeID).name, portion * 100)
     elif invItem is None:
         self.id = None
         self.isChargeable = 0
         self.typeID = None
         self.module = None
         self.charge = None
         self.fitted = 0
         self.isChargeable = 0
         self.HideUtilButtons(1)
         self.sr.chargeIndicator.state = uiconst.UI_HIDDEN
     else:
         self.id = invItem.itemID
         self.typeID = invItem.typeID
         self.module = invItem
         self.fitted = 1
         self.charge = None
         if invItem.groupID in cfg.__chargecompatiblegroups__:
             self.isChargeable = 1
             self.sr.chargeIndicator.rectTop = 0
             self.sr.chargeIndicator.state = uiconst.UI_NORMAL
             self.sr.chargeIndicator.hint = localization.GetByLabel(
                 'UI/Fitting/NoCharge')
         else:
             self.isChargeable = 0
             self.sr.chargeIndicator.state = uiconst.UI_HIDDEN
     if self.typeID:
         self.tooltipPanelClassInfo = TooltipModuleWrapper()
         modulehint = cfg.invtypes.Get(self.typeID).name
         if self.charge:
             modulehint += '<br>%s' % localization.GetByLabel(
                 'UI/Fitting/ChargeQuantity',
                 charge=self.charge.typeID,
                 chargeQuantity=chargeQty)
         shipID = self.GetShipID()
         if not self.shell.SlotExists(shipID, self.module.flagID):
             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.opacity = 1.0
     self.state = uiconst.UI_NORMAL
     self.PrepareUtilButtons()
     if putOnline:
         uthread.new(self.DelayedOnlineAttempt, eve.session.shipid,
                     invItem.itemID)
     icon = self.sr.flagIcon
     icon.SetAlign(uiconst.CENTER)
     iconSize = int(48 * self.scaleFactor)
     icon.SetSize(iconSize, iconSize)
     icon.SetPosition(0, 0)
     if self.charge or self.module:
         icon.LoadIconByTypeID((self.charge or self.module).typeID,
                               ignoreSize=True)
         icon.parent.SetRotation(-self.GetRotation())
     else:
         rev = 0
         slotIcon = {
             const.flagSubSystemSlot0: 'ui_81_64_9',
             const.flagSubSystemSlot1: 'ui_81_64_10',
             const.flagSubSystemSlot2: 'ui_81_64_11',
             const.flagSubSystemSlot3: 'ui_81_64_12',
             const.flagSubSystemSlot4: 'ui_81_64_13'
         }.get(self.flag, None)
         if slotIcon is None:
             slotIcon = {
                 const.effectLoPower: 'ui_81_64_5',
                 const.effectMedPower: 'ui_81_64_6',
                 const.effectHiPower: 'ui_81_64_7',
                 const.effectRigSlot: 'ui_81_64_8'
             }.get(self.powerType, None)
         else:
             rev = 1
         if slotIcon is not None:
             icon.LoadIcon(slotIcon, ignoreSize=True)
         if rev:
             icon.parent.SetRotation(mathUtil.DegToRad(180.0))
         else:
             icon.parent.SetRotation(0.0)
     icon.state = uiconst.UI_PICKCHILDREN
     self.SetGroup()
     self.UpdateOnlineDisplay()
     self.Hilite(0)