def _HideContainers(self): uthread.parallel([ (self._AnimateContainerOpacity, (self.topContainer, 0.0)), (self._AnimateContainerOpacity, (self.bottomContainer, 0.0)) ]) self.topContainer.state = uiconst.UI_DISABLED self.bottomContainer.state = uiconst.UI_DISABLED
def UpdateItem(self, item, change): self.LogInfo('UpdateItem item:', item) activeShipID = util.GetActiveShip() if item.itemID in (activeShipID, eve.session.charid): return if item.flagID == const.flagReward: return if item.groupID == const.groupMineral: return if not self.items.has_key(item.itemID): return if self is None or self.destroyed: return self.items[item.itemID] = item quote = uthread.parallel([ (sm.GetService('reprocessing').GetReprocessingSvc().GetQuotes, ([item.itemID], activeShipID)) ])[0] if self is None or self.destroyed: return if quote.has_key(item.itemID): self.quotes[item.itemID] = quote[item.itemID] elif self.quotes.has_key(item.itemID): del self.quotes[item.itemID] calls = [] calls.append((self.__LoadItems, ())) calls.append((self.__LoadQuotes, ())) uthread.parallel(calls)
def _TearDownComponents(self, entity): with entity.entityLock: try: if entity.state == const.cef.ENTITY_STATE_DESTROYING: entity.state = const.cef.ENTITY_STATE_DEAD preTearDownCalls = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'PreTearDownComponent', None) if f: preTearDownCalls.append((f, (entity, component))) if preTearDownCalls: uthread.parallel(preTearDownCalls) tearDownCalls = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'TearDownComponent', None) if f: tearDownCalls.append((f, (entity, component))) if tearDownCalls: uthread.parallel(tearDownCalls) else: self.LogError('SetupComponents: Entity state should be ', const.cef.ENTITY_STATE_NAMES[const.cef.ENTITY_STATE_DESTROYING], ', is instead ', const.cef.ENTITY_STATE_NAMES[entity.state], '. Entity:', str(entity)) sm.ScatterEvent('OnEntityDeleted', entity.entityID, entity.scene.sceneID) GameWorld.GetNetworkEntityQueueManager().RemoveEntity(entity.entityID) except Exception as e: self._deadEntityList[entity.entityID] = entity log.LogException(e)
def ProcessEntityVisibility(self, eventList): charid = session.charid playerEntityCreateIdx = None charactersCreated = [] for i, event in enumerate(eventList): if event[0] == 'OnEntityCreate' and event[2] == charid: eventList[i] = eventList[0] eventList[0] = event break callsToMake = [] for t in eventList: if t[0] == 'OnEntityCreate': eventName, sceneID, entityID, initialState = t callsToMake.append((self._CreateEntity, (sceneID, entityID, initialState))) if util.IsCharacter(entityID): charactersCreated.append(entityID) elif t[0] == 'OnEntityDestroy': eventName, entityID = t callsToMake.append((self._RemoveEntity, (entityID,))) else: self.LogError('Aperture Client received a unknown event type %s', str(t[0])) if charactersCreated: uthread.new(cfg.eveowners.Prime, charactersCreated) uthread.parallel(callsToMake)
def SetSetting(self, id, string): if self.settingStrs.has_key(id) and self.settingStrs[id] == string: return if self.settings.has_key(id): dbIDs = self.settings[id] dbIDs.sort() else: dbIDs = [] idStr = 'S:' + str(id) newIDs = [] while len(string) > 0: part = string[:6000] string = string[6000:] if len(dbIDs): noteID = int(dbIDs.pop(0)) sm.RemoteSvc('charMgr').EditOwnerNote(noteID, idStr, part) else: noteID = sm.RemoteSvc('charMgr').AddOwnerNote(idStr, part) newIDs.append(noteID) parallelCalls = [] for noteID in dbIDs: parallelCalls.append( (sm.RemoteSvc('charMgr').RemoveOwnerNote, (int(noteID), ))) if len(parallelCalls): uthread.parallel(parallelCalls) self.settings[id] = newIDs
def _TearDownScene(self, scene): self.LogInfo('Tearing Down entity Scene', scene.sceneID) unloadCalls = [] for system in self.sceneCreationSubscriptions: if hasattr(system, 'OnUnloadEntityScene'): unloadCalls.append((system.OnUnloadEntityScene, (scene.sceneID,))) self.LogInfo('Unloading Entity Scene from', len(unloadCalls), 'systems') try: uthread.parallel(unloadCalls) self.LogInfo('Done unloading Entity Scene from', len(unloadCalls), 'systems') except: log.LogException() self.LogWarn('Done unloading Entity Scene, but something threw an exception. Trying to continue execution.') unloadedCalls = [] for system in self.sceneCreationSubscriptions: if hasattr(system, 'OnEntitySceneUnloaded'): unloadedCalls.append((system.OnEntitySceneUnloaded, (scene.sceneID,))) self.LogInfo('Notifying', len(unloadedCalls), 'systems about Entity Scene having been unloaded') try: uthread.parallel(unloadedCalls) self.LogInfo('Done notifying about successful unload') except: log.LogException() self.LogWarn('Done notifying about unload, but something errored. Trying to continue execution.') self.sceneManager.RemoveScene(scene.sceneID) del self.unloadingScenes[scene.sceneID] self.LogInfo('Done Unloading entity Scene', scene.sceneID)
def _ShowContainers(self): self.topContainer.state = uiconst.UI_PICKCHILDREN self.bottomContainer.state = uiconst.UI_PICKCHILDREN uthread.parallel([ (self._AnimateContainerOpacity, (self.topContainer, 1.0)), (self._AnimateContainerOpacity, (self.bottomContainer, 1.0)) ])
def UpdateSessionAttributes(self, idtype, theID, dict): if idtype not in ['charid', 'userid'] + self.additionalAttribsAllowedToUpdate: raise RuntimeError("You shouldn't be calling this, as you obviously don't know what you're doing. This is like one of the most sensitive things in the system, dude.") if machobase.mode == 'proxy' and theID not in sessionsByAttribute[idtype]: raise UnMachoDestination('Wrong proxy or client not connected') if machobase.mode == 'server' and idtype in ('userid', 'charid'): proxyNodeID = None try: proxyNodeID = self.GetProxyNodeFromID(idtype, theID, 1) except UnMachoDestination: sys.exc_clear() if proxyNodeID is not None: return self.GetProxySessionManager(proxyNodeID).UpdateSessionAttributes(idtype, theID, dict) sessions = FindSessions(idtype, [theID]) if idtype == 'charid' and dict.has_key('flagRolesOnly') and sessions and len(sessions) > 0: sessioncorpid = sessions[0].corpid rolecorpid = dict['corpid'] if sessioncorpid != rolecorpid: self.LogError('Character session is wrong!!! Character', theID, 'has session corp', sessioncorpid, 'but should be', rolecorpid, "I'll fix his session but please investigate why this occurred! Update dict:", dict, 'Session:', sessions[0]) if dict.has_key('flagRolesOnly'): del dict['flagRolesOnly'] self.TypeAndNodeValidationHook(idtype, theID) parallelCalls = [] for each in sessions: if hasattr(each, 'clientID'): parallelCalls.append((self.PerformHorridSessionAttributeUpdate, (each.clientID, dict))) else: each.LogSessionHistory('Updating session information via sessionMgr::UpdateSessionAttributes') each.SetAttributes(dict) each.LogSessionHistory('Updated session information via sessionMgr::UpdateSessionAttributes') if len(parallelCalls) > 60: log.LogTraceback('Horrid session change going haywire. Redesign the calling code!') uthread.parallel(parallelCalls)
def UpdateItem(self, item, change): self.LogInfo('UpdateItem item:', item) activeShipID = util.GetActiveShip() if item.itemID in (activeShipID, eve.session.charid): return if item.flagID == const.flagReward: return if item.groupID == const.groupMineral: return if not self.items.has_key(item.itemID): return if self is None or self.destroyed: return self.items[item.itemID] = item quote = uthread.parallel([(sm.GetService('reprocessing').GetReprocessingSvc().GetQuotes, ([item.itemID], activeShipID))])[0] if self is None or self.destroyed: return if quote.has_key(item.itemID): self.quotes[item.itemID] = quote[item.itemID] elif self.quotes.has_key(item.itemID): del self.quotes[item.itemID] calls = [] calls.append((self.__LoadItems, ())) calls.append((self.__LoadQuotes, ())) uthread.parallel(calls)
def ProcessEntityVisibility(self, eventList): charid = session.charid playerEntityCreateIdx = None charactersCreated = [] for i, event in enumerate(eventList): if event[0] == 'OnEntityCreate' and event[2] == charid: eventList[i] = eventList[0] eventList[0] = event break callsToMake = [] for t in eventList: if t[0] == 'OnEntityCreate': eventName, sceneID, entityID, initialState = t callsToMake.append( (self._CreateEntity, (sceneID, entityID, initialState))) if util.IsCharacter(entityID): charactersCreated.append(entityID) elif t[0] == 'OnEntityDestroy': eventName, entityID = t callsToMake.append((self._RemoveEntity, (entityID, ))) else: self.LogError( 'Aperture Client received a unknown event type %s', str(t[0])) if charactersCreated: uthread.new(cfg.eveowners.Prime, charactersCreated) uthread.parallel(callsToMake)
def SetSetting(self, id, string): if self.settingStrs.has_key(id) and self.settingStrs[id] == string: return if self.settings.has_key(id): dbIDs = self.settings[id] dbIDs.sort() else: dbIDs = [] idStr = 'S:' + str(id) newIDs = [] while len(string) > 0: part = string[:6000] string = string[6000:] if len(dbIDs): noteID = int(dbIDs.pop(0)) sm.RemoteSvc('charMgr').EditOwnerNote(noteID, idStr, part) else: noteID = sm.RemoteSvc('charMgr').AddOwnerNote(idStr, part) newIDs.append(noteID) parallelCalls = [] for noteID in dbIDs: parallelCalls.append((sm.RemoteSvc('charMgr').RemoveOwnerNote, (int(noteID),))) if len(parallelCalls): uthread.parallel(parallelCalls) self.settings[id] = newIDs
def FitUsingSlash(self, shipID): title = 'Fitting %s' % GetTypeName(self.typeID) state = [0, 0] def _fitgroup(slot): w = sm.RemoteSvc('slash') for flag, typeID in self.itermodules(banks=(slot, ), smart=True): if typeID: state[0] += 1 modname = GetTypeName(typeID) else: continue state[1] += 1 sm.GetService('loading').ProgressWnd( title, 'Fitting module %s/%s: %s' % (state[0], self.realmodulecount, modname), state[1] * 1000, (self.realmodulecount + self.fakemodulecount) * 1000 + 1) w.SlashCmd('/fit %s %s flag=%d' % (shipID, typeID, flag)) if shipID == util.GetActiveShip(): sm.RemoteSvc('slash').SlashCmd('/unload me all') parallelCalls = [] for slot in SLOTGROUPS: parallelCalls.append((_fitgroup, (slot, ))) uthread.parallel(parallelCalls) sm.GetService('loading').ProgressWnd(title, 'Done', 1, 1)
def UpdateSessionAttributes(self, idtype, theID, dict): """ Performs a session variable update on all sessions whose 'idtype' variable equals 'theID', sequentially for service sessions but otherwise in pseudo-parallel on a thread per session updated, updating the session on proxies but forwarding the call to the relevant proxy, on servers. """ if idtype not in ['charid', 'userid' ] + self.additionalAttribsAllowedToUpdate: raise RuntimeError( "You shouldn't be calling this, as you obviously don't know what you're doing. This is like one of the most sensitive things in the system, dude." ) if machobase.mode == 'proxy' and theID not in sessionsByAttribute[ idtype]: raise UnMachoDestination('Wrong proxy or client not connected') if machobase.mode == 'server' and idtype in ('userid', 'charid'): proxyNodeID = None try: proxyNodeID = self.GetProxyNodeFromID(idtype, theID, 1) except UnMachoDestination: sys.exc_clear() if proxyNodeID is not None: return self.GetProxySessionManager( proxyNodeID).UpdateSessionAttributes(idtype, theID, dict) sessions = FindSessions(idtype, [theID]) if idtype == 'charid' and dict.has_key( 'flagRolesOnly') and sessions and len(sessions) > 0: sessioncorpid = sessions[0].corpid rolecorpid = dict['corpid'] if sessioncorpid != rolecorpid: self.LogError( 'Character session is wrong!!! Character', theID, 'has session corp', sessioncorpid, 'but should be', rolecorpid, "I'll fix his session but please investigate why this occurred! Update dict:", dict, 'Session:', sessions[0]) if dict.has_key('flagRolesOnly'): del dict['flagRolesOnly'] self.TypeAndNodeValidationHook(idtype, theID) parallelCalls = [] for each in sessions: if hasattr(each, 'clientID'): parallelCalls.append((self.PerformHorridSessionAttributeUpdate, (each.clientID, dict))) else: each.LogSessionHistory( 'Updating session information via sessionMgr::UpdateSessionAttributes' ) each.SetAttributes(dict) each.LogSessionHistory( 'Updated session information via sessionMgr::UpdateSessionAttributes' ) if len(parallelCalls) > 60: log.LogTraceback( 'Horrid session change going haywire. Redesign the calling code!' ) uthread.parallel(parallelCalls)
def GrayOutItem(self, item): animateCall = lambda cont: uicore.animations.MorphScalar(cont, attrName= 'saturation', startVal=1.0, endVal=0.0, duration=0.3, sleep=True) uthread.parallel([(animateCall, (item.icon, )), (animateCall, (item.techIcon, ))])
def FullFrontalLobotomy(*args): Progress('Performing lobotomy...', 0, 1) dgm = sm.GetService('godma') sh = dgm.GetSkillHandler() sh.CharStopTrainingSkill() parallelCalls = [ (sh.RemoveImplantFromCharacter, (implant.itemID, )) for implant in dgm.GetItem(eve.session.charid).implants ] uthread.parallel(parallelCalls) Progress('All done!', 1, 1)
def Run(self, *etc): service.Service.Run(self, *etc) self.entitySceneManager = GameWorld.GetEntitySceneManagerSingleton() self.sceneManager = GameWorld.GetSceneManagerSingleton() calls = [] for entitySystem in set(self.__entitysystems__): calls.append((self.SetupEntitySystem, (entitySystem, ))) try: uthread.parallel(calls) except: log.LogException()
def Run(self, *etc): service.Service.Run(self, *etc) self.entitySceneManager = GameWorld.GetEntitySceneManagerSingleton() self.sceneManager = GameWorld.GetSceneManagerSingleton() calls = [] for entitySystem in set(self.__entitysystems__): calls.append((self.SetupEntitySystem, (entitySystem,))) try: uthread.parallel(calls) except: log.LogException()
def AnimateItems(self): for group in self.groupContainers.itervalues(): inputItems = group.tilePlacer.GetItems() timeOffset = 0.2 / len(inputItems) funcs = [ (self.GrayOutItem, (item,)) for item in inputItems ] uthread.parallel(funcs) for item in inputItems: uicore.animations.FadeOut(item, duration=timeOffset, sleep=True) for groupID, group in self.groupContainers.items(): group.Close() self.groupContainers = {}
def DoSelectItems(self, items, *args): if items is None: items = [] else: for item in items: self.selectedItemIDs[item.itemID] = True if getattr(self, 'isready', 0): calls = [] calls.append((self.__LoadItems, ())) calls.append((self.__LoadQuotes, ())) uthread.parallel(calls) uthread.new(self.UpdateButtons) return items
def GetSolarsystemItems(self, solarsystemID, requireLocalizedTexts = True, doYields = False): """ The values returned here are cached for each client run """ local, playerStations = uthread.parallel([(cfg.GetLocationsLocalBySystem, (solarsystemID, requireLocalizedTexts, doYields)), (sm.RemoteSvc('config').GetDynamicCelestials, (solarsystemID,))], contextSuffix='GetSolarsystemItems') for station in playerStations: local.InsertNew(station) return local
def GetSolarsystemItems(self, solarsystemID): local, playerStations = uthread.parallel( [(cfg.GetLocationsLocalBySystem, (solarsystemID, )), (sm.RemoteSvc('config').GetDynamicCelestials, (solarsystemID, ))], contextSuffix='GetSolarsystemItems') for station in playerStations: local.InsertNew(station) return local
def PlugEmIn(self, typeIDs): if len(typeIDs) <= 1: p = lambda *x: None else: p = Progress p('Evaluating state of mind...', 0, 1) dgm = sm.GetService('godma') sh = dgm.GetSkillHandler() sh.CharStopTrainingSkill() head = {} for typeID in typeIDs: rec = dgm.GetType(typeID) head[rec.implantness] = typeID removeCalls = [] for implant in dgm.GetItem(eve.session.charid).implants: rec = dgm.GetType(implant.typeID) if rec.implantness in head: if rec.typeID == head[rec.implantness]: del head[rec.implantness] else: removeCalls.append( (sh.RemoveImplantFromCharacter, (implant.itemID, ))) pluginCalls = [] t = len(head) c = 1 slash = sm.GetService('slash') for typeID in head.itervalues(): p('[%d/%d] Creating implants...' % (c, t), c, t * 2) c += 1 if eve.session.role & service.ROLE_WORLDMOD: itemID = slash.SlashCmd('/create %d 1' % (typeID, )) else: itemID = slash.SlashCmd('/load me %d' % typeID)[0] pluginCalls.append((sh.CharAddImplant, (itemID, ))) if removeCalls: p('Ripping old hardware out...', 1, 2) uthread.parallel(removeCalls) if pluginCalls: p('Plugging you up...', 3, 4) uthread.parallel(pluginCalls) p('All done...', 1, 1)
def FetchBountiesAndKillRightsFromServer(self, charIDs, ownerIDs): bountiesToFetch = {ownerID for ownerID in ownerIDs if self.IsObsolete(ownerID)} killRightsToFetch = self.killRightTracker.GetInvalidKillRights(charIDs) self.LogInfo('FetchBountiesAndKillRightsFromServer - fetching', len(bountiesToFetch), 'for bounties and', len(killRightsToFetch), 'for killRights') if not (bountiesToFetch or killRightsToFetch): self.LogInfo('FetchBountiesAndKillRightsFromServer - Bailing out because nothing to fetch') return myKillRights, (bounties, killRights) = uthread.parallel([(self.GetMyKillRights, ()), (sm.ProxySvc('bountyProxy').GetBountiesAndKillRights, (bountiesToFetch, killRightsToFetch))]) bountyUtil.CacheBounties(self.bounties, [ bounty for targetID, bounty in bounties ]) self.killRightTracker.CacheKillRights(killRights, killRightsToFetch)
def SpawnClientSidePlayer(self, scene, position, rotation): self.LogInfo('Spawning client side player entity for', session.charid) scene.WaitOnStartupEntities() serverInfoCalls = [] serverInfoCalls.append((self.paperDollService.GetMyPaperDollData, (session.charid,))) serverInfoCalls.append((self.charMgr.GetPublicInfo, (session.charid,))) paperdolldna, pubInfo = uthread.parallel(serverInfoCalls) spawner = cef.ClientOnlyPlayerSpawner(scene.sceneID, session.charid, position, rotation, paperdolldna, pubInfo) spawnedEntity = self.entitySpawnClient.LoadEntityFromSpawner(spawner) self.LogInfo('Client side player entity spawned for', session.charid)
def Load(self, *args): self.sr.skillCombo.SelectItemByValue(settings.user.ui.Get('skillqueue_comboFilter', FILTER_ALL)) self.expanded = settings.user.ui.Get('skillqueue_skillsExpanded', 1) if self.expanded: self.SetMinSize([700, 350]) self.OnClickRightExpander() else: self.OnClickLeftExpander() self.SetTime() self.skillQueueSvc.BeginTransaction() self.queueLastApplied = self.skillQueueSvc.GetQueue() parallelCalls = [] parallelCalls.append((self.LoadQueue, ())) parallelCalls.append((self.LoadSkills, ())) uthread.parallel(parallelCalls) inTraining = sm.StartService('skills').SkillInTraining() if not inTraining: self.GrayButton(self.sr.pauseBtn, gray=1) uthread.new(self.StartBars) uthread.new(self.LoopTimers)
def _RegisterScene(self, scene, loadSemaphore): sceneID = scene.sceneID self.LogInfo('Registering entity scene ', sceneID) self.sceneManager.AddScene(scene.sceneID) def LogCall(callName, systemName, call, args): self.LogInfo(callName, 'start for', systemName) call(*args) self.LogInfo(callName, 'end for', systemName) registrationCalls = [] for system in self.sceneCreationSubscriptions: if hasattr(system, 'OnLoadEntityScene'): registrationCalls.append((LogCall, ('OnLoadEntityScene', system.__guid__, system.OnLoadEntityScene, (sceneID,)))) try: uthread.parallel(registrationCalls) except: log.LogException() self.LogInfo('Calling OnEntitySceneLoaded ', sceneID) sceneLoadedCalls = [] for system in self.sceneCreationSubscriptions: if hasattr(system, 'OnEntitySceneLoaded'): sceneLoadedCalls.append((LogCall, ('OnEntitySceneLoaded', system.__guid__, system.OnEntitySceneLoaded, (sceneID,)))) try: uthread.parallel(sceneLoadedCalls) except: log.LogException() scene.state = EntitySceneState.READY if self.loadingScenes.get(scene.sceneID) == loadSemaphore: del self.loadingScenes[scene.sceneID] self.LogInfo('Finished loading entity scene ', sceneID)
def ApplyAttributes(self, attributes): ContainerAutoSize.ApplyAttributes(self, attributes) charID = attributes.charID parentLayoutGrid = LayoutGrid(parent=self, columns=2, align=uiconst.TOPLEFT, padding=6, cellSpacing=(10, 10)) addHeader = attributes.get('addHeader', True) if addHeader: self.AddHeader(parentLayoutGrid) sprite = Sprite(parent=parentLayoutGrid, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, pos=(0, 0, 128, 128)) sm.GetService('photo').GetPortrait(charID, 128, sprite, allowServerTrip=True) subLayoutGrid = LayoutGrid(parent=parentLayoutGrid, columns=2, align=uiconst.TOPLEFT) spacer = Fill(align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=128, height=1, color=(0, 0, 0, 0)) subLayoutGrid.AddCell(cellObject=spacer, colSpan=2) parallelCalls = [] parallelCalls.append( (sm.RemoteSvc('charMgr').GetPublicInfo3, (charID, ))) parallelCalls.append( (sm.GetService('corp').GetInfoWindowDataForChar, (charID, 1))) charinfo, corpCharInfo = uthread.parallel(parallelCalls) charName = cfg.eveowners.Get(charID).name nameLabel = EveLabelMedium(text=charName, autoFitToText=True) subLayoutGrid.AddCell(cellObject=nameLabel, colSpan=2) titleText = self.GetTitleText(corpCharInfo) titleLabel = EveLabelMedium(text=titleText, autoFitToText=True) if titleLabel.textwidth > self.maxTextWidth: titleLabel.width = self.maxTextWidth subLayoutGrid.AddCell(cellObject=titleLabel, colSpan=2) if corpCharInfo: corpID = corpCharInfo.corpID allianceID = corpCharInfo.allianceID for eachID in (corpID, allianceID): if eachID: logo = self.GetLogo(eachID) logo.hint = cfg.eveowners.Get(eachID).name subLayoutGrid.AddCell(cellObject=logo)
def SpawnClientSidePlayer(self, scene, position, rotation): self.LogInfo('Spawning client side player entity for', session.charid) scene.WaitOnStartupEntities() serverInfoCalls = [] serverInfoCalls.append( (self.paperDollService.GetMyPaperDollData, (session.charid, ))) serverInfoCalls.append( (self.charMgr.GetPublicInfo, (session.charid, ))) paperdolldna, pubInfo = uthread.parallel(serverInfoCalls) spawner = cef.ClientOnlyPlayerSpawner(scene.sceneID, session.charid, position, rotation, paperdolldna, pubInfo) spawnedEntity = self.entitySpawnClient.LoadEntityFromSpawner(spawner) self.LogInfo('Client side player entity spawned for', session.charid)
def RemoveItem(self, item): if self.reprocessing == 1: return self.LogInfo('RemoveItem item:', item) if item.itemID in (util.GetActiveShip(), eve.session.charid): return if item.flagID == const.flagReward: return if item.groupID == const.groupMineral: return if not self.items.has_key(item.itemID): return if self is None or self.destroyed: return if self.items.has_key(item.itemID): del self.items[item.itemID] if self.quotes.has_key(item.itemID): del self.quotes[item.itemID] if self.selectedItemIDs.has_key(item.itemID): del self.selectedItemIDs[item.itemID] calls = [] calls.append((self.__LoadItems, ())) calls.append((self.__LoadQuotes, ())) uthread.parallel(calls)
def FitUsingSlash(self, shipID): title = 'Fitting %s' % GetTypeName(self.typeID) state = [0, 0] def _fitgroup(slot): w = sm.RemoteSvc('slash') for flag, typeID in self.itermodules(banks=(slot,), smart=True): if typeID: state[0] += 1 modname = GetTypeName(typeID) else: continue state[1] += 1 sm.GetService('loading').ProgressWnd(title, 'Fitting module %s/%s: %s' % (state[0], self.realmodulecount, modname), state[1] * 1000, (self.realmodulecount + self.fakemodulecount) * 1000 + 1) w.SlashCmd('/fit %s %s flag=%d' % (shipID, typeID, flag)) if shipID == util.GetActiveShip(): sm.RemoteSvc('slash').SlashCmd('/unload me all') parallelCalls = [] for slot in SLOTGROUPS: parallelCalls.append((_fitgroup, (slot,))) uthread.parallel(parallelCalls) sm.GetService('loading').ProgressWnd(title, 'Done', 1, 1)
def GetSetting(self, id): if self.settingStrs.has_key(id): return self.settingStrs[id] if not self.settings.has_key(id): return None parallelCalls = [] for noteID in self.settings[id]: parallelCalls.append((sm.RemoteSvc('charMgr').GetOwnerNote, (int(noteID),))) if len(parallelCalls): notes = uthread.parallel(parallelCalls) self.settingStrs[id] = '' for note in notes: self.settingStrs[id] += note[0].note return self.settingStrs[id]
def __RefreshStandings(self): if not eve.session.charid: return tmp = sm.RemoteSvc('standing2').GetNPCNPCStandings() self.npcnpcstandingsto = tmp.Filter('toID') self.npcnpcstandingsfrom = tmp.Filter('fromID') if util.IsNPC(eve.session.corpid): self.npccharstandings = sm.RemoteSvc('standing2').GetCharStandings() self.npccorpstandings = {} else: ret = uthread.parallel([(sm.RemoteSvc('standing2').GetCharStandings, ()), (sm.RemoteSvc('standing2').GetCorpStandings, ())]) self.npccharstandings = ret[0] self.npccorpstandings = ret[1] if type(self.npccorpstandings) != types.DictType: self.npccorpstandings = self.npccorpstandings.Index('fromID') self.npccharstandings = self.npccharstandings.Index('fromID') self.gotten = 1
def GetSolarsystemItems(self, solarsystemID, requireLocalizedTexts=True, doYields=False): local, playerStations, structures = uthread.parallel( [(cfg.GetLocationsLocalBySystem, (solarsystemID, requireLocalizedTexts, doYields)), (sm.RemoteSvc('config').GetDynamicCelestials, (solarsystemID, )), (sm.GetService('structureDirectory').GetStructureMapData, (solarsystemID, ))], contextSuffix='GetSolarsystemItems') for station in playerStations: local.InsertNew(station) for structure in structures: local.InsertNew(structure) return local
def FetchBountiesAndKillRightsFromServer(self, charIDs, ownerIDs): bountiesToFetch = { ownerID for ownerID in ownerIDs if self.IsObsolete(ownerID) } killRightsToFetch = self.killRightTracker.GetInvalidKillRights(charIDs) self.LogInfo('FetchBountiesAndKillRightsFromServer - fetching', len(bountiesToFetch), 'for bounties and', len(killRightsToFetch), 'for killRights') if not (bountiesToFetch or killRightsToFetch): self.LogInfo( 'FetchBountiesAndKillRightsFromServer - Bailing out because nothing to fetch' ) return myKillRights, (bounties, killRights) = uthread.parallel([ (self.GetMyKillRights, ()), (sm.ProxySvc('bountyProxy').GetBountiesAndKillRights, (bountiesToFetch, killRightsToFetch)) ]) bountyUtil.CacheBounties(self.bounties, [bounty for targetID, bounty in bounties]) self.killRightTracker.CacheKillRights(killRights, killRightsToFetch)
def _SetupComponents(self, entity, initData = None): entityAlreadyThere = entity.scene.entities.get(entity.entityID, None) if entityAlreadyThere: if session.charid and entity.entityID == session.charid: self.LogInfo('Double add of player entity because of playercomponent ack stuff') else: errorText = 'Adding a entity ' + str(entity) + ' that already in this scene. This one was here before ' + str(entityAlreadyThere) + ' Ignoring entity' log.LogTraceback(extraText=errorText) GameWorld.GetNetworkEntityQueueManager().ClearEntity(entity.entityID) return False with entity.entityLock: try: if entity.state == const.cef.ENTITY_STATE_UNINITIALIZED: self.loadingEntities[entity.entityID] = entity entity.state = const.cef.ENTITY_STATE_CREATING self.entitySceneManager.Prepare(entity.entityID, entity.scene.sceneID) preperationCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'PrepareComponent', None) if f: preperationCalls.append((CEFParellelHelper, (f, (entity.scene.sceneID, entity.entityID, component)))) funcContexts.append(system.__guid__) if preperationCalls: uthread.parallel(preperationCalls, contextSuffix='PrepareComponent', funcContextSuffixes=funcContexts) setupCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'SetupComponent', None) if f: setupCalls.append((CEFParellelHelper, (f, (entity, component)))) funcContexts.append(system.__guid__) if setupCalls: uthread.parallel(setupCalls, contextSuffix='SetupComponent', funcContextSuffixes=funcContexts) setupCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'NetworkSyncComponent', None) if f: setupCalls.append((CEFParellelHelper, (f, (entity, component)))) funcContexts.append(system.__guid__) if setupCalls: uthread.parallel(setupCalls, contextSuffix='NetworkSyncComponent', funcContextSuffixes=funcContexts) entity.scene.entities[entity.entityID] = entity else: self.LogError('SetupComponents: Entity state should be', const.cef.ENTITY_STATE_NAMES[const.cef.ENTITY_STATE_UNINITIALIZED], ', is instead ', const.cef.ENTITY_STATE_NAMES[entity.state], '. Entity is:', str(entity)) except Exception as e: self._deadEntityList[entity.entityID] = entity log.LogException(e) return False return True
def Fit(self, charges): dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() chargeByFlag = {} shipID = util.GetActiveShip() shipInv = self.invCache.GetInventoryFromId(shipID) for dogmaItem in dogmaLocation.GetDogmaItem( shipID).GetFittedItems().itervalues(): desiredSize = dogmaLocation.dogmaStaticMgr.GetTypeAttribute( dogmaItem.typeID, const.attributeChargeSize) capacity = dogmaLocation.GetAttributeValue(dogmaItem.itemID, const.attributeCapacity) for chargeGroupAttributeID in dogmaLocation.dogmaStaticMgr.chargeGroupAttributes: if not dogmaLocation.dogmaStaticMgr.TypeHasAttribute( dogmaItem.typeID, chargeGroupAttributeID): continue chargeGroup = dogmaLocation.GetAttributeValue( dogmaItem.itemID, chargeGroupAttributeID) for a in charges: if a.groupID != chargeGroup: continue if a.volume > capacity: continue if desiredSize is not None and getattr( a, 'chargeSize', -1) != desiredSize: continue chargeByFlag[dogmaItem.flagID] = [ a, int(capacity / a.volume) ] break else: continue break tasks = { flagID: (None, '/fit me %d %d flag=%d' % (typeObj.typeID, qtyNeeded, flagID)) for flagID, (typeObj, qtyNeeded) in chargeByFlag.iteritems() } for dogmaItem in dogmaLocation.GetDogmaItem( shipID).GetFittedItems().itervalues(): flagID = dogmaItem.flagID if flagID not in chargeByFlag: continue if dogmaItem.categoryID != const.categoryCharge: continue a, quantityNeeded = chargeByFlag[flagID] if isinstance(dogmaItem.itemID, tuple): if dogmaItem.typeID != a.typeID: tasks[flagID] = [flagID] else: quantityNeeded -= dogmaLocation.GetAttributeValue( dogmaItem.itemID, const.attributeQuantity) tasks[flagID] = [None] else: tasks[flagID] = [flagID] if quantityNeeded > 0: tasks[flagID].append('/fit me %d %d flag=%d' % (a.typeID, quantityNeeded, flagID)) else: tasks[flagID].append(None) def _change(removeFlag, addCmd): if removeFlag: shipInv.ReplaceCharges(removeFlag, None, forceRemove=True) count = 100 while dogmaLocation.GetSubLocation(util.GetActiveShip(), removeFlag): blue.pyos.synchro.SleepSim(50) count -= 1 if not count: raise RuntimeError( 'Dogma is sleeping on the job, or something worse happened!' ) if addCmd: sm.RemoteSvc('slash').SlashCmd(addCmd) uthread.parallel([(_change, (flag, cmd)) for flag, cmd in tasks.itervalues()])
def CompleteJobs(self, jobs): uthread.parallel([(self.CompleteJob, (jobID, )) for jobID in jobs])
def FitUsingHangar(self, shipID): if shipID != util.GetActiveShip(): self.Oops('Oops', 'You cannot fit ships other than your active one.') dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() ship = dogmaLocation.GetDogmaItem(shipID) if ship is None: self.Oops('Huh?', 'Where is your ship?') title = 'Fitting %s' % GetTypeName(self.typeID) setup = self.GetModuleInfo() Cycle(title, 'Locating required modules...') source = {} for typeID in setup['modulelist']: source[typeID] = [] fit = {} for flag, typeID in self.moduleByFlag.iteritems(): if typeID: fit[flag] = typeID for item in ship.GetFittedItems().itervalues(): if item.typeID == self.moduleByFlag[item.flagID]: if fit.has_key(item.flagID): del fit[item.flagID] else: source[typeID].append(item) if setup.has_key(item.typeID): setup[item.typeID] -= 1 invCache = sm.GetService('invCache') for item in invCache.GetInventory(const.containerHangar).List(): if cfg.IsFittableCategory(item.categoryID): if setup.has_key(item.typeID): if item.singleton: source[item.typeID].insert(0, item) else: source[item.typeID].append(item) setup[item.typeID] -= item.stacksize missing = [] for typeID in setup['modulelist']: if setup[typeID] > 0: missing.append(' %s %s' % (setup[typeID], GetTypeName(typeID))) if missing: StopCycle() msg = 'Sorry, you cannot fit your ship with this setup; The following modules are not in your possession:<br><br>' msg += '<br>'.join(missing) self.Oops('Unable to fit ship', msg) Cycle(title, 'Unfitting modules...') charges = {} for item in ship.subLocations.itervalues(): charges[item.flagID] = item unfit = [] for item in ship.GetFittedItems().itervalues(): if item.categoryID == const.categoryCharge: charges[item.flagID] = item elif self.moduleByFlag[item.flagID] != item.typeID: unfit.append(item) ids = [] for item in unfit: charge = charges.get(item.flagID, None) if charge: ids.append(charge.itemID) ids.append(item.itemID) invCache.GetInventory(const.containerHangar).MultiAdd(ids, shipID, flag=const.flagHangar) del charges del unfit del ids del item fitByTypeID = {} for slot in (const.flagLoSlot0, const.flagMedSlot0, const.flagHiSlot0): for flag in xrange(slot, slot + 8): if fit.has_key(flag): typeID = fit[flag] if fitByTypeID.has_key(typeID): fitByTypeID[typeID].append(flag) else: fitByTypeID[typeID] = [flag] total = len(fit) state = [1, False] def _fit(typeID, flags): for flag in flags: sm.GetService('loading').ProgressWnd(title, 'Fitting modules...', state[0], total) try: while source[typeID]: item = source[typeID][0] try: if item.stacksize == 1: source[typeID].pop(0) invCache.GetInventoryFromId(shipID).Add(item.itemID, item.locationID, qty=1, flag=flag) state[0] += 1 break except: pass except: state[1] = True break parallelCalls = [] for typeID, flags in fitByTypeID.iteritems(): parallelCalls.append((_fit, (typeID, flags))) StopCycle() try: uthread.parallel(parallelCalls) except: pass if state[1]: StopCycle() self.Oops('There was a problem...', 'Your hangar inventory changed while fitting the ship, one or more required modules are locked or no longer within your reach.<br>The fitting operation has been aborted.') sm.GetService('loading').ProgressWnd(title, 'Done', 1, 1)
def FitUsingHangar(self, shipID): if shipID != util.GetActiveShip(): self.Oops('Oops', 'You cannot fit ships other than your active one.') dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() ship = dogmaLocation.GetDogmaItem(shipID) if ship is None: self.Oops('Huh?', 'Where is your ship?') title = 'Fitting %s' % GetTypeName(self.typeID) setup = self.GetModuleInfo() Cycle(title, 'Locating required modules...') source = {} for typeID in setup['modulelist']: source[typeID] = [] fit = {} for flag, typeID in self.moduleByFlag.iteritems(): if typeID: fit[flag] = typeID for item in ship.GetFittedItems().itervalues(): if item.typeID == self.moduleByFlag[item.flagID]: if fit.has_key(item.flagID): del fit[item.flagID] else: source[typeID].append(item) if setup.has_key(item.typeID): setup[item.typeID] -= 1 invCache = sm.GetService('invCache') for item in invCache.GetInventory(const.containerHangar).List(): if cfg.IsFittableCategory(item.categoryID): if setup.has_key(item.typeID): if item.singleton: source[item.typeID].insert(0, item) else: source[item.typeID].append(item) setup[item.typeID] -= item.stacksize missing = [] for typeID in setup['modulelist']: if setup[typeID] > 0: missing.append(' %s %s' % (setup[typeID], GetTypeName(typeID))) if missing: StopCycle() msg = 'Sorry, you cannot fit your ship with this setup; The following modules are not in your possession:<br><br>' msg += '<br>'.join(missing) self.Oops('Unable to fit ship', msg) Cycle(title, 'Unfitting modules...') charges = {} for item in ship.subLocations.itervalues(): charges[item.flagID] = item unfit = [] for item in ship.GetFittedItems().itervalues(): if item.categoryID == const.categoryCharge: charges[item.flagID] = item elif self.moduleByFlag[item.flagID] != item.typeID: unfit.append(item) ids = [] for item in unfit: charge = charges.get(item.flagID, None) if charge: ids.append(charge.itemID) ids.append(item.itemID) invCache.GetInventory(const.containerHangar).MultiAdd( ids, shipID, flag=const.flagHangar) del charges del unfit del ids del item fitByTypeID = {} for slot in (const.flagLoSlot0, const.flagMedSlot0, const.flagHiSlot0): for flag in xrange(slot, slot + 8): if fit.has_key(flag): typeID = fit[flag] if fitByTypeID.has_key(typeID): fitByTypeID[typeID].append(flag) else: fitByTypeID[typeID] = [flag] total = len(fit) state = [1, False] def _fit(typeID, flags): for flag in flags: sm.GetService('loading').ProgressWnd(title, 'Fitting modules...', state[0], total) try: while source[typeID]: item = source[typeID][0] try: if item.stacksize == 1: source[typeID].pop(0) invCache.GetInventoryFromId(shipID).Add( item.itemID, item.locationID, qty=1, flag=flag) state[0] += 1 break except: pass except: state[1] = True break parallelCalls = [] for typeID, flags in fitByTypeID.iteritems(): parallelCalls.append((_fit, (typeID, flags))) StopCycle() try: uthread.parallel(parallelCalls) except: pass if state[1]: StopCycle() self.Oops( 'There was a problem...', 'Your hangar inventory changed while fitting the ship, one or more required modules are locked or no longer within your reach.<br>The fitting operation has been aborted.' ) sm.GetService('loading').ProgressWnd(title, 'Done', 1, 1)
def DoOnline(self, shipID = None): if CFG_USEONLINE: if eve.session.role & ROLE_GML: sm.RemoteSvc('slash').SlashCmd('/online me') return roles = 'ROLE_GML or ROLE_HEALSELF' else: roles = 'ROLE_HEALSELF' if shipID is None: shipID = util.GetActiveShip() if shipID is None: return dogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() ship = dogmaLocation.GetDogmaItem(shipID) onlined = 0 offlinemods = [] if eve.session.stationid: title = 'Turbo Power Up' else: if not eve.session.role & ROLE_HEALSELF: sm.GetService('gameui').MessageBox('To use this function in space, you need %s.' % roles, 'Function not available', buttons=uiconst.OK, icon=triui.INFO) return title = 'Power up' c = 0 for slot in (const.flagLoSlot0, const.flagMedSlot0, const.flagHiSlot0): for flag in xrange(slot + 7, slot - 1, -1): c += 1 Progress(title, 'Checking for offline modules...', c, 24) for module in ship.GetFittedItems().itervalues(): if module.flagID == flag and module.categoryID is not const.categoryCharge: if not module.IsOnline(): offlinemods.append(module) break def ONLINE(state, control): try: dogmaLocation.OnlineModule(control.itemID) except: pass state[0] += 1 Progress(title, 'Activating module %s of %s' % (state[0], state[1]), state[0], state[1]) offlinemodcount = len(offlinemods) if offlinemodcount > 0: state = [0, offlinemodcount] w = sm.RemoteSvc('slash') if eve.session.stationid: parallelCalls = [] for control in offlinemods: parallelCalls.append((ONLINE, (state, control))) uthread.parallel(parallelCalls) else: for control in offlinemods: w.SlashCmd('/heal me capac=1') ONLINE(state, control) w.SlashCmd('/heal me capac=1') Progress(title, 'Done', 1, 1) return offlinemodcount
def __call__(self, *args, **kwargs): if not isinstance(self._nodes, (list, set, tuple)): return self._CallNode(self._nodes, *args, **kwargs) calls = [ (self._CallNode, [nodeID] + list(args), kwargs) for nodeID in self._nodes ] return uthread.parallel(calls)
def CompleteJobs(self, jobs): uthread.parallel([ (self.CompleteJob, (jobID,)) for jobID in jobs ])
def LoadNotesData(self): notes = sm.RemoteSvc('charMgr').GetOwnerNoteLabels() folders = [] self.folderIDs = [] badNotes = [ note for note in notes if note.label[0] not in ('I', 'B', 'N', 'S') ] bms = sm.GetService('bookmarkSvc').GetBookmarks() for entry in notes: if entry.label[0] in ('I', 'B', 'N') and entry.label[1] == ':': n = util.KeyVal() n.noteID = entry.noteID n.text = None if entry.label[0] == 'N': n.label = entry.label[2:] self.notes['N:' + str(entry.noteID)] = n elif entry.label[0] == 'B': n.bookmarkID = entry.label[2:] if int(n.bookmarkID) in bms: self.bookmarknotes['B:' + str(n.bookmarkID)] = n else: badNotes.append(entry) if entry.label.startswith('S:'): label = entry.label[2:] if self.settings.has_key(label): self.settings[label].append(entry.noteID) else: self.settings[label] = [entry.noteID] parallelCalls = [] for note in badNotes: parallelCalls.append( (sm.RemoteSvc('charMgr').RemoveOwnerNote, (note.noteID, ))) if len(parallelCalls): uthread.parallel(parallelCalls) folders = self.GetSetting('Folders') if folders is not None: for entry in folders.split('|'): tmp = entry.split('::') if len(tmp) != 4: continue id, _type, parentID, label = tmp n = util.KeyVal() n.type = _type if parentID == 'None': parentID = 0 n.parent = int(parentID) n.data = label self.folders[int(id)] = n self.lastid = max(self.lastid, int(id)) else: n = util.KeyVal() n.type = 'F' n.parent = 0 n.data = localization.GetByLabel('UI/Notepad/Main') self.folders[1] = n self.lastid = 1 self.starting = 0 self.LoadNotes() self.sr.autosaveTimer = base.AutoTimer(60000, self.SaveNote) self.activeNode = None self.ShowNote(settings.char.notepad.Get('activeNote', None))
def _SetupComponents(self, entity, initData=None): """ Called when all the components have been added to the entity for creation """ entityAlreadyThere = entity.scene.entities.get(entity.entityID, None) if entityAlreadyThere: if session.charid and entity.entityID == session.charid: self.LogInfo( 'Double add of player entity because of playercomponent ack stuff' ) else: errorText = 'Adding a entity ' + str( entity ) + ' that already in this scene. This one was here before ' + str( entityAlreadyThere) + ' Ignoring entity' log.LogTraceback(extraText=errorText) GameWorld.GetNetworkEntityQueueManager().ClearEntity( entity.entityID) return False with entity.entityLock: try: if entity.state == const.cef.ENTITY_STATE_UNINITIALIZED: self.loadingEntities[entity.entityID] = entity entity.state = const.cef.ENTITY_STATE_CREATING self.entitySceneManager.Prepare(entity.entityID, entity.scene.sceneID) preperationCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'PrepareComponent', None) if f: preperationCalls.append( (CEFParellelHelper, (f, (entity.scene.sceneID, entity.entityID, component)))) funcContexts.append(system.__guid__) if preperationCalls: uthread.parallel(preperationCalls, contextSuffix='PrepareComponent', funcContextSuffixes=funcContexts) setupCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'SetupComponent', None) if f: setupCalls.append( (CEFParellelHelper, (f, (entity, component)))) funcContexts.append(system.__guid__) if setupCalls: uthread.parallel(setupCalls, contextSuffix='SetupComponent', funcContextSuffixes=funcContexts) setupCalls = [] funcContexts = [] for name, component in entity.components.iteritems(): systems = self.GetComponentSystems(name) if systems: for system in systems: f = getattr(system, 'NetworkSyncComponent', None) if f: setupCalls.append( (CEFParellelHelper, (f, (entity, component)))) funcContexts.append(system.__guid__) if setupCalls: uthread.parallel(setupCalls, contextSuffix='NetworkSyncComponent', funcContextSuffixes=funcContexts) entity.scene.entities[entity.entityID] = entity else: self.LogError( 'SetupComponents: Entity state should be', const.cef.ENTITY_STATE_NAMES[ const.cef.ENTITY_STATE_UNINITIALIZED], ', is instead ', const.cef.ENTITY_STATE_NAMES[entity.state], '. Entity is:', str(entity)) except Exception as e: self._deadEntityList[entity.entityID] = entity log.LogException(e) return False return True
def GrayOutItem(self, item): animateCall = lambda cont: uicore.animations.MorphScalar(cont, attrName='saturation', startVal=1.0, endVal=0.0, duration=0.3, sleep=True) uthread.parallel([(animateCall, (item.icon,)), (animateCall, (item.techIcon,))])
def __call__(self, *args, **kwargs): if not isinstance(self._nodes, (list, set, tuple)): return self._CallNode(self._nodes, *args, **kwargs) calls = [(self._CallNode, [nodeID] + list(args), kwargs) for nodeID in self._nodes] return uthread.parallel(calls)
def LoadNotesData(self): notes = sm.RemoteSvc('charMgr').GetOwnerNoteLabels() folders = [] self.folderIDs = [] badNotes = [ note for note in notes if note.label[0] not in ('I', 'B', 'N', 'S') ] bms = sm.GetService('bookmarkSvc').GetBookmarks() for entry in notes: if entry.label[0] in ('I', 'B', 'N') and entry.label[1] == ':': n = util.KeyVal() n.noteID = entry.noteID n.text = None if entry.label[0] == 'N': n.label = entry.label[2:] self.notes['N:' + str(entry.noteID)] = n elif entry.label[0] == 'B': n.bookmarkID = entry.label[2:] if int(n.bookmarkID) in bms: self.bookmarknotes['B:' + str(n.bookmarkID)] = n else: badNotes.append(entry) if entry.label.startswith('S:'): label = entry.label[2:] if self.settings.has_key(label): self.settings[label].append(entry.noteID) else: self.settings[label] = [entry.noteID] parallelCalls = [] for note in badNotes: parallelCalls.append((sm.RemoteSvc('charMgr').RemoveOwnerNote, (note.noteID,))) if len(parallelCalls): uthread.parallel(parallelCalls) folders = self.GetSetting('Folders') if folders is not None: for entry in folders.split('|'): tmp = entry.split('::') if len(tmp) != 4: continue id, _type, parentID, label = tmp n = util.KeyVal() n.type = _type if parentID == 'None': parentID = 0 n.parent = int(parentID) n.data = label self.folders[int(id)] = n self.lastid = max(self.lastid, int(id)) else: n = util.KeyVal() n.type = 'F' n.parent = 0 n.data = localization.GetByLabel('UI/Notepad/Main') self.folders[1] = n self.lastid = 1 self.starting = 0 self.LoadNotes() self.sr.autosaveTimer = base.AutoTimer(60000, self.SaveNote) self.activeNode = None self.ShowNote(settings.char.notepad.Get('activeNote', None))
def GetSolarsystemItems(self, solarsystemID): local, playerStations = uthread.parallel([(cfg.GetLocationsLocalBySystem, (solarsystemID,)), (sm.RemoteSvc('config').GetDynamicCelestials, (solarsystemID,))], contextSuffix='GetSolarsystemItems') for station in playerStations: local.InsertNew(station) return local