Ejemplo n.º 1
0
 def InsertBrowseControls(self, *args):
     self.sr.backBtn = Container(name='backBtn', parent=self.sr.monthTextCont, align=uiconst.TOPLEFT, pos=(0, 0, 16, 16))
     icon = Sprite(parent=self.sr.backBtn, texturePath='res:/UI/Texture/Icons/1_16_13.png', pos=(0, 0, 16, 16), hint=localization.GetByLabel('/Carbon/UI/Common/Previous'))
     icon.OnClick = (self.ChangeMonth, -1)
     self.sr.fwdBtn = Container(name='fwdBtn', parent=self.sr.monthTextCont, align=uiconst.TOPRIGHT, pos=(0, 0, 16, 16))
     icon = Sprite(parent=self.sr.fwdBtn, texturePath='res:/UI/Texture/Icons/1_16_14.png', pos=(0, 0, 16, 16), hint=localization.GetByLabel('/Carbon/UI/Common/Next'))
     icon.OnClick = (self.ChangeMonth, 1)
Ejemplo n.º 2
0
 def InsertBrowseControls(self, *args):
     self.sr.backBtn = Container(name='backBtn', parent=self.sr.monthTextCont, align=uiconst.TOPLEFT, pos=(0, 0, 16, 16))
     icon = Sprite(parent=self.sr.backBtn, texturePath='res:/UI/Texture/Icons/1_16_13.png', pos=(0, 0, 16, 16), hint=localization.GetByLabel('/Carbon/UI/Common/Previous'))
     icon.OnClick = (self.ChangeMonth, -1)
     self.sr.fwdBtn = Container(name='fwdBtn', parent=self.sr.monthTextCont, align=uiconst.TOPRIGHT, pos=(0, 0, 16, 16))
     icon = Sprite(parent=self.sr.fwdBtn, texturePath='res:/UI/Texture/Icons/1_16_14.png', pos=(0, 0, 16, 16), hint=localization.GetByLabel('/Carbon/UI/Common/Next'))
     icon.OnClick = (self.ChangeMonth, 1)
Ejemplo n.º 3
0
    def LoadTypeRequirements(self, typeID):
        if self.typeID is not None:
            self.Flush()
        self.typeID = typeID
        if typeID is None:
            return
        categoryID = evetypes.GetCategoryID(typeID)
        isSkill = categoryID == invconst.categorySkill
        haveSkill = sm.GetService('skills').GetSkill(typeID) is not None
        requiredSkills = sm.GetService('clientDogmaStaticSvc').GetRequiredSkills(typeID)
        if isSkill and haveSkill:
            SkillLevels(parent=self, align=uiconst.NOALIGN, typeID=typeID, groupID=evetypes.GetGroupID(typeID))
        elif requiredSkills:
            texturePath, hint = sm.GetService('skills').GetRequiredSkillsLevelTexturePathAndHint(requiredSkills.items(), typeID=typeID)
            skillIcon = Sprite(name='skillIcon', parent=self, align=uiconst.NOALIGN, width=ICON_SIZE, height=ICON_SIZE, texturePath=texturePath, hint=hint, useSizeFromTexture=False)
            skillSvc = sm.GetService('skills')
            if any((skillSvc.IsTrialRestricted(typeID) for typeID in requiredSkills.keys())):

                def OpenSubscriptionPage():
                    reasonCategory = {invconst.categoryShip: 'ship',
                     invconst.categorySkill: 'skill'}.get(evetypes.GetCategoryID(typeID), 'item')
                    reason = ':'.join([reasonCategory, str(typeID)])
                    uicore.cmd.OpenSubscriptionPage(origin=ORIGIN_MARKET, reason=reason)

                skillIcon.OnClick = OpenSubscriptionPage
            else:

                def OpenRequirementsInfoTab():
                    info = sm.GetService('info')
                    info.ShowInfo(typeID, selectTabType=infoConst.TAB_REQUIREMENTS)

                skillIcon.OnClick = OpenRequirementsInfoTab
        isModule = categoryID == invconst.categoryModule
        if isModule:
            godma = sm.GetService('godma')
            dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
            shipID = GetActiveShip()
            powerContainer = ContainerAutoSize(parent=self, align=uiconst.NOALIGN)
            modulePowerLoad = godma.GetTypeAttribute(typeID, dconst.attributePower, 0)
            powerOutput = dogmaLocation.GetAttributeValue(shipID, dconst.attributePowerOutput) - dogmaLocation.GetAttributeValue(shipID, dconst.attributePowerLoad)
            havePower = shipID is not None and powerOutput >= modulePowerLoad
            icon = ['res:/UI/Texture/classes/Market/powerRequirementNotMet.png', 'res:/UI/Texture/classes/Market/powerRequirementMet.png'][havePower]
            hint = ['UI/Market/Marketbase/PowerRequirementNotMet', 'UI/Market/Marketbase/PowerRequirementMet'][havePower]
            powerIcon = Sprite(parent=powerContainer, align=uiconst.CENTERTOP, texturePath=icon, width=ICON_SIZE, height=ICON_SIZE, ignoreSize=True, hint=localization.GetByLabel(hint))
            powerLabel = EveLabelSmallBold(parent=powerContainer, align=uiconst.CENTERTOP, top=ICON_SIZE + 2, text=int(modulePowerLoad))
            cpuContainer = ContainerAutoSize(parent=self, align=uiconst.NOALIGN)
            moduleCpuLoad = godma.GetTypeAttribute(typeID, dconst.attributeCpu, 0)
            cpuOutput = dogmaLocation.GetAttributeValue(shipID, dconst.attributeCpuOutput) - dogmaLocation.GetAttributeValue(shipID, dconst.attributeCpuLoad)
            haveCpu = shipID is not None and cpuOutput >= moduleCpuLoad
            icon = ['res:/UI/Texture/classes/Market/cpuRequirementNotMet.png', 'res:/UI/Texture/classes/Market/cpuRequirementMet.png'][haveCpu]
            hint = ['UI/Market/Marketbase/CpuRequirementNotMet', 'UI/Market/Marketbase/CpuRequirementMet'][haveCpu]
            cpuIcon = Sprite(parent=cpuContainer, align=uiconst.CENTERTOP, texturePath=icon, ignoreSize=True, width=ICON_SIZE, height=ICON_SIZE, hint=localization.GetByLabel(hint))
            cpuLabel = EveLabelSmallBold(parent=cpuContainer, align=uiconst.CENTERTOP, top=ICON_SIZE + 2, text=int(moduleCpuLoad))
 def ApplyAttributes(self, attributes):
     ProbeTooltipButtonBase.ApplyAttributes(self, attributes)
     self.formation = attributes.formation
     self.OnChangeCallback = attributes.OnChangeCallback
     self.AddCell()
     self.label = EveLabelSmall(parent=self, text=attributes.text, bold=True, align=uiconst.CENTERLEFT)
     deleteButton = Sprite(texturePath='res:/UI/Texture/Icons/38_16_111.png', pos=(0, 0, 16, 16), align=uiconst.CENTERRIGHT, hint=localization.GetByLabel('UI/Inflight/Scanner/DeleteFormation'))
     self.AddCell(deleteButton, cellPadding=(5, 3, 4, 3))
     deleteButton.OnClick = self.DeleteFormation
