• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python uthread.worker函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中uthread.worker函数的典型用法代码示例。如果您正苦于以下问题:Python worker函数的具体用法?Python worker怎么用?Python worker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了worker函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: Start

 def Start(self, duration):
     if not gfxsettings.Get(gfxsettings.UI_TURRETS_ENABLED):
         return
     shipID = self.ballIDs[0]
     shipBall = self.fxSequencer.GetBall(shipID)
     targetID = self.ballIDs[1]
     targetBall = self.fxSequencer.GetBall(targetID)
     if targetBall is None:
         return
     if shipBall is None:
         return
     if not hasattr(shipBall, 'fitted'):
         self.fxSequencer.LogError(self.__guid__ + str(shipBall.id) + ' Turrets: Error! can not fit turrets. No fitted attribute ')
         return
     shipBall.FitHardpoints(blocking=True)
     if not shipBall.fitted:
         return
     if shipBall.modules is None:
         return
     self.turret = shipBall.modules.get(self.moduleID)
     if not self.turret:
         self.fxSequencer.LogError('StandardWeapon: Turret not fitted on shipID', shipID)
         return
     if hasattr(self.turret, 'SetAmmoColor'):
         self.SetAmmoColor()
     uthread.worker('FxSequencer::ShootTurrets', self.Shoot, shipID, targetID)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:26,代码来源:turrets.py


示例2: __UberMachoRemoteServiceCall

    def __UberMachoRemoteServiceCall(self, sess, service, method, nodes, *args, **keywords):
        retvals = []
        dude = UberDude(len(nodes), service, method)
        if not len(nodes):
            raise UnMachoDestination('No target nodes available for UberMachoRemoteServiceCall')
        uberMachoRaise = keywords.get('uberMachoRaise', False)
        if 'uberMachoRaise' in keywords:
            keywords = copy.copy(keywords)
            del keywords['uberMachoRaise']
        if 'machoTimeout' in keywords:
            keywords = copy.copy(keywords)
        else:
            keywords['machoTimeout'] = 60
        machoTimeout = keywords.get('machoTimeout', 60)
        for each in nodes:
            uthread.worker(blue.pyos.taskletTimer.GetCurrent() + '::RPC', UnterMachoRemoteServiceCall, self, dude, retvals, sess, each, service, method, args, keywords)

        if dude.Await(machoTimeout) == 2:
            log.LogTraceback('Local Timeout')
            n = copy.copy(nodes)
            for r in retvals:
                n.remove(r[1])

            for nodeID in n:
                self.machoNet.LogError('Node ', nodeID, " has not completed it's uber-macho call")
                retvals.append((1, nodeID, RuntimeError('Local Timeout')))

        if uberMachoRaise:
            for isexception, nodeID, ret in retvals:
                if isexception:
                    raise UberMachoException(retvals)

        return retvals
开发者ID:Pluckyduck,项目名称:eve,代码行数:33,代码来源:ServiceCallGPCS.py


示例3: _PerformUICallback

 def _PerformUICallback(self, callbackKey):
     callback = self.uiCallbackDict.get(callbackKey, None)
     if callback is not None:
         uthread.worker('_PerformUICallback_%s' % callbackKey, self._PerformUICallbackTasklet, callbackKey, callback)
         return True
     self.LogError('ActionObject.PerformUICallback: Unknown callbackKey', callbackKey)
     return False
开发者ID:Pluckyduck,项目名称:eve,代码行数:7,代码来源:eveUIProcs.py


示例4: Network

    def Network(self):
        if self.machoNet.GetNodeID() > const.maxNodeID:
            solPackets = float(self.packetsP2S) / self.netTasklets
            proxyPackets = 0
        else:
            proxyPackets = float(self.packetsS2P) / self.netTasklets
            solPackets = float(self.packetsS2S) / self.netTasklets
        if solPackets:
            nodes = self.machoNet.GetConnectedSolNodes()
            nodes = [ (node, self.session.ConnectToRemoteService('loadService', node)) for node in nodes ]
            randomNodes = self.NodeRandomizer(nodes)

            def func():
                self.NetworkSendPacket(randomNodes)

            interval = 1.0 / solPackets if solPackets > 0.0 else 0.0
            uthread.worker('loadServiceService::NetworkTraffic::ToSolServers', self.TaskletWrap(self.IntervalDispatcher), interval, self.netStats, func)
        if proxyPackets:
            nodes = self.machoNet.GetConnectedProxyNodes()
            nodes = [ (node, self.session.ConnectToRemoteService('loadService', node)) for node in nodes ]
            randomNodes = self.NodeRandomizer(nodes)

            def func():
                self.NetworkSendPacket(randomNodes)

            interval = 1.0 / proxyPackets if proxyPackets > 0.0 else 0.0
            uthread.worker('loadServiceService::NetworkTraffic::ToProxyServers', self.TaskletWrap(self.IntervalDispatcher), interval, self.netStats, func)
