Ejemplo n.º 1
0
    def SetHint(self, node, label):
        self.sr.node = node
        c = node.contract
        privateTxt = '<font size=10 color=red> %s</font>' % localization.GetByLabel(
            'UI/Contracts/ContractEntry/PrivateProperty')
        hintList = []
        boldLabel = localization.GetByLabel(
            'UI/Contracts/ContractsService/BoldGenericLabel', labelText=label)
        hintList.append(boldLabel)
        hintLine = localization.GetByLabel(
            'UI/Contracts/ContractEntry/ContractTypeWithType',
            contractType=GetContractTypeText(c.type))
        hintList.append(hintLine)
        hintLine = localization.GetByLabel(
            'UI/Contracts/ContractEntry/ContractLocation',
            location=c.startSolarSystemID,
            numJumpsInfo=node.numJumps)
        if not util.IsStation(c.startStationID):
            hintLine += privateTxt
        if c.type == const.conTypeCourier and not util.IsStation(
                c.endStationID):
            hintLine += '<br>' + localization.GetByLabel(
                'UI/Contracts/ContractEntry/DropOffStation') + privateTxt
        hintList.append(hintLine)
        if c.forCorp:
            issuerID = c.issuerCorpID
        else:
            issuerID = c.issuerID
        issuer = cfg.eveowners.Get(issuerID)
        hintLine = localization.GetByLabel(
            'UI/Contracts/ContractEntry/IssuerWithName',
            issuerName=issuer.name)
        hintList.append(hintLine)
        if c.type in [const.conTypeAuction, const.conTypeItemExchange
                      ] and len(node.contractItems) > 0:
            itemList = []
            itemReqList = []
            numItems = 0
            numItemsReq = 0
            for e in node.contractItems:
                if e.inCrate:
                    itemInfo = cfg.FormatConvert(const.UE_TYPEIDANDQUANTITY,
                                                 e.itemTypeID,
                                                 max(1, e.quantity))
                    itemList.append(itemInfo)
                    numItems += 1
                else:
                    itemReqInfo = cfg.FormatConvert(const.UE_TYPEIDANDQUANTITY,
                                                    e.itemTypeID,
                                                    max(1, e.quantity))
                    itemReqList.append(itemReqInfo)
                    numItemsReq += 1

            if len(itemList) >= 2:
                itemList.append(
                    localization.GetByLabel('UI/Common/MoreWithTrailing'))
            if len(itemReqList) >= 2:
                itemReqList.append(
                    localization.GetByLabel('UI/Common/MoreWithTrailing'))
            if len(itemList) == 0:
                itemList.append(
                    localization.GetByLabel(
                        'UI/Contracts/ContractEntry/NoneParen'))
            itemsString = localization.formatters.FormatGenericList(itemList)
            strItems = localization.GetByLabel(
                'UI/Contracts/ContractEntry/ItemsWithItemList',
                itemsString=itemsString)
            hintList.append(strItems)
            if len(itemReqList) > 0:
                reqItemsString = localization.formatters.FormatGenericList(
                    itemReqList)
                itemsReq = localization.GetByLabel(
                    'UI/Contracts/ContractEntry/ItemsRequiredWithItemList',
                    reqItemsString=reqItemsString)
                hintList.append(itemsReq)
            if len(itemList) >= 2 or len(itemReqList) >= 2:
                hintList.append(
                    localization.GetByLabel(
                        'UI/Contracts/ContractEntry/OpenForItems'))
        if c.title != '':
            hintLine = localization.GetByLabel(
                'UI/Contracts/ContractEntry/IssuerDescriptionWithDescription',
                description=c.title)
            hintList.append(hintLine)
        newHint = '<br>'.join(hintList)
        self.hint = newHint