Ejemplo n.º 5
0
 def Load(self, node):
     self.CheckDestroyed()
     if self.loaded:
         return
     self.loaded = True
     if isinstance(node.uiObject, (Base, )):
         self._label.text = node.uiObject.name or node.uiObject.__class__
         if node.objectLabel:
             self._label.text = '%s: %s' % (node.objectLabel,
                                            self._label.text)
     else:
         self._label.italic = True
         if node.objectLabel:
             self._label.text = node.objectLabel
         elif getattr(node.uiObject, 'name', None):
             self._label.text = '%s (%s)' % (node.uiObject.name,
                                             node.uiObject.__typename__)
         else:
             self._label.text = node.uiObject.__typename__
         self._label.color = (1.0, 1.0, 1.0, 0.5)
     self._label.left = INDENTSIZE * node.level + 20
     if hasattr(node.uiObject, 'Reload') or 'Reload' in getattr(
             node.uiObject, '__methods__', []):
         reloadIcon = Sprite(texturePath=RESROOT + 'tinyReload.png',
                             pos=(3, 0, 16, 16),
                             parent=self,
                             align=uiconst.CENTERRIGHT,
                             idx=0)
         reloadIcon.OnClick = self.ReloadUIObject
     if node.isExpandable:
         if node.isExpanded:
             self._expandIcon.texturePath = RESROOT + 'containerExpanded_down.png'
         else:
             self._expandIcon.texturePath = RESROOT + 'containerCollapsed.png'
     else:
         self._expandIcon.texturePath = RESROOT + 'nonContainer.png'
         self._expandIcon.state = uiconst.UI_DISABLED
     self._expandIcon.left = INDENTSIZE * node.level
     nextNode = node.scroll.GetNode(node.idx + 1)
     if node.connectLevels is not None:
         for i, connectLevel in enumerate(node.connectLevels):
             if connectLevel == node.level:
                 if not nextNode or connectLevel not in nextNode.connectLevels:
                     texturePath = RESROOT + 'connectionL.png'
                 else:
                     texturePath = RESROOT + 'connectionT.png'
             else:
                 texturePath = RESROOT + 'connectionI.png'
             Sprite(parent=self,
                    texturePath=texturePath,
                    align=uiconst.CENTERLEFT,
                    pos=((connectLevel - 1) * INDENTSIZE, 0, INDENTSIZE,
                         INDENTSIZE))
Ejemplo n.º 6
0
 def ApplyAttributes(self, attributes):
     ContainerAutoSize.ApplyAttributes(self, attributes)
     self.level = attributes.get('level', 0)
     self.data = attributes.get('data')
     self.eventListener = attributes.get('eventListener', None)
     self.parentEntry = attributes.get('parentEntry', None)
     self.settingsID = attributes.get('settingsID', self.default_settingsID)
     self.defaultExpanded = attributes.get('defaultExpanded', self.level < 1)
     self.childrenInitialized = False
     self.isToggling = False
     self.canAccess = True
     self.isSelected = False
     self.childSelectedBG = False
     self.icon = None
     self.childCont = None
     self.topRightCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=self.default_height)
     self.topRightCont.GetDragData = self.GetDragData
     left = self.GetSpacerContWidth()
     if self.data.IsRemovable():
         removeBtn = Sprite(texturePath='res:/UI/Texture/icons/73_16_210.png', parent=self.topRightCont, align=uiconst.CENTERLEFT, width=16, height=16, left=left, hint=localization.GetByLabel('UI/Common/Buttons/Close'))
         left += 20
         removeBtn.OnClick = self.Remove
     icon = self.data.GetIcon()
     if icon:
         iconSize = self.height - 2
         self.icon = Icon(icon=icon, parent=self.topRightCont, pos=(left,
          0,
          iconSize,
          iconSize), align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, ignoreSize=True)
         left += iconSize
     self.label = Label(parent=self.topRightCont, align=uiconst.CENTERLEFT, text=self.data.GetLabel(), left=left + 4)
     self.UpdateLabel()
     self.hoverBG = None
     self.selectedBG = None
     self.blinkBG = None
     if self.data.HasChildren():
         self.spacerCont = Container(name='spacerCont', parent=self.topRightCont, align=uiconst.TOLEFT, width=self.GetSpacerContWidth())
         self.toggleBtn = Container(name='toggleBtn', parent=self.spacerCont, align=uiconst.CENTERRIGHT, width=16, height=16, state=uiconst.UI_HIDDEN)
         self.toggleBtn.OnClick = self.OnToggleBtnClick
         self.toggleBtn.OnDblClick = lambda : None
         self.toggleBtnSprite = Sprite(bgParent=self.toggleBtn, texturePath='res:/UI/Texture/classes/Neocom/arrowDown.png', rotation=pi / 2, padding=(4, 4, 5, 5))
         expandChildren = False
         if not self.data.IsForceCollapsed():
             toggleSettingsDict = settings.user.ui.Get('invTreeViewEntryToggle_%s' % self.settingsID, {})
             expandChildren = toggleSettingsDict.get(self.data.GetID(), self.defaultExpanded)
             self.ConstructChildren()
         else:
             self.toggleBtn.state = uiconst.UI_NORMAL
         self.ShowChildCont(expandChildren, animate=False)
     else:
         self.ShowChildCont(False, animate=False)
     if self.eventListener and hasattr(self.eventListener, 'RegisterID'):
         self.eventListener.RegisterID(self, self.data.GetID())
