def SetBuiltStructureGraphics(self, animate=0): safeModel = self.model self.LoadStationModel(False) cameraSvc = self.sm.GetService('camera') cameraSvc.ClearBoundingInfoForID(self.id) if cameraSvc.LookingAt() == self.id: cameraSvc.LookAt(self.id) if animate == 1: self.Assemble() self.buildAnim.scale = 1.0 self.buildAnim.Play() self.Display(1) else: self.buildAnim.Stop() self.buildAnim.scale = 0.0 self.buildAnim.scaledTime = self.buildAnim.GetMaxCurveDuration() self.buildAnim.PlayFrom(self.buildAnim.scaledTime) self.DelayedRemove(safeModel, 0) if animate == 1: if self.IsControlTower(): self.PlayGeneralAudioEvent('wise:/msg_ct_assembly_play') else: self.PlayGeneralAudioEvent('wise:/msg_pos_assembly_play') uthread.pool('PlayerOwnedStructure::DelayedRemove', self.DelayedRemove, safeModel, 35000)
def OnSlimItemUpdated(self, newItem): self.typeData['slimItem'] = newItem if self.wormholeSize != newItem.wormholeSize: self.LogInfo('Wormhole size has changed. Updating graphics') uthread.pool('wormhole:SetWormholeSize', self.SetWormholeSize, newItem.wormholeSize) if self.wormholeAge != newItem.wormholeAge: self.SetWobbleSpeed()
def OrderByTypeID(self, orderlist): for each in orderlist: if len(each) == 4: typeID, wnd, size, itemID = each blueprint = BLUEPRINT_NONE else: typeID, wnd, size, itemID, blueprint = each if uicore.desktop.dpiScaling > 1.0: size = size * 2 if wnd is None or wnd.destroyed: orderlist.remove(each) continue foundPath = self.ExistsInCacheOrRenders(typeID, size, itemID, blueprint) if foundPath: wnd.LoadTexture(foundPath) orderlist.remove(each) continue wnd.LoadTexture('res:/UI/Texture/notavailable.dds') for each in orderlist: self.byTypeIDQue.append(each) if not self.byTypeID_IsRunning: uthread.pool('photo::OrderByTypeID', self.ProduceTypeIDs) self.byTypeID_IsRunning = 1
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
def OnTargetByOther(self, otherID): sm.GetService("state").SetState(otherID, state.threatTargetsMe, 1) if otherID in self.targetedBy: self.LogError("already targeted by", otherID) else: self.targetedBy.append(otherID) bp = sm.GetService("michelle").GetBallpark() if bp is not None: slimItem = bp.GetInvItem(otherID) if slimItem is not None: if slimItem.ownerID: self.ownerToShipIDCache[slimItem.ownerID] = otherID if bp is None or slimItem is None: if otherID not in self.pendingTargeters: self.pendingTargeters.append(otherID) return if otherID in self.pendingTargeters: self.pendingTargeters.remove(otherID) tgts = self.GetTargets().keys() + self.targeting.keys() if ( otherID != eve.session.shipid and otherID not in tgts and otherID not in self.autoTargeting and min( settings.user.ui.Get("autoTargetBack", 1), sm.GetService("godma").GetItem(session.charid).maxLockedTargets, sm.GetService("godma").GetItem(session.shipid).maxLockedTargets, ) > len(tgts) ): if len(self.autoTargeting) < settings.user.ui.Get("autoTargetBack", 1): self.autoTargeting.append(otherID) uthread.pool("TargetManages::OnTargetByOther-->LockTarget", self.LockTarget, otherID, autotargeting=1)
def SaveNote(self, *args): if self.destroyed: self.sr.autosaveTimer = None return if getattr(self, 'activeNode', None) is not None: t, id = self.activeNode.split(':') txt = self.sr.browser.GetValue() if len(txt) >= 3900: return not eve.Message('NoteTooLong', {'total': len(txt)}, uiconst.YESNO) == uiconst.ID_YES if t == 'I': uthread.pool('notepad::SetNote', sm.RemoteSvc('charMgr').SetNote, int(id), txt) if t == 'B': if 'B:' + str( id) not in self.bookmarknotes or self.bookmarknotes[ 'B:' + str(id)].text != txt: if 'B:' + str(id) in self.bookmarknotes: self.bookmarknotes['B:' + str(id)].text = txt sm.GetService('addressbook').UpdateBookmark(int(id), note=txt) if t == 'N': if 'N:' + str(id) in self.notes and self.notes[ 'N:' + str(id)].text != txt: self.notes['N:' + str(id)].text = txt uthread.pool('notepad::SetNote', sm.RemoteSvc('charMgr').EditOwnerNote, int(id), 'N:' + self.notes['N:' + str(id)].label, txt) return True
def updateWeapons(self): if self.disabled: self.__updateTimer = None return weaponModules = findModules(groupNames=WeaponGroupNames) for moduleID, module in weaponModules.items(): if hasattr(module, "ChangeAmmo"): self.ensureModuleHooked(module) canActivate = canActivateModule(module)[0] canDeactivate = canDeactivateModule(module)[0] currentTarget = self.__activeModules.get(moduleID, None) if currentTarget: isActive = isModuleActive(module) if isActive == False: del self.__activeModules[moduleID] currentTarget = None if (((currentTarget is not None) and canDeactivate) or canActivate): uthread.pool("DoUpdateModule", self.doUpdateModule, moduleID, module, currentTarget)
def Init(self): if getattr(self, 'vivoxStatus', vivoxConstants.VIVOX_NONE) != vivoxConstants.VIVOX_NONE: self.LogInfo('Init vivoxStatus was: ', self.vivoxStatus) return if boot.region == 'optic': self.LogInfo('Vivox is not supported in optic') self.vivoxStatus = vivoxConstants.VIVOX_OPTIC return if not self.Enabled(): self.LogInfo('Vivox has been disabled in settings') return if not self.subscriber: self.LogWarn( 'This character is not voice enabled on the server, this might be related to a server-side error.' ) return userid = session.userid self.charid = session.charid self.vivoxStatus = vivoxConstants.VIVOX_INITIALIZING self.password = self.voiceMgr.GetPassword() self.vivoxServer = self.voiceMgr.GetServer() self.LogNotice('Using VivoxServer', self.vivoxServer) hashValue = hashlib.md5(str(userid) + str(self.charid)) self.vivoxUserName = str(self.charid) + 'U' + hashValue.hexdigest() self.LogInfo('Init vivoxStatus was: ', self.vivoxStatus) self.connector = vivox.Connector() self.connector.callback = self self.LogInfo( 'vivoxService: Initializing application specific settings') uthread.pool('vivox::Init', self._Init)
def AppAddToACL(self, vivoxChannelName): isCorpChannel = const.vcPrefixCorp in vivoxChannelName isAllianceChannel = const.vcPrefixAlliance in vivoxChannelName isFleetChannel = False for each in [const.vcPrefixFleet]: if each in vivoxChannelName: isFleetChannel = True prefixLen = len(each) break success = False if isCorpChannel: success = moniker.GetCorpRegistry().AddToVoiceChat( vivoxChannelName) elif isAllianceChannel: success = moniker.GetAlliance().AddToVoiceChat(vivoxChannelName) elif isFleetChannel: fleetid = vivoxChannelName[prefixLen:] success = moniker.GetFleet(fleetid).AddToVoiceChat( vivoxChannelName) if success: uthread.pool('vivox::JoinChannel', self._JoinChannel, vivoxChannelName) else: self.LogError('Could not add voice chat user to ACL.')
def JoinChannel(self, channelID, suppress=False, persist=True): """ Joins a voice chat channel channel after requesting its URI from the server. If the channel does not exist yet, the server will create it. By default the created channel will be persistant, which may not be desired in all cases - for example when creating a private chat conversation between two players. In that case we have to explicitely set the persist parameter to false. """ if not self.Enabled(): if suppress: return if not self.Enabled(): raise UserError('VoiceNotEnabledInSettings') else: raise UserError('VoiceNotEnabled') self.LogInfo('JoinChannel', channelID) if not self.LoggedIn(): if self.vivoxLoginState != vivoxConstants.VXCLOGINSTATE_LOGGINGIN: if channelID not in self.autoJoinQueue: self.autoJoinQueue.append(channelID) self.LogInfo('Not logged in calling login') self.Login() return if self.members.has_key('Echo') and channelID != 'Echo': self.LeaveEchoChannel() if self.AppCanJoinChannel(channelID, suppress): uthread.pool('vivox::JoinChannel', self._JoinChannel, self.GetVivoxChannelName(channelID))
def AppSetSpeakingChannel(self, eveChannelID): self.LogInfo('SetSpeakingChannel(', eveChannelID, ')') vivoxChannelName = self.GetVivoxChannelName(eveChannelID) isMuted = sm.GetService('fleet').IsVoiceMuted(eveChannelID) if self.IsVoiceChannel( eveChannelID ) and isMuted == False and not self.gaggedAt.has_key(vivoxChannelName): if self.speakingChannel: if self.IsVoiceChannel( self.GetCcpChannelName(self.speakingChannel)): self.SetTabColor(self.speakingChannel, 'listen') else: self.SetTabColor(self.speakingChannel, None) uthread.pool('vivox::SetSpeakingChannel', self._SetSpeakingChannel, self.GetVivoxChannelName(eveChannelID), self.speakingChannel) self.speakingChannel = self.GetVivoxChannelName(eveChannelID) if eveChannelID == 'Echo': return self.SetTabColor(self.speakingChannel, 'speak') elif eveChannelID is None and self.speakingChannel: self.SetTabColor(self.speakingChannel, 'listen') uthread.pool('vivox::SetSpeakingChannel', self._SetSpeakingChannel, 'muted', self.speakingChannel) self.speakingChannel = None elif sm.GetService('fleet').IsVoiceMuted( eveChannelID) or self.gaggedAt.has_key(vivoxChannelName): eve.Message( 'CustomNotify', {'notify': localization.GetByLabel('UI/Voice/MutedInChannel')})
def PostStopEffectAction(self, effectID, dogmaItem, activationInfo, *args): dogmax.BaseDogmaLocation.PostStopEffectAction(self, effectID, dogmaItem, activationInfo, *args) if effectID == const.effectOnline: shipID = dogmaItem.locationID if shipID not in self.checkShipOnlineModulesPending: self.checkShipOnlineModulesPending.add(shipID) uthread.pool('LocationManager::CheckShipOnlineModules', self.CheckShipOnlineModules, shipID)
def ShowInRangeTab(self): if not util.GetActiveShip(): return None if self.sr.Get('showing', '') != 'inrange': self.sr.scroll.Load(contentList=[], noContentHint=localization.GetByLabel('UI/CapitalNavigation/CapitalNavigationWindow/CalculatingStellarDistancesMessage')) uthread.pool('form.CapitalNav::ShowInRangeTab', self.GetSolarSystemsInRange_thread, session.solarsystemid2) self.sr.showing = 'inrange'
def OnComboChange(self, entry, header, value, *args): if self.sr.Get('data'): if entry.name == 'eventType': self.sr.data[4] = value self.sr.data[0] = None self.page = 0 uthread.pool('standing::OnComboChange', self.Load, self.sr.data[1], self.sr.data[2])
def JoinEchoChannel(self): self.LogInfo('JoinEchoChannel') if self.LoggedIn(): if len(self.members.keys()) == 0: if self.connector.ChannelJoinInProgressCount( ) == 0 and self.echo == False: self.echo = True uthread.pool('vivox::JoinChannel', self._JoinEchoChannel) return elif self.vivoxLoginState != vivoxConstants.VXCLOGINSTATE_LOGGINGIN: self.autoJoinQueue = ['Echo'] self.LogInfo('Not logged in calling login') self.Login() return if 'Echo' in self.members: self.LeaveEchoChannel() return if self.AppCanJoinEchoChannel(): for channel in self.members.keys(): self._LeaveChannel(channel) if 'Echo' not in self.autoJoinQueue: self.autoJoinQueue = ['Echo'] else: self.LogError( 'Wait a second, I already have the echo channel in my autoJoinQueue!' ) else: sm.ScatterEvent('OnEchoChannel', False)
def updateWeapons(self): if self.disabled: self.__updateTimer = None return weaponModules = findModules(groupNames=WeaponGroupNames) for moduleID, module in weaponModules.items(): if hasattr(module, "ChangeAmmo"): self.ensureModuleHooked(module) canActivate = canActivateModule(module)[0] canDeactivate = canDeactivateModule(module)[0] currentTarget = self.__activeModules.get(moduleID, None) if currentTarget: isActive = isModuleActive(module) if isActive == False: del self.__activeModules[moduleID] currentTarget = None if ( ((currentTarget is not None) and canDeactivate) or canActivate ): uthread.pool("DoUpdateModule", self.doUpdateModule, moduleID, module, currentTarget)
def DoBallRemove(self, ball, slimItem, terminal): if ball.id in self.scans: del self.scans[ball.id] if not self.isSettingEntries: self.isSettingEntries = True uthread.pool('SurveyScanSvc::SetEntriesDelayed', self.SetEntriesDelayed)
def Init(self): if getattr(self, 'vivoxStatus', vivoxConstants.VIVOX_NONE) != vivoxConstants.VIVOX_NONE: self.LogInfo('Init vivoxStatus was: ', self.vivoxStatus) return if boot.region == 'optic': self.LogInfo('Vivox is not supported in optic') self.vivoxStatus = vivoxConstants.VIVOX_OPTIC return if not self.Enabled(): self.LogInfo('Vivox has been disabled in settings') return if not self.subscriber: self.LogWarn('This character is not voice enabled on the server, this might be related to a server-side error.') return userid = session.userid self.charid = session.charid self.vivoxStatus = vivoxConstants.VIVOX_INITIALIZING self.password = self.voiceMgr.GetPassword() self.vivoxServer = self.voiceMgr.GetServer() self.LogNotice('Using VivoxServer', self.vivoxServer) hashValue = hashlib.md5(str(userid) + str(self.charid)) self.vivoxUserName = str(self.charid) + 'U' + hashValue.hexdigest() self.LogInfo('Init vivoxStatus was: ', self.vivoxStatus) self.connector = vivox.Connector() self.connector.callback = self self.LogInfo('vivoxService: Initializing application specific settings') uthread.pool('vivox::Init', self._Init)
def _mainThreadQueueFunc(): import blue import uthread global MainThreadQueueRunning, MainThreadQueue, MainThreadQueueInvoker, MainThreadQueueInterval, MainThreadQueueItemDelay MainThreadQueueInvoker = None MainThreadQueueRunning = True while MainThreadQueueRunning: item = None if len(MainThreadQueue): item = MainThreadQueue.pop(0) if item: fn, args, kwargs = item def invoker(): try: fn(*args, **kwargs) except Exception: showException() uthread.pool("MTQ", invoker) blue.pyos.synchro.Sleep(MainThreadQueueItemDelay) else: blue.pyos.synchro.Sleep(MainThreadQueueInterval)
def JoinEchoChannel(self): self.LogInfo('JoinEchoChannel') if self.LoggedIn(): if len(self.members.keys()) == 0: if self.connector.ChannelJoinInProgressCount() == 0 and self.echo == False: self.echo = True uthread.pool('vivox::JoinChannel', self._JoinEchoChannel) return elif self.vivoxLoginState != vivoxConstants.VXCLOGINSTATE_LOGGINGIN: self.autoJoinQueue = ['Echo'] self.LogInfo('Not logged in calling login') self.Login() return if 'Echo' in self.members: self.LeaveEchoChannel() return if self.AppCanJoinEchoChannel(): for channel in self.members.keys(): self._LeaveChannel(channel) if 'Echo' not in self.autoJoinQueue: self.autoJoinQueue = ['Echo'] else: self.LogError('Wait a second, I already have the echo channel in my autoJoinQueue!') else: sm.ScatterEvent('OnEchoChannel', False)
def _HandleSessionChangeInSpace(self, isRemote, session, change, viewSvc): if 'solarsystemid' in change: oldSolarSystemID, newSolarSystemID = change['solarsystemid'] if oldSolarSystemID: sm.GetService('FxSequencer').ClearAll() self.LogInfo('Cleared effects') sm.GetService('camera').ClearCameraParent() self.LogNotice('GameUI::OnSessionChanged, Heading for inflight', isRemote, session, change) activateViewFunc = self._GetActivateViewFunction(viewSvc) uthread.pool('GameUI::ChangePrimaryView::inflight', activateViewFunc, 'inflight', change=change) elif 'shipid' in change and change['shipid'][1] is not None: michelle = sm.GetService('michelle') bp = michelle.GetBallpark() if bp: if change['shipid'][0]: self.KillCargoView(change['shipid'][0]) uthread.new(sm.GetService('target').ClearTargets) if session.shipid in bp.balls: self.LogInfo('Changing ego:', bp.ego, '->', session.shipid) bp.ego = session.shipid self.OnNewState(bp) else: self.LogInfo('Postponing ego:', bp.ego, '->', session.shipid) self.wannaBeEgo = session.shipid
def GetAvailableVoiceFonts(self): if self.LoggedIn(): if self.voiceFontList is None: self.LogInfo('Requesting Voice Fonts from server') uthread.pool('vivox::GetAvailableVoiceFontseve', self._GetAvailableVoiceFonts) else: sm.ScatterEvent('OnVoiceFontsReceived', self.voiceFontList)
def RequestReset(self): self.validState = False if self.hideDesyncSymptoms: self.FlushSimulationHistory(newBaseSnapshot=False) else: self.RebaseStates(1) uthread.pool('michelle::UpdateStateRequest', self.remoteBallpark.UpdateStateRequest)
def OnSessionReconnect(self): if self.LoggedIn(): if settings.user.audio.Get('talkBinding', 4): self.EnableGlobalPushToTalkMode('talk') setattr(self, 'userSessionDisconnected', 0) for each in self.members.keys(): uthread.pool('vivox::OnSessionReconnect', self.SetChannelOutputVolume, each, vivoxConstants.VXVOLUME_DEFAULT)
def _OnJoinedChannel(self, channelName = 0): self.LogInfo('_OnJoinedChannel channelName', channelName) self.members[channelName] = [] if channelName == 'Echo': sm.ScatterEvent('OnEchoChannel', True) self.SetSpeakingChannel('Echo') return eveChannelName = self.GetCcpChannelName(channelName) uthread.new(self.voiceMgr.LogChannelJoined, channelName).context = 'vivoxService::_OnJoinChannel::LogChannelJoined' eve.Message('CustomNotify', {'notify': localization.GetByLabel('UI/Voice/JoinedChannel', channel=self.GetPrettyChannelName(eveChannelName))}) isRestrictedFleetChannel = False for each in [const.vcPrefixFleet, const.vcPrefixSquad, const.vcPrefixWing]: if each in channelName: if sm.GetService('fleet').GetChannelMuteStatus(eveChannelName) == True: exclusionList = sm.GetService('fleet').GetExclusionList() if exclusionList.has_key(eveChannelName) == False: isRestrictedFleetChannel = True elif exclusionList.has_key(eveChannelName) and session.charid not in exclusionList[eveChannelName]: isRestrictedFleetChannel = True self.SetTabColor(channelName, 'listen') sm.ScatterEvent('OnVoiceChannelJoined', eveChannelName) if self.speakingChannel is None and isRestrictedFleetChannel == False: self.SetSpeakingChannel(eveChannelName) uthread.pool('vivox::_OnJoinedChannel', self.GetParticipants, channelName)
def Setup(self, moduleinfo): targetContainer = uiprimitives.Container(name='targetCont', align=uiconst.TOPLEFT, parent=self, top=0, height=64, width=64) slot = DefenceModuleButton(parent=targetContainer, idx=0) self.sr.targetIcon = uiutil.GetChild(targetContainer, 'iconSprite') self.sr.targetContainer = targetContainer self.sr.targetContainer.state = uiconst.UI_DISABLED sourceContainer = uiprimitives.Container(name='sourceCont', align=uiconst.TOPLEFT, parent=self, top=targetContainer.height + 22, height=64, width=64) slot = DefenceModuleButton(parent=sourceContainer, idx=0) self.sr.sourceIcon = uiutil.GetChild(sourceContainer, 'iconSprite') self.sr.sourceIcon.state = uiconst.UI_DISABLED self.sr.glow = uiutil.GetChild(sourceContainer, 'glow') self.sr.busy = uiutil.GetChild(sourceContainer, 'busy') self.sr.quantityParent = uiutil.GetChild(sourceContainer, 'quantityParent') self.sr.quantityParent.left = 8 self.sr.quantityParent.width = 28 idx = self.parent.children.index(self) fill = uiprimitives.Fill(parent=self, color=(1.0, 1.0, 1.0, 0.125), state=uiconst.UI_HIDDEN, idx=idx) self.sr.hilite = fill self.sr.sourceContainer = sourceContainer self.sr.sourceContainer.state = uiconst.UI_DISABLED chargeIcon = uicontrols.Icon(parent=sourceContainer, align=uiconst.RELATIVE, top=32, left=6, size=24, idx=0, state=uiconst.UI_HIDDEN, ignoreSize=True) self.sr.chargeIcon = chargeIcon if not len(self.__cgattrs__): self.__cgattrs__.extend([ a.attributeID for a in cfg.dgmattribs if cgre.match(a.attributeName) is not None ]) self.sr.typeID = moduleinfo.typeID self.moduleinfo = moduleinfo self.locationFlag = moduleinfo.flagID self.sr.sourceID = moduleinfo.itemID self.id = moduleinfo.itemID self.sr.glow.z = 0 self.sr.qtylabel = uicontrols.Label(text='', parent=self.sr.quantityParent, width=30, state=uiconst.UI_DISABLED, idx=0, fontsize=9) self.sr.distancelabel = uicontrols.EveHeaderSmall(text='', parent=self.sr.targetContainer, left=12, top=-16, width=70, state=uiconst.UI_DISABLED, idx=0) if cfg.IsChargeCompatible(moduleinfo): self.invCookie = sm.GetService('inv').Register(self) self.SetCharge(None) for key in moduleinfo.effects.iterkeys(): effect = moduleinfo.effects[key] if self.IsEffectActivatible(effect): self.def_effect = effect if effect.isActive: self.SetActive() if effect.effectName == 'online': if effect.isActive: self.ShowOnline() else: self.ShowOffline() self.state = uiconst.UI_NORMAL currentTarget = self.GetCurrentTarget() if currentTarget is not None: uthread.pool('DefenceMobuleButton::OnTargetAdded::', self.OnTargetAdded, currentTarget) self.sr.sourceUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'source') self.UpdateData('source') self.sr.targetUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'target') self.UpdateData('target') self.UpdateDistance() self.sr.distanceUpdateTimer = base.AutoTimer(random.randint(5000, 6000), self.UpdateDistance) self.EnableDrag() uthread.new(self.BlinkIcon)
def Setup(self, moduleinfo): targetContainer = uiprimitives.Container(name='targetCont', align=uiconst.TOPLEFT, parent=self, top=0, height=64, width=64) slot = DefenceModuleButton(parent=targetContainer, idx=0) self.sr.targetIcon = uiutil.GetChild(targetContainer, 'iconSprite') self.sr.targetContainer = targetContainer self.sr.targetContainer.state = uiconst.UI_DISABLED sourceContainer = uiprimitives.Container(name='sourceCont', align=uiconst.TOPLEFT, parent=self, top=targetContainer.height + 22, height=64, width=64) slot = DefenceModuleButton(parent=sourceContainer, idx=0) self.sr.sourceIcon = uiutil.GetChild(sourceContainer, 'iconSprite') self.sr.sourceIcon.state = uiconst.UI_DISABLED self.sr.glow = uiutil.GetChild(sourceContainer, 'glow') self.sr.busy = uiutil.GetChild(sourceContainer, 'busy') self.sr.quantityParent = uiutil.GetChild(sourceContainer, 'quantityParent') self.sr.quantityParent.left = 8 self.sr.quantityParent.width = 28 idx = self.parent.children.index(self) fill = uiprimitives.Fill(parent=self, color=(1.0, 1.0, 1.0, 0.125), state=uiconst.UI_HIDDEN, idx=idx) self.sr.hilite = fill self.sr.sourceContainer = sourceContainer self.sr.sourceContainer.state = uiconst.UI_DISABLED chargeIcon = uicontrols.Icon(parent=sourceContainer, align=uiconst.RELATIVE, top=32, left=6, size=24, idx=0, state=uiconst.UI_HIDDEN, ignoreSize=True) self.sr.chargeIcon = chargeIcon if not len(self.__cgattrs__): self.__cgattrs__.extend([ a.attributeID for a in cfg.dgmattribs if cgre.match(a.attributeName) is not None ]) self.sr.typeID = moduleinfo.typeID self.sr.moduleInfo = moduleinfo self.locationFlag = moduleinfo.flagID self.sr.sourceID = moduleinfo.itemID self.id = moduleinfo.itemID self.sr.glow.z = 0 self.sr.qtylabel = uicontrols.Label(text='', parent=self.sr.quantityParent, width=30, state=uiconst.UI_DISABLED, idx=0, fontsize=9) self.sr.distancelabel = uicontrols.EveHeaderSmall(text='', parent=self.sr.targetContainer, left=12, top=-16, width=70, state=uiconst.UI_DISABLED, idx=0) if cfg.IsChargeCompatible(moduleinfo): self.invCookie = sm.GetService('inv').Register(self) self.SetCharge(None) for key in moduleinfo.effects.iterkeys(): effect = moduleinfo.effects[key] if self.IsEffectActivatible(effect): self.def_effect = effect if effect.isActive: self.SetActive() if effect.effectName == 'online': if effect.isActive: self.ShowOnline() else: self.ShowOffline() self.state = uiconst.UI_NORMAL currentTarget = self.GetCurrentTarget() if currentTarget is not None: uthread.pool('DefenceMobuleButton::OnTargetAdded::', self.OnTargetAdded, currentTarget) self.sr.sourceUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'source') self.UpdateData('source') self.sr.targetUpdateTimer = base.AutoTimer(random.randint(750, 1000), self.UpdateData, 'target') self.UpdateData('target') self.UpdateDistance() self.sr.distanceUpdateTimer = base.AutoTimer(random.randint(5000, 6000), self.UpdateDistance) self.EnableDrag() uthread.new(self.BlinkIcon)
def MouseEnter(self, *args): if self.destroyed or sm.GetService('godma').GetItem(self.sr.moduleInfo.itemID) is None: return log.LogInfo('Module.OnMouseEnter', self.sr.sourceID) eve.Message('NeocomButtonEnter') self.ShowAccuracy() self.sr.accuracyTimer = base.AutoTimer(1000, self.ShowAccuracy) uthread.pool('ShipMobuleButton::OnMouseEnter-->UpdateTargetingRanges', sm.GetService('tactical').UpdateTargetingRanges, self.sr.moduleInfo)
def OnMouseEnter(self, *args): if self is None or self.destroyed or self.parent is None or self.parent.destroyed: return if not self.blockDisable and not uicore.cmd.IsUIHidden(): uicore.layer.main.state = uiconst.UI_PICKCHILDREN if sm.IsServiceRunning('tactical'): uthread.pool('InflightNav::MouseEnter --> ResetTargetingRanges', sm.GetService('tactical').ResetTargetingRanges) uiutil.SetOrder(self, -1)
def StopChannelPriority(self): self.LogInfo('StopChannelPriority') self.wingSpeakerCount = {} self.fleetSpeakerCount = {} for each in self.members.keys(): uthread.pool('vivox::StopChannelPriority', self.SetChannelOutputVolume, each, vivoxConstants.VXVOLUME_DEFAULT)
def OnMultiSelect(self, itemIDs): self.itemIDs = itemIDs self.lastActionSerial = None self.lastActionDist = None self.lastBountyCheck = None self.bounty = None if self.ImVisible(): uthread.pool('ActiveItem::UpdateAll', self.UpdateAll, 1)
def OnSessionDisconnect(self): if self.LoggedIn(): self.DisableGlobalPushToTalkMode() setattr(self, 'userSessionDisconnected', 1) for each in self.members.keys(): uthread.pool('vivox::OnSessionDisconnect', self.SetChannelOutputVolume, each, vivoxConstants.VXVOLUME_OFF)
def OnSlimItemChange(self, oldItem, newItem): if oldItem.itemID != self.id: return if oldItem.wormholeSize != newItem.wormholeSize: self.LogInfo('Wormhole size has changed. Updating graphics') uthread.pool('wormhole:SetWormholeSize', self.SetWormholeSize, oldItem.wormholeSize, newItem.wormholeSize) if oldItem.wormholeAge != newItem.wormholeAge: self.SetWobbleSpeed()
def LoadNextView(self): while sm.GetService('viewState').HasActiveTransition(): blue.pyos.synchro.SleepWallclock(500) if sm.GetService('cc').GetCharactersToSelect(): uthread.pool('viewState::ActivateView::charsel', sm.GetService('viewState').ActivateView, 'charsel') else: uthread.pool('viewState::ActivateView::charsel', sm.GetService('viewState').ActivateView, 'charactercreation')
def StopIntro(self): settings.public.generic.Set('showintro2', 0) if sm.GetService('cc').GetCharactersToSelect(): uthread.pool('viewState::ActivateView::charsel', sm.GetService('viewState').ActivateView, 'charsel') else: uthread.pool('viewState::ActivateView::charsel', sm.GetService('viewState').ActivateView, 'charactercreation')
def ShowInRangeTab(self): if not util.GetActiveShip(): return if self.sr.Get('showing', '') != 'inrange': cache = sm.GetService('map').GetMapCache() current = cache['items'].get(session.solarsystemid2, None) self.sr.scroll.Load(contentList=[], noContentHint=localization.GetByLabel('UI/CapitalNavigation/CapitalNavigationWindow/CalculatingStellarDistancesMessage')) uthread.pool('form.CapitalNav::ShowInRangeTab', self.GetSolarSystemsInRange_thread, current, cache['items']) self.sr.showing = 'inrange'
def FailedJoinChannel(self, errorCode, errorMessage, channelName): if errorCode in (vivoxConstants.VX_NOTONACL, vivoxConstants.VX_ACCESSDENIED, vivoxConstants.VX_NOTFOUND): if channelName not in self.addToAclQueue: self.addToAclQueue.append(channelName) uthread.pool('Vivox::FailedJoinChannel', self.AppAddToACL, channelName) return if channelName in self.autoJoinQueue: self.autoJoinQueue.remove(channelName) self.LogInfo('Failed to join channel ', channelName, errorMessage, errorCode, self.autoJoinQueue)
def OnSlimItemChange(self, oldItem, newItem): if newItem.categoryID != const.categoryStructure: return if newItem.posState == oldItem.posState and newItem.posTimestamp == oldItem.posTimestamp and newItem.controllerID == oldItem.controllerID and newItem.incapacitated == oldItem.incapacitated: return if oldItem.controllerID is not None and newItem.controllerID == None: uthread.new(self.RelinquishStructureControl, oldItem, silent=True, force=True) stateName, stateTimestamp, stateDelay = self.GetStructureState(newItem) if stateName == 'onlining': uthread.pool('pwn::StalledOnlineEvent', self.StalledOnlineEvent, newItem.itemID, newItem.posState, stateTimestamp, stateDelay)
def _HandleSessionChangeInWorldSpace(self, isRemote, session, change, viewSvc): if 'worldspaceid' in change: self.LogWarn('GameUI::OnSessionChanged, Heading for worldspace', isRemote, session, change) activateViewFunc = self._GetActivateViewFunction(viewSvc) uthread.pool('GameUI::ActivateView::worldspace', activateViewFunc, 'worldspace', change=change)
def _HandleSessionChangeInStation(self, isRemote, session, change, viewSvc): if 'stationid' in change: self.LogNotice('GameUI::OnSessionChanged, Heading for station', isRemote, session, change) activateViewFunc = viewSvc.ActivateView if viewSvc.IsViewActive('charactercreation') else viewSvc.ChangePrimaryView view = settings.user.ui.Get('defaultDockingView', 'station') if view == 'station' and not settings.public.device.Get('loadstationenv2', 1): self.LogInfo('Docking into hangar because we have disabled the station environments') view = 'hangar' sm.GetService('camera').ClearCameraParent() uthread.pool('GameUI::ActivateView::station', activateViewFunc, view, change=change)
def __init__(self, interval, method, *args, **kw): self.run = 1 self.interval = interval self.method, self.args, self.kw = method, args, kw caller_tb = traceback.extract_stack(limit=2)[0:1] caller = traceback.format_list(caller_tb)[0].replace('\n', '') methrepr = getattr(method, '__name__', '(no __name__)').replace('<', '<').replace('>', '>') ctx = 'AutoTimer::(%s) on %s' % (caller, methrepr) self.wakeupAt = blue.os.GetWallclockTime() / 10000 + self.interval AutoTimer.autoTimers[self] = None uthread.pool(ctx, AutoTimer.Loop, weakref.ref(self))
def FitItem(self, item): self.items[item.itemID] = item self.FitItemToLocation(item.locationID, item.itemID, item.flagID) if self.dogmaStaticMgr.TypeHasEffect(item.typeID, const.effectOnline): try: self.OnlineModule(item.itemID) except UserError as e: if e.msg != 'EffectAlreadyActive2': uthread.pool('FitItem::RaiseUserError', eve.Message, *e.args) except Exception: log.LogException('Raised during OnlineModule')
def SetBallRotation(self, ball): self.model.rotationCurve = None if getattr(ball.model, 'modelRotationCurve', None) is not None: self.model.modelRotationCurve = ball.model.modelRotationCurve else: self.model.modelRotationCurve = trinity.TriRotationCurve() quat = geo2.QuaternionRotationSetYawPitchRoll(ball.yaw, ball.pitch, ball.roll) self.model.modelRotationCurve.value = quat ball.wreckID = self.id self.model.display = 0 uthread.pool('Wreck::DisplayWreck', self.DisplayWreck, 2000)
def DoBallRemove(self, ball, slimItem, terminal): if not self or getattr(self, 'sr', None) is None: return if ball is None: return if not eve.session.solarsystemid: return if self.logme: self.LogInfo('Tactical::DoBallRemove', ball.id) uthread.pool('tactical::DoBallRemoveThread', self.DoBallRemoveThread, ball, slimItem, terminal) self.RemoveBallFromJammers(ball)
def OnSessionDisconnect(self): """ Called when a user session disconnects due to Fast User Switching. Mutes audio input and output from Vivox if the user has it enabled. """ if self.LoggedIn(): self.DisableGlobalPushToTalkMode() setattr(self, 'userSessionDisconnected', 1) for each in self.members.keys(): uthread.pool('vivox::OnSessionDisconnect', self.SetChannelOutputVolume, each, vivoxConstants.VXVOLUME_OFF)
def Login(self): self.LogInfo('vivox Login') if self.vivoxStatus == vivoxConstants.VIVOX_NONE: self.LogWarn('vivox was not initialized, initializing') self.Init() return initialized = self.vivoxStatus == vivoxConstants.VXCCONNECTORSTATE_INITIALIZED loggingIn = self.vivoxLoginState == vivoxConstants.VXCLOGINSTATE_LOGGINGIN if initialized and not loggingIn and not self.LoggedIn(): self.vivoxLoginState = vivoxConstants.VXCLOGINSTATE_LOGGINGIN uthread.pool('vivox::Login', self._Login)
def _HandleSessionChangeInWorldSpace(self, isRemote, session, change, viewSvc): if 'worldspaceid' in change: self.LogWarn('GameUI::OnSessionChanged, Heading for worldspace', isRemote, session, change) activateViewFunc = viewSvc.ActivateView if viewSvc.IsViewActive( 'charactercreation') else viewSvc.ChangePrimaryView uthread.pool('GameUI::ActivateView::worldspace', activateViewFunc, 'worldspace', change=change)
def WriteNote(self, name, text, folderID, noteID = None): if not noteID: noteID = sm.RemoteSvc('charMgr').AddOwnerNote('N:' + name, '<br>') self.AddNote(folderID, 'N', noteID) n = util.KeyVal() n.noteID = noteID n.label = name n.text = text self.notes['N:' + str(noteID)] = n uthread.pool('notepad::SetNote', sm.RemoteSvc('charMgr').EditOwnerNote, int(noteID), 'N:' + self.notes['N:' + str(noteID)].label, text) return noteID