コード例 #1
0
ファイル: userentry.py プロジェクト: connoryang/1v1dec
 def PreLoad(node):
     data = node
     charinfo = data.Get('info', None) or cfg.eveowners.Get(data.charID)
     data.info = charinfo
     if data.GetLabel:
         data.label = data.GetLabel(data)
     elif not data.Get('label', None):
         label = charinfo.name
         if data.bounty:
             label += '<br>'
             label += localization.GetByLabel('UI/Common/BountyAmount',
                                              bountyAmount=util.FmtISK(
                                                  data.bounty.bounty, 0))
         elif data.killTime:
             label += '<br>' + localization.GetByLabel(
                 'UI/PeopleAndPlaces/ExpiresTime', expires=data.killTime)
         data.label = label
     groupID = evetypes.GetGroupID(data.info.typeID)
     data.invtype = data.info.typeID
     data.IsCharacter = groupID == const.groupCharacter
     data.IsCorporation = groupID == const.groupCorporation
     data.IsFaction = groupID == const.groupFaction
     data.IsAlliance = groupID == const.groupAlliance
     if data.IsCharacter and util.IsDustCharacter(data.charID):
         data.isDustCharacter = True
     if data.IsCorporation and not util.IsNPC(data.charID):
         logoData = cfg.corptickernames.Get(data.charID)
コード例 #2
0
 def Load(self, item, instanceRow):
     super(CharacterDogmaItem, self).Load(item, instanceRow)
     self.ownerID = self.itemID
     attrs = self.attributes
     char = self.dogmaLocation.GetCharacter(item.itemID, flush=True)
     if util.IsDustCharacter(item.itemID):
         attrs[const.attributeIntelligence] = 20
         attrs[const.attributeCharisma] = 20
         attrs[const.attributePerception] = 20
         attrs[const.attributeMemory] = 20
         attrs[const.attributeWillpower] = 20
         return
     attrs[const.attributeIntelligence] = char.intelligence
     attrs[const.attributeCharisma] = char.charisma
     attrs[const.attributePerception] = char.perception
     attrs[const.attributeMemory] = char.memory
     attrs[const.attributeWillpower] = char.willpower
コード例 #3
0
ファイル: evePhotosvc.py プロジェクト: connoryang/1v1dec
    def GetImage(self,
                 itemID,
                 size,
                 handler,
                 sprite=None,
                 orderIfMissing=True,
                 callback=None,
                 defaultIcon='res:/UI/Texture/notavailable.dds',
                 isAlliance=False):
        if uicore.desktop.dpiScaling > 1.0 and not isAlliance:
            size = size * 2
        if not isinstance(itemID, numbers.Integral):
            return defaultIcon
        if util.IsDustCharacter(itemID):
            try:
                character = cfg.eveowners.Get(itemID)
                path = const.dustCharacterPortraits[int(
                    character.gender)][evetypes.GetRaceID(character.typeID)]
                isFresh = True
            except KeyError:
                return defaultIcon

        else:
            path, isFresh = handler.GetCachedImage(itemID, size)
        if sprite is not None:
            sprite.LoadTexture(path or defaultIcon)
        if not isFresh and orderIfMissing and not handler.MissingFromServer(
                itemID):
            if (itemID, size, handler) in self.currentlyFetching:
                self.currentlyFetching[itemID, size,
                                       handler].append([sprite, callback])
            else:
                self.imageServerQueue[itemID, size,
                                      handler].append([sprite, callback])
            if len(
                    self.imageServerQueue
            ) > self.fetchingFromImageServer and self.fetchingFromImageServer < MAX_PORTRAIT_THREADS:
                self.fetchingFromImageServer += 1
                uthread.pool('photo::FetchRemoteImages',
                             self.__FetchFromImageServer)
        elif handler.MissingFromServer(itemID) and path is None:
            return defaultIcon
        if isFresh:
            return path