Ejemplo n.º 7
0
 def ApplyAttributes(self, attributes):
     ContainerAutoSize.ApplyAttributes(self, attributes)
     self.level = attributes.get('level', 0)
     self.data = attributes.get('data')
     self.eventListener = attributes.get('eventListener', None)
     self.parentEntry = attributes.get('parentEntry', None)
     self.settingsID = attributes.get('settingsID', self.default_settingsID)
     self.defaultExpanded = attributes.get('defaultExpanded', self.level < 1)
     self.childrenInitialized = False
     self.isToggling = False
     self.canAccess = True
     self.isSelected = False
     self.childSelectedBG = False
     self.icon = None
     self.childCont = None
     self.topRightCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=self.default_height)
     self.topRightCont.GetDragData = self.GetDragData
     left = self.GetSpacerContWidth()
     if self.data.IsRemovable():
         removeBtn = Sprite(texturePath='res:/UI/Texture/icons/73_16_210.png', parent=self.topRightCont, align=uiconst.CENTERLEFT, width=16, height=16, left=left, hint=localization.GetByLabel('UI/Common/Buttons/Close'))
         left += 20
         removeBtn.OnClick = self.Remove
     icon = self.data.GetIcon()
     if icon:
         iconSize = self.height - 2
         self.icon = Icon(icon=icon, parent=self.topRightCont, pos=(left,
          0,
          iconSize,
          iconSize), align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, ignoreSize=True)
         left += iconSize
     self.label = Label(parent=self.topRightCont, align=uiconst.CENTERLEFT, text=self.data.GetLabel(), left=left + 4)
     self.UpdateLabel()
     self.hoverBG = None
     self.selectedBG = None
     self.blinkBG = None
     if self.data.HasChildren():
         self.spacerCont = Container(name='spacerCont', parent=self.topRightCont, align=uiconst.TOLEFT, width=self.GetSpacerContWidth())
         self.toggleBtn = Container(name='toggleBtn', parent=self.spacerCont, align=uiconst.CENTERRIGHT, width=16, height=16, state=uiconst.UI_HIDDEN)
         self.toggleBtn.OnClick = self.OnToggleBtnClick
         self.toggleBtn.OnDblClick = lambda : None
         self.toggleBtnSprite = Sprite(bgParent=self.toggleBtn, texturePath='res:/UI/Texture/classes/Neocom/arrowDown.png', rotation=pi / 2, padding=(4, 4, 5, 5))
         expandChildren = False
         if not self.data.IsForceCollapsed():
             toggleSettingsDict = settings.user.ui.Get('invTreeViewEntryToggle_%s' % self.settingsID, {})
             expandChildren = toggleSettingsDict.get(self.data.GetID(), self.defaultExpanded)
             self.ConstructChildren()
         else:
             self.toggleBtn.state = uiconst.UI_NORMAL
         self.ShowChildCont(expandChildren, animate=False)
     else:
         self.ShowChildCont(False, animate=False)
     if self.eventListener and hasattr(self.eventListener, 'RegisterID'):
         self.eventListener.RegisterID(self, self.data.GetID())
Ejemplo n.º 8
0
 def ApplyAttributes(self, attributes):
     invCont._InvContBase.ApplyAttributes(self, attributes)
     ownerID = attributes.ownerID
     ownerName = cfg.eveowners.Get(ownerID).name
     self.topCont = uiprimitives.Container(parent=self, align=uiconst.TOTOP, height=65, idx=0)
     myImgCont = Sprite(parent=self.topCont, align=uiconst.TOLEFT, width=64, idx=0, texturePath='res:/UI/Texture/silhouette_64.png', left=2)
     sm.GetService('photo').GetPortrait(ownerID, 64, myImgCont)
     myImgCont.OnClick = (self.ShowCharInfo, ownerID)
     myImgCont.hint = ownerName
     ownerLink = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=ownerName, info=('showinfo', const.typeCharacterAmarr, ownerID))
     uicontrols.EveLabelMedium(text=ownerLink, parent=self.topCont, left=72, top=2, bold=True, state=uiconst.UI_NORMAL)
     self.acceptIcon = uicontrols.Icon(icon='ui_38_16_193', parent=self.topCont, left=67, top=14)
     uicls.InvContViewBtns(parent=self.topCont, align=uiconst.BOTTOMLEFT, left=72, controller=self)
     self.moneyLabel = uicontrols.EveLabelMedium(parent=self.topCont, left=6, top=-2, align=uiconst.BOTTOMRIGHT)