开发者ID:Pluckyduck,项目名称:eve,代码行数:27,代码来源:loadService.py


示例5: OnObjectPublicAttributesUpdated

    def OnObjectPublicAttributesUpdated(self, uuid, pa, args, keywords):
        for sess in base.GetSessions():
            try:
                if sess.machoObjectConnectionsByObjectID.get(uuid, 0):
                    for conn in sess.machoObjectConnectionsByObjectID[uuid][1].itervalues():
                        k = keywords.get('partial', [])
                        if k:
                            old = {}
                            for each in k:
                                old[each] = conn.__publicattributes__[each]
                                conn.__publicattributes__[each] = pa[each]

                        else:
                            old = conn.__publicattributes__
                            conn.__publicattributes__ = pa
                        for each in conn.objectChangeHandlers.iterkeys():
                            try:
                                func = getattr(each, 'OnObjectChanged')
                            except StandardError:
                                log.LogException()
                                sys.exc_clear()
                                continue

                            theArgs = [conn, old, conn.__publicattributes__] + list(args)
                            uthread.worker('machoNet::OnObjectChanged', func, *theArgs, **keywords)

            except Exception:
                log.LogException('Exception during OnObjectPublicAttributesUpdated')
                sys.exc_clear()
开发者ID:Pluckyduck,项目名称:eve,代码行数:29,代码来源:ObjectCallGPCS.py


示例6: OnLogin

def OnLogin():
    global _savePeriod
    global _displaySeconds
    global _watchSpan
    global _allowedTime
    global _schedule
    if boot.region != 'optic' or not AmIUnderage():
        return
    if prefs.GetValue('aaTestTimes', 0):
        _watchSpan = _testWatchSpan
        _allowedTime = _testAllowedTime
        _schedule = _testSchedule
        _savePeriod = _testSavePeriod
        _displaySeconds = True
    else:
        _watchSpan = _liveWatchSpan
        _allowedTime = _liveAllowedTime
        _schedule = _liveSchedule
        _savePeriod = _liveSavePeriod
        _displaySeconds = False
    sessionID = StartSession()
    uthread.worker('antiaddiction::EndSession', lambda : EndSessionWorker(sessionID))

    def ActionWrap(action, time):
        return lambda : action(time)

    t = TimeLeft()
    for time, action in _schedule:
        if t <= time:
            action(t)
            break
        else:
            Schedule(t - time, ActionWrap(action, time))
开发者ID:Pluckyduck,项目名称:eve,代码行数:33,代码来源:antiaddiction.py


示例7: Start

 def Start(self, duration):
     if self.gfx is None:
         return
     self.gfx.display = False
     self.hasExploded = False
     self.hasWind = False
     self.hasMoreCollisions = True
     self.findNext = True
     ShipEffect.Start(self, duration)
     bp = sm.StartService('michelle').GetBallpark()
     shipID = self.GetEffectShipID()
     shipBall = bp.GetBall(shipID)
     self.shipBall = shipBall
     self.shipModel = getattr(shipBall, 'model', None)
     self.shipBall.RegisterModelChangeNotification(self.ModelChangeNotify)
     slimItem = bp.GetInvItem(shipID)
     self.warpSpeedModifier = sm.StartService('godma').GetTypeAttribute(slimItem.typeID, const.attributeWarpSpeedMultiplier)
     if self.warpSpeedModifier is None:
         self.warpSpeedModifier = 1.0
     space = sm.GetService('space')
     self.SetupTunnelBindings()
     self.nextCollision = None
     self.insideSolid = False
     self.destination = space.warpDestinationCache[3]
     self.collisions = []
     self.collisions = self.GetWarpCollisions(shipBall)
     self.ControlFlow('NextCollision')
     uthread.worker('FxSequencer::WarpEffectLoop', self.WarpLoop, shipBall)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:28,代码来源:Warp.py


示例8: Explode

 def Explode(self):
     if self.exploded:
         return False
     self.exploded = True
     if self.model is None:
         return False
     uthread.worker('wormhole:PlayDeath', self.PlayDeath)
     return 2000
