Esempio n. 1
0
def MakeTypeIcon(icon, dad, typeID, iconSize, isCopy=False):
    techIcon = uix.GetTechLevelIcon(None, typeID=typeID)
    if techIcon:
        techIcon.left = icon.left
        techIcon.top = icon.top
        dad.children.append(techIcon)
    icon.LoadIconByTypeID(typeID=typeID, size=iconSize, isCopy=isCopy)
Esempio n. 2
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     typeID = attributes.typeID
     qty = attributes.qty
     iconPadding = 1 * const.defaultPadding
     typeIcon = Icon(name='typeIcon',
                     parent=self,
                     state=uiconst.UI_NORMAL,
                     size=32,
                     left=iconPadding,
                     ignoreSize=True,
                     typeID=typeID)
     techIcon = uix.GetTechLevelIcon(typeID=typeID)
     if techIcon:
         techIcon.left = iconPadding
         techIcon.SetParent(self, idx=0)
     typeName = evetypes.GetName(typeID)
     link = '<url="showinfo:%s">%s</url>' % (typeID, typeName)
     text = '%sx %s' % (qty, link)
     left = iconPadding * 2 + typeIcon.width + 10
     label = EveLabelMedium(parent=self,
                            left=left,
                            text=text,
                            state=uiconst.UI_NORMAL,
                            align=uiconst.CENTERLEFT)
     self.width = label.left + label.textwidth + 10
Esempio n. 3
0
    def ClickEntry(self, entry, *args):
        if not self or self.destroyed:
            return
        self.ShowRightPanel()
        if self.fitting is not None and self.fitting.fittingID == entry.sr.node.fitting.fittingID:
            return
        self.fitting = fitting = entry.sr.node.fitting
        self.sr.fittingName.SetText(fitting.name)
        self.RefreshNameCheckbox()
        self.sr.fittingDescription.SetText(fitting.description)
        shipName = evetypes.GetName(fitting.shipTypeID)
        self.sr.shipTypeName.text = shipName
        width = uix.GetTextWidth(shipName, uppercase=1)
        self.sr.infoicon.left = width + 15
        self.sr.infoicon.state = uiconst.UI_NORMAL
        self.sr.shipIcon.LoadIconByTypeID(fitting.shipTypeID, ignoreSize=True)
        self.sr.shipIcon.SetSize(64, 64)
        self.sr.shipIcon.state = uiconst.UI_DISABLED
        uix.GetTechLevelIcon(self.sr.techicon, 0, fitting.shipTypeID)
        self.sr.dragIcon.fitting = fitting
        for button in self.sr.radioButtons:
            button.SetValue(fitting.ownerID == button.data['value'])

        scrolllist = self.fittingSvc.GetFittingInfoScrollList(fitting)
        self.sr.fittingInfo.Load(contentList=scrolllist)