Ejemplo n.º 9
0
 def ApplyAttributes(self, attributes):
     ProbeTooltipButtonBase.ApplyAttributes(self, attributes)
     self.formation = attributes.formation
     self.OnChangeCallback = attributes.OnChangeCallback
     self.AddCell()
     self.label = EveLabelSmall(parent=self,
                                text=attributes.text,
                                bold=True,
                                align=uiconst.CENTERLEFT)
     deleteButton = Sprite(
         texturePath='res:/UI/Texture/Icons/38_16_111.png',
         pos=(0, 0, 16, 16),
         align=uiconst.CENTERRIGHT,
         hint=localization.GetByLabel(
             'UI/Inflight/Scanner/DeleteFormation'))
     self.AddCell(deleteButton, cellPadding=(5, 3, 4, 3))
     deleteButton.OnClick = self.DeleteFormation
Ejemplo n.º 10
0
 def Load(self, node):
     self.CheckDestroyed()
     if self.loaded:
         return
     self.loaded = True
     if isinstance(node.uiObject, (Base,)):
         self._label.text = node.uiObject.name or node.uiObject.__class__
         if node.objectLabel:
             self._label.text = '%s: %s' % (node.objectLabel, self._label.text)
     else:
         self._label.italic = True
         if node.objectLabel:
             self._label.text = node.objectLabel
         elif getattr(node.uiObject, 'name', None):
             self._label.text = '%s (%s)' % (node.uiObject.name, node.uiObject.__typename__)
         else:
             self._label.text = node.uiObject.__typename__
         self._label.color = (1.0, 1.0, 1.0, 0.5)
     self._label.left = INDENTSIZE * node.level + 20
     if hasattr(node.uiObject, 'Reload') or 'Reload' in getattr(node.uiObject, '__methods__', []):
         reloadIcon = Sprite(texturePath=RESROOT + 'tinyReload.png', pos=(3, 0, 16, 16), parent=self, align=uiconst.CENTERRIGHT, idx=0)
         reloadIcon.OnClick = self.ReloadUIObject
     if node.isExpandable:
         if node.isExpanded:
             self._expandIcon.texturePath = RESROOT + 'containerExpanded_down.png'
         else:
             self._expandIcon.texturePath = RESROOT + 'containerCollapsed.png'
     else:
         self._expandIcon.texturePath = RESROOT + 'nonContainer.png'
         self._expandIcon.state = uiconst.UI_DISABLED
     self._expandIcon.left = INDENTSIZE * node.level
     nextNode = node.scroll.GetNode(node.idx + 1)
     if node.connectLevels is not None:
         for i, connectLevel in enumerate(node.connectLevels):
             if connectLevel == node.level:
                 if not nextNode or connectLevel not in nextNode.connectLevels:
                     texturePath = RESROOT + 'connectionL.png'
                 else:
                     texturePath = RESROOT + 'connectionT.png'
             else:
                 texturePath = RESROOT + 'connectionI.png'
             Sprite(parent=self, texturePath=texturePath, align=uiconst.CENTERLEFT, pos=((connectLevel - 1) * INDENTSIZE,
              0,
              INDENTSIZE,
              INDENTSIZE))
Ejemplo n.º 11
0
 def ApplyAttributes(self, attributes):
     invCont._InvContBase.ApplyAttributes(self, attributes)
     tradeItems = attributes.tradeItems
     ownerID = attributes.ownerID
     ownerName = cfg.eveowners.Get(ownerID).name
     self.topCont = uiprimitives.Container(parent=self,
                                           align=uiconst.TOTOP,
                                           height=65,
                                           idx=0)
     myImgCont = Sprite(parent=self.topCont,
                        align=uiconst.TOLEFT,
                        width=64,
                        idx=0,
                        texturePath='res:/UI/Texture/silhouette_64.png',
                        left=2)
     sm.GetService('photo').GetPortrait(ownerID, 64, myImgCont)
     myImgCont.OnClick = (self.ShowCharInfo, ownerID)
     myImgCont.hint = ownerName
     ownerLink = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink',
                            showInfoName=ownerName,
                            info=('showinfo', const.typeCharacterAmarr,
                                  ownerID))
     uicontrols.EveLabelMedium(text=ownerLink,
                               parent=self.topCont,
                               left=72,
                               top=2,
                               bold=True,
                               state=uiconst.UI_NORMAL)
     self.acceptIcon = uicontrols.Icon(icon='ui_38_16_193',
                                       parent=self.topCont,
                                       left=67,
                                       top=14)
     uicls.InvContViewBtns(parent=self.topCont,
                           align=uiconst.BOTTOMLEFT,
                           left=72,
                           controller=self)
     self.moneyLabel = uicontrols.EveLabelMedium(parent=self.topCont,
                                                 left=6,
                                                 top=-2,
                                                 align=uiconst.BOTTOMRIGHT)
     if tradeItems:
         self.invController.OnDropData(tradeItems)