コード例 #4
0
def DeliverToCorpMember(invItems, invCacheSvc):
    if len(invItems) == 0:
        return
    CheckItemsInSamePlace(invItems)
    corpMemberIDs = sm.GetService('corp').GetMemberIDs()
    cfg.eveowners.Prime(corpMemberIDs)
    memberslist = []
    for memberID in corpMemberIDs:
        if util.IsDustCharacter(memberID):
            continue
        who = cfg.eveowners.Get(memberID)
        memberslist.append([who.ownerName, memberID, who.typeID])

    doSplit = uicore.uilib.Key(
        uiconst.VK_SHIFT) and len(invItems) == 1 and invItems[0].stacksize > 1
    stationID = invCacheSvc.GetStationIDOfItem(invItems[0])
    if stationID is None:
        raise UserError('CanOnlyDoInStations')
    ownerID = invItems[0].ownerID
    flagID = invItems[0].flagID
    itemIDs = [item.itemID for item in invItems]
    res = uix.ListWnd(
        memberslist, 'character',
        localization.GetByLabel('UI/Corporations/Common/SelectCorpMember'),
        localization.GetByLabel(
            'UI/Corporations/Common/SelectCorpMemberToDeliverTo'), 1)
    if res:
        corporationMemberID = res[1]
        qty = None
        if doSplit:
            invItem = invItems[0]
            ret = uix.QtyPopup(
                invItem.stacksize, 1, 1, None,
                localization.GetByLabel(
                    'UI/Inventory/ItemActions/DivideItemStack'))
            if ret is not None:
                qty = ret['qty']
        invCacheSvc.GetInventoryMgr().DeliverToCorpMember(
            corporationMemberID, stationID, itemIDs, qty, ownerID, flagID)
        InvalidateItemLocation(ownerID, stationID, flagID, invCacheSvc)
        if ownerID == session.corpid:
            sm.ScatterEvent('OnCorpAssetChange', invItems, stationID)
コード例 #5
0
ファイル: treeData.py プロジェクト: connoryang/1v1dec
    def GetChildren(self):
        if self._children:
            return self._children
        data = []
        maxNumPerLevel = 50
        numMembers = len(self.memberData)
        if not self.groupChildren or numMembers <= maxNumPerLevel:
            for itemID, ownerID in self.memberData:
                if itemID == session.charid:
                    continue
                if util.IsDustCharacter(itemID):
                    continue
                if itemID == ownerID:
                    data.append(TreeDataInv(parent=self, clsName='StationCorpMember', itemID=itemID, ownerID=ownerID))
                else:
                    data.append(TreeDataInv(parent=self, clsName='StationOwnerView', itemID=itemID, ownerID=ownerID))

        else:
            currLetter = None
            levelData = []
            for itemID, ownerID in self.memberData:
                letter = cfg.eveowners.Get(ownerID).name[0].upper()
                if letter != currLetter:
                    if levelData:
                        data.append(TreeDataCorpMembers(label=currLetter, memberData=levelData))
                    currLetter = letter
                    levelData = []
                levelData.append((itemID, ownerID))

            if levelData:
                data.append(TreeDataCorpMembers(label=currLetter, memberData=levelData))
        if not data:
            data.append(TreeData(label=localization.GetByLabel('UI/Inventory/NoCorpHangars')))
        self.forceCollapsed = False
        self._children = data
        return data