Esempio n. 4
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.isSelected = False
     self.typeID = attributes.typeID
     self.invType = cfg.invtypes.Get(self.typeID)
     typeName = self.invType.name
     self.quantity = attributes.quantity
     self.stacksize = attributes.get('stacksize', None)
     self.itemState = attributes.get('itemState', None)
     singleton = attributes.get('singleton', 0)
     isBlueprint = cfg.invtypes.Get(self.typeID).categoryID == const.categoryBlueprint
     isCopy = isBlueprint and singleton == const.singletonBlueprintCopy
     self.stateIcon = None
     self.spriteCont = self.spriteCont = Container(name='spriteCont', parent=self, align=CENTER, width=ICON_SIZE, height=ICON_SIZE, state=uiconst.UI_PICKCHILDREN)
     self.icon = Icon(name=typeName, parent=self.spriteCont, width=ICON_SIZE, height=ICON_SIZE, align=CENTER, state=uiconst.UI_DISABLED, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT)
     self.icon.LoadIconByTypeID(typeID=self.typeID, ignoreSize=True, isCopy=isCopy)
     self.hint = typeName
     self.techIcon = Sprite(name='techIcon', parent=self.spriteCont, width=16, height=16, idx=0, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT)
     uix.GetTechLevelIcon(self.techIcon, 0, self.typeID)
     if self.itemState:
         resPath, stateColor = self.GetStateResPathAndColor(self.itemState)
         self.stateIcon = Sprite(name='stateIcon', parent=self.spriteCont, width=32, height=32, idx=0, left=-4, top=-4, align=uiconst.TOPRIGHT, texturePath=resPath, color=stateColor, state=uiconst.UI_DISABLED)
     self.entryHilite = Sprite(name='hilite', align=uiconst.TOALL, parent=self.spriteCont, texturePath='res:/UI/Texture/classes/InvItem/bgHover.png', blendMode=trinity.TR2_SBM_ADD, opacity=0.0, idx=0, state=uiconst.UI_DISABLED)
     self.entryHilite.hint = typeName
     self.quantityParent = Container(parent=self, idx=0, name='qtyCont', pos=(3, 38, 32, 11), align=uiconst.TOPRIGHT, bgColor=(0, 0, 0, 0.95), state=uiconst.UI_HIDDEN)
     self.qtyLabel = Label(parent=self.quantityParent, left=2, maxLines=1, fontsize=9)
     self._SetQtyText()
 def LoadInfo(self, killer):
     self.killerCont.Flush()
     self.shipCont.Flush()
     self.weaponCont.Flush()
     self.allianceLabel.text = ''
     self.damageLabel.text = ''
     nameHint = ''
     killerLogo = uiprimitives.Sprite(parent=self.killerCont, align=uiconst.TOALL, idx=0, texturePath='res:/UI/Texture/silhouette_64.png')
     if killer.killerID:
         sm.GetService('photo').GetPortrait(killer.killerID, 64, killerLogo)
         killerLogo.OnClick = (self.ShowInfo, killer.killerID, inventoryConst.typeCharacterAmarr)
         killerLogo.hint = cfg.eveowners.Get(killer.killerID).name
     if killer.killerShipTypeID:
         shipLogo = uicontrols.Icon(parent=self.shipCont, align=uiconst.TOPRIGHT, size=32, typeID=killer.killerShipTypeID, ignoreSize=True)
         shipLogo.OnClick = (self.ShowInfo, None, killer.killerShipTypeID)
         shipTechIcon = uiprimitives.Sprite(name='techIcon', parent=self.shipCont, width=12, height=12, idx=0)
         shipTechSprite = uix.GetTechLevelIcon(shipTechIcon, 0, killer.killerShipTypeID)
         if shipTechSprite:
             shipTechSprite.SetSize(12, 12)
         shipLogo.hint = cfg.invtypes.Get(killer.killerShipTypeID).typeName
     if killer.killerWeaponTypeID:
         weaponLogo = uicontrols.Icon(parent=self.weaponCont, align=uiconst.TOPRIGHT, size=32, typeID=killer.killerWeaponTypeID, ignoreSize=True)
         weaponLogo.OnClick = (self.ShowInfo, None, killer.killerWeaponTypeID)
         techIcon = uiprimitives.Sprite(name='techIcon', parent=self.weaponCont, width=12, height=12, idx=0)
         techSprite = uix.GetTechLevelIcon(techIcon, 0, killer.killerWeaponTypeID)
         if techSprite:
             techSprite.SetSize(12, 12)
         self.damageLabel.text = localization.GetByLabel('UI/Corporations/Wars/Killmails/DamageDone', damage=killer.killerDamageDone, percentage=killer.percentage)
         weaponLogo.hint = '%s<br>%s' % (cfg.invtypes.Get(killer.killerWeaponTypeID).typeName, self.damageLabel.text)
     if killer.killerID:
         self.nameLabel.text = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=cfg.eveowners.Get(killer.killerID).name, info=('showinfo', inventoryConst.typeCharacterAmarr, killer.killerID))
         nameHint = '%s<br>%s' % (cfg.eveowners.Get(killer.killerID).name, cfg.eveowners.Get(killer.killerCorporationID).name)
     else:
         self.nameLabel.text = cfg.invtypes.Get(killer.killerShipTypeID).typeName
     self.corpLabel.text = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=cfg.eveowners.Get(killer.killerCorporationID).name, info=('showinfo', inventoryConst.typeCorporation, killer.killerCorporationID))
     if killer.killerAllianceID:
         self.allianceLabel.text = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=cfg.eveowners.Get(killer.killerAllianceID).name, info=('showinfo', inventoryConst.typeAlliance, killer.killerAllianceID))
         nameHint += '<br>%s' % cfg.eveowners.Get(killer.killerAllianceID).name
     elif killer.killerFactionID:
         self.allianceLabel.text = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=cfg.eveowners.Get(killer.killerFactionID).name, info=('showinfo', inventoryConst.typeFaction, killer.killerFactionID))
         nameHint += '<br>%s' % cfg.eveowners.Get(killer.killerFactionID).name
     killerLogo.hint = nameHint
Esempio n. 6
0
 def Load(self, node):
     Group.Load(self, node)
     typeID = node.typeID
     self.sr.icon.LoadIconByTypeID(typeID=typeID,
                                   size=self.iconSize,
                                   ignoreSize=True,
                                   isCopy=False)
     self.sr.icon.SetSize(self.iconSize, self.iconSize)
     techSprite = uix.GetTechLevelIcon(self.techIcon, 1, typeID)
     self.techIcon.left = self.sr.icon.left
     self.sr.label.left = self.sr.icon.left + self.sr.icon.width + 4