Ejemplo n.º 12
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(0)
     self.bountyEscrow = attributes.bountyEscrow
     self.bountyAmount = attributes.bountyAmount
     self.component = attributes.component
     factionResPath = FACTIONPATHBYESSTYPEID[attributes.ESSTypeID]
     navyID = CORPIDBYFACTIONID[attributes.ESSTypeID]
     self.SetCaption(GetByLabel(CAPTIONBYESSTYPEID[attributes.ESSTypeID]))
     self.myContribution = 0
     self.amountInTags = 0
     mainCont = Container(name='mainCont', parent=self.sr.main, padding=const.defaultPadding)
     iconCont = Container(name='iconCont', parent=mainCont, align=uiconst.TOTOP, height=64)
     headerCont = Container(name='headerCont', parent=mainCont, align=uiconst.TOTOP, height=54, padBottom=6)
     buttonsCont = Container(name='buttonsCont', parent=mainCont, align=uiconst.TOBOTTOM, height=80, padTop=4, padBottom=4)
     listCont = Container(name='listCont', parent=mainCont, align=uiconst.TOALL, padBottom=14)
     factionLogo = Sprite(parent=iconCont, align=uiconst.CENTERTOP, width=64, height=64, texturePath=factionResPath)
     factionLogo.hint = cfg.eveowners.Get(navyID).name
     factionLogo.OnClick = (self.OpenNavyInfo, navyID)
     EveLabelLarge(text=GetByLabel('UI/Inflight/Brackets/TotalBounty'), parent=headerCont, maxLines=1, align=uiconst.CENTERTOP)
     EveCaptionMedium(text=FmtISK(self.bountyAmount, 0), parent=headerCont, maxLines=1, align=uiconst.CENTERTOP, state=uiconst.UI_NORMAL, top=16)
     contributorsCont = Container(name='contributorsCont', parent=listCont, align=uiconst.TOLEFT_PROP, width=0.45)
     self.tagsCont = Container(name='tagsCont', parent=listCont, align=uiconst.TORIGHT_PROP, width=0.45)
     topSpaceCont = Container(name='topSpaceCont', parent=listCont, align=uiconst.TOALL)
     self.contributersList = ScrollContainer(name='contributersList', parent=contributorsCont, align=uiconst.TOALL)
     shareCont = Container(name='shareCont', parent=buttonsCont, align=uiconst.TOLEFT_PROP, width=0.45)
     takeCont = Container(name='takeCont', parent=buttonsCont, align=uiconst.TORIGHT_PROP, width=0.45)
     spaceCont = Container(name='spaceCont', parent=buttonsCont, align=uiconst.TOALL)
     youGetLabel = EveLabelMedium(text=GetByLabel('UI/Inflight/Brackets/YouGet'), parent=shareCont, align=uiconst.CENTERTOP, top=1)
     myContribLabel = EveLabelLargeBold(text='', parent=shareCont, align=uiconst.CENTERTOP, top=16)
     shareLabel = EveLabelSmall(text=GetByLabel('UI/Inflight/Brackets/EveryoneGetsTheirShare'), parent=shareCont, align=uiconst.CENTERBOTTOM)
     shareBtn = Button(parent=shareCont, label=GetByLabel('UI/Inflight/Brackets/Share'), align=uiconst.TOBOTTOM, top=20, func=self.ShareContribution)
     orLabel = EveLabelLargeBold(text=GetByLabel('UI/Inflight/Brackets/Or'), parent=spaceCont, align=uiconst.CENTER, top=10)
     amountInTagsLabel = EveLabelLarge(text=GetByLabel('UI/Inflight/Brackets/AmountInTags', amount=FmtISK(0, 0)), parent=takeCont, align=uiconst.CENTERTOP, top=16)
     takeLabel = EveLabelSmall(text=GetByLabel('UI/Inflight/Brackets/OthersGetNothing'), parent=takeCont, align=uiconst.CENTERBOTTOM)
     takeAllBtn = Button(parent=takeCont, label=GetByLabel('UI/Inflight/Brackets/TakeAll'), align=uiconst.TOBOTTOM, top=20, func=self.TakeAll)
     self.LoadContributions(attributes.contributions)
     myContribLabel.SetText(FmtISK(self.myContribution, 0))
     self.LoadTags()
     amountInTagsLabel.SetText(GetByLabel('UI/Inflight/Brackets/AmountInTags', amount=FmtISK(self.amountInTags, 0)))