コード例 #6
0
ファイル: userentry.py プロジェクト: connoryang/1v1dec
    def _GetMultiMenu(self, selected):
        m = []
        charIDs = []
        multiCharIDs = []
        multiEveCharIDs = []
        listGroupIDs = {}
        listGroupID_charIDs = []
        onlyCharacters = True
        for entry in selected:
            listGroupID = entry.listGroupID
            if listGroupID:
                listGroupIDs[listGroupID] = 0
                listGroupID_charIDs.append((listGroupID, entry.charID))
            if entry.charID:
                charIDs.append((entry.charID, None))
                multiCharIDs.append(entry.charID)
                if not util.IsCharacter(entry.charID):
                    onlyCharacters = False
                elif util.IsDustCharacter(entry.charID):
                    multiEveCharIDs.append(entry.charID)

        if self.isContactList is None:
            if onlyCharacters:
                m += sm.GetService('menu').CharacterMenu(charIDs)
            if listGroupIDs:
                listname = ''
                delCharIDs = []
                rem = []
                for listGroupID, charID in listGroupID_charIDs:
                    if listGroupID in [('buddygroups', 'all'),
                                       ('buddygroups', 'allcorps')]:
                        if onlyCharacters:
                            return m
                        group = uicore.registry.GetListGroup(listGroupID)
                        listname = [
                            localization.GetByLabel('UI/Generic/BuddyList')
                        ][listGroupID == ('buddygroups', 'all')]
                        delCharIDs.append(charID)
                        rem.append((listGroupID, charID))

                for each in rem:
                    listGroupID_charIDs.remove(each)

                foldername = 'folders'
                if len(listGroupIDs) == 1:
                    group = uicore.registry.GetListGroup(
                        listGroupIDs.keys()[0])
                    if group:
                        foldername = group['label']
                label = ''
                if delCharIDs and listname:
                    label = localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveMultipleFromAddressbook',
                        removecount=len(delCharIDs))
                    if listGroupID_charIDs:
                        label += [', ']
                if listGroupID_charIDs:
                    label += localization.GetByLabel(
                        'UI/PeopleAndPlaces/RemoveFromFolder',
                        foldername=foldername,
                        removecount=len(listGroupID_charIDs))
                m.append((label, self.RemoveFromListGroup,
                          (listGroupID_charIDs, delCharIDs, listname)))
        else:
            addressBookSvc = sm.GetService('addressbook')
            counter = len(selected)
            blocked = 0
            if self.isContactList == 'contact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditContacts', contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'contact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveContacts', contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'contact']))
                for charid in multiCharIDs:
                    if sm.GetService('addressbook').IsBlocked(charid):
                        blocked += 1

                if blocked == counter:
                    unblockLabel = localization.GetByLabel(
                        'UI/PeopleAndPlaces/UnblockContacts',
                        contactcount=blocked)
                    m.append((unblockLabel, addressBookSvc.UnblockOwner,
                              [multiCharIDs]))
            elif self.isContactList == 'corpcontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditCorpContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'corpcontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveCorpContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'corpcontact']))
            elif self.isContactList == 'alliancecontact':
                editLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/EditAllianceContacts',
                    contactcount=counter)
                m.append((editLabel, addressBookSvc.EditContacts,
                          [multiCharIDs, 'alliancecontact']))
                deleteLabel = localization.GetByLabel(
                    'UI/PeopleAndPlaces/RemoveAllianceContacts',
                    contactcount=counter)
                m.append((deleteLabel, addressBookSvc.DeleteEntryMulti,
                          [multiCharIDs, 'alliancecontact']))
            m.append(None)
            assignLabelMenu = sm.StartService(
                'addressbook').GetAssignLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(assignLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/AddContactLabel'),
                     assignLabelMenu))
            removeLabelMenu = sm.StartService(
                'addressbook').GetRemoveLabelMenu(selected, multiCharIDs,
                                                  self.isContactList)
            if len(removeLabelMenu) > 0:
                m.append(
                    (uiutil.MenuLabel('UI/PeopleAndPlaces/RemoveContactLabel'),
                     removeLabelMenu))
            m.append(None)
            m.append(
                (uiutil.MenuLabel('UI/Commands/CapturePortrait'),
                 sm.StartService('photo').SavePortraits, [multiEveCharIDs]))
        if self.sr.node.Get('MenuFunction', None):
            cm = [None]
            cm += self.sr.node.MenuFunction(selected)
            m += cm
        return m
コード例 #7
0
    def ApplyAttributes(self, attributes):
        uicontrols.Window.ApplyAttributes(self, attributes)
        charID = attributes.charID
        self.charID = None
        self.corp = None
        self.standing2 = None
        self.charMgr = None
        self.memberinfo = None
        self.corporation = None
        self.roleGroupings = None
        self.myGrantableRoles = None
        self.myGrantableRolesAtHQ = None
        self.myGrantableRolesAtBase = None
        self.myGrantableRolesAtOther = None
        self.isCEOorEq = None
        self.userIsCEO = None
        self.member = None
        self.playerIsCEO = 0
        self.playerIsDirector = 0
        self.roles = 0
        self.grantableRoles = 0
        self.rolesAtHQ = 0
        self.grantableRolesAtHQ = 0
        self.rolesAtBase = 0
        self.grantableRolesAtBase = 0
        self.rolesAtOther = 0
        self.grantableRolesAtOther = 0
        self.baseID = None
        self.title = ''
        self.titleMask = 0
        self.args = ''
        self.ddxFunction = None
        self.viewType = 0
        self.viewRoleGroupingID = 1
        self.bases = [('-', None)]
        self.LoadServices()
        self.LoadChar(charID)
        self.SetScope('all')
        if not self.member:
            self.Close()
            return
        self.SetTopparentHeight(70)
        self.SetCaption(
            localization.GetByLabel(
                'UI/Corporations/EditMemberDialog/EditMemberCaption'))
        self.SetMinSize([310, 300])
        self.sr.main = uiutil.GetChild(self, 'main')
        self.wndCombos = uiprimitives.Container(name='options',
                                                parent=self.sr.main,
                                                align=uiconst.TOTOP,
                                                height=34)
        viewOptionsList1 = [[
            localization.GetByLabel('UI/Corporations/Common/Roles'), VIEW_ROLES
        ],
                            [
                                localization.GetByLabel(
                                    'UI/Corporations/Common/GrantableRoles'),
                                VIEW_GRANTABLE_ROLES
                            ]]
        viewOptionsList2 = []
        for roleGrouping in self.roleGroupings.itervalues():
            viewOptionsList2.append([
                localization.GetByMessageID(roleGrouping.roleGroupNameID),
                roleGrouping.roleGroupID
            ])

        i = 0
        for optlist, label, config, defval in [
            (viewOptionsList1, localization.GetByLabel('UI/Common/View'),
             'viewtype', 1000),
            (viewOptionsList2,
             localization.GetByLabel('UI/Corporations/Common/GroupType'),
             'rolegroup', None)
        ]:
            combo = uicontrols.Combo(label=label,
                                     parent=self.wndCombos,
                                     options=optlist,
                                     name=config,
                                     callback=self.OnComboChange,
                                     width=146,
                                     pos=(const.defaultPadding + i * 152 + 1,
                                          const.defaultPadding + 12, 0, 0))
            i += 1

        self.sr.dynamicScroll = uicontrols.BasicDynamicScroll(
            parent=self.sr.main, padding=const.defaultPadding)
        self.sr.scroll = uicontrols.Scroll(parent=self.sr.main,
                                           padding=const.defaultPadding)
        self.sr.standardBtns = uicontrols.ButtonGroup(
            btns=[[
                localization.GetByLabel('UI/Common/Buttons/OK'), self.OnOK, (
                ), 81
            ],
                  [
                      localization.GetByLabel('UI/Common/Buttons/Cancel'),
                      self.OnCancel, (), 81
                  ],
                  [
                      localization.GetByLabel(
                          'UI/Corporations/EditMemberDialog/Apply'),
                      self.OnApply, (), 81
                  ]])
        self.sr.main.children.insert(0, self.sr.standardBtns)
        cap = uicontrols.CaptionLabel(text=cfg.eveowners.Get(self.charID).name,
                                      parent=self.sr.topParent,
                                      align=uiconst.RELATIVE,
                                      left=74,
                                      top=20)
        if self.member.title:
            uicontrols.EveHeaderLarge(text=self.member.title,
                                      parent=self.sr.topParent,
                                      align=uiconst.RELATIVE,
                                      left=cap.left,
                                      top=cap.top + cap.height,
                                      bold=True)
        if util.IsDustCharacter(charID):
            btns = []
        else:
            btns = [[
                localization.GetByLabel(
                    'UI/Corporations/EditMemberDialog/GiveShares'),
                self.OnGiveShares, (), 81
            ]]
        buttons = uicontrols.ButtonGroup(btns=btns)
        self.sr.main.children.insert(1, buttons)
        maintabs = uicontrols.TabGroup(name='tabparent',
                                       parent=self.sr.main,
                                       idx=0)
        maintabs.Startup(
            [[
                localization.GetByLabel('UI/Generic/General'), self.sr.scroll,
                self, 'general', buttons
            ],
             [
                 localization.GetByLabel('UI/Corporations/Common/Roles'),
                 self.sr.dynamicScroll, self, 'roles'
             ],
             [
                 localization.GetByLabel('UI/Corporations/Common/Titles'),
                 self.sr.dynamicScroll, self, 'titles'
             ],
             [
                 localization.GetByLabel(
                     'UI/Corporations/EditMemberDialog/RolesSummary'),
                 self.sr.scroll, self, 'roles_summary'
             ]], 'editmemberdialog')
        self.sr.maintabs = maintabs
        self.DisplayPhoto()