开发者ID:Pluckyduck,项目名称:eve,代码行数:8,代码来源:wormhole.py


示例9: ImportCharacter

    def ImportCharacter(factory, scene, resPath, **kwargs):
        blocking = kwargs.get('blocking')
        callBack = kwargs.get('callBack')
        rotation = kwargs.get('rotation')
        position = kwargs.get('point')
        pdc = PaperDollCharacter(factory)
        pdc.scene = scene
        pdc.avatar = trinity.Load(resPath + '/unique.red')
        if pdc.avatar is None:
            log.LogInfo('Import failed on ' + resPath + '/unique.red')
            return
        pdc.visualModel = pdc.avatar.visualModel
        slash = resPath.rfind('/')
        pdc.avatar.name = str(resPath[slash + 1:] + ' (import)')
        if position:
            pdc.avatar.translation = position
        if rotation:
            pdc.avatar.rotation = rotation
        rf = blue.ResFile()
        bsPath = resPath + '/blendshapes.yaml'
        meshes = None
        morphTargets = None
        if rf.FileExists(bsPath):
            f = rf.open(bsPath)
            morphTargets = yaml.load(f, Loader=yaml.CLoader)
            f.close()
            if morphTargets:
                meshes = pdc.visualModel.meshes

        def fun():
            if meshes:
                factory.ApplyMorphTargetsToMeshes(meshes, morphTargets)
                if trinity.GetShaderModel() == 'SM_2_0_LO':
                    PD.PortraitTools.RebindDXT5ShadersForSM2(meshes)
            if callBack:
                callBack()

        if blocking:
            fun()
        else:
            uthread.worker('paperDoll::PaperDollCharacter::ImportCharacter', fun)
        scene.AddDynamic(pdc.avatar)
        rf = blue.ResFile()
        aoPath = resPath + '/animationOffsets.yaml'
        if rf.FileExists(aoPath):
            f = rf.open(aoPath)
            animationOffsets = yaml.load(f, Loader=yaml.CLoader)
            f.close()
            if animationOffsets:
                pdc.ApplyAnimationOffsets(animationOffsets)
        pdc.avatar.explicitMinBounds = (-5, -5, -5)
        pdc.avatar.explicitMaxBounds = (5, 5, 5)
        pdc.avatar.useExplicitBounds = True
        if PD.SkinSpotLightShadows.instance is not None:
            for mesh in pdc.visualModel.meshes:
                PD.SkinSpotLightShadows.instance.CreateEffectParamsForMesh(mesh)

        return pdc
开发者ID:Pluckyduck,项目名称:eve,代码行数:58,代码来源:paperDollSpawnWrappers.py


示例10: _Close

 def _Close(self, s, noSend):
     flag = log.LGWARN
     if self.closeReason and self.closeReason.get('exception', None) is None:
         flag = log.LGINFO
     mylog.Log('Closing connection to ' + self.address + ': ' + repr(self.closeReason), flag)
     if noSend:
         SocketTransport._Close(self, s, noSend)
     else:
         uthread.worker('Socket::DelayedClose', self._DelayedClose, s)
开发者ID:Pluckyduck,项目名称:eve,代码行数:9,代码来源:SocketGPS.py


示例11: QueuedcastWithoutTheStars

 def QueuedcastWithoutTheStars(self, idtype, ids, method, args):
     if ids:
         self.queue.append((idtype,
          tuple(ids),
          method,
          args))
         if not self.busrunning:
             self.busrunning = 1
             uthread.worker('MachoNet::BroadcastStuff::BusDriver', self.__BusDriver)
开发者ID:Pluckyduck,项目名称:eve,代码行数:9,代码来源:BroadcastStuffGPCS.py


示例12: __CacheIsDirty

 def __CacheIsDirty(self, what, key):
     if macho.mode == 'client':
         ret = blue.os.GetWallclockTime()
         shouldFlush = len(self.lastChange) == 0
         self.lastChange[what, key] = ret
         filename = self.cachePath + what + '/%s.cache' % self.KeyToFileName(key)
         self.downloadedCachedObjects[key] = filename
         if shouldFlush:
             uthread.worker('objectCaching::FlushCache', self.__FlushCache, True)
         return ret
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:10,代码来源:objectCaching.py