Ejemplo n.º 2
0
    def Load(self, node):
        self.sr.node = node
        c = node.contract
        self.sr.node.contractID = c.contractID
        self.sr.node.solarSystemID = c.startSolarSystemID
        items = node.contractItems
        issuerID = [c.issuerID, c.issuerCorpID][not not c.forCorp]
        fromName = cfg.eveowners.Get(issuerID).ownerName
        if c.acceptorID:
            toID = c.acceptorID
        else:
            toID = c.assigneeID
        if toID == 0:
            toName = localization.GetByLabel(
                'UI/Contracts/ContractEntry/NoneParen')
        else:
            toName = cfg.eveowners.Get(toID).ownerName
        name = GetContractTitle(c, items)
        if not node.Get('callerdefined', False):
            node.label = '%s<t>%s<t>%s<t>%s%s' % (
                name, GetContractTypeText(c.type), fromName, toName,
                node.Get('additionalColumns', ''))
        self.sr.label.text = self.sr.node.label = node.label
        self.OnSelectCallback = node.Get('callback', None)
        if node.Get('selected', 0):
            self.Select()
        else:
            self.Deselect()
        self.state = uiconst.UI_NORMAL
        self.sr.claiming = 0
        self.sr.node.name = name
        self.hint = ''
        jmps = None
        hintList = []
        if c.startSolarSystemID > 0:
            n = sm.GetService('clientPathfinderService').GetAutopilotJumpCount(
                session.solarsystemid2, c.startSolarSystemID)
            if c.startStationID in {
                    eve.session.stationid, eve.session.structureid
            }:
                jmps = localization.GetByLabel('UI/Generic/CurrentStation')
            elif c.startSolarSystemID == eve.session.solarsystemid2:
                jmps = localization.GetByLabel('UI/Generic/CurrentSystem')
            elif n == 1:
                jmps = localization.GetByLabel('UI/Contracts/OneJumpAway')
            else:
                jmps = localization.GetByLabel(
                    'UI/Contracts/ContractEntry/NumJumpsAway', numJumps=n)
        hintLine = localization.GetByLabel(
            'UI/Contracts/ContractEntry/ContractTypeWithType',
            contractType=GetContractTypeText(c.type))
        hintList.append(hintLine)
        if c.title != '':
            hintLine = localization.GetByLabel(
                'UI/Contracts/ContractEntry/IssuerDescriptionWithDescription',
                description=c.title)
            hintList.append(hintLine)
        if jmps:
            hintLine = localization.GetByLabel(
                'UI/Contracts/ContractEntry/ContractLocation',
                location=c.startSolarSystemID,
                numJumpsInfo=jmps)
        else:
            labelText = localization.GetByLabel(
                'UI/Contracts/ContractEntry/MenuLocation')
            hintLine = localization.GetByLabel(
                'UI/Contracts/ContractsService/BoldGenericLabel',
                labelText=labelText)
        hintList.append(hintLine)
        if c.type in [const.conTypeAuction, const.conTypeItemExchange
                      ] and len(items) > 0:
            itemList = []
            itemReqList = []
            numItems = 0
            numItemsReq = 0
            for e in items:
                if e.inCrate:
                    itemInfo = cfg.FormatConvert(const.UE_TYPEIDANDQUANTITY,
                                                 e.itemTypeID,
                                                 max(1, e.quantity))
                    itemList.append(itemInfo)
                    numItems += 1
                else:
                    itemReqInfo = cfg.FormatConvert(const.UE_TYPEIDANDQUANTITY,
                                                    e.itemTypeID,
                                                    max(1, e.quantity))
                    itemReqList.append(itemReqInfo)
                    numItemsReq += 1

            if len(itemList) >= 2:
                itemList.append(
                    localization.GetByLabel('UI/Common/MoreWithTrailing'))
            if len(itemReqList) >= 2:
                itemReqList.append(
                    localization.GetByLabel('UI/Common/MoreWithTrailing'))
            if len(itemList) == 0:
                itemList.append(
                    localization.GetByLabel(
                        'UI/Contracts/ContractEntry/NoneParen'))
            itemsString = localization.formatters.FormatGenericList(itemList)
            strItems = localization.GetByLabel(
                'UI/Contracts/ContractEntry/ItemsWithItemList',
                itemsString=itemsString)
            hintList.append(strItems)
            if len(itemReqList) > 0:
                reqItemsString = localization.formatters.FormatGenericList(
                    itemReqList)
                itemsReq = localization.GetByLabel(
                    'UI/Contracts/ContractEntry/ItemsRequiredWithItemList',
                    reqItemsString=reqItemsString)
                hintList.append(itemsReq)
            if len(itemList) >= 2 or len(itemReqList) >= 2:
                hintList.append(
                    localization.GetByLabel(
                        'UI/Contracts/ContractEntry/OpenForItems'))
            if c.assigneeID > 0:
                labelText = localization.GetByLabel(
                    'UI/Contracts/ContractEntry/PrivateContract')
                string = localization.GetByLabel(
                    'UI/Contracts/ContractsService/BoldGenericLabel',
                    labelText=labelText)
                hintList.append(string)
        newHint = '<br>'.join(hintList)
        self.hint = newHint