Ejemplo n.º 13
0
    def ConstructHeader(self):
        if self.loadingHeader:
            return
        self.loadingHeader = True
        self.topCont.Flush()
        characterName = cfg.eveowners.Get(session.charid).name
        if not getattr(self, 'charMgr', None):
            self.charMgr = sm.RemoteSvc('charMgr')
        if not getattr(self, 'cc', None):
            self.charsvc = sm.GetService('cc')
        self.sr.charinfo = charinfo = self.charMgr.GetPublicInfo(
            session.charid)
        if settings.user.ui.Get('charsheetExpanded', 1):
            parent = self.topCont
            self.sr.picParent = Container(name='picpar',
                                          parent=parent,
                                          align=uiconst.TOPLEFT,
                                          width=200,
                                          height=200,
                                          left=const.defaultPadding,
                                          top=16)
            self.sr.pic = Sprite(parent=self.sr.picParent,
                                 align=uiconst.TOALL,
                                 left=1,
                                 top=1,
                                 height=1,
                                 width=1)
            self.sr.pic.OnClick = self.OpenPortraitWnd
            self.sr.pic.cursor = uiconst.UICURSOR_MAGNIFIER
            uicontrols.Frame(parent=self.sr.picParent, opacity=0.2)
            sm.GetService('photo').GetPortrait(session.charid, 256,
                                               self.sr.pic)
            infoTextPadding = self.sr.picParent.width + const.defaultPadding * 4
            characterLink = GetByLabel(
                'UI/Contracts/ContractsWindow/ShowInfoLink',
                showInfoName=characterName,
                info=('showinfo', const.typeCharacterAmarr, session.charid))
            self.sr.nameText = uicontrols.EveCaptionMedium(
                text=characterLink,
                parent=self.topCont,
                left=infoTextPadding,
                top=12,
                state=uiconst.UI_NORMAL)
            self.sr.raceinfo = raceinfo = cfg.races.Get(charinfo.raceID)
            self.sr.bloodlineinfo = bloodlineinfo = cfg.bloodlines.Get(
                charinfo.bloodlineID)
            self.sr.schoolinfo = schoolinfo = self.charsvc.GetData(
                'schools', ['schoolID', charinfo.schoolID])
            self.sr.ancestryinfo = ancestryinfo = self.charsvc.GetData(
                'ancestries', ['ancestryID', charinfo.ancestryID])
            if self.destroyed:
                self.loadingHeader = False
                return
            securityStatus = sm.GetService(
                'crimewatchSvc').GetMySecurityStatus()
            roundedSecurityStatus = localization.formatters.FormatNumeric(
                securityStatus, decimalPlaces=1)
            cloneLocationRow = sm.RemoteSvc('charMgr').GetHomeStationRow()
            if cloneLocationRow:
                stationID = cloneLocationRow.stationID
                cloneLocationSystemID = cloneLocationRow.solarSystemID
                if cloneLocationSystemID:
                    labelPath = 'UI/CharacterSheet/CharacterSheetWindow/CloneLocationHint'
                    cloneLocationHint = GetByLabel(
                        labelPath,
                        locationId=stationID,
                        systemId=cloneLocationSystemID)
                    cloneLocation = cfg.evelocations.Get(
                        cloneLocationSystemID).name
                else:
                    cloneLocationHint = cfg.evelocations.Get(stationID).name
                    cloneLocation = GetByLabel(
                        'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem')
            else:
                cloneLocation = GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem')
                cloneLocationHint = ''
            alliance = ''
            if session.allianceid:
                cfg.eveowners.Prime([session.allianceid])
                alliance = (GetByLabel('UI/Common/Alliance'),
                            cfg.eveowners.Get(session.allianceid).name, '')
            faction = ''
            if session.warfactionid:
                fac = sm.StartService('facwar').GetFactionalWarStatus()
                faction = (GetByLabel('UI/Common/Militia'),
                           cfg.eveowners.Get(fac.factionID).name, '')
            bounty = ''
            bountyOwnerIDs = (session.charid, session.corpid,
                              session.allianceid)
            bountyAmount = sm.GetService('bountySvc').GetBounty(
                *bountyOwnerIDs)
            bountyAmounts = sm.GetService('bountySvc').GetBounties(
                *bountyOwnerIDs)
            charBounty = 0
            corpBounty = 0
            allianceBounty = 0
            if len(bountyAmounts):
                for ownerID, value in bountyAmounts.iteritems():
                    if util.IsCharacter(ownerID):
                        charBounty = value
                    elif util.IsCorporation(ownerID):
                        corpBounty = value
                    elif util.IsAlliance(ownerID):
                        allianceBounty = value

            bountyHint = GetByLabel('UI/Station/BountyOffice/BountyHint',
                                    charBounty=util.FmtISK(charBounty, 0),
                                    corpBounty=util.FmtISK(corpBounty, 0),
                                    allianceBounty=util.FmtISK(
                                        allianceBounty, 0))
            bounty = (GetByLabel('UI/Station/BountyOffice/Bounty'),
                      util.FmtISK(bountyAmount, 0), bountyHint)
            skillPoints = int(sm.GetService('skills').GetSkillPoints())
            textList = [
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/SkillPoints'),
                 localization.formatters.FormatNumeric(skillPoints,
                                                       useGrouping=True), ''),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/HomeSystem'),
                 cloneLocation, cloneLocationHint),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/CharacterBackground'
                ),
                 GetByLabel(
                     'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundInformation',
                     raceName=localization.GetByMessageID(raceinfo.raceNameID),
                     bloodlineName=localization.GetByMessageID(
                         bloodlineinfo.bloodlineNameID),
                     ancestryName=localization.GetByMessageID(
                         ancestryinfo.ancestryNameID)),
                 GetByLabel(
                     'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundHint'
                 )),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/DateOfBirth'),
                 localization.formatters.FormatDateTime(
                     charinfo.createDateTime,
                     dateFormat='long',
                     timeFormat='long'), ''),
                (GetByLabel('UI/CharacterSheet/CharacterSheetWindow/School'),
                 localization.GetByMessageID(schoolinfo.schoolNameID), ''),
                (GetByLabel('UI/Common/Corporation'),
                 cfg.eveowners.Get(session.corpid).name, ''),
                (GetByLabel(
                    'UI/CharacterSheet/CharacterSheetWindow/SecurityStatus'),
                 roundedSecurityStatus,
                 localization.formatters.FormatNumeric(securityStatus,
                                                       decimalPlaces=4))
            ]
            if faction:
                textList.insert(len(textList) - 1, faction)
            if alliance:
                textList.insert(len(textList) - 1, alliance)
            if bounty:
                textList.insert(len(textList), bounty)
            numLines = len(textList) + 2
            mtext = 'Xg<br>' * numLines
            mtext = mtext[:-4]
            th = GetTextHeight(mtext)
            topParentHeight = max(220, th + const.defaultPadding * 2 + 2)
            top = max(34, self.sr.nameText.top + self.sr.nameText.height)
            leftContainer = Container(parent=self.topCont,
                                      left=infoTextPadding,
                                      top=top,
                                      align=uiconst.TOPLEFT)
            rightContainer = Container(parent=self.topCont,
                                       top=top,
                                       align=uiconst.TOPLEFT)
            subTop = 0
            for label, value, hint in textList:
                label = uicontrols.EveLabelMedium(text=label,
                                                  parent=leftContainer,
                                                  idx=0,
                                                  state=uiconst.UI_NORMAL,
                                                  align=uiconst.TOPLEFT,
                                                  top=subTop)
                label.hint = hint
                label._tabMargin = 0
                display = uicontrols.EveLabelMedium(text=value,
                                                    parent=rightContainer,
                                                    idx=0,
                                                    state=uiconst.UI_NORMAL,
                                                    align=uiconst.TOPLEFT,
                                                    top=subTop)
                display.hint = hint
                display._tabMargin = 0
                subTop += label.height

            leftContainer.AutoFitToContent()
            rightContainer.left = leftContainer.left + leftContainer.width + 20
            rightContainer.AutoFitToContent()
            self.topCont.EnableAutoSize()
        else:
            self.topCont.DisableAutoSize()
            self.topCont.height = 18
        charsheetExpanded = settings.user.ui.Get('charsheetExpanded', 1)
        if not charsheetExpanded:
            uicontrols.EveLabelMedium(text=characterName,
                                      parent=self.topCont,
                                      left=8,
                                      top=1,
                                      state=uiconst.UI_DISABLED)
        expandOptions = [
            GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Expand'),
            GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Collapse')
        ]
        a = uicontrols.EveLabelSmall(text=expandOptions[charsheetExpanded],
                                     parent=self.topCont,
                                     left=15,
                                     top=3,
                                     state=uiconst.UI_NORMAL,
                                     align=uiconst.TOPRIGHT,
                                     bold=True)
        a.OnClick = self.ToggleGeneral
        expander = Sprite(parent=self.topCont,
                          pos=(3, 2, 11, 11),
                          name='expandericon',
                          state=uiconst.UI_NORMAL,
                          texturePath=[
                              'res:/UI/Texture/Shared/expanderDown.png',
                              'res:/UI/Texture/Shared/expanderUp.png'
                          ][charsheetExpanded],
                          align=uiconst.TOPRIGHT)
        expander.OnClick = self.ToggleGeneral
        self.loadingHeader = False