示例13: __init__

 def __init__(self):
     self._InitializeInternalVariables()
     self._InitializeTextData()
     self._importantNameSetting = None
     self._languageTooltipSetting = None
     self._qaTooltipOverride = None
     self._highlightImportantSetting = None
     uthread.worker('localization::_SetHardcodedStringDetection', self._SetHardcodedStringDetection)
     message = 'Cerberus localization module loaded on ' + boot.role
     LogInfo(message)
     print message
开发者ID:Pluckyduck,项目名称:eve,代码行数:11,代码来源:localization.py


示例14: LoadDollFromDNA

 def LoadDollFromDNA(self, dollDNA, dollName = None, lodEnabled = True, compressionSettings = None):
     name = dollName if dollName is not None else PaperDollCharacter.__DEFAULT_NAME
     self.doll = PD.Doll(name)
     self.doll.LoadDNA(dollDNA, self.factory)
     if compressionSettings:
         self.doll.compressionSettings = compressionSettings
     if self.avatar:
         gender = PD.GENDER.MALE if self.doll.gender else PD.GENDER.FEMALE
         networkToLoad = const.FEMALE_MORPHEME_PATH if gender == PD.GENDER.FEMALE else const.MALE_MORPHEME_PATH
         if lodEnabled:
             uthread.worker('^PaperDollCharacter::LoadFromDNA', PD.SetupLODFromPaperdoll, self.avatar, self.doll, self.factory, networkToLoad)
         else:
             uthread.worker('^PaperDollCharacter::LoadFromDNA', self.doll.Update, self.factory, self.avatar)
开发者ID:Pluckyduck,项目名称:eve,代码行数:13,代码来源:paperDollSpawnWrappers.py


示例15: OnFleetBroadcast_Local

 def OnFleetBroadcast_Local(self, broadcast):
     caption = broadcast.broadcastLabel
     iconName = fleetbr.defaultIcon[1]
     t = fleetbr.types.get(broadcast.name, None)
     if t:
         iconName = t['smallIcon']
     roleIcon = fleetbr.GetRoleIconFromCharID(broadcast.charID)
     self.sr.lastBroadcastCont.Flush()
     t = uicontrols.EveLabelMedium(text=caption, parent=self.sr.lastBroadcastCont, align=uiconst.TOALL, left=25, maxLines=1, state=uiconst.UI_DISABLED)
     self.sr.lastBroadcastCont.GetMenu = lambda : self.GetLastBroadcastMenu(broadcast)
     self.sr.lastBroadcastCont.OnClick = lambda : self.OnLastBroadcastClick(broadcast)
     self.sr.lastBroadcastCont.hint = localization.GetByLabel('UI/Fleet/FleetBroadcast/BroadcastNotificationHint', eventLabel=broadcast.broadcastLabel, time=broadcast.time, charID=broadcast.charID, range=fleetbr.GetBroadcastScopeName(broadcast.scope, broadcast.where), role=fleetbr.GetRankName(sm.GetService('fleet').GetMemberInfo(int(broadcast.charID))))
     icon = uicontrols.Icon(icon=iconName, parent=self.sr.lastBroadcastCont, align=uiconst.RELATIVE, pos=(6, 0, 16, 16), state=uiconst.UI_DISABLED)
     uthread.worker('fleet::flash', self.Flash, icon)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:14,代码来源:fleetwindow.py


示例16: UberMachoRemoteServiceCall

 def UberMachoRemoteServiceCall(self, nodeGroup, batchInterval, sess, service, method, *args, **keywords):
     if batchInterval:
         queue = sess.GetSessionVariable(('batchedCallQueue', batchInterval), ({}, {}))
         if not queue[0]:
             uthread.worker('GPCS::BroadcastStuff::BatchedUberMachoRemoteServiceCall', self.__BatchedUberMachoRemoteServiceCall, nodeGroup, sess, batchInterval)
         i = len(queue[0])
         queue[0][i] = (service,
          method,
          args,
          keywords)
         queue[1][i] = uthread.Channel()
         return queue[1][i].receive()
     else:
         return self.__UberMachoRemoteServiceCall(sess, service, method, self.__GetNodeGroup(nodeGroup), *args, **keywords)
开发者ID:Pluckyduck,项目名称:eve,代码行数:14,代码来源:ServiceCallGPCS.py