Esempio n. 7
0
    def LoadTypeIcon(self, *args):
        attrs = self.attrs
        src = attrs.src
        typeID = None
        try:
            typeID = int(src[9:])
        except:
            log.LogInfo("couldn't convert string to typeID, looking up constvalue, Img::Load", src)
            typeID = util.LookupConstValue('type%s' % attrs.src[9:].strip().capitalize(), None)

        bumped = getattr(attrs, 'bumped', 0)
        showFitting = getattr(attrs, 'showfitting', 0)
        showTechLevel = getattr(attrs, 'showtechlevel', 0)
        isCopy = getattr(attrs, 'iscopy', 0)
        if not typeID:
            kw = htmlwriter.PythonizeArgs(src[9:])
            typeID = kw.get('typeID', None)
            bumped = kw.get('bumped', 0)
            isCopy = kw.get('isCopy', 0)
            showFitting = kw.get('showFitting', 0)
            showTechLevel = kw.get('showTechLevel', 0)
        if typeID:
            if bumped:
                if hasattr(self, 'icon') and self.icon:
                    self.icon.Close()
                self.icon = DraggableIcon(parent=self, typeID=typeID, isCopy=True if isCopy == 1 else False, state=uiconst.UI_DISABLED)
                if showFitting:
                    powerEffect = None
                    powerIcon = None
                    powerEffects = [const.effectHiPower, const.effectMedPower, const.effectLoPower]
                    for effect in cfg.dgmtypeeffects.get(typeID, []):
                        if effect.effectID in powerEffects:
                            powerEffect = cfg.dgmeffects.Get(effect.effectID, None)
                            powerIcon = {const.effectHiPower: 11,
                             const.effectMedPower: 10,
                             const.effectLoPower: 9}.get(powerEffect.effectID, None)
                            break

                    if powerIcon:
                        c = uiprimitives.Container(name='powericon', align=uiconst.BOTTOMRIGHT, parent=self.icon, width=attrs.width / 4, height=attrs.width / 4, idx=0)
                        uiprimitives.Line(parent=c, align=uiconst.TOLEFT, color=(1.0, 1.0, 1.0, 0.5))
                        uiprimitives.Line(parent=c, align=uiconst.TOTOP, color=(1.0, 1.0, 1.0, 0.5))
                        uiprimitives.Fill(parent=c, padRight=2, padBottom=2, color=(0.0, 0.0, 0.0, 1.0))
                        pwrIcon = uicontrols.Icon(icon='ui_8_64_%s' % powerIcon, parent=c, align=uiconst.TOALL, idx=0, hint=localization.GetByLabel('UI/Common/FitsToSlot', slotType=powerEffect.displayName), ignoreSize=True)
                if showTechLevel:
                    techSprite = uix.GetTechLevelIcon(None, 0, typeID)
                    if techSprite:
                        c = uiprimitives.Container(name='techIcon', align=uiconst.TOPLEFT, parent=self.icon, width=16, height=16, idx=0)
                        c.children.append(techSprite)
            else:
                uicontrols.Icon(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, pos=(0, 0, 0, 0), typeID=typeID, size=attrs.width, isCopy=isCopy)
        else:
            log.LogInfo('Couldnt convert', attrs.src[9:], 'to typeID')
Esempio n. 8
0
 def Load(self, node):
     self.sr.node = node
     c = node.contract
     numJumps = node.numJumps
     self.sr.node.contractID = c.contractID
     self.sr.node.solarSystemID = c.startSolarSystemID
     self.sr.node.name = name = GetContractTitle(c, node.contractItems)
     if prefs.GetValue('contractsSimpleView', 0):
         self.sr.icon.state = uiconst.UI_HIDDEN
         self.sr.contractIconParent.width = 6
     else:
         self.sr.icon.state = uiconst.UI_DISABLED
         self.sr.contractIconParent.width = self.iconSize + 5
     label = '<color=0xFFFFA600>%s</color>' % name
     if len(node.contractItems) == 1:
         item = node.contractItems[0]
         group = cfg.invtypes.Get(item.itemTypeID).Group()
         if group.categoryID == const.categoryBlueprint:
             if item.copy:
                 label += ' (%s)' % localization.GetByLabel('UI/Generic/Copy').lower()
             else:
                 label += ' (%s)' % localization.GetByLabel('UI/Generic/Original').lower()
     if c.type == const.conTypeAuction:
         label += ' (%s)' % localization.GetByLabel('UI/Contracts/Auction').lower()
     self.sr.contractLabel.SetText(label)
     if c.type in [const.conTypeAuction, const.conTypeItemExchange] and len(node.contractItems) == 1:
         typeID = node.contractItems[0].itemTypeID
         self.sr.icon.LoadIconByTypeID(typeID=typeID, size=32, ignoreSize=True, isCopy=getattr(node.contractItems[0], 'copy', False))
         if self.sr.icon.state != uiconst.UI_HIDDEN:
             uix.GetTechLevelIcon(self.sr.techIcon, 1, typeID)
     else:
         self.sr.icon.LoadIcon(GetContractIcon(node.contract.type), ignoreSize=True)
         self.sr.techIcon.state = uiconst.UI_HIDDEN
     numJumpsTxt = ''
     if numJumps == 0:
         if c.startStationID == session.stationid:
             numJumpsTxt = localization.GetByLabel('UI/Generic/CurrentStation')
         elif c.startSolarSystemID == session.solarsystemid2:
             numJumpsTxt = localization.GetByLabel('UI/Generic/CurrentSystem')
     elif numJumps == 1:
         numJumpsTxt = localization.GetByLabel('UI/Contracts/OneJumpAway')
     else:
         numJumpsTxt = localization.GetByLabel('UI/Contracts/ContractEntry/NumJumpsAway', numJumps=numJumps)
     if int(node.numJumps) > cc.NUMJUMPS_UNREACHABLE:
         numJumpsTxt = '<color=0xffff6666>%s</color>' % localization.GetByLabel('UI/Generic/Unreachable').upper()
     self.sr.jumpsLabel.SetText(numJumpsTxt)
     self.sr.timeLeftLabel.SetText(GetContractTimeLeftText(c))
     self.SetHint(node, label)
     if self.sr.Get('selection', None):
         self.sr.selection.state = uiconst.UI_HIDDEN