Ejemplo n.º 14
0
    def LoadTypeRequirements(self, typeID):
        if self.typeID is not None:
            self.Flush()
        self.typeID = typeID
        if typeID is None:
            return
        invType = cfg.invtypes.Get(typeID)
        isSkill = invType.categoryID == invconst.categorySkill
        haveSkill = sm.GetService('skills').GetMySkillsFromTypeID(
            typeID) is not None
        requiredSkills = sm.GetService(
            'clientDogmaStaticSvc').GetRequiredSkills(typeID)
        if isSkill and haveSkill:
            SkillLevels(parent=self,
                        align=uiconst.NOALIGN,
                        typeID=typeID,
                        groupID=invType.groupID)
        elif requiredSkills:
            texturePath, hint = sm.GetService(
                'skills').GetRequiredSkillsLevelTexturePathAndHint(
                    requiredSkills.items(), typeID=typeID)
            skillIcon = Sprite(name='skillIcon',
                               parent=self,
                               align=uiconst.NOALIGN,
                               width=ICON_SIZE,
                               height=ICON_SIZE,
                               texturePath=texturePath,
                               hint=hint,
                               useSizeFromTexture=False)
            skillSvc = sm.GetService('skills')
            if any((skillSvc.IsTrialRestricted(typeID)
                    for typeID in requiredSkills.keys())):

                def OpenSubscriptionPage():
                    reasonCategory = {
                        invconst.categoryShip: 'ship',
                        invconst.categorySkill: 'skill'
                    }.get(types.GetCategoryID(typeID), 'item')
                    reason = ':'.join([reasonCategory, str(typeID)])
                    uicore.cmd.OpenSubscriptionPage(origin=ORIGIN_MARKET,
                                                    reason=reason)

                skillIcon.OnClick = OpenSubscriptionPage
            else:

                def OpenRequirementsInfoTab():
                    info = sm.GetService('info')
                    info.ShowInfo(typeID,
                                  selectTabType=infoConst.TAB_REQUIREMENTS)

                skillIcon.OnClick = OpenRequirementsInfoTab
        isModule = invType.categoryID == invconst.categoryModule
        if isModule:
            godma = sm.GetService('godma')
            dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation()
            shipID = GetActiveShip()
            powerContainer = ContainerAutoSize(parent=self,
                                               align=uiconst.NOALIGN)
            modulePowerLoad = godma.GetTypeAttribute(typeID,
                                                     dconst.attributePower, 0)
            powerOutput = dogmaLocation.GetAttributeValue(
                shipID,
                dconst.attributePowerOutput) - dogmaLocation.GetAttributeValue(
                    shipID, dconst.attributePowerLoad)
            havePower = shipID is not None and powerOutput > modulePowerLoad
            icon = [
                'res:/UI/Texture/classes/Market/powerRequirementNotMet.png',
                'res:/UI/Texture/classes/Market/powerRequirementMet.png'
            ][havePower]
            hint = [
                'UI/Market/Marketbase/PowerRequirementNotMet',
                'UI/Market/Marketbase/PowerRequirementMet'
            ][havePower]
            powerIcon = Sprite(parent=powerContainer,
                               align=uiconst.CENTERTOP,
                               texturePath=icon,
                               width=ICON_SIZE,
                               height=ICON_SIZE,
                               ignoreSize=True,
                               hint=localization.GetByLabel(hint))
            powerLabel = EveLabelSmallBold(parent=powerContainer,
                                           align=uiconst.CENTERTOP,
                                           top=ICON_SIZE + 2,
                                           text=int(modulePowerLoad))
            cpuContainer = ContainerAutoSize(parent=self,
                                             align=uiconst.NOALIGN)
            moduleCpuLoad = godma.GetTypeAttribute(typeID, dconst.attributeCpu,
                                                   0)
            cpuOutput = dogmaLocation.GetAttributeValue(
                shipID,
                dconst.attributeCpuOutput) - dogmaLocation.GetAttributeValue(
                    shipID, dconst.attributeCpuLoad)
            haveCpu = shipID is not None and cpuOutput > moduleCpuLoad
            icon = [
                'res:/UI/Texture/classes/Market/cpuRequirementNotMet.png',
                'res:/UI/Texture/classes/Market/cpuRequirementMet.png'
            ][haveCpu]
            hint = [
                'UI/Market/Marketbase/CpuRequirementNotMet',
                'UI/Market/Marketbase/CpuRequirementMet'
            ][haveCpu]
            cpuIcon = Sprite(parent=cpuContainer,
                             align=uiconst.CENTERTOP,
                             texturePath=icon,
                             ignoreSize=True,
                             width=ICON_SIZE,
                             height=ICON_SIZE,
                             hint=localization.GetByLabel(hint))
            cpuLabel = EveLabelSmallBold(parent=cpuContainer,
                                         align=uiconst.CENTERTOP,
                                         top=ICON_SIZE + 2,
                                         text=int(moduleCpuLoad))
