예제 #1
0
 def OnDropCharacter(self, dragObj, nodes):
     node = nodes[0]
     if node.Get('__guid__', None) not in uiutil.AllUserEntries() + ['TextLink']:
         return
     charID = GetCharIDFromTextLink(node)
     if charID is None:
         charID = node.charID
     if util.IsCharacter(charID):
         charName = cfg.eveowners.Get(charID).name
         self.SetValue(charName)
예제 #2
0
 def OnDropCharacter(self, dragObj, nodes):
     node = nodes[0]
     charID = None
     if node.Get('__guid__', None) == 'TextLink' and node.Get(
             'url', '').startswith('showinfo'):
         parts = node.Get('url', '').split('//')
         charID = int(parts[-1])
     elif node.Get('__guid__',
                   None) not in uiutil.AllUserEntries() + ['TextLink']:
         return
     if charID is None:
         charID = node.charID
     if util.IsCharacter(charID):
         charName = cfg.eveowners.Get(charID).name
         self.SetValue(charName)
예제 #3
0
    def ShowAgents(self):
        self.sr.agentbtns.state = uiconst.UI_PICKCHILDREN
        scrollData = self._GetAgentScrollData()
        scrolllist = []
        for s in scrollData:
            data = {
                'GetSubContent': self.GetAgentsSubContent,
                'DropData': self.DropInBuddyGroup,
                'RefreshScroll': self.RefreshWindow,
                'label': s.label,
                'id': s.id,
                'groupItems': s.groupItems,
                'headers': [localization.GetByLabel('UI/Common/Name')],
                'iconMargin': 18,
                'showlen': 1,
                'state': s.state,
                'npc': True,
                'allowCopy': 1,
                'showicon': s.logo,
                'allowGuids': uiutil.AllUserEntries()
            }
            sortBy = s.sortBy
            scrolllist.append((sortBy.lower(), listentry.Get('Group', data)))

        self.sr.scroll.sr.iconMargin = 18
        scrolllist = uiutil.SortListOfTuples(scrolllist)
        self.sr.scroll.Load(
            contentList=scrolllist,
            fixedEntryHeight=None,
            headers=[localization.GetByLabel('UI/Common/Name')],
            scrolltotop=not getattr(self, 'personalshown', 0),
            noContentHint=localization.GetByLabel(
                'UI/PeopleAndPlaces/NoAgents'))
        setattr(self, 'personalshown', 1)
        if not self.destroyed:
            self.HideLoad()
예제 #4
0
 def OnDropDataDelegate(self, node, nodes):
     EditCore.OnDropDataDelegate(self, node, nodes)
     if self.readonly:
         return
     for entry in nodes:
         if entry.__guid__ in uiutil.AllUserEntries():
             link = 'showinfo:' + str(entry.info.typeID) + '//' + str(
                 entry.charID)
             self.AddLink(entry.info.name, link)
         elif entry.__guid__ == 'listentry.PlaceEntry' and self.allowPrivateDrops:
             bookmarkID = entry.bm.bookmarkID
             bookmarkSvc = sm.GetService('bookmarkSvc')
             bms = bookmarkSvc.GetBookmarks()
             if bookmarkID in bms:
                 bookmark = bms[bookmarkID]
                 hint, comment = bookmarkSvc.UnzipMemo(bookmark.memo)
             link = 'showinfo:' + str(bms[bookmarkID].typeID) + '//' + str(
                 bms[bookmarkID].itemID)
             self.AddLink(hint, link)
         elif entry.__guid__ == 'listentry.NoteItem' and self.allowPrivateDrops:
             link = 'note:' + str(entry.noteID)
             self.AddLink(entry.label, link)
         elif entry.__guid__ in ('listentry.InvItem', 'xtriui.InvItem',
                                 'xtriui.ShipUIModule',
                                 'listentry.InvAssetItem'):
             if type(entry.rec.itemID) is tuple:
                 link = 'showinfo:' + str(entry.rec.typeID)
             else:
                 link = 'showinfo:' + str(entry.rec.typeID) + '//' + str(
                     entry.rec.itemID)
             self.AddLink(entry.name, link)
         elif entry.__guid__ == 'listentry.VirtualAgentMissionEntry':
             link = 'fleetmission:' + str(entry.agentID) + '//' + str(
                 entry.charID)
             self.AddLink(entry.label, link)
         elif entry.__guid__ in ('listentry.CertEntry',
                                 'listentry.CertEntryBasic'):
             link = 'CertEntry:%s//%s' % (entry.certID, entry.level)
             self.AddLink(entry.label, link)
         elif entry.__guid__ and entry.__guid__.startswith(
                 'listentry.ContractEntry'):
             link = 'contract:' + str(entry.solarSystemID) + '//' + str(
                 entry.contractID)
             self.AddLink(entry.name.replace('>', '>'), link)
         elif entry.__guid__ == 'listentry.FleetFinderEntry':
             link = 'fleet:%s' % entry.fleet.fleetID
             self.AddLink(
                 entry.fleet.fleetName
                 or localization.GetByLabel('UI/Common/Unknown'), link)
         elif entry.__guid__ in ('xtriui.ListSurroundingsBtn',
                                 'listentry.LocationTextEntry',
                                 'listentry.LabelLocationTextTop',
                                 'listentry.LocationGroup',
                                 'listentry.LocationSearchItem'):
             if not entry.typeID and not entry.itemID:
                 return
             link = 'showinfo:' + str(entry.typeID) + '//' + str(
                 entry.itemID)
             displayLabel = getattr(entry, 'genericDisplayLabel',
                                    None) or entry.label
             self.AddLink(displayLabel, link)
         elif entry.__guid__ == 'listentry.FittingEntry':
             PADDING = 12
             link = 'fitting:' + sm.StartService(
                 'fittingSvc').GetStringForFitting(entry.fitting)
             roomLeft = self.RoomLeft() - PADDING
             if len(link) >= roomLeft:
                 if roomLeft < 14:
                     raise UserError('LinkTooLong')
                 if eve.Message('ConfirmTruncateLink', {
                         'numchar': len(link),
                         'maxchar': roomLeft
                 },
                                uiconst.YESNO,
                                suppress=uiconst.ID_YES) != uiconst.ID_YES:
                     return
                 link = link[:roomLeft]
             self.AddLink(entry.fitting.name, link)
         elif entry.__guid__ in ('listentry.GenericMarketItem',
                                 'uicls.GenericDraggableForTypeID',
                                 'listentry.DroneEntry',
                                 'listentry.SkillTreeEntry'):
             link = 'showinfo:' + str(entry.typeID)
             label = getattr(entry, 'label', None) or getattr(
                 entry, 'text', '')
             self.AddLink(label, link)
         elif entry.__guid__ in ('listentry.KillMail',
                                 'listentry.KillMailCondensed',
                                 'listentry.WarKillEntry'):
             killmail = entry.mail
             hashValue = util.GetKillReportHashValue(killmail)
             if util.IsCharacter(killmail.victimCharacterID):
                 victimName = cfg.eveowners.Get(
                     killmail.victimCharacterID).name
                 shipName = evetypes.GetName(killmail.victimShipTypeID)
                 label = localization.GetByLabel(
                     'UI/Corporations/Wars/Killmails/KillLinkCharacter',
                     charName=victimName,
                     typeName=shipName)
             else:
                 shipName = evetypes.GetName(killmail.victimShipTypeID)
                 label = localization.GetByLabel(
                     'UI/Corporations/Wars/Killmails/KillLinkStructure',
                     typeName=shipName)
             link = 'killReport:%d:%s' % (entry.mail.killID, hashValue)
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.WarEntry':
             warID = entry.war.warID
             attackerID = entry.war.declaredByID
             defenderID = entry.war.againstID
             attackerName = cfg.eveowners.Get(attackerID).name
             defenderName = cfg.eveowners.Get(defenderID).name
             label = localization.GetByLabel(
                 'UI/Corporations/Wars/WarReportLink',
                 attackerName=attackerName,
                 defenderName=defenderName)
             link = 'warReport:%d' % warID
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.TutorialEntry':
             tutorialID = entry.tutorialID
             link = 'tutorial:%s' % tutorialID
             label = entry.label
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.listentry.RecruitmentEntry':
             label = '%s - %s ' % (cfg.eveowners.Get(
                 entry.advert.corporationID).name, entry.adTitle)
             link = 'recruitmentAd:' + str(
                 entry.advert.corporationID) + '//' + str(entry.advert.adID)
             self.AddLink(label, link)
         elif entry.__guid__ == 'listentry.DirectionalScanResults':
             label = entry.typeName
             link = 'showinfo:' + str(entry.typeID) + '//' + str(
                 entry.itemID)
             self.AddLink(label, link)
         elif entry.__guid__ in ('listentry.SkillEntry',
                                 'listentry.SkillQueueSkillEntry'):
             label = entry.invtype.typeName
             link = 'showinfo:' + str(entry.invtype.typeID)
             self.AddLink(label, link)
예제 #5
0
    def OnDropDataDelegate(self, node, nodes):
        """ 
            Handle the event when something is drag-dropped into the edit 
        """
        uicontrols.EditPlainTextCore.OnDropDataDelegate(self, node, nodes)
        if self.readonly:
            return
        uicore.registry.SetFocus(self)
        for entry in nodes:
            if entry.__guid__ in uiutil.AllUserEntries():
                link = 'showinfo:' + str(entry.info.typeID) + '//' + str(
                    entry.charID)
                self.AddLink(entry.info.name, link)
            elif entry.__guid__ == 'listentry.PlaceEntry' and self.allowPrivateDrops:
                bookmarkID = entry.bm.bookmarkID
                bookmarkSvc = sm.GetService('bookmarkSvc')
                bms = bookmarkSvc.GetBookmarks()
                if bookmarkID in bms:
                    bookmark = bms[bookmarkID]
                    hint, comment = bookmarkSvc.UnzipMemo(bookmark.memo)
                link = 'showinfo:' + str(bms[bookmarkID].typeID) + '//' + str(
                    bms[bookmarkID].itemID)
                self.AddLink(hint, link)
            elif entry.__guid__ == 'listentry.NoteItem' and self.allowPrivateDrops:
                link = 'note:' + str(entry.noteID)
                self.AddLink(entry.label, link)
            elif entry.__guid__ in ('listentry.InvItem', 'xtriui.InvItem',
                                    'xtriui.ShipUIModule',
                                    'listentry.InvAssetItem',
                                    'listentry.ItemCheckbox'):
                if type(entry.rec.itemID) is tuple:
                    link = 'showinfo:' + str(entry.rec.typeID)
                else:
                    link = 'showinfo:' + str(entry.rec.typeID) + '//' + str(
                        entry.rec.itemID)
                self.AddLink(entry.name, link)
            elif entry.__guid__ in ('listentry.VirtualAgentMissionEntry', ):
                link = 'fleetmission:' + str(entry.agentID) + '//' + str(
                    entry.charID)
                self.AddLink(entry.label, link)
            elif entry.__guid__ in ('listentry.CertEntry',
                                    'listentry.CertEntryBasic'):
                link = 'CertEntry:%s//%s' % (entry.certID, entry.level)
                self.AddLink(entry.label, link)
            elif entry.__guid__.startswith('listentry.ContractEntry'):
                link = 'contract:' + str(entry.solarSystemID) + '//' + str(
                    entry.contractID)
                self.AddLink(entry.name.replace('&gt;', '>'), link)
            elif entry.__guid__ in ('listentry.FleetFinderEntry', ):
                link = 'fleet:%s' % entry.fleet.fleetID
                self.AddLink(
                    entry.fleet.fleetName
                    or localization.GetByLabel('UI/Common/Unknown'), link)
            elif entry.__guid__ in ('xtriui.ListSurroundingsBtn',
                                    'listentry.LocationTextEntry',
                                    'listentry.LabelLocationTextTop',
                                    'listentry.LocationGroup',
                                    'listentry.LocationSearchItem'):
                if not entry.typeID and not entry.itemID:
                    return
                link = 'showinfo:' + str(entry.typeID) + '//' + str(
                    entry.itemID)
                displayLabel = getattr(entry, 'genericDisplayLabel',
                                       None) or entry.label
                self.AddLink(displayLabel, link)
            elif entry.__guid__ == 'listentry.FittingEntry':
                PADDING = 12
                link = 'fitting:' + sm.StartService(
                    'fittingSvc').GetStringForFitting(entry.fitting)
                roomLeft = self.RoomLeft()
                if roomLeft is not None:
                    roomLeft = roomLeft - PADDING
                    if len(link) >= roomLeft:
                        if roomLeft < 14:
                            raise UserError('LinkTooLong')
                        if eve.Message(
                                'ConfirmTruncateLink', {
                                    'numchar': len(link),
                                    'maxchar': roomLeft
                                },
                                uiconst.YESNO,
                                suppress=uiconst.ID_YES) != uiconst.ID_YES:
                            return
                        link = link[:roomLeft]
                self.AddLink(entry.fitting.name, link)
            elif entry.__guid__ in ('listentry.GenericMarketItem',
                                    'listentry.QuickbarItem',
                                    'uicls.GenericDraggableForTypeID',
                                    'listentry.DroneEntry',
                                    'listentry.SkillTreeEntry'):
                link = 'showinfo:' + str(entry.typeID)
                label = getattr(entry, 'label', None) or getattr(
                    entry, 'text', '')
                self.AddLink(label, link)
            elif entry.__guid__ == 'TextLink':
                self.AddLink(entry.displayText, entry.url)
            elif entry.__guid__ == 'listentry.ChannelField':
                link = 'joinChannel:%s//%s//%s' % (entry.channel.channelID,
                                                   None, None)
                label = getattr(entry, 'genericDisplayLabel',
                                None) or entry.label
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.KillMail',
                                    'listentry.KillMailCondensed',
                                    'listentry.WarKillEntry'):
                killmail = entry.mail
                hashValue = util.GetKillReportHashValue(killmail)
                if util.IsCharacter(killmail.victimCharacterID):
                    victimName = cfg.eveowners.Get(
                        killmail.victimCharacterID).name
                    shipName = cfg.invtypes.Get(
                        killmail.victimShipTypeID).typeName
                    label = localization.GetByLabel(
                        'UI/Corporations/Wars/Killmails/KillLinkCharacter',
                        charName=victimName,
                        typeName=shipName)
                else:
                    shipName = cfg.invtypes.Get(
                        killmail.victimShipTypeID).typeName
                    label = localization.GetByLabel(
                        'UI/Corporations/Wars/Killmails/KillLinkStructure',
                        typeName=shipName)
                link = 'killReport:%d:%s' % (entry.mail.killID, hashValue)
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.WarEntry':
                warID = entry.war.warID
                attackerID = entry.war.declaredByID
                defenderID = entry.war.againstID
                attackerName = cfg.eveowners.Get(attackerID).name
                defenderName = cfg.eveowners.Get(defenderID).name
                label = localization.GetByLabel(
                    'UI/Corporations/Wars/WarReportLink',
                    attackerName=attackerName,
                    defenderName=defenderName)
                link = 'warReport:%d' % warID
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.TutorialEntry':
                tutorialID = entry.tutorialID
                link = 'tutorial:%s' % tutorialID
                label = entry.label
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.listentry.RecruitmentEntry':
                label = '%s - %s ' % (cfg.eveowners.Get(
                    entry.advert.corporationID).name, entry.adTitle)
                link = 'recruitmentAd:' + str(
                    entry.advert.corporationID) + '//' + str(entry.advert.adID)
                self.AddLink(label, link)
            elif entry.__guid__ in 'listentry.DirectionalScanResults':
                label = entry.typeName
                link = 'showinfo:' + str(entry.typeID) + '//' + str(
                    entry.itemID)
                self.AddLink(label, link, addLineBreak=True)
            elif entry.__guid__ in ('listentry.SkillEntry',
                                    'listentry.SkillQueueSkillEntry'):
                label = entry.invtype.typeName
                link = 'showinfo:' + str(entry.invtype.typeID)
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.Item',
                                    'listentry.ContractItemSelect',
                                    'listentry.RedeemToken',
                                    'listentry.FittingModuleEntry',
                                    'listentry.KillItems'):
                label = cfg.invtypes.Get(entry.typeID).name
                link = 'showinfo:' + str(entry.typeID)
                self.AddLink(label, link)
            elif entry.__guid__ in ('listentry.PodGuideBrowseEntry', ):
                label = entry.label
                link = 'podGuideLink:%s' % entry.termID
                self.AddLink(label, link)
            elif entry.__guid__ == 'fakeentry.OverviewProfile':
                progressText = localization.GetByLabel(
                    'UI/Overview/FetchingOverviewProfile')
                sm.GetService('loading').ProgressWnd(progressText, '', 1, 2)
                try:
                    presetKeyVal = sm.RemoteSvc(
                        'overviewPresetMgr').StoreLinkAndGetID(entry.data)
                    if presetKeyVal is None:
                        raise UserError('OverviewProfileLoadingError')
                    else:
                        presetKey = (presetKeyVal.hashvalue, presetKeyVal.sqID)
                finally:
                    sm.GetService('loading').ProgressWnd(
                        progressText, '', 2, 2)

                link = 'overviewPreset:%s//%s' % presetKey
                label = entry.label
                self.AddLink(label, link)
예제 #6
0
def PrepareDrag_Override(dragContainer, dragSource, *args):
    dad = dragContainer
    x = 0
    y = 0
    iconSize = 64
    for node in dragContainer.dragData:
        nameSpace, className = node.__guid__.split('.')
        ns = Import(nameSpace)
        decoClass = getattr(ns, className, None)
        icon = uicls.DraggableIcon(align=uiconst.TOPLEFT, pos=(0, 0, 64, 64))
        icon.left = x * (iconSize + 10)
        icon.top = y * (iconSize + 10)
        if decoClass is not None and issubclass(
                decoClass, xtriui.InvItem) or node.__guid__ in (
                    'xtriui.FittingSlot', 'xtriui.ModuleButton',
                    'xtriui.ShipUIModule'):
            isCopy = False
            if getattr(node, 'invtype', None) is not None:
                node.isBlueprint = node.invtype.Group(
                ).categoryID == const.categoryBlueprint
                if node.isBlueprint:
                    isCopy = node.rec.singleton == const.singletonBlueprintCopy
            typeID = node.rec.typeID
            MakeTypeIcon(icon, dad, typeID, iconSize, isCopy=isCopy)
        if node.__guid__ in ('xtriui.TypeIcon', 'listentry.DraggableItem',
                             'uicls.GenericDraggableForTypeID'):
            icon.LoadIconByTypeID(node.typeID)
        elif node.__guid__ in uiutil.AllUserEntries():
            charinfo = node.info or cfg.eveowners.Get(node.charID)
            uix.GetOwnerLogo(icon, node.charID, iconSize, noServerCall=False)
        elif node.__guid__ in ('listentry.PlaceEntry', ):
            icon.LoadIcon('ui_9_64_1')
        elif node.__guid__ in ('listentry.NoteItem', ):
            icon.LoadIcon('ui_49_64_3')
        elif node.__guid__ in ('listentry.QuickbarItem',
                               'listentry.GenericMarketItem',
                               'listentry.DirectionalScanReults'):
            typeID = node.typeID
            MakeTypeIcon(icon, dad, typeID, iconSize)
        elif node.__guid__ in ('listentry.VirtualAgentMissionEntry', ):
            icon.LoadIcon('ui_25_64_3')
        elif node.__guid__.startswith('listentry.ContractEntry'):
            iconName = 'ui_64_64_10'
            if 'Auction' in node.__guid__:
                iconName = 'ui_64_64_16'
            elif 'ItemExchange' in node.__guid__:
                iconName = 'ui_64_64_9'
            elif 'Courier' in node.__guid__:
                iconName = 'ui_64_64_13'
            icon.LoadIcon(iconName)
        elif node.__guid__ in ('listentry.FleetFinderEntry', ):
            icon.LoadIcon('ui_53_64_16')
        elif node.__guid__ == 'xtriui.ListSurroundingsBtn':
            icon.LoadIconByTypeID(node.typeID, itemID=node.itemID)
        elif node.__guid__ == 'listentry.PaletteEntry':
            icon.LoadIconByTypeID(node.id, itemID=node.id)
        elif node.__guid__ == 'listentry.DungeonTemplateEntry':
            icon.LoadIcon('ui_74_64_15')
        elif node.__guid__ in ('listentry.SkillEntry',
                               'listentry.SkillQueueSkillEntry'):
            icon.LoadIconByTypeID(node.invtype.typeID)
        elif node.__guid__ in ('listentry.FittingEntry', ):
            icon.LoadIcon('ui_17_128_4')
        elif node.__guid__ in ('listentry.MailEntry', ):
            icon.LoadIcon('ui_94_64_1')
        elif node.__guid__ in ('listentry.CorpAllianceEntry', ):
            icon.LoadIcon('ui_7_64_10')
        elif node.__guid__ in ('neocom.BtnDataNode', ):
            icon.LoadIcon(node.iconPath)
        elif node.__guid__ in ('listentry.QuickbarGroup', ):
            icon.LoadIcon('ui_22_32_29')
        elif node.__guid__ in ('listentry.KillMail',
                               'listentry.KillMailCondensed',
                               'listentry.WarKillEntry'):
            icon.LoadIcon('ui_1337_64_1')
        elif node.__guid__ in 'listentry.WarEntry':
            icon.LoadIcon('ui_1337_64_2')
        elif node.__guid__ in 'listentry.TutorialEntry':
            icon.LoadIcon('74_13')
        elif node.__guid__ in ('xtriui.CertSlot', 'listentry.CertEntry'):
            icon.LoadIcon('79_1')
        elif isinstance(node, (uiutil.TreeDataInv, uiutil.TreeDataInvFolder)):
            icon.LoadIcon(node.GetIcon())
        elif node.__guid__ in 'listentry.RecruitmentEntry':
            corpID = node.corporationID
            uix.GetOwnerLogo(icon, corpID, iconSize, noServerCall=False)
        elif node.__guid__ == 'uiutil.InfoPanelDragData':
            icon.LoadIcon(node.infoPanelCls.default_iconTexturePath)
            icon.width = icon.height = 32
        x += 1
        if x >= 3:
            x = 0
            y += 1
        dad.children.append(icon)
        icon.state = uiconst.UI_DISABLED
        if y > 2:
            break

    sm.GetService('audio').StartSoundLoop('DragDropLoop')
    dragContainer.dragSound = 'DragDropLoop'
    return (0, 0)
예제 #7
0
def IsUserNode(node):
    isUserNode = node.Get('__guid__',
                          None) in uiutil.AllUserEntries() + ['TextLink']
    return isUserNode