Esempio n. 9
0
 def LoadWindow(self, fitting, qty=1):
     self.fitting = fitting
     self.shipCounter.missingDict = {}
     self.equipmentCounter.missingDict = {}
     shipTypeID = fitting.shipTypeID
     self.shipIcon.LoadIconByTypeID(shipTypeID)
     uix.GetTechLevelIcon(self.techSprite, typeID=shipTypeID)
     self.numToFitEdit.text = qty
     self.fitNameEdit.SetValue(fitting.name)
     self.shipNameLabel.text = GetShowInfoLink(shipTypeID,
                                               evetypes.GetName(shipTypeID))
     self.SetInventoryStatus()
     self.missingLayoutGrid.RefreshGridLayout()
     self.layoutGrid.RefreshGridLayout()
     layoutWidth, layoutHeight = self.layoutGrid.GetSize()
     newHeight = layoutHeight + self.fitBtn.height + self.progressCont.height + self.sr.topParent.height + 20
     self.height = max(newHeight, self.default_height)
     self.width = max(layoutWidth + 20, self.default_width)
Esempio n. 10
0
 def Load(self, node):
     listentry.Generic.Load(self, node)
     self.sr.node = node
     data = node
     if node.indented:
         self.itemCont.padLeft = 16
     self.sr.node.typeID = int(node.typeID)
     self.typeID = int(data.typeID)
     qtyDestroyed = data.qtyDestroyed
     qtyDropped = data.qtyDropped
     singleton = data.singleton
     flag = data.flag
     typeName = cfg.invtypes.Get(self.typeID).typeName
     isCopy = False
     categoryID = cfg.invtypes.Get(self.typeID).categoryID
     if categoryID == inventoryConst.categoryBlueprint:
         self.sr.icon.top = 0
         if singleton == singletonBlueprintCopy:
             isCopy = True
             typeName += ' (%s)' % localization.GetByLabel('UI/Generic/Copy').lower()
         else:
             typeName += ' (%s)' % localization.GetByLabel('UI/Generic/Original').lower()
     self.sr.label.text = typeName
     if qtyDropped > 0:
         self.bgColor.state = uiconst.UI_DISABLED
         self.sr.qtyLabel.text = util.FmtAmt(qtyDropped)
     else:
         self.bgColor = uiconst.UI_HIDDEN
         self.sr.qtyLabel.text = util.FmtAmt(qtyDestroyed)
     self.sr.techIcon.state = uiconst.UI_HIDDEN
     if self.typeID:
         self.sr.icon.state = uiconst.UI_NORMAL
         if flag == inventoryConst.flagImplant:
             self.sr.icon.LoadIcon(cfg.invtypes.Get(self.typeID).iconID, ignoreSize=True)
         else:
             self.sr.icon.LoadIconByTypeID(typeID=self.typeID, size=24, ignoreSize=True, isCopy=isCopy)
         self.sr.icon.SetSize(24, 24)
         self.sr.label.left = self.height + 16
         techSprite = uix.GetTechLevelIcon(self.sr.techIcon, 1, self.typeID)
         techSprite.SetSize(12, 12)
Esempio n. 11
0
    def DisplayInfo(self):
        uix.GetTechLevelIcon(self.techIcon, 0, self.victimShipTypeID)
        self.shipIcon.LoadIconByTypeID(typeID=self.victimShipTypeID)
        self.shipIcon.typeID = self.victimShipTypeID
        self.shipIcon.hint = cfg.invtypes.Get(self.victimShipTypeID).typeName
        if self.attackerKill:
            color = ATTACKER_COLOR
        else:
            color = DEFENDER_COLOR
        self.shipFrame.color = color
        try:
            victimName = cfg.eveowners.Get(self.victimCharacterID).name
            victimInfo = ('showinfo', const.typeCharacterGallente, self.victimCharacterID)
        except:
            victimName = cfg.invtypes.Get(self.victimShipTypeID).typeName
            victimInfo = ('showinfo', self.victimShipTypeID)

        victimCorp = cfg.eveowners.Get(self.victimCorporationID).name
        victimCorpInfo = ('showinfo', const.typeCorporation, self.victimCorporationID)
        if self.victimAllianceID:
            victimAlliance = cfg.eveowners.Get(self.victimAllianceID).name
            victimAllianceInfo = ('showinfo', const.typeAlliance, self.victimAllianceID)
            victimLabel = localization.GetByLabel('UI/Corporations/Wars/KillVictimInAlliance', victimName=victimName, victimInfo=victimInfo, victimCorp=victimCorp, victimCorpInfo=victimCorpInfo, victimAlliance=victimAlliance, victimAllianceInfo=victimAllianceInfo)
        else:
            victimLabel = localization.GetByLabel('UI/Corporations/Wars/KillVictim', victimName=victimName, victimInfo=victimInfo, victimCorp=victimCorp, victimCorpInfo=victimCorpInfo)
        self.victimLabel.text = victimLabel
        killerName = cfg.eveowners.Get(self.finalCharacterID).name
        killerInfo = ('showinfo', const.typeCharacterGallente, self.finalCharacterID)
        killerCorp = cfg.eveowners.Get(self.finalCorporationID).name
        killerCorpInfo = ('showinfo', const.typeCorporation, self.finalCorporationID)
        if self.finalAllianceID:
            killerAlliance = cfg.eveowners.Get(self.finalAllianceID).name
            killerAllianceInfo = ('showinfo', const.typeAlliance, self.finalAllianceID)
            killerLabel = localization.GetByLabel('UI/Corporations/Wars/KillKillerInAlliance', killerName=killerName, killerInfo=killerInfo, killerCorp=killerCorp, killerCorpInfo=killerCorpInfo, killerAlliance=killerAlliance, killerAllianceInfo=killerAllianceInfo)
        else:
            killerLabel = localization.GetByLabel('UI/Corporations/Wars/KillKiller', killerName=killerName, killerInfo=killerInfo, killerCorp=killerCorp, killerCorpInfo=killerCorpInfo)
        self.killerLabel.text = killerLabel
        self.dateLabel.text = util.FmtDate(self.killTime, 'ns')
Esempio n. 12
0
    def Draw(self):
        self.sr.main.Flush()
        uiprimitives.Container(name='push', parent=self.sr.main, align=uiconst.TOTOP, height=6)
        topParent = uiprimitives.Container(parent=self.sr.main, align=uiconst.TOTOP, height=80)
        topLeftParent = uiprimitives.Container(parent=topParent, align=uiconst.TOLEFT, width=70)
        topRightParent = uiprimitives.Container(parent=topParent, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        bottomParent = uiprimitives.Container(parent=self.sr.main, align=uiconst.TOALL, pos=(0, 0, 0, 0))
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOTOP, height=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOBOTTOM, height=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TOLEFT, width=const.defaultPadding)
        uiprimitives.Container(name='push', parent=bottomParent, align=uiconst.TORIGHT, width=const.defaultPadding)
        self.sr.shipIcon = uicontrols.Icon(parent=topParent, state=uiconst.UI_HIDDEN, size=64, left=const.defaultPadding, typeID=self.fitting.shipTypeID, ignoreSize=True)
        self.sr.techicon = uiprimitives.Sprite(name='techIcon', parent=topParent, align=uiconst.RELATIVE, left=const.defaultPadding, width=16, height=16, idx=0)
        uix.GetTechLevelIcon(self.sr.techicon, 0, self.fitting.shipTypeID)
        dragIcon = FittingDraggableIcon(name='theicon', align=uiconst.TOPLEFT, parent=topParent, height=64, width=64, top=const.defaultPadding, left=const.defaultPadding)
        dragIcon.Startup(self.fitting)
        dragIcon.hint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/FittingIconHint')
        dragIcon.OnClick = self.ClickDragIcon
        dragIcon.state = uiconst.UI_NORMAL
        self.sr.shipIcon.state = uiconst.UI_DISABLED
        fittingNameContainer = uiprimitives.Container(parent=topRightParent, align=uiconst.TOTOP, height=20)
        self.sr.fittingName = uicontrols.SinglelineEdit(name='fittingName', parent=fittingNameContainer, align=uiconst.TOPLEFT, pos=(const.defaultPadding,
         1,
         160,
         0), maxLength=40)
        self.sr.fittingName.SetText(self.fitting.name)
        if self.truncated:
            uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Truncated'), parent=fittingNameContainer, left=self.sr.fittingName.width + 10, top=3, width=60, height=20, state=uiconst.UI_NORMAL)
        shipInfoContainer = uiprimitives.Container(parent=topRightParent, align=uiconst.TOTOP, height=20)
        shipName = cfg.invtypes.Get(self.fitting.shipTypeID).typeName
        self.sr.shipName = uicontrols.EveLabelMedium(text=shipName, parent=shipInfoContainer, align=uiconst.RELATIVE, state=uiconst.UI_NORMAL, left=const.defaultPadding)
        self.sr.infoicon = InfoIcon(parent=shipInfoContainer, left=1, top=0, idx=0)
        self.sr.infoicon.OnClick = self.ShowInfo
        self.sr.infoicon.left = self.sr.shipName.textwidth + 6
        self.sr.radioButton = uiprimitives.Container(name='', parent=topRightParent, align=uiconst.TOPLEFT, height=50, width=100, top=fittingNameContainer.height + shipInfoContainer.height)
        radioBtns = []
        for cfgname, value, label, checked, group in [['fittingNone',
          session.charid,
          localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Personal'),
          True,
          'ownership'], ['fittingOwnerCorporation',
          session.corpid,
          localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Corporation'),
          False,
          'ownership']]:
            radioBtns.append(uicontrols.Checkbox(text=label, parent=self.sr.radioButton, configName=cfgname, retval=value, checked=checked, groupname=group, callback=None))

        self.sr.radioButtons = radioBtns
        self.sr.fittingDescription = uicls.EditPlainText(parent=bottomParent, align=uiconst.TOALL, maxLength=400)
        self.sr.fittingDescription.SetText(self.fitting.description)
        self.sr.fittingInfo = uicontrols.Scroll(name='fittingInfoScroll', parent=bottomParent)
        scrolllist = self.fittingSvc.GetFittingInfoScrollList(self.fitting)
        self.sr.fittingInfo.Load(contentList=scrolllist)
        tabs = [[localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/Fittings'),
          self.sr.fittingInfo,
          self,
          None,
          self.sr.fittingInfo], [localization.GetByLabel('UI/Common/Description'),
          self.sr.fittingDescription,
          self,
          None,
          self.sr.fittingDescription]]
        self.fittingInfoTab = uicontrols.TabGroup(name='tabparent', parent=bottomParent, idx=0)
        self.fittingInfoTab.Startup(tabs, 'fittingInfoTab')
        saveDeleteButtons = FlowContainer(name='buttonParent', parent=self.sr.main, align=uiconst.TOBOTTOM, padding=6, autoHeight=True, centerContent=True, contentSpacing=uiconst.BUTTONGROUPMARGIN, idx=0)
        self.saveBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Common/Buttons/Save'), func=self.Save, align=uiconst.NOALIGN)
        if boot.region != 'optic':
            self.exportBtn = Button(parent=saveDeleteButtons, label=localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ExportToClipboard'), func=self.ExportFittingToClipboard, align=uiconst.NOALIGN)
            self.exportBtn.hint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/ExportToClipboardHint')
Esempio n. 13
0
 def LoadTechLevelIcon(self, typeID=None):
     tlicon = uix.GetTechLevelIcon(self.sr.tlicon, 0, typeID)
     if tlicon is not None and util.GetAttrs(tlicon, 'parent') is None:
         self.sr.tlicon = tlicon
         tlicon.SetParent(self, 0)
Esempio n. 14
0
    def DoRenderTypes(self, sz, blueprintCopy=False):
        folderLabel = 'Types' if not blueprintCopy else 'BPCs'
        filePath = blue.win32.SHGetFolderPath(
            blue.win32.CSIDL_PERSONAL
        ) + '/EVE/capture/Screenshots/%s/' % folderLabel
        dr = DirectoryRoutines()
        dr.GenericCheckCreateDirectory(filePath)
        CSAA_FMT = trinity.TRIMULTISAMPLE_NONE
        CSAA_QTY = 0
        baseTexture = trinity.Tr2RenderTarget(
            sz, sz, 1, trinity.PIXEL_FORMAT.B8G8R8A8_UNORM, CSAA_FMT, CSAA_QTY)
        renderJob = trinity.CreateRenderJob()
        desktop = uicls.UIRoot(name='WebTools',
                               width=sz,
                               height=sz,
                               renderTarget=baseTexture,
                               renderJob=renderJob,
                               clearBackground=True)
        desktop.backgroundColor = (0, 0, 0, 0)
        toRender = []
        godma = sm.GetService('godma')
        BAD_TYPES = (29494, 29193)
        if not blueprintCopy:
            for t in cfg.invtypes:
                if (t.graphicID or t.iconID
                        or t.categoryID == const.categoryBlueprint
                    ) and t.typeID not in BAD_TYPES:
                    toRender.append(t.typeID)

        else:
            for t in cfg.invtypes:
                if t.categoryID == const.categoryBlueprint and t.typeID not in BAD_TYPES:
                    toRender.append(t.typeID)

        toRender.sort()
        photoSvc = sm.GetService('photo')
        print 'Rendering out %s %s' % (len(toRender), 'types'
                                       if not blueprintCopy else 'BPCs')
        numSkipped = 0
        if blueprintCopy:
            fileName = 'bpc_%s_%s.png'
        else:
            fileName = '%s_%s.png'
        for counter, typeID in enumerate(toRender):
            try:
                name = filePath + fileName % (typeID, sz)
                if os.path.isfile(name):
                    numSkipped += 1
                    continue
                sys.stdout.write('.')
                desktop.Flush()
                icon = uicls.Icon(parent=desktop,
                                  pos=(0, 0, sz, sz),
                                  ignoreSize=True,
                                  state=uiconst.UI_DISABLED,
                                  idx=1)
                techIcon = uicls.Icon(parent=desktop,
                                      pos=(0, 0, 16, 16),
                                      align=uiconst.TOPLEFT,
                                      state=uiconst.UI_NORMAL,
                                      idx=0)
                icon.LoadIconByTypeID(typeID,
                                      ignoreSize=True,
                                      isCopy=blueprintCopy)
                icon.SetSize(sz, sz)
                uix.GetTechLevelIcon(techIcon, 1, typeID)
                blue.resMan.Wait()
                i = 0
                while photoSvc.byTypeID_IsRunning:
                    if i > 20:
                        print 'waited for photoservice for a long time... %s' % i
                    blue.pyos.synchro.SleepWallclock(50)
                    i += 1

                desktop.UpdateAlignmentAsRoot()
                renderJob.ScheduleOnce()
                renderJob.WaitForFinish()
                blue.pyos.synchro.Yield()
                trinity.SaveRenderTarget(name, baseTexture)
                if counter % 100 == 0:
                    msg = 'Rendering %sx%s icons: %s / %s' % (sz, sz, counter,
                                                              len(toRender))
                    print '\n', msg
                    eve.Message('CustomNotify', {'notify': msg})
            except:
                log.LogException('Exception rendering type %s' % typeID)
                continue

        desktop.Close()
        msg = 'Done rendering out type icons in size %sx%s to folder %s.<br>Rendered %s types and skipped %s types' % (
            sz, sz, filePath, len(toRender) - numSkipped, numSkipped)
        Msg(msg)
Esempio n. 15
0
 def LoadInfo_thread(self, killmail):
     self.guyCont.Flush()
     self.shipCont.Flush()
     self.victimAllianceLogoCont.Flush()
     self.victimCorpLogoCont.Flush()
     self.rawKillmail = killmail
     self.killmail = self.FormatKillMail(killmail)
     killmail = self.killmail
     self.attackers, self.items = util.GetKillMailInfo(self.rawKillmail)
     isCapsule = cfg.invtypes.Get(killmail.victimShipTypeID).groupID == inventoryConst.groupCapsule
     isShip = cfg.invtypes.Get(killmail.victimShipTypeID).categoryID == inventoryConst.categoryShip
     if len(self.items) and isShip and not isCapsule:
         self.savefittingBtn.display = True
     else:
         self.savefittingBtn.display = False
     if util.IsCharacter(killmail.victimCharacterID):
         victim = uicontrols.Icon(parent=self.guyCont, align=uiconst.TOPRIGHT, size=128, idx=0)
         sm.GetService('photo').GetPortrait(killmail.victimCharacterID, 128, victim)
         victim.OnClick = (self.OpenPortrait, killmail.victimCharacterID)
         victimHint = cfg.eveowners.Get(killmail.victimCharacterID).name
         dragHint = localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/FittingIconHint')
     else:
         victim = uiutil.GetLogoIcon(itemID=killmail.victimCorporationID, parent=self.guyCont, acceptNone=False, align=uiconst.TOPRIGHT, height=128, width=128, state=uiconst.UI_NORMAL)
         victim.OnClick = (self.ShowInfo, killmail.victimCorporationID, inventoryConst.typeCorporation)
         victimHint = cfg.eveowners.Get(killmail.victimCorporationID).name
         dragHint = localization.GetByLabel('UI/Corporations/Wars/DragToShare')
     victim.GetDragData = self.GetKillDragData
     victim.hint = '%s<br>%s' % (victimHint, dragHint)
     ship = uicontrols.Icon(parent=self.shipCont, align=uiconst.TOPRIGHT, size=128, typeID=killmail.victimShipTypeID)
     ship.OnClick = (self.OpenPreview, killmail.victimShipTypeID)
     ship.GetDragData = self.GetKillDragData
     shipTechIcon = uiprimitives.Sprite(name='techIcon', parent=self.shipCont, width=16, height=16, idx=0)
     uix.GetTechLevelIcon(shipTechIcon, 0, killmail.victimShipTypeID)
     ship.hint = '%s<br>%s' % (cfg.invtypes.Get(killmail.victimShipTypeID).typeName, localization.GetByLabel('UI/Fitting/FittingWindow/FittingManagement/FittingIconHint'))
     victimCorpName = cfg.eveowners.Get(killmail.victimCorporationID).name
     victimCorpLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=victimCorpName, info=('showinfo', inventoryConst.typeCorporation, killmail.victimCorporationID))
     self.victimCorpName.text = victimCorpLabel
     victimCorpLogo = uiutil.GetLogoIcon(itemID=killmail.victimCorporationID, parent=self.victimCorpLogoCont, acceptNone=False, align=uiconst.TOPRIGHT, height=32, width=32, state=uiconst.UI_NORMAL)
     victimCorpLogo.OnClick = (self.ShowInfo, killmail.victimCorporationID, inventoryConst.typeCorporation)
     victimCorpLogo.hint = victimCorpName
     victimCorpLogo.SetSize(32, 32)
     victimCorpNameTop = defaultPadding * 2
     if killmail.victimAllianceID:
         victimAllianceName = cfg.eveowners.Get(killmail.victimAllianceID).name
         victimAllianceLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=victimAllianceName, info=('showinfo', inventoryConst.typeAlliance, killmail.victimAllianceID))
         self.victimAllianceName.text = victimAllianceLabel
         victimAllianceLogo = uiutil.GetLogoIcon(itemID=killmail.victimAllianceID, parent=self.victimAllianceLogoCont, acceptNone=False, align=uiconst.TOPRIGHT, height=32, width=32)
         victimAllianceLogo.OnClick = (self.ShowInfo, killmail.victimAllianceID, inventoryConst.typeAlliance)
         victimAllianceLogo.hint = victimAllianceName
         victimCorpNameTop = 0
     elif killmail.victimFactionID:
         victimFactionName = cfg.eveowners.Get(killmail.victimFactionID).name
         victimFactionLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=victimFactionName, info=('showinfo', inventoryConst.typeFaction, killmail.victimFactionID))
         self.victimAllianceName.text = victimFactionLabel
         victimAllianceLogo = uiutil.GetLogoIcon(itemID=killmail.victimFactionID, parent=self.victimAllianceLogoCont, acceptNone=False, align=uiconst.TOPRIGHT, height=32, width=32)
         victimAllianceLogo.OnClick = (self.ShowInfo, killmail.victimFactionID, inventoryConst.typeFaction)
         victimAllianceLogo.hint = victimFactionName
         victimAllianceLogo.SetSize(32, 32)
         victimCorpNameTop = 0
     else:
         self.victimAllianceName.text = ''
         victimAllianceLogo = uiprimitives.Sprite(texturePath='res:/UI/Texture/defaultAlliance.dds', parent=self.victimAllianceLogoCont, align=uiconst.TOPLEFT, width=32, height=32, state=uiconst.UI_NORMAL)
         victimAllianceLogo.hint = localization.GetByLabel('UI/PeopleAndPlaces/OwnerNotInAnyAlliance', corpName=victimCorpName)
         victimAllianceLogo.SetAlpha(0.2)
     self.victimCorpName.top = victimCorpNameTop
     self.killDate.text = util.FmtDate(killmail.killTime, 'ss')
     self.locationName.text = self.GetLocation(killmail.solarSystemID)
     shipType = cfg.invtypes.Get(killmail.victimShipTypeID)
     shipName = shipType.typeName
     shipGroupID = shipType.groupID
     shipGroupName = cfg.invgroups.Get(shipGroupID).groupName
     shipLabel = localization.GetByLabel('UI/Corporations/Wars/Killmails/ShipInfo', showInfoName=shipName, info=('showinfo', killmail.victimShipTypeID), groupName=shipGroupName)
     if util.IsCharacter(killmail.victimCharacterID):
         victimName = cfg.eveowners.Get(killmail.victimCharacterID).name
         victimNameLabel = localization.GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=victimName, info=('showinfo', inventoryConst.typeCharacterAmarr, killmail.victimCharacterID))
         self.victimName.text = victimNameLabel
         self.shipName.text = shipLabel
     else:
         self.victimName.text = shipLabel
         self.shipName.text = ''
     self.damageTaken.text = localization.GetByLabel('UI/Corporations/Wars/Killmails/TotalDamage', damage=killmail.victimDamageTaken)
     if killmail.iskLost:
         worthText = util.FmtISK(killmail.iskLost, 0)
     else:
         worthText = localization.GetByLabel('UI/Common/Unknown')
     self.totalWorthLabel.text = worthText
     if self.rawKillmail.iskDestroyed is not None:
         lossText = util.FmtISK(self.rawKillmail.iskDestroyed, 0)
     else:
         lossText = localization.GetByLabel('UI/Common/Unknown')
     self.pendLabel.text = lossText
     if self.rawKillmail.bountyClaimed:
         bountyText = util.FmtISK(self.rawKillmail.bountyClaimed, 0)
         self.totalBountyLabel.text = bountyText
         self.bountyCont.display = True
     else:
         bountyText = None
         self.bountyCont.display = False
     if self.rawKillmail.loyaltyPoints is not None and self.rawKillmail.loyaltyPoints > 0:
         LPText = localization.GetByLabel('UI/LPStore/AmountLP', lpAmount=util.FmtAmt(self.rawKillmail.loyaltyPoints, showFraction=0))
         self.totalLPLabel.text = LPText
         self.lpCont.display = True
     else:
         LPText = None
         self.lpCont.display = False
     if bountyText is None and LPText is None:
         self.totalPayoutCont.display = False
     else:
         self.totalPayoutCont.display = True
     self._LoadItemsToScrollPanel(self.itemsScroll, self.GetItems())
     self.GetAttackers()
     self.DrawKillers()
     isKilledOnBehalf = False
     self.IsKilledOnBehalf(isKilledOnBehalf)