Ejemplo n.º 15
0
 def ApplyAttributes(self, attributes):
     Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(0)
     self.bountyEscrow = attributes.bountyEscrow
     self.bountyAmount = attributes.bountyAmount
     self.component = attributes.component
     factionResPath = FACTIONPATHBYESSTYPEID[attributes.ESSTypeID]
     navyID = CORPIDBYFACTIONID[attributes.ESSTypeID]
     self.SetCaption(GetByLabel(CAPTIONBYESSTYPEID[attributes.ESSTypeID]))
     self.myContribution = 0
     self.amountInTags = 0
     mainCont = Container(name='mainCont',
                          parent=self.sr.main,
                          padding=const.defaultPadding)
     iconCont = Container(name='iconCont',
                          parent=mainCont,
                          align=uiconst.TOTOP,
                          height=64)
     headerCont = Container(name='headerCont',
                            parent=mainCont,
                            align=uiconst.TOTOP,
                            height=54,
                            padBottom=6)
     buttonsCont = Container(name='buttonsCont',
                             parent=mainCont,
                             align=uiconst.TOBOTTOM,
                             height=80,
                             padTop=4,
                             padBottom=4)
     listCont = Container(name='listCont',
                          parent=mainCont,
                          align=uiconst.TOALL,
                          padBottom=14)
     factionLogo = Sprite(parent=iconCont,
                          align=uiconst.CENTERTOP,
                          width=64,
                          height=64,
                          texturePath=factionResPath)
     factionLogo.hint = cfg.eveowners.Get(navyID).name
     factionLogo.OnClick = (self.OpenNavyInfo, navyID)
     EveLabelLarge(text=GetByLabel('UI/Inflight/Brackets/TotalBounty'),
                   parent=headerCont,
                   maxLines=1,
                   align=uiconst.CENTERTOP)
     EveCaptionMedium(text=FmtISK(self.bountyAmount, 0),
                      parent=headerCont,
                      maxLines=1,
                      align=uiconst.CENTERTOP,
                      state=uiconst.UI_NORMAL,
                      top=16)
     contributorsCont = Container(name='contributorsCont',
                                  parent=listCont,
                                  align=uiconst.TOLEFT_PROP,
                                  width=0.45)
     self.tagsCont = Container(name='tagsCont',
                               parent=listCont,
                               align=uiconst.TORIGHT_PROP,
                               width=0.45)
     topSpaceCont = Container(name='topSpaceCont',
                              parent=listCont,
                              align=uiconst.TOALL)
     self.contributersList = ScrollContainer(name='contributersList',
                                             parent=contributorsCont,
                                             align=uiconst.TOALL)
     shareCont = Container(name='shareCont',
                           parent=buttonsCont,
                           align=uiconst.TOLEFT_PROP,
                           width=0.45)
     takeCont = Container(name='takeCont',
                          parent=buttonsCont,
                          align=uiconst.TORIGHT_PROP,
                          width=0.45)
     spaceCont = Container(name='spaceCont',
                           parent=buttonsCont,
                           align=uiconst.TOALL)
     youGetLabel = EveLabelMedium(
         text=GetByLabel('UI/Inflight/Brackets/YouGet'),
         parent=shareCont,
         align=uiconst.CENTERTOP,
         top=1)
     myContribLabel = EveLabelLargeBold(text='',
                                        parent=shareCont,
                                        align=uiconst.CENTERTOP,
                                        top=16)
     shareLabel = EveLabelSmall(
         text=GetByLabel('UI/Inflight/Brackets/EveryoneGetsTheirShare'),
         parent=shareCont,
         align=uiconst.CENTERBOTTOM)
     shareBtn = Button(parent=shareCont,
                       label=GetByLabel('UI/Inflight/Brackets/Share'),
                       align=uiconst.TOBOTTOM,
                       top=20,
                       func=self.ShareContribution)
     orLabel = EveLabelLargeBold(text=GetByLabel('UI/Inflight/Brackets/Or'),
                                 parent=spaceCont,
                                 align=uiconst.CENTER,
                                 top=10)
     amountInTagsLabel = EveLabelLarge(text=GetByLabel(
         'UI/Inflight/Brackets/AmountInTags', amount=FmtISK(0, 0)),
                                       parent=takeCont,
                                       align=uiconst.CENTERTOP,
                                       top=16)
     takeLabel = EveLabelSmall(
         text=GetByLabel('UI/Inflight/Brackets/OthersGetNothing'),
         parent=takeCont,
         align=uiconst.CENTERBOTTOM)
     takeAllBtn = Button(parent=takeCont,
                         label=GetByLabel('UI/Inflight/Brackets/TakeAll'),
                         align=uiconst.TOBOTTOM,
                         top=20,
                         func=self.TakeAll)
     self.LoadContributions(attributes.contributions)
     myContribLabel.SetText(FmtISK(self.myContribution, 0))
     self.LoadTags()
     amountInTagsLabel.SetText(
         GetByLabel('UI/Inflight/Brackets/AmountInTags',
                    amount=FmtISK(self.amountInTags, 0)))