示例17: RemoveSessionsFromServer

    def RemoveSessionsFromServer(self, nodeID, sessionIDs):
        if machobase.mode != 'proxy':
            raise RuntimeError('RemoveSessionsFromServer should only be called on a proxy')
        log.LogInfo('CTXSESS: RemoveSessionsFromServer(nodeID=', nodeID, '), with ', len(sessionIDs), ' session IDs')
        mn = sm.services['machoNet']
        serverTID = mn.transportIDbySolNodeID.get(nodeID, None)
        if serverTID is not None:
            serverTransport = mn.transportsByID[serverTID]
            for sid in sessionIDs:
                sess = sessionsBySID.get(sid, None)
                if sess is not None:
                    uthread.worker('SessionMgr::RemoveSesssionsFromServer', serverTransport.RemoveSessionFromServer, sess)

        else:
            log.LogWarning('RemoveSessionsFromServer() called with unknown or non-server nodeID ', nodeID)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:15,代码来源:sessions.py


示例18: RemoveWnd

 def RemoveWnd(self, wnd, grab, correctpos = 1, idx = 0, dragging = 0, check = 1):
     if wnd.parent != self.sr.content:
         return
     if hasattr(wnd, 'OnTabSelect'):
         uthread.worker('WindowStack::RemoveWnd', wnd.OnTabSelect)
     wnd._detaching = True
     uiutil.Transplant(wnd, self.parent, idx)
     if hasattr(wnd, '_stack_cacheContents'):
         wnd.cacheContents = wnd._stack_cacheContents
     self.RemovePreferredIdx(self.windowID, wnd.windowID)
     wnd.sr.stack = None
     wnd.sr.tab = None
     wnd.align = uiconst.RELATIVE
     wnd.state = uiconst.UI_NORMAL
     wnd.grab = grab
     wnd.dragMousePosition = (uicore.uilib.x, uicore.uilib.y)
     wnd.width = wnd._fixedWidth or self.width
     wnd.height = wnd._fixedHeight or self.height
     wnd.RefreshHeaderButtonsIfVisible()
     if dragging:
         uicore.uilib.SetMouseCapture(wnd)
         uthread.new(wnd._BeginDrag)
         if wnd.height < wnd.GetMinHeight():
             wnd.height = wnd.GetMinHeight()
         if wnd.width < wnd.GetMinWidth():
             wnd.width = wnd.GetMinWidth()
     wnd.ShowHeader()
     wnd.ShowBackground()
     if correctpos:
         wnd.left = uicore.uilib.x - grab[0]
         wnd.top = uicore.uilib.y - grab[1]
     if check:
         self.Check()
     wnd.RegisterStackID()
     wnd._detaching = False
     wnd._dragging = dragging
     myWindows = self.GetWindows()
     if len(myWindows) == 1 and not self.IsCollapsed():
         w = myWindows[0]
         aL, aT, aW, aH = self.GetAbsolute()
         x, y = aL, aT
         self.RemoveWnd(w, (0, 0), 1, 1, check=0)
         self.RemovePreferredIdx(self.windowID, w)
         w.left, w.top = x, y
         return
     if len(self.GetWindows()) == 0:
         self.sr.tabs.Close()
         self.Close()
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:48,代码来源:eveWindowStack.py


示例19: Repeat

 def Repeat(self, duration):
     if getattr(self, 'turret', None) is None:
         return
     shipID = self.ballIDs[0]
     shipBall = self.fxSequencer.GetBall(shipID)
     targetID = self.ballIDs[1]
     targetBall = self.fxSequencer.GetBall(targetID)
     if targetBall is None:
         self.turret.Rest()
         self.turret.shooting = 0
         return
     if shipBall is None:
         self.turret.Rest()
         self.turret.shooting = 0
         return
     uthread.worker('FxSequencer::ShootTurrets', self.Shoot, shipID, targetID)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:16,代码来源:turrets.py


示例20: OnOpenView

 def OnOpenView(self):
     memorySnapshot.AutoMemorySnapshotIfEnabled('Login_OnOpenView')
     self.Reset()
     uthread.worker('login::StatusTextWorker', self.__StatusTextWorker)
     blue.resMan.Wait()
     self.serverName = utillib.GetServerName()
     self.serverIP = GetServerIP(self.serverName)
     self.serverName = GetServerName(self.serverIP)
     self.serverPort = utillib.GetServerPort()
     self.firstCheck = True
     self.isShowingUpdateDialog = False
     self.Layout()
     sm.ScatterEvent('OnClientReady', 'login')
     self.isopen = 1
     uthread.new(self.UpdateServerStatus)
     sm.ScatterEvent('OnClientStageChanged', 'login')
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:16,代码来源:loginII.py



注:本文中的uthread.worker函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util._error_response函数代码示例发布时间:2022-05-27
下一篇:
Python uthread.pool函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap